Skip to content

azurermDedicatedHardwareSecurityModule

Manages a Dedicated Hardware Security Module.

-> Note: Before using this resource, it's required to submit the request of registering the providers and features with Azure CLI azProviderRegisterNamespaceMicrosoftHardwareSecurityModules &&AzFeatureRegisterNamespaceMicrosoftHardwareSecurityModulesNameAzureDedicatedHsm &&AzProviderRegisterNamespaceMicrosoftNetwork &&AzFeatureRegisterNamespaceMicrosoftNetworkNameAllowBaremetalServers and ask service team (hsmrequest@microsoft.com) to approve. See more details from https://docs.microsoft.com/azure/dedicated-hsm/tutorial-deploy-hsm-cli#prerequisites.

-> Note: If the quota is not enough in some region, please submit the quota request to service team.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "example-resources",
  }
);
const azurermVirtualNetworkExample = new azurerm.virtualNetwork.VirtualNetwork(
  this,
  "example_1",
  {
    address_space: ["10.2.0.0/16"],
    location: azurermResourceGroupExample.location,
    name: "example-vnet",
    resource_group_name: azurermResourceGroupExample.name,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermVirtualNetworkExample.overrideLogicalId("example");
const azurermPublicIpExample = new azurerm.publicIp.PublicIp(
  this,
  "example_2",
  {
    allocation_method: "Dynamic",
    location: azurermResourceGroupExample.location,
    name: "example-pip",
    resource_group_name: azurermResourceGroupExample.name,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermPublicIpExample.overrideLogicalId("example");
const azurermSubnetExample = new azurerm.subnet.Subnet(this, "example_3", {
  address_prefixes: ["10.2.0.0/24"],
  name: "example-compute",
  resource_group_name: azurermResourceGroupExample.name,
  virtual_network_name: azurermVirtualNetworkExample.name,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSubnetExample.overrideLogicalId("example");
const azurermSubnetExample2 = new azurerm.subnet.Subnet(this, "example2", {
  address_prefixes: ["10.2.1.0/24"],
  delegation: [
    {
      name: "first",
      service_delegation: [
        {
          actions: [
            "Microsoft.Network/networkinterfaces/*",
            "Microsoft.Network/virtualNetworks/subnets/join/action",
          ],
          name: "Microsoft.HardwareSecurityModules/dedicatedHSMs",
        },
      ],
    },
  ],
  name: "example-hsmsubnet",
  resource_group_name: azurermResourceGroupExample.name,
  virtual_network_name: azurermVirtualNetworkExample.name,
});
const azurermSubnetExample3 = new azurerm.subnet.Subnet(this, "example3", {
  address_prefixes: ["10.2.255.0/26"],
  name: "gatewaysubnet",
  resource_group_name: azurermResourceGroupExample.name,
  virtual_network_name: azurermVirtualNetworkExample.name,
});
const azurermVirtualNetworkGatewayExample =
  new azurerm.virtualNetworkGateway.VirtualNetworkGateway(this, "example_6", {
    ip_configuration: [
      {
        private_ip_address_allocation: "Dynamic",
        public_ip_address_id: azurermPublicIpExample.id,
        subnet_id: azurermSubnetExample3.id,
      },
    ],
    location: azurermResourceGroupExample.location,
    name: "example-vnetgateway",
    resource_group_name: azurermResourceGroupExample.name,
    sku: "Standard",
    type: "ExpressRoute",
    vpn_type: "PolicyBased",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermVirtualNetworkGatewayExample.overrideLogicalId("example");
const azurermDedicatedHardwareSecurityModuleExample =
  new azurerm.dedicatedHardwareSecurityModule.DedicatedHardwareSecurityModule(
    this,
    "example_7",
    {
      depends_on: [`\${${azurermVirtualNetworkGatewayExample.fqn}}`],
      location: azurermResourceGroupExample.location,
      management_network_profile: [
        {
          network_interface_private_ip_addresses: ["10.2.1.7"],
          subnet_id: azurermSubnetExample2.id,
        },
      ],
      name: "example-hsm",
      network_profile: [
        {
          network_interface_private_ip_addresses: ["10.2.1.8"],
          subnet_id: azurermSubnetExample2.id,
        },
      ],
      resource_group_name: azurermResourceGroupExample.name,
      sku_name: "payShield10K_LMK1_CPS60",
      stamp_id: "stamp2",
      tags: {
        env: "Test",
      },
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermDedicatedHardwareSecurityModuleExample.overrideLogicalId("example");

Arguments Reference

The following arguments are supported:

  • name - (Required) The name which should be used for this Dedicated Hardware Security Module. Changing this forces a new Dedicated Hardware Security Module to be created.

  • resourceGroupName - (Required) The name of the Resource Group where the Dedicated Hardware Security Module should exist. Changing this forces a new Dedicated Hardware Security Module to be created.

  • location - (Required) The Azure Region where the Dedicated Hardware Security Module should exist. Changing this forces a new Dedicated Hardware Security Module to be created.

  • networkProfile - (Required) A networkProfile block as defined below.

  • skuName - (Required) The SKU name of the dedicated hardware security module. Possible values are payShield10KLmk1Cps60,payShield10KLmk1Cps250,payShield10KLmk1Cps2500,payShield10KLmk2Cps60,payShield10KLmk2Cps250,payShield10KLmk2Cps2500 and safeNetLunaNetworkHsmA790. Changing this forces a new Dedicated Hardware Security Module to be created.

  • managementNetworkProfile - (Optional) A managementNetworkProfile block as defined below.

->NOTE: The managementNetworkProfile should not be specified when skuName is safeNetLunaNetworkHsmA790.

  • stampId - (Optional) The ID of the stamp. Possible values are stamp1 or stamp2. Changing this forces a new Dedicated Hardware Security Module to be created.

  • zones - (Optional) Specifies a list of Availability Zones in which this Dedicated Hardware Security Module should be located. Changing this forces a new Dedicated Hardware Security Module to be created.

  • tags - (Optional) A mapping of tags which should be assigned to the Dedicated Hardware Security Module.


An networkProfile block exports the following:

  • networkInterfacePrivateIpAddresses - (Required) The private IPv4 address of the network interface. Changing this forces a new Dedicated Hardware Security Module to be created.

  • subnetId - (Required) The ID of the subnet. Changing this forces a new Dedicated Hardware Security Module to be created.


A managementNetworkProfile block exports the following:

  • networkInterfacePrivateIpAddresses - (Required) The private IPv4 address of the network interface. Changing this forces a new Dedicated Hardware Security Module to be created.

  • subnetId - (Required) The ID of the subnet. Changing this forces a new Dedicated Hardware Security Module to be created.

Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:

  • id - The ID of the Dedicated Hardware Security Module.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating the Dedicated Hardware Security Module.
  • read - (Defaults to 5 minutes) Used when retrieving the Dedicated Hardware Security Module.
  • update - (Defaults to 30 minutes) Used when updating the Dedicated Hardware Security Module.
  • delete - (Defaults to 30 minutes) Used when deleting the Dedicated Hardware Security Module.

Import

Dedicated Hardware Security Module can be imported using the resourceId, e.g.

terraform import azurerm_dedicated_hardware_security_module.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/hsm1