@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
133 lines • 5.6 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.Cluster = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Creates an Amazon CloudHSM v2 cluster.
*
* For information about CloudHSM v2, see the
* [AWS CloudHSM User Guide](https://docs.aws.amazon.com/cloudhsm/latest/userguide/introduction.html) and the [Amazon
* CloudHSM API Reference][2].
*
* > **NOTE:** A CloudHSM Cluster can take several minutes to set up.
* Practically no single attribute can be updated, except for `tags`.
* If you need to delete a cluster, you have to remove its HSM modules first.
* To initialize cluster, you have to add an HSM instance to the cluster, then sign CSR and upload it.
*
* ## Example Usage
*
* The following example below creates a CloudHSM cluster.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const available = aws.getAvailabilityZones({});
* const cloudhsmV2Vpc = new aws.ec2.Vpc("cloudhsm_v2_vpc", {
* cidrBlock: "10.0.0.0/16",
* tags: {
* Name: "example-aws_cloudhsm_v2_cluster",
* },
* });
* const cloudhsmV2Subnets: aws.ec2.Subnet[] = [];
* for (const range = {value: 0}; range.value < 2; range.value++) {
* cloudhsmV2Subnets.push(new aws.ec2.Subnet(`cloudhsm_v2_subnets-${range.value}`, {
* vpcId: cloudhsmV2Vpc.id,
* cidrBlock: subnets[range.value],
* mapPublicIpOnLaunch: false,
* availabilityZone: available.then(available => available.names[range.value]),
* tags: {
* Name: "example-aws_cloudhsm_v2_cluster",
* },
* }));
* }
* const cloudhsmV2Cluster = new aws.cloudhsmv2.Cluster("cloudhsm_v2_cluster", {
* hsmType: "hsm1.medium",
* subnetIds: cloudhsmV2Subnets.map(__item => __item.id),
* tags: {
* Name: "example-aws_cloudhsm_v2_cluster",
* },
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import CloudHSM v2 Clusters using the cluster `id`. For example:
*
* ```sh
* $ pulumi import aws:cloudhsmv2/cluster:Cluster test_cluster cluster-aeb282a201
* ```
*/
class Cluster extends pulumi.CustomResource {
/**
* Get an existing Cluster 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 Cluster(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of Cluster. 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'] === Cluster.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["clusterCertificates"] = state?.clusterCertificates;
resourceInputs["clusterId"] = state?.clusterId;
resourceInputs["clusterState"] = state?.clusterState;
resourceInputs["hsmType"] = state?.hsmType;
resourceInputs["mode"] = state?.mode;
resourceInputs["region"] = state?.region;
resourceInputs["securityGroupId"] = state?.securityGroupId;
resourceInputs["sourceBackupIdentifier"] = state?.sourceBackupIdentifier;
resourceInputs["subnetIds"] = state?.subnetIds;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
resourceInputs["vpcId"] = state?.vpcId;
}
else {
const args = argsOrState;
if (args?.hsmType === undefined && !opts.urn) {
throw new Error("Missing required property 'hsmType'");
}
if (args?.subnetIds === undefined && !opts.urn) {
throw new Error("Missing required property 'subnetIds'");
}
resourceInputs["hsmType"] = args?.hsmType;
resourceInputs["mode"] = args?.mode;
resourceInputs["region"] = args?.region;
resourceInputs["sourceBackupIdentifier"] = args?.sourceBackupIdentifier;
resourceInputs["subnetIds"] = args?.subnetIds;
resourceInputs["tags"] = args?.tags;
resourceInputs["clusterCertificates"] = undefined /*out*/;
resourceInputs["clusterId"] = undefined /*out*/;
resourceInputs["clusterState"] = undefined /*out*/;
resourceInputs["securityGroupId"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
resourceInputs["vpcId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Cluster.__pulumiType, name, resourceInputs, opts);
}
}
exports.Cluster = Cluster;
/** @internal */
Cluster.__pulumiType = 'aws:cloudhsmv2/cluster:Cluster';
//# sourceMappingURL=cluster.js.map