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

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

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

    public var args: AuthBackendConfigArgs = AuthBackendConfigArgs()

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

/**
 * Manages an Kubernetes auth backend config in a Vault server. See the [Vault
 * documentation](https://www.vaultproject.io/docs/auth/kubernetes.html) for more
 * information.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as vault from "@pulumi/vault";
 * const kubernetes = new vault.AuthBackend("kubernetes", {type: "kubernetes"});
 * const example = new vault.kubernetes.AuthBackendConfig("example", {
 *     backend: kubernetes.path,
 *     kubernetesHost: "http://example.com:443",
 *     kubernetesCaCert: `-----BEGIN CERTIFICATE-----
 * example
 * -----END CERTIFICATE-----`,
 *     tokenReviewerJwt: "ZXhhbXBsZQo=",
 *     issuer: "api",
 *     disableIssValidation: true,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_vault as vault
 * kubernetes = vault.AuthBackend("kubernetes", type="kubernetes")
 * example = vault.kubernetes.AuthBackendConfig("example",
 *     backend=kubernetes.path,
 *     kubernetes_host="http://example.com:443",
 *     kubernetes_ca_cert="""-----BEGIN CERTIFICATE-----
 * example
 * -----END CERTIFICATE-----""",
 *     token_reviewer_jwt="ZXhhbXBsZQo=",
 *     issuer="api",
 *     disable_iss_validation=True)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Vault = Pulumi.Vault;
 * return await Deployment.RunAsync(() =>
 * {
 *     var kubernetes = new Vault.AuthBackend("kubernetes", new()
 *     {
 *         Type = "kubernetes",
 *     });
 *     var example = new Vault.Kubernetes.AuthBackendConfig("example", new()
 *     {
 *         Backend = kubernetes.Path,
 *         KubernetesHost = "http://example.com:443",
 *         KubernetesCaCert = @"-----BEGIN CERTIFICATE-----
 * example
 * -----END CERTIFICATE-----",
 *         TokenReviewerJwt = "ZXhhbXBsZQo=",
 *         Issuer = "api",
 *         DisableIssValidation = true,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-vault/sdk/v6/go/vault"
 * 	"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 {
 * 		kubernetes, err := vault.NewAuthBackend(ctx, "kubernetes", &vault.AuthBackendArgs{
 * 			Type: pulumi.String("kubernetes"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = kubernetes.NewAuthBackendConfig(ctx, "example", &kubernetes.AuthBackendConfigArgs{
 * 			Backend:              kubernetes.Path,
 * 			KubernetesHost:       pulumi.String("http://example.com:443"),
 * 			KubernetesCaCert:     pulumi.String("-----BEGIN CERTIFICATE-----\nexample\n-----END CERTIFICATE-----"),
 * 			TokenReviewerJwt:     pulumi.String("ZXhhbXBsZQo="),
 * 			Issuer:               pulumi.String("api"),
 * 			DisableIssValidation: pulumi.Bool(true),
 * 		})
 * 		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.AuthBackend;
 * import com.pulumi.vault.AuthBackendArgs;
 * import com.pulumi.vault.kubernetes.AuthBackendConfig;
 * import com.pulumi.vault.kubernetes.AuthBackendConfigArgs;
 * 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 kubernetes = new AuthBackend("kubernetes", AuthBackendArgs.builder()
 *             .type("kubernetes")
 *             .build());
 *         var example = new AuthBackendConfig("example", AuthBackendConfigArgs.builder()
 *             .backend(kubernetes.path())
 *             .kubernetesHost("http://example.com:443")
 *             .kubernetesCaCert("""
 * -----BEGIN CERTIFICATE-----
 * example
 * -----END CERTIFICATE-----            """)
 *             .tokenReviewerJwt("ZXhhbXBsZQo=")
 *             .issuer("api")
 *             .disableIssValidation("true")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   kubernetes:
 *     type: vault:AuthBackend
 *     properties:
 *       type: kubernetes
 *   example:
 *     type: vault:kubernetes:AuthBackendConfig
 *     properties:
 *       backend: ${kubernetes.path}
 *       kubernetesHost: http://example.com:443
 *       kubernetesCaCert: |-
 *         -----BEGIN CERTIFICATE-----
 *         example
 *         -----END CERTIFICATE-----
 *       tokenReviewerJwt: ZXhhbXBsZQo=
 *       issuer: api
 *       disableIssValidation: 'true'
 * ```
 * 
 * ## Import
 * Kubernetes authentication backend can be imported using the `path`, e.g.
 * ```sh
 * $ pulumi import vault:kubernetes/authBackendConfig:AuthBackendConfig config auth/kubernetes/config
 * ```
 */
public class AuthBackendConfig internal constructor(
    override val javaResource: com.pulumi.vault.kubernetes.AuthBackendConfig,
) : KotlinCustomResource(javaResource, AuthBackendConfigMapper) {
    /**
     * Unique name of the kubernetes backend to configure.
     */
    public val backend: Output?
        get() = javaResource.backend().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Disable JWT issuer validation. Allows to skip ISS validation. Requires Vault `v1.5.4+` or Vault auth kubernetes plugin `v0.7.1+`
     */
    public val disableIssValidation: Output
        get() = javaResource.disableIssValidation().applyValue({ args0 -> args0 })

    /**
     * Disable defaulting to the local CA cert and service account JWT when running in a Kubernetes pod. Requires Vault `v1.5.4+` or Vault auth kubernetes plugin `v0.7.1+`
     */
    public val disableLocalCaJwt: Output
        get() = javaResource.disableLocalCaJwt().applyValue({ args0 -> args0 })

    /**
     * JWT issuer. If no issuer is specified, `kubernetes.io/serviceaccount` will be used as the default issuer.
     */
    public val issuer: Output?
        get() = javaResource.issuer().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * PEM encoded CA cert for use by the TLS client used to talk with the Kubernetes API.
     */
    public val kubernetesCaCert: Output
        get() = javaResource.kubernetesCaCert().applyValue({ args0 -> args0 })

    /**
     * Host must be a host string, a host:port pair, or a URL to the base of the Kubernetes API server.
     */
    public val kubernetesHost: Output
        get() = javaResource.kubernetesHost().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.
     * *Available only for Vault Enterprise*.
     */
    public val namespace: Output?
        get() = javaResource.namespace().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * List of PEM-formatted public keys or certificates used to verify the signatures of Kubernetes service account JWTs. If a certificate is given, its public key will be extracted. Not every installation of Kubernetes exposes these keys.
     */
    public val pemKeys: Output>?
        get() = javaResource.pemKeys().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * A service account JWT (or other token) used as a bearer token to access the TokenReview API to validate other JWTs during login. If not set the JWT used for login will be used to access the API.
     */
    public val tokenReviewerJwt: Output?
        get() = javaResource.tokenReviewerJwt().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

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

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy