1. Packages
  2. HashiCorp Vault
  3. API Docs
  4. identity
  5. EntityPolicies
HashiCorp Vault v6.2.0 published on Friday, Jun 21, 2024 by Pulumi

vault.identity.EntityPolicies

Explore with Pulumi AI

vault logo
HashiCorp Vault v6.2.0 published on Friday, Jun 21, 2024 by Pulumi

    Manages policies for an Identity Entity for Vault. The Identity secrets engine is the identity management solution for Vault.

    Example Usage

    Exclusive Policies

    import * as pulumi from "@pulumi/pulumi";
    import * as vault from "@pulumi/vault";
    
    const entity = new vault.identity.Entity("entity", {
        name: "entity",
        externalPolicies: true,
    });
    const policies = new vault.identity.EntityPolicies("policies", {
        policies: [
            "default",
            "test",
        ],
        exclusive: true,
        entityId: entity.id,
    });
    
    import pulumi
    import pulumi_vault as vault
    
    entity = vault.identity.Entity("entity",
        name="entity",
        external_policies=True)
    policies = vault.identity.EntityPolicies("policies",
        policies=[
            "default",
            "test",
        ],
        exclusive=True,
        entity_id=entity.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-vault/sdk/v6/go/vault/identity"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		entity, err := identity.NewEntity(ctx, "entity", &identity.EntityArgs{
    			Name:             pulumi.String("entity"),
    			ExternalPolicies: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = identity.NewEntityPolicies(ctx, "policies", &identity.EntityPoliciesArgs{
    			Policies: pulumi.StringArray{
    				pulumi.String("default"),
    				pulumi.String("test"),
    			},
    			Exclusive: pulumi.Bool(true),
    			EntityId:  entity.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Vault = Pulumi.Vault;
    
    return await Deployment.RunAsync(() => 
    {
        var entity = new Vault.Identity.Entity("entity", new()
        {
            Name = "entity",
            ExternalPolicies = true,
        });
    
        var policies = new Vault.Identity.EntityPolicies("policies", new()
        {
            Policies = new[]
            {
                "default",
                "test",
            },
            Exclusive = true,
            EntityId = entity.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.vault.identity.Entity;
    import com.pulumi.vault.identity.EntityArgs;
    import com.pulumi.vault.identity.EntityPolicies;
    import com.pulumi.vault.identity.EntityPoliciesArgs;
    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 entity = new Entity("entity", EntityArgs.builder()
                .name("entity")
                .externalPolicies(true)
                .build());
    
            var policies = new EntityPolicies("policies", EntityPoliciesArgs.builder()
                .policies(            
                    "default",
                    "test")
                .exclusive(true)
                .entityId(entity.id())
                .build());
    
        }
    }
    
    resources:
      entity:
        type: vault:identity:Entity
        properties:
          name: entity
          externalPolicies: true
      policies:
        type: vault:identity:EntityPolicies
        properties:
          policies:
            - default
            - test
          exclusive: true
          entityId: ${entity.id}
    

    Non-exclusive Policies

    import * as pulumi from "@pulumi/pulumi";
    import * as vault from "@pulumi/vault";
    
    const entity = new vault.identity.Entity("entity", {
        name: "entity",
        externalPolicies: true,
    });
    const _default = new vault.identity.EntityPolicies("default", {
        policies: [
            "default",
            "test",
        ],
        exclusive: false,
        entityId: entity.id,
    });
    const others = new vault.identity.EntityPolicies("others", {
        policies: ["others"],
        exclusive: false,
        entityId: entity.id,
    });
    
    import pulumi
    import pulumi_vault as vault
    
    entity = vault.identity.Entity("entity",
        name="entity",
        external_policies=True)
    default = vault.identity.EntityPolicies("default",
        policies=[
            "default",
            "test",
        ],
        exclusive=False,
        entity_id=entity.id)
    others = vault.identity.EntityPolicies("others",
        policies=["others"],
        exclusive=False,
        entity_id=entity.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-vault/sdk/v6/go/vault/identity"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		entity, err := identity.NewEntity(ctx, "entity", &identity.EntityArgs{
    			Name:             pulumi.String("entity"),
    			ExternalPolicies: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = identity.NewEntityPolicies(ctx, "default", &identity.EntityPoliciesArgs{
    			Policies: pulumi.StringArray{
    				pulumi.String("default"),
    				pulumi.String("test"),
    			},
    			Exclusive: pulumi.Bool(false),
    			EntityId:  entity.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = identity.NewEntityPolicies(ctx, "others", &identity.EntityPoliciesArgs{
    			Policies: pulumi.StringArray{
    				pulumi.String("others"),
    			},
    			Exclusive: pulumi.Bool(false),
    			EntityId:  entity.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Vault = Pulumi.Vault;
    
    return await Deployment.RunAsync(() => 
    {
        var entity = new Vault.Identity.Entity("entity", new()
        {
            Name = "entity",
            ExternalPolicies = true,
        });
    
        var @default = new Vault.Identity.EntityPolicies("default", new()
        {
            Policies = new[]
            {
                "default",
                "test",
            },
            Exclusive = false,
            EntityId = entity.Id,
        });
    
        var others = new Vault.Identity.EntityPolicies("others", new()
        {
            Policies = new[]
            {
                "others",
            },
            Exclusive = false,
            EntityId = entity.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.vault.identity.Entity;
    import com.pulumi.vault.identity.EntityArgs;
    import com.pulumi.vault.identity.EntityPolicies;
    import com.pulumi.vault.identity.EntityPoliciesArgs;
    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 entity = new Entity("entity", EntityArgs.builder()
                .name("entity")
                .externalPolicies(true)
                .build());
    
            var default_ = new EntityPolicies("default", EntityPoliciesArgs.builder()
                .policies(            
                    "default",
                    "test")
                .exclusive(false)
                .entityId(entity.id())
                .build());
    
            var others = new EntityPolicies("others", EntityPoliciesArgs.builder()
                .policies("others")
                .exclusive(false)
                .entityId(entity.id())
                .build());
    
        }
    }
    
    resources:
      entity:
        type: vault:identity:Entity
        properties:
          name: entity
          externalPolicies: true
      default:
        type: vault:identity:EntityPolicies
        properties:
          policies:
            - default
            - test
          exclusive: false
          entityId: ${entity.id}
      others:
        type: vault:identity:EntityPolicies
        properties:
          policies:
            - others
          exclusive: false
          entityId: ${entity.id}
    

    Create EntityPolicies Resource

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

    Constructor syntax

    new EntityPolicies(name: string, args: EntityPoliciesArgs, opts?: CustomResourceOptions);
    @overload
    def EntityPolicies(resource_name: str,
                       args: EntityPoliciesArgs,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def EntityPolicies(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       entity_id: Optional[str] = None,
                       policies: Optional[Sequence[str]] = None,
                       exclusive: Optional[bool] = None,
                       namespace: Optional[str] = None)
    func NewEntityPolicies(ctx *Context, name string, args EntityPoliciesArgs, opts ...ResourceOption) (*EntityPolicies, error)
    public EntityPolicies(string name, EntityPoliciesArgs args, CustomResourceOptions? opts = null)
    public EntityPolicies(String name, EntityPoliciesArgs args)
    public EntityPolicies(String name, EntityPoliciesArgs args, CustomResourceOptions options)
    
    type: vault:identity:EntityPolicies
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args EntityPoliciesArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args EntityPoliciesArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args EntityPoliciesArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args EntityPoliciesArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args EntityPoliciesArgs
    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 entityPoliciesResource = new Vault.Identity.EntityPolicies("entityPoliciesResource", new()
    {
        EntityId = "string",
        Policies = new[]
        {
            "string",
        },
        Exclusive = false,
        Namespace = "string",
    });
    
    example, err := identity.NewEntityPolicies(ctx, "entityPoliciesResource", &identity.EntityPoliciesArgs{
    	EntityId: pulumi.String("string"),
    	Policies: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Exclusive: pulumi.Bool(false),
    	Namespace: pulumi.String("string"),
    })
    
    var entityPoliciesResource = new EntityPolicies("entityPoliciesResource", EntityPoliciesArgs.builder()
        .entityId("string")
        .policies("string")
        .exclusive(false)
        .namespace("string")
        .build());
    
    entity_policies_resource = vault.identity.EntityPolicies("entityPoliciesResource",
        entity_id="string",
        policies=["string"],
        exclusive=False,
        namespace="string")
    
    const entityPoliciesResource = new vault.identity.EntityPolicies("entityPoliciesResource", {
        entityId: "string",
        policies: ["string"],
        exclusive: false,
        namespace: "string",
    });
    
    type: vault:identity:EntityPolicies
    properties:
        entityId: string
        exclusive: false
        namespace: string
        policies:
            - string
    

    EntityPolicies Resource Properties

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

    Inputs

    The EntityPolicies resource accepts the following input properties:

    EntityId string
    Entity ID to assign policies to.
    Policies List<string>
    List of policies to assign to the entity
    Exclusive bool

    Defaults to true.

    If true, this resource will take exclusive control of the policies assigned to the entity and will set it equal to what is specified in the resource.

    If set to false, this resource will simply ensure that the policies specified in the resource are present in the entity. When destroying the resource, the resource will ensure that the policies specified in the resource are removed.

    Namespace 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.
    EntityId string
    Entity ID to assign policies to.
    Policies []string
    List of policies to assign to the entity
    Exclusive bool

    Defaults to true.

    If true, this resource will take exclusive control of the policies assigned to the entity and will set it equal to what is specified in the resource.

    If set to false, this resource will simply ensure that the policies specified in the resource are present in the entity. When destroying the resource, the resource will ensure that the policies specified in the resource are removed.

    Namespace 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.
    entityId String
    Entity ID to assign policies to.
    policies List<String>
    List of policies to assign to the entity
    exclusive Boolean

    Defaults to true.

    If true, this resource will take exclusive control of the policies assigned to the entity and will set it equal to what is specified in the resource.

    If set to false, this resource will simply ensure that the policies specified in the resource are present in the entity. When destroying the resource, the resource will ensure that the policies specified in the resource are removed.

    namespace 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.
    entityId string
    Entity ID to assign policies to.
    policies string[]
    List of policies to assign to the entity
    exclusive boolean

    Defaults to true.

    If true, this resource will take exclusive control of the policies assigned to the entity and will set it equal to what is specified in the resource.

    If set to false, this resource will simply ensure that the policies specified in the resource are present in the entity. When destroying the resource, the resource will ensure that the policies specified in the resource are removed.

    namespace 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.
    entity_id str
    Entity ID to assign policies to.
    policies Sequence[str]
    List of policies to assign to the entity
    exclusive bool

    Defaults to true.

    If true, this resource will take exclusive control of the policies assigned to the entity and will set it equal to what is specified in the resource.

    If set to false, this resource will simply ensure that the policies specified in the resource are present in the entity. When destroying the resource, the resource will ensure that the policies specified in the resource are removed.

    namespace 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.
    entityId String
    Entity ID to assign policies to.
    policies List<String>
    List of policies to assign to the entity
    exclusive Boolean

    Defaults to true.

    If true, this resource will take exclusive control of the policies assigned to the entity and will set it equal to what is specified in the resource.

    If set to false, this resource will simply ensure that the policies specified in the resource are present in the entity. When destroying the resource, the resource will ensure that the policies specified in the resource are removed.

    namespace 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 EntityPolicies resource produces the following output properties:

    EntityName string
    The name of the entity that are assigned the policies.
    Id string
    The provider-assigned unique ID for this managed resource.
    EntityName string
    The name of the entity that are assigned the policies.
    Id string
    The provider-assigned unique ID for this managed resource.
    entityName String
    The name of the entity that are assigned the policies.
    id String
    The provider-assigned unique ID for this managed resource.
    entityName string
    The name of the entity that are assigned the policies.
    id string
    The provider-assigned unique ID for this managed resource.
    entity_name str
    The name of the entity that are assigned the policies.
    id str
    The provider-assigned unique ID for this managed resource.
    entityName String
    The name of the entity that are assigned the policies.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing EntityPolicies Resource

    Get an existing EntityPolicies 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?: EntityPoliciesState, opts?: CustomResourceOptions): EntityPolicies
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            entity_id: Optional[str] = None,
            entity_name: Optional[str] = None,
            exclusive: Optional[bool] = None,
            namespace: Optional[str] = None,
            policies: Optional[Sequence[str]] = None) -> EntityPolicies
    func GetEntityPolicies(ctx *Context, name string, id IDInput, state *EntityPoliciesState, opts ...ResourceOption) (*EntityPolicies, error)
    public static EntityPolicies Get(string name, Input<string> id, EntityPoliciesState? state, CustomResourceOptions? opts = null)
    public static EntityPolicies get(String name, Output<String> id, EntityPoliciesState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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:
    EntityId string
    Entity ID to assign policies to.
    EntityName string
    The name of the entity that are assigned the policies.
    Exclusive bool

    Defaults to true.

    If true, this resource will take exclusive control of the policies assigned to the entity and will set it equal to what is specified in the resource.

    If set to false, this resource will simply ensure that the policies specified in the resource are present in the entity. When destroying the resource, the resource will ensure that the policies specified in the resource are removed.

    Namespace 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.
    Policies List<string>
    List of policies to assign to the entity
    EntityId string
    Entity ID to assign policies to.
    EntityName string
    The name of the entity that are assigned the policies.
    Exclusive bool

    Defaults to true.

    If true, this resource will take exclusive control of the policies assigned to the entity and will set it equal to what is specified in the resource.

    If set to false, this resource will simply ensure that the policies specified in the resource are present in the entity. When destroying the resource, the resource will ensure that the policies specified in the resource are removed.

    Namespace 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.
    Policies []string
    List of policies to assign to the entity
    entityId String
    Entity ID to assign policies to.
    entityName String
    The name of the entity that are assigned the policies.
    exclusive Boolean

    Defaults to true.

    If true, this resource will take exclusive control of the policies assigned to the entity and will set it equal to what is specified in the resource.

    If set to false, this resource will simply ensure that the policies specified in the resource are present in the entity. When destroying the resource, the resource will ensure that the policies specified in the resource are removed.

    namespace 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.
    policies List<String>
    List of policies to assign to the entity
    entityId string
    Entity ID to assign policies to.
    entityName string
    The name of the entity that are assigned the policies.
    exclusive boolean

    Defaults to true.

    If true, this resource will take exclusive control of the policies assigned to the entity and will set it equal to what is specified in the resource.

    If set to false, this resource will simply ensure that the policies specified in the resource are present in the entity. When destroying the resource, the resource will ensure that the policies specified in the resource are removed.

    namespace 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.
    policies string[]
    List of policies to assign to the entity
    entity_id str
    Entity ID to assign policies to.
    entity_name str
    The name of the entity that are assigned the policies.
    exclusive bool

    Defaults to true.

    If true, this resource will take exclusive control of the policies assigned to the entity and will set it equal to what is specified in the resource.

    If set to false, this resource will simply ensure that the policies specified in the resource are present in the entity. When destroying the resource, the resource will ensure that the policies specified in the resource are removed.

    namespace 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.
    policies Sequence[str]
    List of policies to assign to the entity
    entityId String
    Entity ID to assign policies to.
    entityName String
    The name of the entity that are assigned the policies.
    exclusive Boolean

    Defaults to true.

    If true, this resource will take exclusive control of the policies assigned to the entity and will set it equal to what is specified in the resource.

    If set to false, this resource will simply ensure that the policies specified in the resource are present in the entity. When destroying the resource, the resource will ensure that the policies specified in the resource are removed.

    namespace 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.
    policies List<String>
    List of policies to assign to the entity

    Package Details

    Repository
    Vault pulumi/pulumi-vault
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the vault Terraform Provider.
    vault logo
    HashiCorp Vault v6.2.0 published on Friday, Jun 21, 2024 by Pulumi