All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.vault.identity.kotlin.Group.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.4.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.vault.identity.kotlin

import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map

/**
 * Builder for [Group].
 */
@PulumiTagMarker
public class GroupResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: GroupArgs = GroupArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend GroupArgsBuilder.() -> Unit) {
        val builder = GroupArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): Group {
        val builtJavaResource = com.pulumi.vault.identity.Group(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Group(builtJavaResource)
    }
}

/**
 * Creates an Identity Group for Vault. The [Identity secrets engine](https://www.vaultproject.io/docs/secrets/identity/index.html) is the identity management solution for Vault.
 * A group can contain multiple entities as its members. A group can also have subgroups. Policies set on the group is granted to all members of the group. During request time, when the token's entity ID is being evaluated for the policies that it has access to; along with the policies on the entity itself, policies that are inherited due to group memberships are also granted.
 * ## Example Usage
 * ### Internal Group
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as vault from "@pulumi/vault";
 * const internal = new vault.identity.Group("internal", {
 *     name: "internal",
 *     type: "internal",
 *     policies: [
 *         "dev",
 *         "test",
 *     ],
 *     metadata: {
 *         version: "2",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_vault as vault
 * internal = vault.identity.Group("internal",
 *     name="internal",
 *     type="internal",
 *     policies=[
 *         "dev",
 *         "test",
 *     ],
 *     metadata={
 *         "version": "2",
 *     })
 * ```
 * ```csharp
 * 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",
 *         Policies = new[]
 *         {
 *             "dev",
 *             "test",
 *         },
 *         Metadata =
 *         {
 *             { "version", "2" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * 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 {
 * 		_, err := identity.NewGroup(ctx, "internal", &identity.GroupArgs{
 * 			Name: pulumi.String("internal"),
 * 			Type: pulumi.String("internal"),
 * 			Policies: pulumi.StringArray{
 * 				pulumi.String("dev"),
 * 				pulumi.String("test"),
 * 			},
 * 			Metadata: pulumi.StringMap{
 * 				"version": pulumi.String("2"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * 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 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")
 *             .policies(
 *                 "dev",
 *                 "test")
 *             .metadata(Map.of("version", "2"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   internal:
 *     type: vault:identity:Group
 *     properties:
 *       name: internal
 *       type: internal
 *       policies:
 *         - dev
 *         - test
 *       metadata:
 *         version: '2'
 * ```
 * 
 * ### External Group
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as vault from "@pulumi/vault";
 * const group = new vault.identity.Group("group", {
 *     name: "external",
 *     type: "external",
 *     policies: ["test"],
 *     metadata: {
 *         version: "1",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_vault as vault
 * group = vault.identity.Group("group",
 *     name="external",
 *     type="external",
 *     policies=["test"],
 *     metadata={
 *         "version": "1",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Vault = Pulumi.Vault;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @group = new Vault.Identity.Group("group", new()
 *     {
 *         Name = "external",
 *         Type = "external",
 *         Policies = new[]
 *         {
 *             "test",
 *         },
 *         Metadata =
 *         {
 *             { "version", "1" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * 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 {
 * 		_, err := identity.NewGroup(ctx, "group", &identity.GroupArgs{
 * 			Name: pulumi.String("external"),
 * 			Type: pulumi.String("external"),
 * 			Policies: pulumi.StringArray{
 * 				pulumi.String("test"),
 * 			},
 * 			Metadata: pulumi.StringMap{
 * 				"version": pulumi.String("1"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * 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 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 group = new Group("group", GroupArgs.builder()
 *             .name("external")
 *             .type("external")
 *             .policies("test")
 *             .metadata(Map.of("version", "1"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   group:
 *     type: vault:identity:Group
 *     properties:
 *       name: external
 *       type: external
 *       policies:
 *         - test
 *       metadata:
 *         version: '1'
 * ```
 * 
 * ## Caveats
 * It's important to note that Vault identity groups names are *case-insensitive*. For example the following resources would be equivalent.
 * Applying this configuration would result in the provider failing to create one of the identity groups, since the resources share the same `name`.
 * This sort of pattern should be avoided:
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as vault from "@pulumi/vault";
 * const internal = new vault.identity.Group("internal", {
 *     name: "internal",
 *     type: "internal",
 *     policies: [
 *         "dev",
 *         "test",
 *     ],
 *     metadata: {
 *         version: "2",
 *     },
 * });
 * const internalGroup = new vault.identity.Group("Internal", {
 *     name: "Internal",
 *     type: "internal",
 *     policies: [
 *         "dev",
 *         "test",
 *     ],
 *     metadata: {
 *         version: "2",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_vault as vault
 * internal = vault.identity.Group("internal",
 *     name="internal",
 *     type="internal",
 *     policies=[
 *         "dev",
 *         "test",
 *     ],
 *     metadata={
 *         "version": "2",
 *     })
 * internal_group = vault.identity.Group("Internal",
 *     name="Internal",
 *     type="internal",
 *     policies=[
 *         "dev",
 *         "test",
 *     ],
 *     metadata={
 *         "version": "2",
 *     })
 * ```
 * ```csharp
 * 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",
 *         Policies = new[]
 *         {
 *             "dev",
 *             "test",
 *         },
 *         Metadata =
 *         {
 *             { "version", "2" },
 *         },
 *     });
 *     var internalGroup = new Vault.Identity.Group("Internal", new()
 *     {
 *         Name = "Internal",
 *         Type = "internal",
 *         Policies = new[]
 *         {
 *             "dev",
 *             "test",
 *         },
 *         Metadata =
 *         {
 *             { "version", "2" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * 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 {
 * 		_, err := identity.NewGroup(ctx, "internal", &identity.GroupArgs{
 * 			Name: pulumi.String("internal"),
 * 			Type: pulumi.String("internal"),
 * 			Policies: pulumi.StringArray{
 * 				pulumi.String("dev"),
 * 				pulumi.String("test"),
 * 			},
 * 			Metadata: pulumi.StringMap{
 * 				"version": pulumi.String("2"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = identity.NewGroup(ctx, "Internal", &identity.GroupArgs{
 * 			Name: pulumi.String("Internal"),
 * 			Type: pulumi.String("internal"),
 * 			Policies: pulumi.StringArray{
 * 				pulumi.String("dev"),
 * 				pulumi.String("test"),
 * 			},
 * 			Metadata: pulumi.StringMap{
 * 				"version": pulumi.String("2"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * 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 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")
 *             .policies(
 *                 "dev",
 *                 "test")
 *             .metadata(Map.of("version", "2"))
 *             .build());
 *         var internalGroup = new Group("internalGroup", GroupArgs.builder()
 *             .name("Internal")
 *             .type("internal")
 *             .policies(
 *                 "dev",
 *                 "test")
 *             .metadata(Map.of("version", "2"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   internal:
 *     type: vault:identity:Group
 *     properties:
 *       name: internal
 *       type: internal
 *       policies:
 *         - dev
 *         - test
 *       metadata:
 *         version: '2'
 *   internalGroup:
 *     type: vault:identity:Group
 *     name: Internal
 *     properties:
 *       name: Internal
 *       type: internal
 *       policies:
 *         - dev
 *         - test
 *       metadata:
 *         version: '2'
 * ```
 * 
 * ## Import
 * Identity group can be imported using the `id`, e.g.
 * ```sh
 * $ pulumi import vault:identity/group:Group test 'fcbf1efb-2b69-4209-bed8-811e3475dad3'
 * ```
 */
