@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
91 lines • 3.71 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.Ciphertext = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* The KMS ciphertext resource allows you to encrypt plaintext into ciphertext
* by using an AWS KMS customer master key. The value returned by this resource
* is stable across every apply. For a changing ciphertext value each apply, see
* the `aws.kms.Ciphertext` data source.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const oauthConfig = new aws.kms.Key("oauth_config", {
* description: "oauth config",
* isEnabled: true,
* });
* const oauth = new aws.kms.Ciphertext("oauth", {
* keyId: oauthConfig.keyId,
* plaintext: `{
* \\"client_id\\": \\"e587dbae22222f55da22\\",
* \\"client_secret\\": \\"8289575d00000ace55e1815ec13673955721b8a5\\"
* }
* `,
* });
* ```
*/
class Ciphertext extends pulumi.CustomResource {
/**
* Get an existing Ciphertext 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 Ciphertext(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of Ciphertext. 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'] === Ciphertext.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["ciphertextBlob"] = state?.ciphertextBlob;
resourceInputs["context"] = state?.context;
resourceInputs["keyId"] = state?.keyId;
resourceInputs["plaintext"] = state?.plaintext;
resourceInputs["region"] = state?.region;
}
else {
const args = argsOrState;
if (args?.keyId === undefined && !opts.urn) {
throw new Error("Missing required property 'keyId'");
}
if (args?.plaintext === undefined && !opts.urn) {
throw new Error("Missing required property 'plaintext'");
}
resourceInputs["context"] = args?.context;
resourceInputs["keyId"] = args?.keyId;
resourceInputs["plaintext"] = args?.plaintext ? pulumi.secret(args.plaintext) : undefined;
resourceInputs["region"] = args?.region;
resourceInputs["ciphertextBlob"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["plaintext"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(Ciphertext.__pulumiType, name, resourceInputs, opts);
}
}
exports.Ciphertext = Ciphertext;
/** @internal */
Ciphertext.__pulumiType = 'aws:kms/ciphertext:Ciphertext';
//# sourceMappingURL=ciphertext.js.map