UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

106 lines 4.78 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.SecretVersion = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a resource to manage AWS Secrets Manager secret version including its secret value. To manage secret metadata, see the `aws.secretsmanager.Secret` resource. * * > **NOTE:** If the `AWSCURRENT` staging label is present on this version during resource deletion, that label cannot be removed and will be skipped to prevent errors when fully deleting the secret. That label will leave this secret version active even after the resource is deleted from this provider unless the secret itself is deleted. Move the `AWSCURRENT` staging label before or after deleting this resource from this provider to fully trigger version deprecation if necessary. * * ## Example Usage * * ### Simple String Value * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.secretsmanager.SecretVersion("example", { * secretId: exampleAwsSecretsmanagerSecret.id, * secretString: "example-string-to-protect", * }); * ``` * * ### Key-Value Pairs * * Secrets Manager also accepts key-value pairs in JSON. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const config = new pulumi.Config(); * const example = config.getObject<Record<string, string>>("example") || { * key1: "value1", * key2: "value2", * }; * const exampleSecretVersion = new aws.secretsmanager.SecretVersion("example", { * secretId: exampleAwsSecretsmanagerSecret.id, * secretString: JSON.stringify(example), * }); * ``` * * Reading key-value pairs from JSON back into a native map */ class SecretVersion extends pulumi.CustomResource { /** * Get an existing SecretVersion resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new SecretVersion(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of SecretVersion. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === SecretVersion.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["arn"] = state?.arn; resourceInputs["region"] = state?.region; resourceInputs["secretBinary"] = state?.secretBinary; resourceInputs["secretId"] = state?.secretId; resourceInputs["secretString"] = state?.secretString; resourceInputs["versionId"] = state?.versionId; resourceInputs["versionStages"] = state?.versionStages; } else { const args = argsOrState; if (args?.secretId === undefined && !opts.urn) { throw new Error("Missing required property 'secretId'"); } resourceInputs["region"] = args?.region; resourceInputs["secretBinary"] = args?.secretBinary ? pulumi.secret(args.secretBinary) : undefined; resourceInputs["secretId"] = args?.secretId; resourceInputs["secretString"] = args?.secretString ? pulumi.secret(args.secretString) : undefined; resourceInputs["versionStages"] = args?.versionStages; resourceInputs["arn"] = undefined /*out*/; resourceInputs["versionId"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["secretBinary", "secretString"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(SecretVersion.__pulumiType, name, resourceInputs, opts); } } exports.SecretVersion = SecretVersion; /** @internal */ SecretVersion.__pulumiType = 'aws:secretsmanager/secretVersion:SecretVersion'; //# sourceMappingURL=secretVersion.js.map