public class Group internal constructor(
    override val javaResource: com.pulumi.vault.identity.Group,
) : KotlinCustomResource(javaResource, GroupMapper) {
    /**
     * `false` by default. If set to `true`, this resource will ignore any Entity IDs
     * returned from Vault or specified in the resource. You can use
     * `vault.identity.GroupMemberEntityIds` to manage Entity IDs for this group in a
     * decoupled manner.
     */
    public val externalMemberEntityIds: Output?
        get() = javaResource.externalMemberEntityIds().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * `false` by default. If set to `true`, this resource will ignore any Group IDs
     * returned from Vault or specified in the resource. You can use
     * `vault.identity.GroupMemberGroupIds` to manage Group IDs for this group in a
     * decoupled manner.
     */
    public val externalMemberGroupIds: Output?
        get() = javaResource.externalMemberGroupIds().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * `false` by default. If set to `true`, this resource will ignore any policies returned from
     * Vault or specified in the resource. You can use `vault.identity.GroupPolicies` to manage
     * policies for this group in a decoupled manner.
     */
    public val externalPolicies: Output?
        get() = javaResource.externalPolicies().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A list of Entity IDs to be assigned as group members. Not allowed on `external` groups.
     */
    public val memberEntityIds: Output>?
        get() = javaResource.memberEntityIds().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * A list of Group IDs to be assigned as group members. Not allowed on `external` groups.
     */
    public val memberGroupIds: Output>?
        get() = javaResource.memberGroupIds().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * A Map of additional metadata to associate with the group.
     */
    public val metadata: Output>?
        get() = javaResource.metadata().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * Name of the identity group to create.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * 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](https://www.terraform.io/docs/providers/vault/index.html#namespace).
     * *Available only for Vault Enterprise*.
     */
    public val namespace: Output?
        get() = javaResource.namespace().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * A list of policies to apply to the group.
     */
    public val policies: Output>?
        get() = javaResource.policies().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * Type of the group, internal or external. Defaults to `internal`.
     */
    public val type: Output?
        get() = javaResource.type().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}

public object GroupMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.vault.identity.Group::class == javaResource::class

    override fun map(javaResource: Resource): Group = Group(
        javaResource as
            com.pulumi.vault.identity.Group,
    )
}

/**
 * @see [Group].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [Group].
 */
public suspend fun group(name: String, block: suspend GroupResourceBuilder.() -> Unit): Group {
    val builder = GroupResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [Group].
 * @param name The _unique_ name of the resulting resource.
 */
public fun group(name: String): Group {
    val builder = GroupResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy