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

com.pulumi.vault.azure.kotlin.Backend.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.6.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.vault.azure.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.Deprecated
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit

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

    public var args: BackendArgs = BackendArgs()

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

/**
 * ## Example Usage
 * ### *Vault-1.9 And Above*
 * You can setup the Azure secrets engine with Workload Identity Federation (WIF) for a secret-less configuration:
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as vault from "@pulumi/vault";
 * const azure = new vault.azure.Backend("azure", {
 *     subscriptionId: "11111111-2222-3333-4444-111111111111",
 *     tenantId: "11111111-2222-3333-4444-222222222222",
 *     clientId: "11111111-2222-3333-4444-333333333333",
 *     identityTokenAudience: "",
 *     identityTokenTtl: "",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_vault as vault
 * azure = vault.azure.Backend("azure",
 *     subscription_id="11111111-2222-3333-4444-111111111111",
 *     tenant_id="11111111-2222-3333-4444-222222222222",
 *     client_id="11111111-2222-3333-4444-333333333333",
 *     identity_token_audience="",
 *     identity_token_ttl="")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Vault = Pulumi.Vault;
 * return await Deployment.RunAsync(() =>
 * {
 *     var azure = new Vault.Azure.Backend("azure", new()
 *     {
 *         SubscriptionId = "11111111-2222-3333-4444-111111111111",
 *         TenantId = "11111111-2222-3333-4444-222222222222",
 *         ClientId = "11111111-2222-3333-4444-333333333333",
 *         IdentityTokenAudience = "",
 *         IdentityTokenTtl = "",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-vault/sdk/v6/go/vault/azure"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := azure.NewBackend(ctx, "azure", &azure.BackendArgs{
 * 			SubscriptionId:        pulumi.String("11111111-2222-3333-4444-111111111111"),
 * 			TenantId:              pulumi.String("11111111-2222-3333-4444-222222222222"),
 * 			ClientId:              pulumi.String("11111111-2222-3333-4444-333333333333"),
 * 			IdentityTokenAudience: pulumi.String(""),
 * 			IdentityTokenTtl:      pulumi.Int(""),
 * 		})
 * 		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.azure.Backend;
 * import com.pulumi.vault.azure.BackendArgs;
 * 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 azure = new Backend("azure", BackendArgs.builder()
 *             .subscriptionId("11111111-2222-3333-4444-111111111111")
 *             .tenantId("11111111-2222-3333-4444-222222222222")
 *             .clientId("11111111-2222-3333-4444-333333333333")
 *             .identityTokenAudience("")
 *             .identityTokenTtl("")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   azure:
 *     type: vault:azure:Backend
 *     properties:
 *       subscriptionId: 11111111-2222-3333-4444-111111111111
 *       tenantId: 11111111-2222-3333-4444-222222222222
 *       clientId: 11111111-2222-3333-4444-333333333333
 *       identityTokenAudience: 
 *       identityTokenTtl: 
 * ```
 * 
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as vault from "@pulumi/vault";
 * const azure = new vault.azure.Backend("azure", {
 *     useMicrosoftGraphApi: true,
 *     subscriptionId: "11111111-2222-3333-4444-111111111111",
 *     tenantId: "11111111-2222-3333-4444-222222222222",
 *     clientId: "11111111-2222-3333-4444-333333333333",
 *     clientSecret: "12345678901234567890",
 *     environment: "AzurePublicCloud",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_vault as vault
 * azure = vault.azure.Backend("azure",
 *     use_microsoft_graph_api=True,
 *     subscription_id="11111111-2222-3333-4444-111111111111",
 *     tenant_id="11111111-2222-3333-4444-222222222222",
 *     client_id="11111111-2222-3333-4444-333333333333",
 *     client_secret="12345678901234567890",
 *     environment="AzurePublicCloud")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Vault = Pulumi.Vault;
 * return await Deployment.RunAsync(() =>
 * {
 *     var azure = new Vault.Azure.Backend("azure", new()
 *     {
 *         UseMicrosoftGraphApi = true,
 *         SubscriptionId = "11111111-2222-3333-4444-111111111111",
 *         TenantId = "11111111-2222-3333-4444-222222222222",
 *         ClientId = "11111111-2222-3333-4444-333333333333",
 *         ClientSecret = "12345678901234567890",
 *         Environment = "AzurePublicCloud",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-vault/sdk/v6/go/vault/azure"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := azure.NewBackend(ctx, "azure", &azure.BackendArgs{
 * 			UseMicrosoftGraphApi: pulumi.Bool(true),
 * 			SubscriptionId:       pulumi.String("11111111-2222-3333-4444-111111111111"),
 * 			TenantId:             pulumi.String("11111111-2222-3333-4444-222222222222"),
 * 			ClientId:             pulumi.String("11111111-2222-3333-4444-333333333333"),
 * 			ClientSecret:         pulumi.String("12345678901234567890"),
 * 			Environment:          pulumi.String("AzurePublicCloud"),
 * 		})
 * 		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.azure.Backend;
 * import com.pulumi.vault.azure.BackendArgs;
 * 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 azure = new Backend("azure", BackendArgs.builder()
 *             .useMicrosoftGraphApi(true)
 *             .subscriptionId("11111111-2222-3333-4444-111111111111")
 *             .tenantId("11111111-2222-3333-4444-222222222222")
 *             .clientId("11111111-2222-3333-4444-333333333333")
 *             .clientSecret("12345678901234567890")
 *             .environment("AzurePublicCloud")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   azure:
 *     type: vault:azure:Backend
 *     properties:
 *       useMicrosoftGraphApi: true
 *       subscriptionId: 11111111-2222-3333-4444-111111111111
 *       tenantId: 11111111-2222-3333-4444-222222222222
 *       clientId: 11111111-2222-3333-4444-333333333333
 *       clientSecret: '12345678901234567890'
 *       environment: AzurePublicCloud
 * ```
 * 
 * ### *Vault-1.8 And Below*
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as vault from "@pulumi/vault";
 * const azure = new vault.azure.Backend("azure", {
 *     useMicrosoftGraphApi: false,
 *     subscriptionId: "11111111-2222-3333-4444-111111111111",
 *     tenantId: "11111111-2222-3333-4444-222222222222",
 *     clientId: "11111111-2222-3333-4444-333333333333",
 *     clientSecret: "12345678901234567890",
 *     environment: "AzurePublicCloud",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_vault as vault
 * azure = vault.azure.Backend("azure",
 *     use_microsoft_graph_api=False,
 *     subscription_id="11111111-2222-3333-4444-111111111111",
 *     tenant_id="11111111-2222-3333-4444-222222222222",
 *     client_id="11111111-2222-3333-4444-333333333333",
 *     client_secret="12345678901234567890",
 *     environment="AzurePublicCloud")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Vault = Pulumi.Vault;
 * return await Deployment.RunAsync(() =>
 * {
 *     var azure = new Vault.Azure.Backend("azure", new()
 *     {
 *         UseMicrosoftGraphApi = false,
 *         SubscriptionId = "11111111-2222-3333-4444-111111111111",
 *         TenantId = "11111111-2222-3333-4444-222222222222",
 *         ClientId = "11111111-2222-3333-4444-333333333333",
 *         ClientSecret = "12345678901234567890",
 *         Environment = "AzurePublicCloud",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-vault/sdk/v6/go/vault/azure"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := azure.NewBackend(ctx, "azure", &azure.BackendArgs{
 * 			UseMicrosoftGraphApi: pulumi.Bool(false),
 * 			SubscriptionId:       pulumi.String("11111111-2222-3333-4444-111111111111"),
 * 			TenantId:             pulumi.String("11111111-2222-3333-4444-222222222222"),
 * 			ClientId:             pulumi.String("11111111-2222-3333-4444-333333333333"),
 * 			ClientSecret:         pulumi.String("12345678901234567890"),
 * 			Environment:          pulumi.String("AzurePublicCloud"),
 * 		})
 * 		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.azure.Backend;
 * import com.pulumi.vault.azure.BackendArgs;
 * 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 azure = new Backend("azure", BackendArgs.builder()
 *             .useMicrosoftGraphApi(false)
 *             .subscriptionId("11111111-2222-3333-4444-111111111111")
 *             .tenantId("11111111-2222-3333-4444-222222222222")
 *             .clientId("11111111-2222-3333-4444-333333333333")
 *             .clientSecret("12345678901234567890")
 *             .environment("AzurePublicCloud")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   azure:
 *     type: vault:azure:Backend
 *     properties:
 *       useMicrosoftGraphApi: false
 *       subscriptionId: 11111111-2222-3333-4444-111111111111
 *       tenantId: 11111111-2222-3333-4444-222222222222
 *       clientId: 11111111-2222-3333-4444-333333333333
 *       clientSecret: '12345678901234567890'
 *       environment: AzurePublicCloud
 * ```
 * 
 */
