vault logo
HashiCorp Vault v5.11.0, Apr 25 23

vault.identity.EntityPolicies

Explore with Pulumi AI

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

Example Usage

Exclusive Policies

using System.Collections.Generic;
using Pulumi;
using Vault = Pulumi.Vault;

return await Deployment.RunAsync(() => 
{
    var entity = new Vault.Identity.Entity("entity", new()
    {
        ExternalPolicies = true,
    });

    var policies = new Vault.Identity.EntityPolicies("policies", new()
    {
        Policies = new[]
        {
            "default",
            "test",
        },
        Exclusive = true,
        EntityId = entity.Id,
    });

});
package main

import (
	"github.com/pulumi/pulumi-vault/sdk/v5/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{
			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
	})
}
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()        
            .externalPolicies(true)
            .build());

        var policies = new EntityPolicies("policies", EntityPoliciesArgs.builder()        
            .policies(            
                "default",
                "test")
            .exclusive(true)
            .entityId(entity.id())
            .build());

    }
}
import pulumi
import pulumi_vault as vault

entity = vault.identity.Entity("entity", external_policies=True)
policies = vault.identity.EntityPolicies("policies",
    policies=[
        "default",
        "test",
    ],
    exclusive=True,
    entity_id=entity.id)
import * as pulumi from "@pulumi/pulumi";
import * as vault from "@pulumi/vault";

const entity = new vault.identity.Entity("entity", {externalPolicies: true});
const policies = new vault.identity.EntityPolicies("policies", {
    policies: [
        "default",
        "test",
    ],
    exclusive: true,
    entityId: entity.id,
});
resources:
  entity:
    type: vault:identity:Entity
    properties:
      externalPolicies: true
  policies:
    type: vault:identity:EntityPolicies
    properties:
      policies:
        - default
        - test
      exclusive: true
      entityId: ${entity.id}

Non-exclusive Policies

using System.Collections.Generic;
using Pulumi;
using Vault = Pulumi.Vault;

return await Deployment.RunAsync(() => 
{
    var entity = new Vault.Identity.Entity("entity", new()
    {
        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 main

import (
	"github.com/pulumi/pulumi-vault/sdk/v5/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{
			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
	})
}
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()        
            .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());

    }
}
import pulumi
import pulumi_vault as vault

entity = vault.identity.Entity("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)
import * as pulumi from "@pulumi/pulumi";
import * as vault from "@pulumi/vault";

const entity = new vault.identity.Entity("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,
});
resources:
  entity:
    type: vault:identity:Entity
    properties:
      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

new EntityPolicies(name: string, args: EntityPoliciesArgs, opts?: CustomResourceOptions);
@overload
def EntityPolicies(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   entity_id: Optional[str] = None,
                   exclusive: Optional[bool] = None,
                   namespace: Optional[str] = None,
                   policies: Optional[Sequence[str]] = None)
@overload
def EntityPolicies(resource_name: str,
                   args: EntityPoliciesArgs,
                   opts: Optional[ResourceOptions] = 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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.