Skip to content

Resource: awsCloudhsmV2Hsm

Creates an HSM module in Amazon CloudHSM v2 cluster.

Example Usage

The following example below creates an HSM module in CloudHSM cluster.

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const dataAwsCloudhsmV2ClusterCluster =
  new aws.dataAwsCloudhsmV2Cluster.DataAwsCloudhsmV2Cluster(this, "cluster", {
    clusterId: "${var.cloudhsm_cluster_id}",
  });
new aws.cloudhsmV2Hsm.CloudhsmV2Hsm(this, "cloudhsm_v2_hsm", {
  clusterId: dataAwsCloudhsmV2ClusterCluster.clusterId,
  subnetId: `\${${dataAwsCloudhsmV2ClusterCluster.subnetIds.fqn}[0]}`,
});

Argument Reference

The following arguments are supported:

\~> NOTE: Either subnetId or availabilityZone must be specified.

  • clusterId - (Required) The ID of Cloud HSM v2 cluster to which HSM will be added.
  • subnetId - (Optional) The ID of subnet in which HSM module will be located. Conflicts with availabilityZone.
  • availabilityZone - (Optional) The IDs of AZ in which HSM module will be located. Conflicts with subnetId.
  • ipAddress - (Optional) The IP address of HSM module. Must be within the CIDR of selected subnet.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • hsmId - The id of the HSM module.
  • hsmState - The state of the HSM module.
  • hsmEniId - The id of the ENI interface allocated for HSM module.

Import

HSM modules can be imported using their HSM ID, e.g.,

$ terraform import aws_cloudhsm_v2_hsm.bar hsm-quo8dahtaca