» azurerm_iothub_shared_access_policy

Manages an IotHub Shared Access Policy

» Example Usage

resource "azurerm_resource_group" "example" {
  name     = "resourceGroup1"
  location = "West US"
}

resource "azurerm_iothub" "example" {
  name                = "example"
  resource_group_name = "${azurerm_resource_group.example.name}"
  location            = "${azurerm_resource_group.example.location}"

  sku {
    name     = "S1"
    capacity = "1"
  }
}

resource "azurerm_iothub_shared_access_policy" "example" {
  name                = "example"
  resource_group_name = "${azurerm_resource_group.example.name}"
  iothub_name         = "${azurerm_iothub.example.name}"

  registry_read  = true
  registry_write = true
}

» Argument Reference

The following arguments are supported:

  • name - (Required) Specifies the name of the IotHub Shared Access Policy resource. Changing this forces a new resource to be created.

  • resource_group_name - (Required) The name of the resource group under which the IotHub Shared Access Policy resource has to be created. Changing this forces a new resource to be created.

  • iothub_name - (Required) The name of the IoTHub to which this Shared Access Policy belongs. Changing this forces a new resource to be created.

  • registry_read - (Optional) Adds RegistryRead permission to this Shared Access Account. It allows read access to the identity registry.

  • registry_write - (Optional) Adds RegistryWrite permission to this Shared Access Account. It allows write access to the identity registry.

  • service_connect - (Optional) Adds ServiceConnect permission to this Shared Access Account. It allows sending and receiving on the cloud-side endpoints.

  • device_connect - (Optional) Adds DeviceConnect permission to this Shared Access Account. It allows sending and receiving on the device-side endpoints.

» Attributes Reference

The following attributes are exported:

» Import

IoTHub Shared Access Policies can be imported using the resource id, e.g.

terraform import azurerm_iothub_shared_access_policy.shared_access_policy1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Devices/IotHubs/hub1/IotHubKeys/shared_access_policy1