UNPKG

@pulumiverse/scaleway

Version:

A Pulumi package for creating and managing Scaleway cloud resources.

158 lines 7.22 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! *** 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.KeyMaterial = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * Import externally generated key material into Key Manager to derive a new cryptographic key. The key's origin must be external. * * > **Security Best Practice:** * For enhanced security, we recommend using the `keyMaterialWo` and `saltWo` write-only arguments instead of the regular `keyMaterial` and `salt` arguments. This ensures your sensitive cryptographic material is never stored in Terraform state files, providing superior protection against accidental exposure. Write-Only arguments are supported in Terraform 1.11.0 and later. * * > **Note:** When using write-only arguments (`keyMaterialWo` and `saltWo`), you must also provide the corresponding version fields (`keyMaterialWoVersion` and `saltWoVersion`) to enable proper resource lifecycle management. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as random from "@pulumi/random"; * import * as scaleway from "@pulumiverse/scaleway"; * import * as std from "@pulumi/std"; * * const main = new scaleway.keymanager.Key("main", { * name: "my-external-key", * description: "Key with externally imported material", * usage: "symmetric_encryption", * algorithm: "aes_256_gcm", * origin: "external", * region: "fr-par", * }); * const keyMaterial = new random.index.Bytes("key_material", {length: 32}); * const mainKeyMaterial = new scaleway.keymanager.KeyMaterial("main", { * keyId: main.id, * keyMaterialWo: std.base64encode({ * input: keyMaterial.base64, * }).result, * keyMaterialWoVersion: 1, * }); * ``` * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as random from "@pulumi/random"; * import * as scaleway from "@pulumiverse/scaleway"; * import * as std from "@pulumi/std"; * * const main = new scaleway.keymanager.Key("main", { * name: "my-external-key", * description: "Key with externally imported material and salt", * usage: "symmetric_encryption", * algorithm: "aes_256_gcm", * origin: "external", * region: "fr-par", * }); * const keyMaterial = new random.index.Bytes("key_material", {length: 32}); * const salt = new random.index.Bytes("salt", {length: 16}); * const mainKeyMaterial = new scaleway.keymanager.KeyMaterial("main", { * keyId: main.id, * keyMaterialWo: std.base64encode({ * input: keyMaterial.base64, * }).result, * keyMaterialWoVersion: 1, * saltWo: std.base64encode({ * input: salt.base64, * }).result, * saltWoVersion: 1, * }); * ``` */ class KeyMaterial extends pulumi.CustomResource { /** * Get an existing KeyMaterial 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 KeyMaterial(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'scaleway:keymanager/keyMaterial:KeyMaterial'; /** * Returns true if the given object is an instance of KeyMaterial. 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'] === KeyMaterial.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["keyId"] = state?.keyId; resourceInputs["keyMaterial"] = state?.keyMaterial; resourceInputs["keyMaterialWo"] = state?.keyMaterialWo; resourceInputs["keyMaterialWoVersion"] = state?.keyMaterialWoVersion; resourceInputs["keyState"] = state?.keyState; resourceInputs["origin"] = state?.origin; resourceInputs["region"] = state?.region; resourceInputs["salt"] = state?.salt; resourceInputs["saltWo"] = state?.saltWo; resourceInputs["saltWoVersion"] = state?.saltWoVersion; } else { const args = argsOrState; if (args?.keyId === undefined && !opts.urn) { throw new Error("Missing required property 'keyId'"); } resourceInputs["keyId"] = args?.keyId; resourceInputs["keyMaterial"] = args?.keyMaterial ? pulumi.secret(args.keyMaterial) : undefined; resourceInputs["keyMaterialWo"] = args?.keyMaterialWo ? pulumi.secret(args.keyMaterialWo) : undefined; resourceInputs["keyMaterialWoVersion"] = args?.keyMaterialWoVersion; resourceInputs["region"] = args?.region; resourceInputs["salt"] = args?.salt ? pulumi.secret(args.salt) : undefined; resourceInputs["saltWo"] = args?.saltWo ? pulumi.secret(args.saltWo) : undefined; resourceInputs["saltWoVersion"] = args?.saltWoVersion; resourceInputs["keyState"] = undefined /*out*/; resourceInputs["origin"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["keyMaterial", "keyMaterialWo", "salt", "saltWo"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(KeyMaterial.__pulumiType, name, resourceInputs, opts); } } exports.KeyMaterial = KeyMaterial; //# sourceMappingURL=keyMaterial.js.map