@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
144 lines • 5.95 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! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SecretCiphertext = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* Encrypts secret data with Google Cloud KMS and provides access to the ciphertext.
*
* > **NOTE:** Using this resource will allow you to conceal secret data within your
* resource definitions, but it does not take care of protecting that data in the
* logging output, plan output, or state output. Please take care to secure your secret
* data outside of resource definitions.
*
* To get more information about SecretCiphertext, see:
*
* * [API documentation](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys/encrypt)
* * How-to Guides
* * [Encrypting and decrypting data with a symmetric key](https://cloud.google.com/kms/docs/encrypt-decrypt)
*
* ## Example Usage
*
* ### Kms Secret Ciphertext Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const keyring = new gcp.kms.KeyRing("keyring", {
* name: "keyring-example",
* location: "global",
* });
* const cryptokey = new gcp.kms.CryptoKey("cryptokey", {
* name: "crypto-key-example",
* keyRing: keyring.id,
* rotationPeriod: "7776000s",
* });
* const myPassword = new gcp.kms.SecretCiphertext("my_password", {
* cryptoKey: cryptokey.id,
* plaintext: "my-secret-password",
* });
* const instance = new gcp.compute.Instance("instance", {
* networkInterfaces: [{
* accessConfigs: [{}],
* network: "default",
* }],
* name: "my-instance",
* machineType: "e2-medium",
* zone: "us-central1-a",
* bootDisk: {
* initializeParams: {
* image: "debian-cloud/debian-11",
* },
* },
* metadata: {
* password: myPassword.ciphertext,
* },
* });
* ```
*
* ## Import
*
* This resource does not support import.
*/
class SecretCiphertext extends pulumi.CustomResource {
/**
* Get an existing SecretCiphertext 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 SecretCiphertext(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:kms/secretCiphertext:SecretCiphertext';
/**
* Returns true if the given object is an instance of SecretCiphertext. 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'] === SecretCiphertext.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["additionalAuthenticatedData"] = state?.additionalAuthenticatedData;
resourceInputs["ciphertext"] = state?.ciphertext;
resourceInputs["cryptoKey"] = state?.cryptoKey;
resourceInputs["plaintext"] = state?.plaintext;
}
else {
const args = argsOrState;
if (args?.cryptoKey === undefined && !opts.urn) {
throw new Error("Missing required property 'cryptoKey'");
}
if (args?.plaintext === undefined && !opts.urn) {
throw new Error("Missing required property 'plaintext'");
}
resourceInputs["additionalAuthenticatedData"] = args?.additionalAuthenticatedData ? pulumi.secret(args.additionalAuthenticatedData) : undefined;
resourceInputs["cryptoKey"] = args?.cryptoKey;
resourceInputs["plaintext"] = args?.plaintext ? pulumi.secret(args.plaintext) : undefined;
resourceInputs["ciphertext"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["additionalAuthenticatedData", "plaintext"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(SecretCiphertext.__pulumiType, name, resourceInputs, opts);
}
}
exports.SecretCiphertext = SecretCiphertext;
//# sourceMappingURL=secretCiphertext.js.map