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

vault.identity.GroupPolicies

Explore with Pulumi AI

Manages policies for an Identity Group 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 internal = new vault.identity.Group("internal", {
    name: "internal",
    type: "internal",
    externalPolicies: true,
    metadata: {
        version: "2",
    },
});
const policies = new vault.identity.GroupPolicies("policies", {
    policies: [
        "default",
        "test",
    ],
    exclusive: true,
    groupId: internal.id,
});
Copy
import pulumi
import pulumi_vault as vault

internal = vault.identity.Group("internal",
    name="internal",
    type="internal",
    external_policies=True,
    metadata={
        "version": "2",
    })
policies = vault.identity.GroupPolicies("policies",
    policies=[
        "default",
        "test",
    ],
    exclusive=True,
    group_id=internal.id)
Copy
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 {
		internal, err := identity.NewGroup(ctx, "internal", &identity.GroupArgs{
			Name:             pulumi.String("internal"),
			Type:             pulumi.String("internal"),
			ExternalPolicies: pulumi.Bool(true),
			Metadata: pulumi.StringMap{
				"version": pulumi.String("2"),
			},
		})
		if err != nil {
			return err
		}
		_, err = identity.NewGroupPolicies(ctx, "policies", &identity.GroupPoliciesArgs{
			Policies: pulumi.StringArray{
				pulumi.String("default"),
				pulumi.String("test"),
			},
			Exclusive: pulumi.Bool(true),
			GroupId:   internal.ID(),
		})
		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 @internal = new Vault.Identity.Group("internal", new()
    {
        Name = "internal",
        Type = "internal",
        ExternalPolicies = true,
        Metadata = 
        {
            { "version", "2" },
        },
    });

    var policies = new Vault.Identity.GroupPolicies("policies", new()
    {
        Policies = new[]
        {
            "default",
            "test",
        },
        Exclusive = true,
        GroupId = @internal.Id,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vault.identity.Group;
import com.pulumi.vault.identity.GroupArgs;
import com.pulumi.vault.identity.GroupPolicies;
import com.pulumi.vault.identity.GroupPoliciesArgs;
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 internal = new Group("internal", GroupArgs.builder()
            .name("internal")
            .type("internal")
            .externalPolicies(true)
            .metadata(Map.of("version", "2"))
            .build());

        var policies = new GroupPolicies("policies", GroupPoliciesArgs.builder()
            .policies(            
                "default",
                "test")
            .exclusive(true)
            .groupId(internal.id())
            .build());

    }
}
Copy
resources:
  internal:
    type: vault:identity:Group
    properties:
      name: internal
      type: internal
      externalPolicies: true
      metadata:
        version: '2'
  policies:
    type: vault:identity:GroupPolicies
    properties:
      policies:
        - default
        - test
      exclusive: true
      groupId: ${internal.id}
Copy

Non-exclusive Policies

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

const internal = new vault.identity.Group("internal", {
    name: "internal",
    type: "internal",
    externalPolicies: true,
    metadata: {
        version: "2",
    },
});
const _default = new vault.identity.GroupPolicies("default", {
    policies: [
        "default",
        "test",
    ],
    exclusive: false,
    groupId: internal.id,
});
const others = new vault.identity.GroupPolicies("others", {
    policies: ["others"],
    exclusive: false,
    groupId: internal.id,
});
Copy
import pulumi
import pulumi_vault as vault

internal = vault.identity.Group("internal",
    name="internal",
    type="internal",
    external_policies=True,
    metadata={
        "version": "2",
    })
default = vault.identity.GroupPolicies("default",
    policies=[
        "default",
        "test",
    ],
    exclusive=False,
    group_id=internal.id)
others = vault.identity.GroupPolicies("others",
    policies=["others"],
    exclusive=False,
    group_id=internal.id)
Copy
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 {
		internal, err := identity.NewGroup(ctx, "internal", &identity.GroupArgs{
			Name:             pulumi.String("internal"),
			Type:             pulumi.String("internal"),
			ExternalPolicies: pulumi.Bool(true),
			Metadata: pulumi.StringMap{
				"version": pulumi.String("2"),
			},
		})
		if err != nil {
			return err
		}
		_, err = identity.NewGroupPolicies(ctx, "default", &identity.GroupPoliciesArgs{
			Policies: pulumi.StringArray{
				pulumi.String("default"),
				pulumi.String("test"),
			},
			Exclusive: pulumi.Bool(false),
			GroupId:   internal.ID(),
		})
		if err != nil {
			return err
		}
		_, err = identity.NewGroupPolicies(ctx, "others", &identity.GroupPoliciesArgs{
			Policies: pulumi.StringArray{
				pulumi.String("others"),
			},
			Exclusive: pulumi.Bool(false),
			GroupId:   internal.ID(),
		})
		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 @internal = new Vault.Identity.Group("internal", new()
    {
        Name = "internal",
        Type = "internal",
        ExternalPolicies = true,
        Metadata = 
        {
            { "version", "2" },
        },
    });

    var @default = new Vault.Identity.GroupPolicies("default", new()
    {
        Policies = new[]
        {
            "default",
            "test",
        },
        Exclusive = false,
        GroupId = @internal.Id,
    });

    var others = new Vault.Identity.GroupPolicies("others", new()
    {
        Policies = new[]
        {
            "others",
        },
        Exclusive = false,
        GroupId = @internal.Id,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vault.identity.Group;
import com.pulumi.vault.identity.GroupArgs;
import com.pulumi.vault.identity.GroupPolicies;
import com.pulumi.vault.identity.GroupPoliciesArgs;
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 internal = new Group("internal", GroupArgs.builder()
            .name("internal")
            .type("internal")
            .externalPolicies(true)
            .metadata(Map.of("version", "2"))
            .build());

        var default_ = new GroupPolicies("default", GroupPoliciesArgs.builder()
            .policies(            
                "default",
                "test")
            .exclusive(false)
            .groupId(internal.id())
            .build());

        var others = new GroupPolicies("others", GroupPoliciesArgs.builder()
            .policies("others")
            .exclusive(false)
            .groupId(internal.id())
            .build());

    }
}
Copy
resources:
  internal:
    type: vault:identity:Group
    properties:
      name: internal
      type: internal
      externalPolicies: true
      metadata:
        version: '2'
  default:
    type: vault:identity:GroupPolicies
    properties:
      policies:
        - default
        - test
      exclusive: false
      groupId: ${internal.id}
  others:
    type: vault:identity:GroupPolicies
    properties:
      policies:
        - others
      exclusive: false
      groupId: ${internal.id}
Copy

Create GroupPolicies Resource

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

Constructor syntax

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

@overload
def GroupPolicies(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  group_id: Optional[str] = None,
                  policies: Optional[Sequence[str]] = None,
                  exclusive: Optional[bool] = None,
                  namespace: Optional[str] = None)
func NewGroupPolicies(ctx *Context, name string, args GroupPoliciesArgs, opts ...ResourceOption) (*GroupPolicies, error)
public GroupPolicies(string name, GroupPoliciesArgs args, CustomResourceOptions? opts = null)
public GroupPolicies(String name, GroupPoliciesArgs args)
public GroupPolicies(String name, GroupPoliciesArgs args, CustomResourceOptions options)
type: vault:identity:GroupPolicies
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. GroupPoliciesArgs
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. GroupPoliciesArgs
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. GroupPoliciesArgs
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. GroupPoliciesArgs
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. GroupPoliciesArgs
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 groupPoliciesResource = new Vault.Identity.GroupPolicies("groupPoliciesResource", new()
{
    GroupId = "string",
    Policies = new[]
    {
        "string",
    },
    Exclusive = false,
    Namespace = "string",
});
Copy
example, err := identity.NewGroupPolicies(ctx, "groupPoliciesResource", &identity.GroupPoliciesArgs{
	GroupId: pulumi.String("string"),
	Policies: pulumi.StringArray{
		pulumi.String("string"),
	},
	Exclusive: pulumi.Bool(false),
	Namespace: pulumi.String("string"),
})
Copy
var groupPoliciesResource = new GroupPolicies("groupPoliciesResource", GroupPoliciesArgs.builder()
    .groupId("string")
    .policies("string")
    .exclusive(false)
    .namespace("string")
    .build());
Copy
group_policies_resource = vault.identity.GroupPolicies("groupPoliciesResource",
    group_id="string",
    policies=["string"],
    exclusive=False,
    namespace="string")
Copy
const groupPoliciesResource = new vault.identity.GroupPolicies("groupPoliciesResource", {
    groupId: "string",
    policies: ["string"],
    exclusive: false,
    namespace: "string",
});
Copy
type: vault:identity:GroupPolicies
properties:
    exclusive: false
    groupId: string
    namespace: string
    policies:
        - string
Copy

GroupPolicies 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 GroupPolicies resource accepts the following input properties:

GroupId This property is required. string
Group ID to assign policies to.
Policies This property is required. List<string>
List of policies to assign to the group
Exclusive bool

Defaults to true.

If true, this resource will take exclusive control of the policies assigned to the group 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 group. When destroying the resource, the resource will ensure that the policies specified in the resource are removed.

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.
GroupId This property is required. string
Group ID to assign policies to.
Policies This property is required. []string
List of policies to assign to the group
Exclusive bool

Defaults to true.

If true, this resource will take exclusive control of the policies assigned to the group 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 group. When destroying the resource, the resource will ensure that the policies specified in the resource are removed.

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.
groupId This property is required. String
Group ID to assign policies to.
policies This property is required. List<String>
List of policies to assign to the group
exclusive Boolean

Defaults to true.

If true, this resource will take exclusive control of the policies assigned to the group 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 group. When destroying the resource, the resource will ensure that the policies specified in the resource are removed.

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.
groupId This property is required. string
Group ID to assign policies to.
policies This property is required. string[]
List of policies to assign to the group
exclusive boolean

Defaults to true.

If true, this resource will take exclusive control of the policies assigned to the group 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 group. When destroying the resource, the resource will ensure that the policies specified in the resource are removed.

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.
group_id This property is required. str
Group ID to assign policies to.
policies This property is required. Sequence[str]
List of policies to assign to the group
exclusive bool

Defaults to true.

If true, this resource will take exclusive control of the policies assigned to the group 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 group. When destroying the resource, the resource will ensure that the policies specified in the resource are removed.

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.
groupId This property is required. String
Group ID to assign policies to.
policies This property is required. List<String>
List of policies to assign to the group
exclusive Boolean

Defaults to true.

If true, this resource will take exclusive control of the policies assigned to the group 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 group. When destroying the resource, the resource will ensure that the policies specified in the resource are removed.

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

GroupName string
The name of the group that are assigned the policies.
Id string
The provider-assigned unique ID for this managed resource.
GroupName string
The name of the group that are assigned the policies.
Id string
The provider-assigned unique ID for this managed resource.
groupName String
The name of the group that are assigned the policies.
id String
The provider-assigned unique ID for this managed resource.
groupName string
The name of the group that are assigned the policies.
id string
The provider-assigned unique ID for this managed resource.
group_name str
The name of the group that are assigned the policies.
id str
The provider-assigned unique ID for this managed resource.
groupName String
The name of the group that are assigned the policies.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing GroupPolicies Resource

Get an existing GroupPolicies 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?: GroupPoliciesState, opts?: CustomResourceOptions): GroupPolicies
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        exclusive: Optional[bool] = None,
        group_id: Optional[str] = None,
        group_name: Optional[str] = None,
        namespace: Optional[str] = None,
        policies: Optional[Sequence[str]] = None) -> GroupPolicies