public class Backend internal constructor(
    override val javaResource: com.pulumi.vault.azure.Backend,
) : KotlinCustomResource(javaResource, BackendMapper) {
    /**
     * The OAuth2 client id to connect to Azure.
     */
    public val clientId: Output?
        get() = javaResource.clientId().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The OAuth2 client secret to connect to Azure.
     */
    public val clientSecret: Output?
        get() = javaResource.clientSecret().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

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

    /**
     * If set, opts out of mount migration on path updates.
     * See here for more info on [Mount Migration](https://www.vaultproject.io/docs/concepts/mount-migration)
     */
    public val disableRemount: Output?
        get() = javaResource.disableRemount().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The Azure environment.
     */
    public val environment: Output?
        get() = javaResource.environment().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The audience claim value. Requires Vault 1.17+.
     * *Available only for Vault Enterprise*
     */
    public val identityTokenAudience: Output?
        get() = javaResource.identityTokenAudience().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The key to use for signing identity tokens. Requires Vault 1.17+.
     * *Available only for Vault Enterprise*
     */
    public val identityTokenKey: Output?
        get() = javaResource.identityTokenKey().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The TTL of generated identity tokens in seconds. Requires Vault 1.17+.
     * *Available only for Vault Enterprise*
     */
    public val identityTokenTtl: Output
        get() = javaResource.identityTokenTtl().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) })

    /**
     * The unique path this backend should be mounted at. Defaults to `azure`.
     */
    public val path: Output?
        get() = javaResource.path().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The subscription id for the Azure Active Directory.
     */
    public val subscriptionId: Output
        get() = javaResource.subscriptionId().applyValue({ args0 -> args0 })

    /**
     * The tenant id for the Azure Active Directory.
     */
    public val tenantId: Output
        get() = javaResource.tenantId().applyValue({ args0 -> args0 })

    /**
     * Use the Microsoft Graph API. Should be set to true on vault-1.10+
     */
    @Deprecated(
        message = """
  This field is not supported in Vault-1.12+ and is the default behavior. This field will be removed
      in future version of the provider.
  """,
    )
    public val useMicrosoftGraphApi: Output
        get() = javaResource.useMicrosoftGraphApi().applyValue({ args0 -> args0 })
}

public object BackendMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.vault.azure.Backend::class == javaResource::class

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy