This template creates an HSM module within a specified AWS CloudHSM v2 cluster using a subnet ID from the cluster.

Terraform Template

data "aws_cloudhsm_v2_cluster" "cluster" {
  cluster_id = "var.cloudhsm_cluster_id"
}

resource "aws_cloudhsm_v2_hsm" "cloudhsm_v2_hsm" {
  cluster_id = data.aws_cloudhsm_v2_cluster.cluster.cluster_id
  subnet_id = data.aws_cloudhsm_v2_cluster.cluster.subnet_ids[0]
}