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

com.pulumi.gcp.secretmanager.kotlin.SecretVersion.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.secretmanager.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

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

    public var args: SecretVersionArgs = SecretVersionArgs()

    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 SecretVersionArgsBuilder.() -> Unit) {
        val builder = SecretVersionArgsBuilder()
        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(): SecretVersion {
        val builtJavaResource = com.pulumi.gcp.secretmanager.SecretVersion(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return SecretVersion(builtJavaResource)
    }
}

/**
 * A secret version resource.
 * ## Example Usage
 * ### Secret Version Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const secret_basic = new gcp.secretmanager.Secret("secret-basic", {
 *     secretId: "secret-version",
 *     labels: {
 *         label: "my-label",
 *     },
 *     replication: {
 *         auto: {},
 *     },
 * });
 * const secret_version_basic = new gcp.secretmanager.SecretVersion("secret-version-basic", {
 *     secret: secret_basic.id,
 *     secretData: "secret-data",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * secret_basic = gcp.secretmanager.Secret("secret-basic",
 *     secret_id="secret-version",
 *     labels={
 *         "label": "my-label",
 *     },
 *     replication={
 *         "auto": {},
 *     })
 * secret_version_basic = gcp.secretmanager.SecretVersion("secret-version-basic",
 *     secret=secret_basic.id,
 *     secret_data="secret-data")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var secret_basic = new Gcp.SecretManager.Secret("secret-basic", new()
 *     {
 *         SecretId = "secret-version",
 *         Labels =
 *         {
 *             { "label", "my-label" },
 *         },
 *         Replication = new Gcp.SecretManager.Inputs.SecretReplicationArgs
 *         {
 *             Auto = null,
 *         },
 *     });
 *     var secret_version_basic = new Gcp.SecretManager.SecretVersion("secret-version-basic", new()
 *     {
 *         Secret = secret_basic.Id,
 *         SecretData = "secret-data",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/secretmanager"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := secretmanager.NewSecret(ctx, "secret-basic", &secretmanager.SecretArgs{
 * 			SecretId: pulumi.String("secret-version"),
 * 			Labels: pulumi.StringMap{
 * 				"label": pulumi.String("my-label"),
 * 			},
 * 			Replication: &secretmanager.SecretReplicationArgs{
 * 				Auto: nil,
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = secretmanager.NewSecretVersion(ctx, "secret-version-basic", &secretmanager.SecretVersionArgs{
 * 			Secret:     secret_basic.ID(),
 * 			SecretData: pulumi.String("secret-data"),
 * 		})
 * 		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.gcp.secretmanager.Secret;
 * import com.pulumi.gcp.secretmanager.SecretArgs;
 * import com.pulumi.gcp.secretmanager.inputs.SecretReplicationArgs;
 * import com.pulumi.gcp.secretmanager.inputs.SecretReplicationAutoArgs;
 * import com.pulumi.gcp.secretmanager.SecretVersion;
 * import com.pulumi.gcp.secretmanager.SecretVersionArgs;
 * 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 secret_basic = new Secret("secret-basic", SecretArgs.builder()
 *             .secretId("secret-version")
 *             .labels(Map.of("label", "my-label"))
 *             .replication(SecretReplicationArgs.builder()
 *                 .auto()
 *                 .build())
 *             .build());
 *         var secret_version_basic = new SecretVersion("secret-version-basic", SecretVersionArgs.builder()
 *             .secret(secret_basic.id())
 *             .secretData("secret-data")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   secret-basic:
 *     type: gcp:secretmanager:Secret
 *     properties:
 *       secretId: secret-version
 *       labels:
 *         label: my-label
 *       replication:
 *         auto: {}
 *   secret-version-basic:
 *     type: gcp:secretmanager:SecretVersion
 *     properties:
 *       secret: ${["secret-basic"].id}
 *       secretData: secret-data
 * ```
 * 
 * ### Secret Version Deletion Policy Abandon
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const secret_basic = new gcp.secretmanager.Secret("secret-basic", {
 *     secretId: "secret-version",
 *     replication: {
 *         userManaged: {
 *             replicas: [{
 *                 location: "us-central1",
 *             }],
 *         },
 *     },
 * });
 * const secret_version_deletion_policy = new gcp.secretmanager.SecretVersion("secret-version-deletion-policy", {
 *     secret: secret_basic.id,
 *     secretData: "secret-data",
 *     deletionPolicy: "ABANDON",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * secret_basic = gcp.secretmanager.Secret("secret-basic",
 *     secret_id="secret-version",
 *     replication={
 *         "user_managed": {
 *             "replicas": [{
 *                 "location": "us-central1",
 *             }],
 *         },
 *     })
 * secret_version_deletion_policy = gcp.secretmanager.SecretVersion("secret-version-deletion-policy",
 *     secret=secret_basic.id,
 *     secret_data="secret-data",
 *     deletion_policy="ABANDON")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var secret_basic = new Gcp.SecretManager.Secret("secret-basic", new()
 *     {
 *         SecretId = "secret-version",
 *         Replication = new Gcp.SecretManager.Inputs.SecretReplicationArgs
 *         {
 *             UserManaged = new Gcp.SecretManager.Inputs.SecretReplicationUserManagedArgs
 *             {
 *                 Replicas = new[]
 *                 {
 *                     new Gcp.SecretManager.Inputs.SecretReplicationUserManagedReplicaArgs
 *                     {
 *                         Location = "us-central1",
 *                     },
 *                 },
 *             },
 *         },
 *     });
 *     var secret_version_deletion_policy = new Gcp.SecretManager.SecretVersion("secret-version-deletion-policy", new()
 *     {
 *         Secret = secret_basic.Id,
 *         SecretData = "secret-data",
 *         DeletionPolicy = "ABANDON",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/secretmanager"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := secretmanager.NewSecret(ctx, "secret-basic", &secretmanager.SecretArgs{
 * 			SecretId: pulumi.String("secret-version"),
 * 			Replication: &secretmanager.SecretReplicationArgs{
 * 				UserManaged: &secretmanager.SecretReplicationUserManagedArgs{
 * 					Replicas: secretmanager.SecretReplicationUserManagedReplicaArray{
 * 						&secretmanager.SecretReplicationUserManagedReplicaArgs{
 * 							Location: pulumi.String("us-central1"),
 * 						},
 * 					},
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = secretmanager.NewSecretVersion(ctx, "secret-version-deletion-policy", &secretmanager.SecretVersionArgs{
 * 			Secret:         secret_basic.ID(),
 * 			SecretData:     pulumi.String("secret-data"),
 * 			DeletionPolicy: pulumi.String("ABANDON"),
 * 		})
 * 		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.gcp.secretmanager.Secret;
 * import com.pulumi.gcp.secretmanager.SecretArgs;
 * import com.pulumi.gcp.secretmanager.inputs.SecretReplicationArgs;
 * import com.pulumi.gcp.secretmanager.inputs.SecretReplicationUserManagedArgs;
 * import com.pulumi.gcp.secretmanager.SecretVersion;
 * import com.pulumi.gcp.secretmanager.SecretVersionArgs;
 * 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 secret_basic = new Secret("secret-basic", SecretArgs.builder()
 *             .secretId("secret-version")
 *             .replication(SecretReplicationArgs.builder()
 *                 .userManaged(SecretReplicationUserManagedArgs.builder()
 *                     .replicas(SecretReplicationUserManagedReplicaArgs.builder()
 *                         .location("us-central1")
 *                         .build())
 *                     .build())
 *                 .build())
 *             .build());
 *         var secret_version_deletion_policy = new SecretVersion("secret-version-deletion-policy", SecretVersionArgs.builder()
 *             .secret(secret_basic.id())
 *             .secretData("secret-data")
 *             .deletionPolicy("ABANDON")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   secret-basic:
 *     type: gcp:secretmanager:Secret
 *     properties:
 *       secretId: secret-version
 *       replication:
 *         userManaged:
 *           replicas:
 *             - location: us-central1
 *   secret-version-deletion-policy:
 *     type: gcp:secretmanager:SecretVersion
 *     properties:
 *       secret: ${["secret-basic"].id}
 *       secretData: secret-data
 *       deletionPolicy: ABANDON
 * ```
 * 
 * ### Secret Version Deletion Policy Disable
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const secret_basic = new gcp.secretmanager.Secret("secret-basic", {
 *     secretId: "secret-version",
 *     replication: {
 *         userManaged: {
 *             replicas: [{
 *                 location: "us-central1",
 *             }],
 *         },
 *     },
 * });
 * const secret_version_deletion_policy = new gcp.secretmanager.SecretVersion("secret-version-deletion-policy", {
 *     secret: secret_basic.id,
 *     secretData: "secret-data",
 *     deletionPolicy: "DISABLE",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * secret_basic = gcp.secretmanager.Secret("secret-basic",
 *     secret_id="secret-version",
 *     replication={
 *         "user_managed": {
 *             "replicas": [{
 *                 "location": "us-central1",
 *             }],
 *         },
 *     })
 * secret_version_deletion_policy = gcp.secretmanager.SecretVersion("secret-version-deletion-policy",
 *     secret=secret_basic.id,
 *     secret_data="secret-data",
 *     deletion_policy="DISABLE")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var secret_basic = new Gcp.SecretManager.Secret("secret-basic", new()
 *     {
 *         SecretId = "secret-version",
 *         Replication = new Gcp.SecretManager.Inputs.SecretReplicationArgs
 *         {
 *             UserManaged = new Gcp.SecretManager.Inputs.SecretReplicationUserManagedArgs
 *             {
 *                 Replicas = new[]
 *                 {
 *                     new Gcp.SecretManager.Inputs.SecretReplicationUserManagedReplicaArgs
 *                     {
 *                         Location = "us-central1",
 *                     },
 *                 },
 *             },
 *         },
 *     });
 *     var secret_version_deletion_policy = new Gcp.SecretManager.SecretVersion("secret-version-deletion-policy", new()
 *     {
 *         Secret = secret_basic.Id,
 *         SecretData = "secret-data",
 *         DeletionPolicy = "DISABLE",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/secretmanager"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := secretmanager.NewSecret(ctx, "secret-basic", &secretmanager.SecretArgs{
 * 			SecretId: pulumi.String("secret-version"),
 * 			Replication: &secretmanager.SecretReplicationArgs{
 * 				UserManaged: &secretmanager.SecretReplicationUserManagedArgs{
 * 					Replicas: secretmanager.SecretReplicationUserManagedReplicaArray{
 * 						&secretmanager.SecretReplicationUserManagedReplicaArgs{
 * 							Location: pulumi.String("us-central1"),
 * 						},
 * 					},
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = secretmanager.NewSecretVersion(ctx, "secret-version-deletion-policy", &secretmanager.SecretVersionArgs{
 * 			Secret:         secret_basic.ID(),
 * 			SecretData:     pulumi.String("secret-data"),
 * 			DeletionPolicy: pulumi.String("DISABLE"),
 * 		})
 * 		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.gcp.secretmanager.Secret;
 * import com.pulumi.gcp.secretmanager.SecretArgs;
 * import com.pulumi.gcp.secretmanager.inputs.SecretReplicationArgs;
 * import com.pulumi.gcp.secretmanager.inputs.SecretReplicationUserManagedArgs;
 * import com.pulumi.gcp.secretmanager.SecretVersion;
 * import com.pulumi.gcp.secretmanager.SecretVersionArgs;
 * 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 secret_basic = new Secret("secret-basic", SecretArgs.builder()
 *             .secretId("secret-version")
 *             .replication(SecretReplicationArgs.builder()
 *                 .userManaged(SecretReplicationUserManagedArgs.builder()
 *                     .replicas(SecretReplicationUserManagedReplicaArgs.builder()
 *                         .location("us-central1")
 *                         .build())
 *                     .build())
 *                 .build())
 *             .build());
 *         var secret_version_deletion_policy = new SecretVersion("secret-version-deletion-policy", SecretVersionArgs.builder()
 *             .secret(secret_basic.id())
 *             .secretData("secret-data")
 *             .deletionPolicy("DISABLE")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   secret-basic:
 *     type: gcp:secretmanager:Secret
 *     properties:
 *       secretId: secret-version
 *       replication:
 *         userManaged:
 *           replicas:
 *             - location: us-central1
 *   secret-version-deletion-policy:
 *     type: gcp:secretmanager:SecretVersion
 *     properties:
 *       secret: ${["secret-basic"].id}
 *       secretData: secret-data
 *       deletionPolicy: DISABLE
 * ```
 * 
 * ### Secret Version With Base64 String Secret Data
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * import * as std from "@pulumi/std";
 * const secret_basic = new gcp.secretmanager.Secret("secret-basic", {
 *     secretId: "secret-version",
 *     replication: {
 *         userManaged: {
 *             replicas: [{
 *                 location: "us-central1",
 *             }],
 *         },
 *     },
 * });
 * const secret_version_base64 = new gcp.secretmanager.SecretVersion("secret-version-base64", {
 *     secret: secret_basic.id,
 *     isSecretDataBase64: true,
 *     secretData: std.filebase64({
 *         input: "secret-data.pfx",
 *     }).then(invoke => invoke.result),
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * import pulumi_std as std
 * secret_basic = gcp.secretmanager.Secret("secret-basic",
 *     secret_id="secret-version",
 *     replication={
 *         "user_managed": {
 *             "replicas": [{
 *                 "location": "us-central1",
 *             }],
 *         },
 *     })
 * secret_version_base64 = gcp.secretmanager.SecretVersion("secret-version-base64",
 *     secret=secret_basic.id,
 *     is_secret_data_base64=True,
 *     secret_data=std.filebase64(input="secret-data.pfx").result)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * using Std = Pulumi.Std;
 * return await Deployment.RunAsync(() =>
 * {
 *     var secret_basic = new Gcp.SecretManager.Secret("secret-basic", new()
 *     {
 *         SecretId = "secret-version",
 *         Replication = new Gcp.SecretManager.Inputs.SecretReplicationArgs
 *         {
 *             UserManaged = new Gcp.SecretManager.Inputs.SecretReplicationUserManagedArgs
 *             {
 *                 Replicas = new[]
 *                 {
 *                     new Gcp.SecretManager.Inputs.SecretReplicationUserManagedReplicaArgs
 *                     {
 *                         Location = "us-central1",
 *                     },
 *                 },
 *             },
 *         },
 *     });
 *     var secret_version_base64 = new Gcp.SecretManager.SecretVersion("secret-version-base64", new()
 *     {
 *         Secret = secret_basic.Id,
 *         IsSecretDataBase64 = true,
 *         SecretData = Std.Filebase64.Invoke(new()
 *         {
 *             Input = "secret-data.pfx",
 *         }).Apply(invoke => invoke.Result),
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/secretmanager"
 * 	"github.com/pulumi/pulumi-std/sdk/go/std"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := secretmanager.NewSecret(ctx, "secret-basic", &secretmanager.SecretArgs{
 * 			SecretId: pulumi.String("secret-version"),
 * 			Replication: &secretmanager.SecretReplicationArgs{
 * 				UserManaged: &secretmanager.SecretReplicationUserManagedArgs{
 * 					Replicas: secretmanager.SecretReplicationUserManagedReplicaArray{
 * 						&secretmanager.SecretReplicationUserManagedReplicaArgs{
 * 							Location: pulumi.String("us-central1"),
 * 						},
 * 					},
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		invokeFilebase64, err := std.Filebase64(ctx, &std.Filebase64Args{
 * 			Input: "secret-data.pfx",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = secretmanager.NewSecretVersion(ctx, "secret-version-base64", &secretmanager.SecretVersionArgs{
 * 			Secret:             secret_basic.ID(),
 * 			IsSecretDataBase64: pulumi.Bool(true),
 * 			SecretData:         pulumi.String(invokeFilebase64.Result),
 * 		})
 * 		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.gcp.secretmanager.Secret;
 * import com.pulumi.gcp.secretmanager.SecretArgs;
 * import com.pulumi.gcp.secretmanager.inputs.SecretReplicationArgs;
 * import com.pulumi.gcp.secretmanager.inputs.SecretReplicationUserManagedArgs;
 * import com.pulumi.gcp.secretmanager.SecretVersion;
 * import com.pulumi.gcp.secretmanager.SecretVersionArgs;
 * 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 secret_basic = new Secret("secret-basic", SecretArgs.builder()
 *             .secretId("secret-version")
 *             .replication(SecretReplicationArgs.builder()
 *                 .userManaged(SecretReplicationUserManagedArgs.builder()
 *                     .replicas(SecretReplicationUserManagedReplicaArgs.builder()
 *                         .location("us-central1")
 *                         .build())
 *                     .build())
 *                 .build())
 *             .build());
 *         var secret_version_base64 = new SecretVersion("secret-version-base64", SecretVersionArgs.builder()
 *             .secret(secret_basic.id())
 *             .isSecretDataBase64(true)
 *             .secretData(StdFunctions.filebase64(Filebase64Args.builder()
 *                 .input("secret-data.pfx")
 *                 .build()).result())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   secret-basic:
 *     type: gcp:secretmanager:Secret
 *     properties:
 *       secretId: secret-version
 *       replication:
 *         userManaged:
 *           replicas:
 *             - location: us-central1
 *   secret-version-base64:
 *     type: gcp:secretmanager:SecretVersion
 *     properties:
 *       secret: ${["secret-basic"].id}
 *       isSecretDataBase64: true
 *       secretData:
 *         fn::invoke:
 *           Function: std:filebase64
 *           Arguments:
 *             input: secret-data.pfx
 *           Return: result
 * ```
 * 
 * ## Import
 * SecretVersion can be imported using any of these accepted formats:
 * * `projects/{{project}}/secrets/{{secret_id}}/versions/{{version}}`
 * When using the `pulumi import` command, SecretVersion can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:secretmanager/secretVersion:SecretVersion default projects/{{project}}/secrets/{{secret_id}}/versions/{{version}}
 * ```
 */
public class SecretVersion internal constructor(
    override val javaResource: com.pulumi.gcp.secretmanager.SecretVersion,
) : KotlinCustomResource(javaResource, SecretVersionMapper) {
    /**
     * The time at which the Secret was created.
     */
    public val createTime: Output
        get() = javaResource.createTime().applyValue({ args0 -> args0 })

    /**
     * The deletion policy for the secret version. Setting `ABANDON` allows the resource
     * to be abandoned rather than deleted. Setting `DISABLE` allows the resource to be
     * disabled rather than deleted. Default is `DELETE`. Possible values are:
     * * DELETE
     * * DISABLE
     * * ABANDON
     */
    public val deletionPolicy: Output?
        get() = javaResource.deletionPolicy().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The time at which the Secret was destroyed. Only present if state is DESTROYED.
     */
    public val destroyTime: Output
        get() = javaResource.destroyTime().applyValue({ args0 -> args0 })

    /**
     * The current state of the SecretVersion.
     */
    public val enabled: Output?
        get() = javaResource.enabled().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * If set to 'true', the secret data is expected to be base64-encoded string and would be sent as is.
     */
    public val isSecretDataBase64: Output?
        get() = javaResource.isSecretDataBase64().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The resource name of the SecretVersion. Format:
     * `projects/{{project}}/secrets/{{secret_id}}/versions/{{version}}`
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Secret Manager secret resource
     * - - -
     */
    public val secret: Output
        get() = javaResource.secret().applyValue({ args0 -> args0 })

    /**
     * The secret data. Must be no larger than 64KiB.
     * **Note**: This property is sensitive and will not be displayed in the plan.
     */
    public val secretData: Output
        get() = javaResource.secretData().applyValue({ args0 -> args0 })

    /**
     * The version of the Secret.
     */
    public val version: Output
        get() = javaResource.version().applyValue({ args0 -> args0 })
}

public object SecretVersionMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.secretmanager.SecretVersion::class == javaResource::class

    override fun map(javaResource: Resource): SecretVersion = SecretVersion(
        javaResource as
            com.pulumi.gcp.secretmanager.SecretVersion,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy