Manages an IotHub Device Provisioning Service Shared Access Policy
resource "azurerm_resource_group" "example" {
name = "example-resources"
location = "West Europe"
}
resource "azurerm_iothub_dps" "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_dps_shared_access_policy" "example" {
name = "example"
resource_group_name = azurerm_resource_group.example.name
iothub_dps_name = azurerm_iothub_dps.example.name
enrollment_write = true
enrollment_read = true
}
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_dps_name
- (Required) The name of the IoT Hub Device Provisioning service to which this Shared Access Policy belongs. Changing this forces a new resource to be created.
enrollment_read
- (Optional) Adds EnrollmentRead
permission to this Shared Access Account. It allows read access to enrollment data.
enrollment_write
- (Optional) Adds EnrollmentWrite
permission to this Shared Access Account. It allows write access to enrollment data.registration_read
- (Optional) Adds RegistrationStatusRead
permission to this Shared Access Account. It allows read access to device registrations.
registration_write
- (Optional) Adds RegistrationStatusWrite
permission to this Shared Access Account. It allows write access to device registrations.
service_config
- (Optional) Adds ServiceConfig
permission to this Shared Access Account. It allows configuration of the Device Provisioning Service.In addition to the Arguments listed above - the following Attributes are exported:
id
- The ID of the IoTHub Device Provisioning Service Shared Access Policy.
primary_key
- The primary key used to create the authentication token.
primary_connection_string
- The primary connection string of the Shared Access Policy.
secondary_key
- The secondary key used to create the authentication token.
secondary_connection_string
- The secondary connection string of the Shared Access Policy.
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the IotHub Device Provisioning Service Shared Access Policy.update
- (Defaults to 30 minutes) Used when updating the IotHub Device Provisioning Service Shared Access Policy.read
- (Defaults to 5 minutes) Used when retrieving the IotHub Device Provisioning Service Shared Access Policy.delete
- (Defaults to 30 minutes) Used when deleting the IotHub Device Provisioning Service Shared Access Policy.IoTHub Device Provisioning Service Shared Access Policies can be imported using the resource id
, e.g.
terraform import azurerm_iothub_dps_shared_access_policy.shared_access_policy1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Devices/provisioningServices/dps1/keys/shared_access_policy1