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

com.pulumi.vault.kubernetes.kotlin.SecretBackend.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.kubernetes.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.Any
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map

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

    public var args: SecretBackendArgs = SecretBackendArgs()

    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 SecretBackendArgsBuilder.() -> Unit) {
        val builder = SecretBackendArgsBuilder()
        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(): SecretBackend {
        val builtJavaResource = com.pulumi.vault.kubernetes.SecretBackend(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return SecretBackend(builtJavaResource)
    }
}

/**
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as std from "@pulumi/std";
 * import * as vault from "@pulumi/vault";
 * const config = new vault.kubernetes.SecretBackend("config", {
 *     path: "kubernetes",
 *     description: "kubernetes secrets engine description",
 *     defaultLeaseTtlSeconds: 43200,
 *     maxLeaseTtlSeconds: 86400,
 *     kubernetesHost: "https://127.0.0.1:61233",
 *     kubernetesCaCert: std.file({
 *         input: "/path/to/cert",
 *     }).then(invoke => invoke.result),
 *     serviceAccountJwt: std.file({
 *         input: "/path/to/token",
 *     }).then(invoke => invoke.result),
 *     disableLocalCaJwt: false,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_std as std
 * import pulumi_vault as vault
 * config = vault.kubernetes.SecretBackend("config",
 *     path="kubernetes",
 *     description="kubernetes secrets engine description",
 *     default_lease_ttl_seconds=43200,
 *     max_lease_ttl_seconds=86400,
 *     kubernetes_host="https://127.0.0.1:61233",
 *     kubernetes_ca_cert=std.file(input="/path/to/cert").result,
 *     service_account_jwt=std.file(input="/path/to/token").result,
 *     disable_local_ca_jwt=False)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Std = Pulumi.Std;
 * using Vault = Pulumi.Vault;
 * return await Deployment.RunAsync(() =>
 * {
 *     var config = new Vault.Kubernetes.SecretBackend("config", new()
 *     {
 *         Path = "kubernetes",
 *         Description = "kubernetes secrets engine description",
 *         DefaultLeaseTtlSeconds = 43200,
 *         MaxLeaseTtlSeconds = 86400,
 *         KubernetesHost = "https://127.0.0.1:61233",
 *         KubernetesCaCert = Std.File.Invoke(new()
 *         {
 *             Input = "/path/to/cert",
 *         }).Apply(invoke => invoke.Result),
 *         ServiceAccountJwt = Std.File.Invoke(new()
 *         {
 *             Input = "/path/to/token",
 *         }).Apply(invoke => invoke.Result),
 *         DisableLocalCaJwt = false,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-std/sdk/go/std"
 * 	"github.com/pulumi/pulumi-vault/sdk/v6/go/vault/kubernetes"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		invokeFile, err := std.File(ctx, &std.FileArgs{
 * 			Input: "/path/to/cert",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		invokeFile1, err := std.File(ctx, &std.FileArgs{
 * 			Input: "/path/to/token",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = kubernetes.NewSecretBackend(ctx, "config", &kubernetes.SecretBackendArgs{
 * 			Path:                   pulumi.String("kubernetes"),
 * 			Description:            pulumi.String("kubernetes secrets engine description"),
 * 			DefaultLeaseTtlSeconds: pulumi.Int(43200),
 * 			MaxLeaseTtlSeconds:     pulumi.Int(86400),
 * 			KubernetesHost:         pulumi.String("https://127.0.0.1:61233"),
 * 			KubernetesCaCert:       pulumi.String(invokeFile.Result),
 * 			ServiceAccountJwt:      pulumi.String(invokeFile1.Result),
 * 			DisableLocalCaJwt:      pulumi.Bool(false),
 * 		})
 * 		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.kubernetes.SecretBackend;
 * import com.pulumi.vault.kubernetes.SecretBackendArgs;
 * 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 config = new SecretBackend("config", SecretBackendArgs.builder()
 *             .path("kubernetes")
 *             .description("kubernetes secrets engine description")
 *             .defaultLeaseTtlSeconds(43200)
 *             .maxLeaseTtlSeconds(86400)
 *             .kubernetesHost("https://127.0.0.1:61233")
 *             .kubernetesCaCert(StdFunctions.file(FileArgs.builder()
 *                 .input("/path/to/cert")
 *                 .build()).result())
 *             .serviceAccountJwt(StdFunctions.file(FileArgs.builder()
 *                 .input("/path/to/token")
 *                 .build()).result())
 *             .disableLocalCaJwt(false)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   config:
 *     type: vault:kubernetes:SecretBackend
 *     properties:
 *       path: kubernetes
 *       description: kubernetes secrets engine description
 *       defaultLeaseTtlSeconds: 43200
 *       maxLeaseTtlSeconds: 86400
 *       kubernetesHost: https://127.0.0.1:61233
 *       kubernetesCaCert:
 *         fn::invoke:
 *           Function: std:file
 *           Arguments:
 *             input: /path/to/cert
 *           Return: result
 *       serviceAccountJwt:
 *         fn::invoke:
 *           Function: std:file
 *           Arguments:
 *             input: /path/to/token
 *           Return: result
 *       disableLocalCaJwt: false
 * ```
 * 
 * ## Import
 * The Kubernetes secret backend can be imported using its `path` e.g.
 * ```sh
 * $ pulumi import vault:kubernetes/secretBackend:SecretBackend config kubernetes
 * ```
 */
public class SecretBackend internal constructor(
    override val javaResource: com.pulumi.vault.kubernetes.SecretBackend,
) : KotlinCustomResource(javaResource, SecretBackendMapper) {
    /**
     * Accessor of the mount
     */
    public val accessor: Output
        get() = javaResource.accessor().applyValue({ args0 -> args0 })

    /**
     * List of managed key registry entry names that the mount in question is allowed to access
     */
    public val allowedManagedKeys: Output>?
        get() = javaResource.allowedManagedKeys().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * List of headers to allow and pass from the request to the plugin
     */
    public val allowedResponseHeaders: Output>?
        get() = javaResource.allowedResponseHeaders().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * Specifies the list of keys that will not be HMAC'd by audit devices in the request data object.
     */
    public val auditNonHmacRequestKeys: Output>
        get() = javaResource.auditNonHmacRequestKeys().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            })
        })

    /**
     * Specifies the list of keys that will not be HMAC'd by audit devices in the response data object.
     */
    public val auditNonHmacResponseKeys: Output>
        get() = javaResource.auditNonHmacResponseKeys().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            })
        })

    /**
     * Default lease duration for tokens and secrets in seconds
     */
    public val defaultLeaseTtlSeconds: Output
        get() = javaResource.defaultLeaseTtlSeconds().applyValue({ args0 -> args0 })

    /**
     * List of headers to allow and pass from the request to the plugin
     */
    public val delegatedAuthAccessors: Output>?
        get() = javaResource.delegatedAuthAccessors().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * Human-friendly description of the mount
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Disable defaulting to the local CA certificate and
     * service account JWT when Vault is running in a Kubernetes pod.
     */
    public val disableLocalCaJwt: Output?
        get() = javaResource.disableLocalCaJwt().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Enable the secrets engine to access Vault's external entropy source
     */
    public val externalEntropyAccess: Output?
        get() = javaResource.externalEntropyAccess().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The key to use for signing plugin workload identity tokens
     */
    public val identityTokenKey: Output?
        get() = javaResource.identityTokenKey().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A PEM-encoded CA certificate used by the
     * secrets engine to verify the Kubernetes API server certificate. Defaults to the local
     * pod’s CA if Vault is running in Kubernetes. Otherwise, defaults to the root CA set where
     * Vault is running.
     */
    public val kubernetesCaCert: Output?
        get() = javaResource.kubernetesCaCert().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The Kubernetes API URL to connect to. Required if the
     * standard pod environment variables `KUBERNETES_SERVICE_HOST` or `KUBERNETES_SERVICE_PORT`
     * are not set on the host that Vault is running on.
     */
    public val kubernetesHost: Output?
        get() = javaResource.kubernetesHost().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies whether to show this mount in the UI-specific listing endpoint
     */
    public val listingVisibility: Output?
        get() = javaResource.listingVisibility().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Local mount flag that can be explicitly set to true to enforce local mount in HA environment
     */
    public val local: Output?
        get() = javaResource.local().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Maximum possible lease duration for tokens and secrets in seconds
     */
    public val maxLeaseTtlSeconds: Output
        get() = javaResource.maxLeaseTtlSeconds().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) })

    /**
     * Specifies mount type specific options that are passed to the backend
     */
    public val options: Output>?
        get() = javaResource.options().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * List of headers to allow and pass from the request to the plugin
     */
    public val passthroughRequestHeaders: Output>?
        get() = javaResource.passthroughRequestHeaders().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * Where the secret backend will be mounted
     */
    public val path: Output
        get() = javaResource.path().applyValue({ args0 -> args0 })

    /**
     * Specifies the semantic version of the plugin to use, e.g. 'v1.0.0'
     */
    public val pluginVersion: Output?
        get() = javaResource.pluginVersion().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Enable seal wrapping for the mount, causing values stored by the mount to be wrapped by the seal's encryption capability
     */
    public val sealWrap: Output
        get() = javaResource.sealWrap().applyValue({ args0 -> args0 })

    /**
     * The JSON web token of the service account used by the
     * secrets engine to manage Kubernetes credentials. Defaults to the local pod’s JWT if Vault
     * is running in Kubernetes.
     */
    public val serviceAccountJwt: Output?
        get() = javaResource.serviceAccountJwt().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

public object SecretBackendMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.vault.kubernetes.SecretBackend::class == javaResource::class

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy