@pulumi/aws-native
Version:
The Pulumi AWS Cloud Control Provider enables you to build, deploy, and manage [any AWS resource that's supported by the AWS Cloud Control API](https://github.com/pulumi/pulumi-aws-native/blob/master/provider/cmd/pulumi-gen-aws-native/supported-types.txt)
137 lines • 6.99 kB
JavaScript
;
// *** 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.Secret = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Creates a new secret. A *secret* can be a password, a set of credentials such as a user name and password, an OAuth token, or other secret information that you store in an encrypted form in Secrets Manager.
* For RDS master user credentials, see [AWS::RDS::DBCluster MasterUserSecret](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-dbcluster-masterusersecret.html).
* For RS admin user credentials, see [AWS::Redshift::Cluster](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html).
* To retrieve a secret in a CFNshort template, use a *dynamic reference*. For more information, see [Retrieve a secret in an resource](https://docs.aws.amazon.com/secretsmanager/latest/userguide/cfn-example_reference-secret.html).
* For information about creating a secret in the console, see [Create a secret](https://docs.aws.amazon.com/secretsmanager/latest/userguide/manage_create-basic-secret.html). For information about creating a secret using the CLI or SDK, see [CreateSecret](https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_CreateSecret.html).
* For information about retrieving a secret in code, see [Retrieve secrets from Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieving-secrets.html).
*
* ## Example Usage
* ### Example
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws_native from "@pulumi/aws-native";
*
* const myRedshiftSecret = new aws_native.secretsmanager.Secret("myRedshiftSecret", {
* description: "This is a Secrets Manager secret for a Redshift cluster",
* generateSecretString: {
* secretStringTemplate: "{\"username\": \"admin\"}",
* generateStringKey: "password",
* passwordLength: 16,
* excludeCharacters: "\"'@/\\",
* },
* });
* const myRedshiftCluster = new aws_native.redshift.Cluster("myRedshiftCluster", {
* dbName: "myjsondb",
* masterUsername: pulumi.interpolate`{{resolve:secretsmanager:${myRedshiftSecret.id}::username}}`,
* masterUserPassword: pulumi.interpolate`{{resolve:secretsmanager:${myRedshiftSecret.id}::password}}`,
* nodeType: "ds2.xlarge",
* clusterType: "single-node",
* });
* const secretRedshiftAttachment = new aws_native.secretsmanager.SecretTargetAttachment("secretRedshiftAttachment", {
* secretId: myRedshiftSecret.id,
* targetId: myRedshiftCluster.id,
* targetType: "AWS::Redshift::Cluster",
* });
*
* ```
* ### Example
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws_native from "@pulumi/aws-native";
*
* const myRedshiftSecret = new aws_native.secretsmanager.Secret("myRedshiftSecret", {
* description: "This is a Secrets Manager secret for a Redshift cluster",
* generateSecretString: {
* secretStringTemplate: "{\"username\": \"admin\"}",
* generateStringKey: "password",
* passwordLength: 16,
* excludeCharacters: "\"'@/\\",
* },
* });
* const myRedshiftCluster = new aws_native.redshift.Cluster("myRedshiftCluster", {
* dbName: "myjsondb",
* masterUsername: pulumi.interpolate`{{resolve:secretsmanager:${myRedshiftSecret.id}::username}}`,
* masterUserPassword: pulumi.interpolate`{{resolve:secretsmanager:${myRedshiftSecret.id}::password}}`,
* nodeType: "ds2.xlarge",
* clusterType: "single-node",
* });
* const secretRedshiftAttachment = new aws_native.secretsmanager.SecretTargetAttachment("secretRedshiftAttachment", {
* secretId: myRedshiftSecret.id,
* targetId: myRedshiftCluster.id,
* targetType: "AWS::Redshift::Cluster",
* });
*
* ```
*/
class Secret extends pulumi.CustomResource {
/**
* Get an existing Secret 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 opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, opts) {
return new Secret(name, undefined, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Secret. 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'] === Secret.__pulumiType;
}
/**
* Create a Secret resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name, args, opts) {
let resourceInputs = {};
opts = opts || {};
if (!opts.id) {
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["generateSecretString"] = args ? args.generateSecretString : undefined;
resourceInputs["kmsKeyId"] = args ? args.kmsKeyId : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["replicaRegions"] = args ? args.replicaRegions : undefined;
resourceInputs["secretString"] = args ? args.secretString : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["awsId"] = undefined /*out*/;
}
else {
resourceInputs["awsId"] = undefined /*out*/;
resourceInputs["description"] = undefined /*out*/;
resourceInputs["generateSecretString"] = undefined /*out*/;
resourceInputs["kmsKeyId"] = undefined /*out*/;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["replicaRegions"] = undefined /*out*/;
resourceInputs["secretString"] = undefined /*out*/;
resourceInputs["tags"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const replaceOnChanges = { replaceOnChanges: ["name"] };
opts = pulumi.mergeOptions(opts, replaceOnChanges);
super(Secret.__pulumiType, name, resourceInputs, opts);
}
}
exports.Secret = Secret;
/** @internal */
Secret.__pulumiType = 'aws-native:secretsmanager:Secret';
//# sourceMappingURL=secret.js.map