1. Packages
  2. HashiCorp Vault Provider
  3. API Docs
  4. RgpPolicy
HashiCorp Vault v6.6.0 published on Thursday, Mar 13, 2025 by Pulumi

vault.RgpPolicy

Explore with Pulumi AI

Provides a resource to manage Role Governing Policy (RGP) via Sentinel.

Note this feature is available only with Vault Enterprise.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as vault from "@pulumi/vault";

const allow_all = new vault.RgpPolicy("allow-all", {
    name: "allow-all",
    enforcementLevel: "soft-mandatory",
    policy: `main = rule {
  true
}
`,
});
Copy
import pulumi
import pulumi_vault as vault

allow_all = vault.RgpPolicy("allow-all",
    name="allow-all",
    enforcement_level="soft-mandatory",
    policy="""main = rule {
  true
}
""")
Copy
package main

import (
	"github.com/pulumi/pulumi-vault/sdk/v6/go/vault"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := vault.NewRgpPolicy(ctx, "allow-all", &vault.RgpPolicyArgs{
			Name:             pulumi.String("allow-all"),
			EnforcementLevel: pulumi.String("soft-mandatory"),
			Policy:           pulumi.String("main = rule {\n  true\n}\n"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Vault = Pulumi.Vault;

return await Deployment.RunAsync(() => 
{
    var allow_all = new Vault.RgpPolicy("allow-all", new()
    {
        Name = "allow-all",
        EnforcementLevel = "soft-mandatory",
        Policy = @"main = rule {
  true
}
",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vault.RgpPolicy;
import com.pulumi.vault.RgpPolicyArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var allow_all = new RgpPolicy("allow-all", RgpPolicyArgs.builder()
            .name("allow-all")
            .enforcementLevel("soft-mandatory")
            .policy("""
main = rule {
  true
}
            """)
            .build());

    }
}
Copy
resources:
  allow-all:
    type: vault:RgpPolicy
    properties:
      name: allow-all
      enforcementLevel: soft-mandatory
      policy: |
        main = rule {
          true
        }        
Copy

Create RgpPolicy Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new RgpPolicy(name: string, args: RgpPolicyArgs, opts?: CustomResourceOptions);
@overload
def RgpPolicy(resource_name: str,
              args: RgpPolicyArgs,
              opts: Optional[ResourceOptions] = None)

@overload
def RgpPolicy(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              enforcement_level: Optional[str] = None,
              policy: Optional[str] = None,
              name: Optional[str] = None,
              namespace: Optional[str] = None)
func NewRgpPolicy(ctx *Context, name string, args RgpPolicyArgs, opts ...ResourceOption) (*RgpPolicy, error)
public RgpPolicy(string name, RgpPolicyArgs args, CustomResourceOptions? opts = null)
public RgpPolicy(String name, RgpPolicyArgs args)
public RgpPolicy(String name, RgpPolicyArgs args, CustomResourceOptions options)
type: vault:RgpPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. RgpPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. RgpPolicyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. RgpPolicyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. RgpPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. RgpPolicyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var rgpPolicyResource = new Vault.RgpPolicy("rgpPolicyResource", new()
{
    EnforcementLevel = "string",
    Policy = "string",
    Name = "string",
    Namespace = "string",
});
Copy
example, err := vault.NewRgpPolicy(ctx, "rgpPolicyResource", &vault.RgpPolicyArgs{
	EnforcementLevel: pulumi.String("string"),
	Policy:           pulumi.String("string"),
	Name:             pulumi.String("string"),
	Namespace:        pulumi.String("string"),
})
Copy
var rgpPolicyResource = new RgpPolicy("rgpPolicyResource", RgpPolicyArgs.builder()
    .enforcementLevel("string")
    .policy("string")
    .name("string")
    .namespace("string")
    .build());
Copy
rgp_policy_resource = vault.RgpPolicy("rgpPolicyResource",
    enforcement_level="string",
    policy="string",
    name="string",
    namespace="string")
Copy
const rgpPolicyResource = new vault.RgpPolicy("rgpPolicyResource", {
    enforcementLevel: "string",
    policy: "string",
    name: "string",
    namespace: "string",
});
Copy
type: vault:RgpPolicy
properties:
    enforcementLevel: string
    name: string
    namespace: string
    policy: string
Copy

RgpPolicy Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The RgpPolicy resource accepts the following input properties:

EnforcementLevel This property is required. string
Enforcement level of Sentinel policy. Can be either advisory or soft-mandatory or hard-mandatory
Policy This property is required. string
String containing a Sentinel policy
Name Changes to this property will trigger replacement. string
The name of the policy
Namespace Changes to this property will trigger replacement. string
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
EnforcementLevel This property is required. string
Enforcement level of Sentinel policy. Can be either advisory or soft-mandatory or hard-mandatory
Policy This property is required. string
String containing a Sentinel policy
Name Changes to this property will trigger replacement. string
The name of the policy
Namespace Changes to this property will trigger replacement. string
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
enforcementLevel This property is required. String
Enforcement level of Sentinel policy. Can be either advisory or soft-mandatory or hard-mandatory
policy This property is required. String
String containing a Sentinel policy
name Changes to this property will trigger replacement. String
The name of the policy
namespace Changes to this property will trigger replacement. String
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
enforcementLevel This property is required. string
Enforcement level of Sentinel policy. Can be either advisory or soft-mandatory or hard-mandatory
policy This property is required. string
String containing a Sentinel policy
name Changes to this property will trigger replacement. string
The name of the policy
namespace Changes to this property will trigger replacement. string
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
enforcement_level This property is required. str
Enforcement level of Sentinel policy. Can be either advisory or soft-mandatory or hard-mandatory
policy This property is required. str
String containing a Sentinel policy
name Changes to this property will trigger replacement. str
The name of the policy
namespace Changes to this property will trigger replacement. str
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
enforcementLevel This property is required. String
Enforcement level of Sentinel policy. Can be either advisory or soft-mandatory or hard-mandatory
policy This property is required. String
String containing a Sentinel policy
name Changes to this property will trigger replacement. String
The name of the policy
namespace Changes to this property will trigger replacement. String
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.

Outputs

All input properties are implicitly available as output properties. Additionally, the RgpPolicy resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing RgpPolicy Resource

Get an existing RgpPolicy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: RgpPolicyState, opts?: CustomResourceOptions): RgpPolicy
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        enforcement_level: Optional[str] = None,
        name: Optional[str] = None,
        namespace: Optional[str] = None,
        policy: Optional[str] = None) -> RgpPolicy
func GetRgpPolicy(ctx *Context, name string, id IDInput, state *RgpPolicyState, opts ...ResourceOption) (*RgpPolicy, error)
public static RgpPolicy Get(string name, Input<string> id, RgpPolicyState? state, CustomResourceOptions? opts = null)
public static RgpPolicy get(String name, Output<String> id, RgpPolicyState state, CustomResourceOptions options)
resources:  _:    type: vault:RgpPolicy    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
EnforcementLevel string
Enforcement level of Sentinel policy. Can be either advisory or soft-mandatory or hard-mandatory
Name Changes to this property will trigger replacement. string
The name of the policy
Namespace Changes to this property will trigger replacement. string
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
Policy string
String containing a Sentinel policy
EnforcementLevel string
Enforcement level of Sentinel policy. Can be either advisory or soft-mandatory or hard-mandatory
Name Changes to this property will trigger replacement. string
The name of the policy
Namespace Changes to this property will trigger replacement. string
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
Policy string
String containing a Sentinel policy
enforcementLevel String
Enforcement level of Sentinel policy. Can be either advisory or soft-mandatory or hard-mandatory
name Changes to this property will trigger replacement. String
The name of the policy
namespace Changes to this property will trigger replacement. String
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
policy String
String containing a Sentinel policy
enforcementLevel string
Enforcement level of Sentinel policy. Can be either advisory or soft-mandatory or hard-mandatory
name Changes to this property will trigger replacement. string
The name of the policy
namespace Changes to this property will trigger replacement. string
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
policy string
String containing a Sentinel policy
enforcement_level str
Enforcement level of Sentinel policy. Can be either advisory or soft-mandatory or hard-mandatory
name Changes to this property will trigger replacement. str
The name of the policy
namespace Changes to this property will trigger replacement. str
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
policy str
String containing a Sentinel policy
enforcementLevel String
Enforcement level of Sentinel policy. Can be either advisory or soft-mandatory or hard-mandatory
name Changes to this property will trigger replacement. String
The name of the policy
namespace Changes to this property will trigger replacement. String
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
policy String
String containing a Sentinel policy

Package Details

Repository
Vault pulumi/pulumi-vault
License
Apache-2.0
Notes
This Pulumi package is based on the vault Terraform Provider.