» azurerm_iothub

Manages a IotHub

» Example Usage

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

resource "azurerm_iothub" "test" {
  name                = "test"
  resource_group_name = "${azurerm_resource_group.test.name}"
  location            = "${azurerm_resource_group.test.location}"
  sku {
    name = "S1"
    tier = "Standard"
    capacity = "1"
  }

  tags {
    "purpose" = "testing"
  }
}

» Argument Reference

The following arguments are supported:

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

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

  • location - (Required) Specifies the supported Azure location where the resource has to be createc. Changing this forces a new resource to be created.

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

  • tags - (Optional) A mapping of tags to assign to the resource.


A sku block supports the following:

  • name - (Required) The name of the sku. Possible values are B1, B2, B3, F1, S1, S2, and S3.

  • tier - (Required) The billing tier for the IoT Hub. Possible values are Basic, Free or Standard.

  • capacity - (Required) The number of provisioned IoT Hub units.

» Attributes Reference

The following attributes are exported:

  • id - The ID of the IoTHub.

  • hostname - The hostname of the IotHub Resource.

  • shared_access_policy - One or more shared_access_policy blocks as defined below.


A shared access policy block contains the following:

» Import

IoTHubs can be imported using the resource id, e.g.

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