com.pulumi.aws.secretsmanager.kotlin.Secret.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-aws-kotlin Show documentation
Show all versions of pulumi-aws-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.aws.secretsmanager.kotlin
import com.pulumi.aws.secretsmanager.kotlin.outputs.SecretReplica
import com.pulumi.aws.secretsmanager.kotlin.outputs.SecretReplica.Companion.toKotlin
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
import kotlin.collections.List
import kotlin.collections.Map
/**
* Builder for [Secret].
*/
@PulumiTagMarker
public class SecretResourceBuilder internal constructor() {
public var name: String? = null
public var args: SecretArgs = SecretArgs()
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 SecretArgsBuilder.() -> Unit) {
val builder = SecretArgsBuilder()
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(): Secret {
val builtJavaResource = com.pulumi.aws.secretsmanager.Secret(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Secret(builtJavaResource)
}
}
/**
* Provides a resource to manage AWS Secrets Manager secret metadata. To manage secret rotation, see the `aws.secretsmanager.SecretRotation` resource. To manage a secret value, see the `aws.secretsmanager.SecretVersion` resource.
* ## Example Usage
* ### Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const example = new aws.secretsmanager.Secret("example", {name: "example"});
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* example = aws.secretsmanager.Secret("example", name="example")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var example = new Aws.SecretsManager.Secret("example", new()
* {
* Name = "example",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/secretsmanager"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := secretsmanager.NewSecret(ctx, "example", &secretsmanager.SecretArgs{
* Name: pulumi.String("example"),
* })
* 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.aws.secretsmanager.Secret;
* import com.pulumi.aws.secretsmanager.SecretArgs;
* 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 example = new Secret("example", SecretArgs.builder()
* .name("example")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: aws:secretsmanager:Secret
* properties:
* name: example
* ```
*
* ## Import
* Using `pulumi import`, import `aws_secretsmanager_secret` using the secret Amazon Resource Name (ARN). For example:
* ```sh
* $ pulumi import aws:secretsmanager/secret:Secret example arn:aws:secretsmanager:us-east-1:123456789012:secret:example-123456
* ```
*/
public class Secret internal constructor(
override val javaResource: com.pulumi.aws.secretsmanager.Secret,
) : KotlinCustomResource(javaResource, SecretMapper) {
/**
* ARN of the secret.
*/
public val arn: Output
get() = javaResource.arn().applyValue({ args0 -> args0 })
/**
* Description of the secret.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Accepts boolean value to specify whether to overwrite a secret with the same name in the destination Region.
*/
public val forceOverwriteReplicaSecret: Output?
get() = javaResource.forceOverwriteReplicaSecret().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* ARN or Id of the AWS KMS key to be used to encrypt the secret values in the versions stored in this secret. If you need to reference a CMK in a different account, you can use only the key ARN. If you don't specify this value, then Secrets Manager defaults to using the AWS account's default KMS key (the one named `aws/secretsmanager`). If the default KMS key with that name doesn't yet exist, then AWS Secrets Manager creates it for you automatically the first time.
*/
public val kmsKeyId: Output?
get() = javaResource.kmsKeyId().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* Friendly name of the new secret. The secret name can consist of uppercase letters, lowercase letters, digits, and any of the following characters: `/_+=.@-` Conflicts with `name_prefix`.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* Creates a unique name beginning with the specified prefix. Conflicts with `name`.
*/
public val namePrefix: Output
get() = javaResource.namePrefix().applyValue({ args0 -> args0 })
/**
* Valid JSON document representing a [resource policy](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_resource-based-policies.html). Removing `policy` from your configuration or setting `policy` to null or an empty string (i.e., `policy = ""`) _will not_ delete the policy since it could have been set by `aws.secretsmanager.SecretPolicy`. To delete the `policy`, set it to `"{}"` (an empty JSON document).
*/
public val policy: Output
get() = javaResource.policy().applyValue({ args0 -> args0 })
/**
* Number of days that AWS Secrets Manager waits before it can delete the secret. This value can be `0` to force deletion without recovery or range from `7` to `30` days. The default value is `30`.
*/
public val recoveryWindowInDays: Output?
get() = javaResource.recoveryWindowInDays().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Configuration block to support secret replication. See details below.
*/
public val replicas: Output>
get() = javaResource.replicas().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
toKotlin(args0)
})
})
})
/**
* Key-value map of user-defined tags that are attached to the secret. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
*/
public val tags: Output
© 2015 - 2024 Weber Informatics LLC | Privacy Policy