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

com.pulumi.vault.consul.kotlin.SecretBackendRoleArgs.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.consul.kotlin

import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.vault.consul.SecretBackendRoleArgs.builder
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * Manages a Consul secrets role for a Consul secrets engine in Vault. Consul secret backends can then issue Consul tokens.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as vault from "@pulumi/vault";
 * const test = new vault.consul.SecretBackend("test", {
 *     path: "consul",
 *     description: "Manages the Consul backend",
 *     address: "127.0.0.1:8500",
 *     token: "4240861b-ce3d-8530-115a-521ff070dd29",
 * });
 * const example = new vault.consul.SecretBackendRole("example", {
 *     name: "test-role",
 *     backend: test.path,
 *     consulPolicies: ["example-policy"],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_vault as vault
 * test = vault.consul.SecretBackend("test",
 *     path="consul",
 *     description="Manages the Consul backend",
 *     address="127.0.0.1:8500",
 *     token="4240861b-ce3d-8530-115a-521ff070dd29")
 * example = vault.consul.SecretBackendRole("example",
 *     name="test-role",
 *     backend=test.path,
 *     consul_policies=["example-policy"])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Vault = Pulumi.Vault;
 * return await Deployment.RunAsync(() =>
 * {
 *     var test = new Vault.Consul.SecretBackend("test", new()
 *     {
 *         Path = "consul",
 *         Description = "Manages the Consul backend",
 *         Address = "127.0.0.1:8500",
 *         Token = "4240861b-ce3d-8530-115a-521ff070dd29",
 *     });
 *     var example = new Vault.Consul.SecretBackendRole("example", new()
 *     {
 *         Name = "test-role",
 *         Backend = test.Path,
 *         ConsulPolicies = new[]
 *         {
 *             "example-policy",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-vault/sdk/v6/go/vault/consul"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		test, err := consul.NewSecretBackend(ctx, "test", &consul.SecretBackendArgs{
 * 			Path:        pulumi.String("consul"),
 * 			Description: pulumi.String("Manages the Consul backend"),
 * 			Address:     pulumi.String("127.0.0.1:8500"),
 * 			Token:       pulumi.String("4240861b-ce3d-8530-115a-521ff070dd29"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = consul.NewSecretBackendRole(ctx, "example", &consul.SecretBackendRoleArgs{
 * 			Name:    pulumi.String("test-role"),
 * 			Backend: test.Path,
 * 			ConsulPolicies: pulumi.StringArray{
 * 				pulumi.String("example-policy"),
 * 			},
 * 		})
 * 		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.consul.SecretBackend;
 * import com.pulumi.vault.consul.SecretBackendArgs;
 * import com.pulumi.vault.consul.SecretBackendRole;
 * import com.pulumi.vault.consul.SecretBackendRoleArgs;
 * 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 test = new SecretBackend("test", SecretBackendArgs.builder()
 *             .path("consul")
 *             .description("Manages the Consul backend")
 *             .address("127.0.0.1:8500")
 *             .token("4240861b-ce3d-8530-115a-521ff070dd29")
 *             .build());
 *         var example = new SecretBackendRole("example", SecretBackendRoleArgs.builder()
 *             .name("test-role")
 *             .backend(test.path())
 *             .consulPolicies("example-policy")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   test:
 *     type: vault:consul:SecretBackend
 *     properties:
 *       path: consul
 *       description: Manages the Consul backend
 *       address: 127.0.0.1:8500
 *       token: 4240861b-ce3d-8530-115a-521ff070dd29
 *   example:
 *     type: vault:consul:SecretBackendRole
 *     properties:
 *       name: test-role
 *       backend: ${test.path}
 *       consulPolicies:
 *         - example-policy
 * ```
 * 
 * ## Note About Required Arguments
 * *At least one* of the four arguments `consul_policies`, `consul_roles`, `service_identities`, or
 * `node_identities` is required for a token. If desired, any combination of the four arguments up-to and
 * including all four, is valid.
 * ## Import
 * Consul secret backend roles can be imported using the `backend`, `/roles/`, and the `name` e.g.
 * ```sh
 * $ pulumi import vault:consul/secretBackendRole:SecretBackendRole example consul/roles/my-role
 * ```
 * @property backend The unique name of an existing Consul secrets backend mount. Must not begin or end with a `/`. One of `path` or `backend` is required.
 * @property consulNamespace The Consul namespace that the token will be created in.
 * Applicable for Vault 1.10+ and Consul 1.7+".
 * @property consulPolicies SEE NOTE The list of Consul ACL policies to associate with these roles.
 * @property consulRoles SEE NOTE Set of Consul roles to attach to the token.
 * Applicable for Vault 1.10+ with Consul 1.5+.
 * @property local Indicates that the token should not be replicated globally and instead be local to the current datacenter.
 * @property maxTtl Maximum TTL for leases associated with this role, in seconds.
 * @property name The name of the Consul secrets engine role to create.
 * @property namespace 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*.
 * @property nodeIdentities SEE NOTE Set of Consul node
 * identities to attach to the token. Applicable for Vault 1.11+ with Consul 1.8+.
 * @property partition The admin partition that the token will be created in.
 * Applicable for Vault 1.10+ and Consul 1.11+".
 * @property policies The list of Consul ACL policies to associate with these roles.
 * **NOTE:** The new parameter `consul_policies` should be used in favor of this. This parameter,
 * `policies`, remains supported for legacy users, but Vault has deprecated this field.
 * @property serviceIdentities SEE NOTE Set of Consul
 * service identities to attach to the token. Applicable for Vault 1.11+ with Consul 1.5+.
 * @property ttl Specifies the TTL for this role.
 */
public data class SecretBackendRoleArgs(
    public val backend: Output? = null,
    public val consulNamespace: Output? = null,
    public val consulPolicies: Output>? = null,
    public val consulRoles: Output>? = null,
    public val local: Output? = null,
    public val maxTtl: Output? = null,
    public val name: Output? = null,
    public val namespace: Output? = null,
    public val nodeIdentities: Output>? = null,
    public val partition: Output? = null,
    public val policies: Output>? = null,
    public val serviceIdentities: Output>? = null,
    public val ttl: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.vault.consul.SecretBackendRoleArgs =
        com.pulumi.vault.consul.SecretBackendRoleArgs.builder()
            .backend(backend?.applyValue({ args0 -> args0 }))
            .consulNamespace(consulNamespace?.applyValue({ args0 -> args0 }))
            .consulPolicies(consulPolicies?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .consulRoles(consulRoles?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .local(local?.applyValue({ args0 -> args0 }))
            .maxTtl(maxTtl?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .namespace(namespace?.applyValue({ args0 -> args0 }))
            .nodeIdentities(nodeIdentities?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .partition(partition?.applyValue({ args0 -> args0 }))
            .policies(policies?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .serviceIdentities(serviceIdentities?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .ttl(ttl?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [SecretBackendRoleArgs].
 */
@PulumiTagMarker
public class SecretBackendRoleArgsBuilder internal constructor() {
    private var backend: Output? = null

    private var consulNamespace: Output? = null

    private var consulPolicies: Output>? = null

    private var consulRoles: Output>? = null

    private var local: Output? = null

    private var maxTtl: Output? = null

    private var name: Output? = null

    private var namespace: Output? = null

    private var nodeIdentities: Output>? = null

    private var partition: Output? = null

    private var policies: Output>? = null

    private var serviceIdentities: Output>? = null

    private var ttl: Output? = null

    /**
     * @param value The unique name of an existing Consul secrets backend mount. Must not begin or end with a `/`. One of `path` or `backend` is required.
     */
    @JvmName("cmyhldxpfwrpdicg")
    public suspend fun backend(`value`: Output) {
        this.backend = value
    }

    /**
     * @param value The Consul namespace that the token will be created in.
     * Applicable for Vault 1.10+ and Consul 1.7+".
     */
    @JvmName("dhjqqeksfwetnptw")
    public suspend fun consulNamespace(`value`: Output) {
        this.consulNamespace = value
    }

    /**
     * @param value SEE NOTE The list of Consul ACL policies to associate with these roles.
     */
    @JvmName("ksdhhqfavvplylbf")
    public suspend fun consulPolicies(`value`: Output>) {
        this.consulPolicies = value
    }

    @JvmName("tshvuwcjsfmkqycv")
    public suspend fun consulPolicies(vararg values: Output) {
        this.consulPolicies = Output.all(values.asList())
    }

    /**
     * @param values SEE NOTE The list of Consul ACL policies to associate with these roles.
     */
    @JvmName("fxcbdxpidegxbfym")
    public suspend fun consulPolicies(values: List>) {
        this.consulPolicies = Output.all(values)
    }

    /**
     * @param value SEE NOTE Set of Consul roles to attach to the token.
     * Applicable for Vault 1.10+ with Consul 1.5+.
     */
    @JvmName("wwntqofmqssvwpop")
    public suspend fun consulRoles(`value`: Output>) {
        this.consulRoles = value
    }

    @JvmName("ydtrydpjhocwofss")
    public suspend fun consulRoles(vararg values: Output) {
        this.consulRoles = Output.all(values.asList())
    }

    /**
     * @param values SEE NOTE Set of Consul roles to attach to the token.
     * Applicable for Vault 1.10+ with Consul 1.5+.
     */
    @JvmName("fmchyvykgwbmekuq")
    public suspend fun consulRoles(values: List>) {
        this.consulRoles = Output.all(values)
    }

    /**
     * @param value Indicates that the token should not be replicated globally and instead be local to the current datacenter.
     */
    @JvmName("gmrfeccseepkjkbl")
    public suspend fun local(`value`: Output) {
        this.local = value
    }

    /**
     * @param value Maximum TTL for leases associated with this role, in seconds.
     */
    @JvmName("wqumptgbubatgkfo")
    public suspend fun maxTtl(`value`: Output) {
        this.maxTtl = value
    }

    /**
     * @param value The name of the Consul secrets engine role to create.
     */
    @JvmName("uopkpotrfjirtyam")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value 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*.
     */
    @JvmName("qckdbkmqdmrynisu")
    public suspend fun namespace(`value`: Output) {
        this.namespace = value
    }

    /**
     * @param value SEE NOTE Set of Consul node
     * identities to attach to the token. Applicable for Vault 1.11+ with Consul 1.8+.
     */
    @JvmName("jwfbutrgbqfvyweg")
    public suspend fun nodeIdentities(`value`: Output>) {
        this.nodeIdentities = value
    }

    @JvmName("nbumajfymbccudlk")
    public suspend fun nodeIdentities(vararg values: Output) {
        this.nodeIdentities = Output.all(values.asList())
    }

    /**
     * @param values SEE NOTE Set of Consul node
     * identities to attach to the token. Applicable for Vault 1.11+ with Consul 1.8+.
     */
    @JvmName("lkbwjsveskiqlmbr")
    public suspend fun nodeIdentities(values: List>) {
        this.nodeIdentities = Output.all(values)
    }

    /**
     * @param value The admin partition that the token will be created in.
     * Applicable for Vault 1.10+ and Consul 1.11+".
     */
    @JvmName("idbllyhxtbreojwo")
    public suspend fun partition(`value`: Output) {
        this.partition = value
    }

    /**
     * @param value The list of Consul ACL policies to associate with these roles.
     * **NOTE:** The new parameter `consul_policies` should be used in favor of this. This parameter,
     * `policies`, remains supported for legacy users, but Vault has deprecated this field.
     */
    @JvmName("iigwmordpffqmoht")
    public suspend fun policies(`value`: Output>) {
        this.policies = value
    }

    @JvmName("qoookhxmtnoqlvlv")
    public suspend fun policies(vararg values: Output) {
        this.policies = Output.all(values.asList())
    }

    /**
     * @param values The list of Consul ACL policies to associate with these roles.
     * **NOTE:** The new parameter `consul_policies` should be used in favor of this. This parameter,
     * `policies`, remains supported for legacy users, but Vault has deprecated this field.
     */
    @JvmName("otlbinvlwtkjfpej")
    public suspend fun policies(values: List>) {
        this.policies = Output.all(values)
    }

    /**
     * @param value SEE NOTE Set of Consul
     * service identities to attach to the token. Applicable for Vault 1.11+ with Consul 1.5+.
     */
    @JvmName("tmleaoovkvneawmg")
    public suspend fun serviceIdentities(`value`: Output>) {
        this.serviceIdentities = value
    }

    @JvmName("japdjljaylxkdmvy")
    public suspend fun serviceIdentities(vararg values: Output) {
        this.serviceIdentities = Output.all(values.asList())
    }

    /**
     * @param values SEE NOTE Set of Consul
     * service identities to attach to the token. Applicable for Vault 1.11+ with Consul 1.5+.
     */
    @JvmName("gowmsbgvyxkwuwbq")
    public suspend fun serviceIdentities(values: List>) {
        this.serviceIdentities = Output.all(values)
    }

    /**
     * @param value Specifies the TTL for this role.
     */
    @JvmName("eltuaqcnbxcqqojk")
    public suspend fun ttl(`value`: Output) {
        this.ttl = value
    }

    /**
     * @param value The unique name of an existing Consul secrets backend mount. Must not begin or end with a `/`. One of `path` or `backend` is required.
     */
    @JvmName("owwwfefpaeuofemi")
    public suspend fun backend(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.backend = mapped
    }

    /**
     * @param value The Consul namespace that the token will be created in.
     * Applicable for Vault 1.10+ and Consul 1.7+".
     */
    @JvmName("ayiamxmtyxtrqxur")
    public suspend fun consulNamespace(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.consulNamespace = mapped
    }

    /**
     * @param value SEE NOTE The list of Consul ACL policies to associate with these roles.
     */
    @JvmName("rcwbqfyesxrylbsh")
    public suspend fun consulPolicies(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.consulPolicies = mapped
    }

    /**
     * @param values SEE NOTE The list of Consul ACL policies to associate with these roles.
     */
    @JvmName("itevytrmltckxkee")
    public suspend fun consulPolicies(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.consulPolicies = mapped
    }

    /**
     * @param value SEE NOTE Set of Consul roles to attach to the token.
     * Applicable for Vault 1.10+ with Consul 1.5+.
     */
    @JvmName("xdxwvmruvksvjapv")
    public suspend fun consulRoles(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.consulRoles = mapped
    }

    /**
     * @param values SEE NOTE Set of Consul roles to attach to the token.
     * Applicable for Vault 1.10+ with Consul 1.5+.
     */
    @JvmName("ttwtkghfwbjnrpux")
    public suspend fun consulRoles(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.consulRoles = mapped
    }

    /**
     * @param value Indicates that the token should not be replicated globally and instead be local to the current datacenter.
     */
    @JvmName("ssmwbrgxmqwfymbl")
    public suspend fun local(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.local = mapped
    }

    /**
     * @param value Maximum TTL for leases associated with this role, in seconds.
     */
    @JvmName("iwdyjmlhacumxwun")
    public suspend fun maxTtl(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.maxTtl = mapped
    }

    /**
     * @param value The name of the Consul secrets engine role to create.
     */
    @JvmName("pnsilvkvwpneoteh")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value 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*.
     */
    @JvmName("cxndeeuhaddvwfyp")
    public suspend fun namespace(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.namespace = mapped
    }

    /**
     * @param value SEE NOTE Set of Consul node
     * identities to attach to the token. Applicable for Vault 1.11+ with Consul 1.8+.
     */
    @JvmName("wyinpscevvbipgfh")
    public suspend fun nodeIdentities(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.nodeIdentities = mapped
    }

    /**
     * @param values SEE NOTE Set of Consul node
     * identities to attach to the token. Applicable for Vault 1.11+ with Consul 1.8+.
     */
    @JvmName("rudjtbfmxoegqrnu")
    public suspend fun nodeIdentities(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.nodeIdentities = mapped
    }

    /**
     * @param value The admin partition that the token will be created in.
     * Applicable for Vault 1.10+ and Consul 1.11+".
     */
    @JvmName("matbscddbcewghto")
    public suspend fun partition(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.partition = mapped
    }

    /**
     * @param value The list of Consul ACL policies to associate with these roles.
     * **NOTE:** The new parameter `consul_policies` should be used in favor of this. This parameter,
     * `policies`, remains supported for legacy users, but Vault has deprecated this field.
     */
    @JvmName("jdbhavjrbsqcapor")
    public suspend fun policies(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.policies = mapped
    }

    /**
     * @param values The list of Consul ACL policies to associate with these roles.
     * **NOTE:** The new parameter `consul_policies` should be used in favor of this. This parameter,
     * `policies`, remains supported for legacy users, but Vault has deprecated this field.
     */
    @JvmName("dophsmbgjkuxgyet")
    public suspend fun policies(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.policies = mapped
    }

    /**
     * @param value SEE NOTE Set of Consul
     * service identities to attach to the token. Applicable for Vault 1.11+ with Consul 1.5+.
     */
    @JvmName("fdgslcjtgdbgdkkn")
    public suspend fun serviceIdentities(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.serviceIdentities = mapped
    }

    /**
     * @param values SEE NOTE Set of Consul
     * service identities to attach to the token. Applicable for Vault 1.11+ with Consul 1.5+.
     */
    @JvmName("yatojmuygsakycos")
    public suspend fun serviceIdentities(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.serviceIdentities = mapped
    }

    /**
     * @param value Specifies the TTL for this role.
     */
    @JvmName("kfoklyjgaeuxflpj")
    public suspend fun ttl(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.ttl = mapped
    }

    internal fun build(): SecretBackendRoleArgs = SecretBackendRoleArgs(
        backend = backend,
        consulNamespace = consulNamespace,
        consulPolicies = consulPolicies,
        consulRoles = consulRoles,
        local = local,
        maxTtl = maxTtl,
        name = name,
        namespace = namespace,
        nodeIdentities = nodeIdentities,
        partition = partition,
        policies = policies,
        serviceIdentities = serviceIdentities,
        ttl = ttl,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy