UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

152 lines 7 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.CryptoKey = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * A `CryptoKey` represents a logical key that can be used for cryptographic operations. * * > **Note:** CryptoKeys cannot be deleted from Google Cloud Platform. * Destroying a provider-managed CryptoKey will remove it from state * and delete all CryptoKeyVersions, rendering the key unusable, but *will * not delete the resource from the project.* When the provider destroys these keys, * any data previously encrypted with these keys will be irrecoverable. * For this reason, it is strongly recommended that you use Pulumi's [protect resource option](https://www.pulumi.com/docs/concepts/options/protect/). * * To get more information about CryptoKey, see: * * * [API documentation](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys) * * How-to Guides * * [Creating a key](https://cloud.google.com/kms/docs/creating-keys#create_a_key) * * ## Example Usage * * ### Kms Crypto Key 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 example_key = new gcp.kms.CryptoKey("example-key", { * name: "crypto-key-example", * keyRing: keyring.id, * rotationPeriod: "7776000s", * }); * ``` * ### Kms Crypto Key Asymmetric Sign * * ```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 example_asymmetric_sign_key = new gcp.kms.CryptoKey("example-asymmetric-sign-key", { * name: "crypto-key-example", * keyRing: keyring.id, * purpose: "ASYMMETRIC_SIGN", * versionTemplate: { * algorithm: "EC_SIGN_P384_SHA384", * }, * }); * ``` * * ## Import * * CryptoKey can be imported using any of these accepted formats: * * * `{{key_ring}}/cryptoKeys/{{name}}` * * * `{{key_ring}}/{{name}}` * * When using the `pulumi import` command, CryptoKey can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:kms/cryptoKey:CryptoKey default {{key_ring}}/cryptoKeys/{{name}} * ``` * * ```sh * $ pulumi import gcp:kms/cryptoKey:CryptoKey default {{key_ring}}/{{name}} * ``` */ class CryptoKey extends pulumi.CustomResource { /** * Get an existing CryptoKey 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 CryptoKey(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of CryptoKey. 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'] === CryptoKey.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["cryptoKeyBackend"] = state ? state.cryptoKeyBackend : undefined; resourceInputs["destroyScheduledDuration"] = state ? state.destroyScheduledDuration : undefined; resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined; resourceInputs["importOnly"] = state ? state.importOnly : undefined; resourceInputs["keyAccessJustificationsPolicy"] = state ? state.keyAccessJustificationsPolicy : undefined; resourceInputs["keyRing"] = state ? state.keyRing : undefined; resourceInputs["labels"] = state ? state.labels : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["primaries"] = state ? state.primaries : undefined; resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined; resourceInputs["purpose"] = state ? state.purpose : undefined; resourceInputs["rotationPeriod"] = state ? state.rotationPeriod : undefined; resourceInputs["skipInitialVersionCreation"] = state ? state.skipInitialVersionCreation : undefined; resourceInputs["versionTemplate"] = state ? state.versionTemplate : undefined; } else { const args = argsOrState; if ((!args || args.keyRing === undefined) && !opts.urn) { throw new Error("Missing required property 'keyRing'"); } resourceInputs["cryptoKeyBackend"] = args ? args.cryptoKeyBackend : undefined; resourceInputs["destroyScheduledDuration"] = args ? args.destroyScheduledDuration : undefined; resourceInputs["importOnly"] = args ? args.importOnly : undefined; resourceInputs["keyAccessJustificationsPolicy"] = args ? args.keyAccessJustificationsPolicy : undefined; resourceInputs["keyRing"] = args ? args.keyRing : undefined; resourceInputs["labels"] = args ? args.labels : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["purpose"] = args ? args.purpose : undefined; resourceInputs["rotationPeriod"] = args ? args.rotationPeriod : undefined; resourceInputs["skipInitialVersionCreation"] = args ? args.skipInitialVersionCreation : undefined; resourceInputs["versionTemplate"] = args ? args.versionTemplate : undefined; resourceInputs["effectiveLabels"] = undefined /*out*/; resourceInputs["primaries"] = undefined /*out*/; resourceInputs["pulumiLabels"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(CryptoKey.__pulumiType, name, resourceInputs, opts); } } exports.CryptoKey = CryptoKey; /** @internal */ CryptoKey.__pulumiType = 'gcp:kms/cryptoKey:CryptoKey'; //# sourceMappingURL=cryptoKey.js.map