@pulumiverse/scaleway
Version:
A Pulumi package for creating and managing Scaleway cloud resources.
190 lines • 7.91 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.Key = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* Provides a Scaleway Key Manager Key resource.\
* This resource allows you to create and manage cryptographic keys in Scaleway Key Manager (KMS).
*
* ## Example Usage
*
* ### Symmetric Encryption Key
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@pulumiverse/scaleway";
*
* const symmetric = new scaleway.keymanager.Key("symmetric", {
* name: "my-kms-key",
* region: "fr-par",
* projectId: "your-project-id",
* usage: "symmetric_encryption",
* algorithm: "aes_256_gcm",
* description: "Key for encrypting secrets",
* tags: [
* "env:prod",
* "kms",
* ],
* unprotected: true,
* rotationPolicy: {
* rotationPeriod: "720h",
* },
* });
* ```
*
* ### Asymmetric Encryption Key with RSA-4096
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@pulumiverse/scaleway";
*
* const rsa4096 = new scaleway.keymanager.Key("rsa_4096", {
* name: "rsa-4096-key",
* region: "fr-par",
* usage: "asymmetric_encryption",
* algorithm: "rsa_oaep_4096_sha256",
* description: "Key for encrypting large files with RSA-4096",
* unprotected: true,
* });
* ```
*
* ### Asymmetric Signing Key
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@pulumiverse/scaleway";
*
* const signing = new scaleway.keymanager.Key("signing", {
* name: "signing-key",
* region: "fr-par",
* usage: "asymmetric_signing",
* algorithm: "rsa_pss_2048_sha256",
* description: "Key for signing documents",
* unprotected: true,
* });
* ```
*
* ## Notes
*
* - **Protection**: By default, keys are protected and cannot be deleted. To allow deletion, set `unprotected = true` when creating the key.
* - **Rotation Policy**: The `rotationPolicy` block allows you to set automatic rotation for your key.
* - **Origin**: The `origin` argument is optional and defaults to `scalewayKms`. Use `external` if you want to import an external key (see Scaleway documentation for details).
* - **Project and Region**: If not specified, `projectId` and `region` will default to the provider configuration.
* - **Algorithm Validation**: The provider validates that the specified `algorithm` is compatible with the `usage` type at plan time, providing early feedback on configuration errors.
*
* ## Import
*
* You can import a key using its ID and region:
*
* ```sh
* $ pulumi import scaleway:keymanager/key:Key main fr-par/11111111-2222-3333-4444-555555555555
* ```
*/
class Key extends pulumi.CustomResource {
/**
* Get an existing Key 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 Key(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'scaleway:keymanager/key:Key';
/**
* Returns true if the given object is an instance of Key. 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'] === Key.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["algorithm"] = state?.algorithm;
resourceInputs["createdAt"] = state?.createdAt;
resourceInputs["description"] = state?.description;
resourceInputs["locked"] = state?.locked;
resourceInputs["name"] = state?.name;
resourceInputs["origin"] = state?.origin;
resourceInputs["projectId"] = state?.projectId;
resourceInputs["protected"] = state?.protected;
resourceInputs["region"] = state?.region;
resourceInputs["rotatedAt"] = state?.rotatedAt;
resourceInputs["rotationCount"] = state?.rotationCount;
resourceInputs["rotationPolicy"] = state?.rotationPolicy;
resourceInputs["state"] = state?.state;
resourceInputs["tags"] = state?.tags;
resourceInputs["unprotected"] = state?.unprotected;
resourceInputs["updatedAt"] = state?.updatedAt;
resourceInputs["usage"] = state?.usage;
}
else {
const args = argsOrState;
if (args?.algorithm === undefined && !opts.urn) {
throw new Error("Missing required property 'algorithm'");
}
if (args?.usage === undefined && !opts.urn) {
throw new Error("Missing required property 'usage'");
}
resourceInputs["algorithm"] = args?.algorithm;
resourceInputs["description"] = args?.description;
resourceInputs["name"] = args?.name;
resourceInputs["origin"] = args?.origin;
resourceInputs["projectId"] = args?.projectId;
resourceInputs["region"] = args?.region;
resourceInputs["rotationPolicy"] = args?.rotationPolicy;
resourceInputs["tags"] = args?.tags;
resourceInputs["unprotected"] = args?.unprotected;
resourceInputs["usage"] = args?.usage;
resourceInputs["createdAt"] = undefined /*out*/;
resourceInputs["locked"] = undefined /*out*/;
resourceInputs["protected"] = undefined /*out*/;
resourceInputs["rotatedAt"] = undefined /*out*/;
resourceInputs["rotationCount"] = undefined /*out*/;
resourceInputs["state"] = undefined /*out*/;
resourceInputs["updatedAt"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const aliasOpts = { aliases: [{ type: "scaleway:index/keyManagerKey:KeyManagerKey" }] };
opts = pulumi.mergeOptions(opts, aliasOpts);
super(Key.__pulumiType, name, resourceInputs, opts);
}
}
exports.Key = Key;
//# sourceMappingURL=key.js.map