func GetGroupPolicies(ctx *Context, name string, id IDInput, state *GroupPoliciesState, opts ...ResourceOption) (*GroupPolicies, error)
public static GroupPolicies Get(string name, Input<string> id, GroupPoliciesState? state, CustomResourceOptions? opts = null)
public static GroupPolicies get(String name, Output<String> id, GroupPoliciesState state, CustomResourceOptions options)
resources:  _:    type: vault:identity:GroupPolicies    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:
Exclusive bool

Defaults to true.

If true, this resource will take exclusive control of the policies assigned to the group 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 group. When destroying the resource, the resource will ensure that the policies specified in the resource are removed.

GroupId string
Group ID to assign policies to.
GroupName string
The name of the group that are assigned the policies.
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.
Policies List<string>
List of policies to assign to the group
Exclusive bool

Defaults to true.

If true, this resource will take exclusive control of the policies assigned to the group 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 group. When destroying the resource, the resource will ensure that the policies specified in the resource are removed.

GroupId string
Group ID to assign policies to.
GroupName string
The name of the group that are assigned the policies.
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.
Policies []string
List of policies to assign to the group
exclusive Boolean

Defaults to true.

If true, this resource will take exclusive control of the policies assigned to the group 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 group. When destroying the resource, the resource will ensure that the policies specified in the resource are removed.

groupId String
Group ID to assign policies to.
groupName String
The name of the group that are assigned the policies.
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.
policies List<String>
List of policies to assign to the group
exclusive boolean

Defaults to true.

If true, this resource will take exclusive control of the policies assigned to the group 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 group. When destroying the resource, the resource will ensure that the policies specified in the resource are removed.

groupId string
Group ID to assign policies to.
groupName string
The name of the group that are assigned the policies.
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.
policies string[]
List of policies to assign to the group
exclusive bool

Defaults to true.

If true, this resource will take exclusive control of the policies assigned to the group 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 group. When destroying the resource, the resource will ensure that the policies specified in the resource are removed.

group_id str
Group ID to assign policies to.
group_name str
The name of the group that are assigned the policies.
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.
policies Sequence[str]
List of policies to assign to the group
exclusive Boolean

Defaults to true.

If true, this resource will take exclusive control of the policies assigned to the group 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 group. When destroying the resource, the resource will ensure that the policies specified in the resource are removed.

groupId String
Group ID to assign policies to.
groupName String
The name of the group that are assigned the policies.
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.
policies List<String>
List of policies to assign to the group

Package Details

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