Skip to content

azurermIothubCertificate

Manages an IotHub Certificate.

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 azurermIothubExample = new azurerm.iothub.Iothub(this, "example_1", {
  location: azurermResourceGroupExample.location,
  name: "example",
  resource_group_name: azurermResourceGroupExample.name,
  sku: [
    {
      capacity: "1",
      name: "B1",
    },
  ],
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermIothubExample.overrideLogicalId("example");
const azurermIothubCertificateExample =
  new azurerm.iothubCertificate.IothubCertificate(this, "example_2", {
    certificate_content: '${filebase64("example.cer")}',
    iothub_name: azurermIothubExample.name,
    is_verified: true,
    name: "example",
    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.*/
azurermIothubCertificateExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

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

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

  • iothubName - (Required) The name of the IoTHub that this certificate will be attached to. Changing this forces a new resource to be created.

  • certificateContent - (Required) The Base-64 representation of the X509 leaf certificate .cer file or just a .pem file content.

  • isVerified - (Optional) Is the certificate verified? Defaults to false.

Attributes Reference

The following attributes are exported:

  • id - The ID of the IoTHub Certificate.

Timeouts

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

  • create - (Defaults to 30 minutes) Used when creating the IotHub Certificate.
  • update - (Defaults to 30 minutes) Used when updating the IotHub Certificate.
  • read - (Defaults to 5 minutes) Used when retrieving the IotHub Certificate.
  • delete - (Defaults to 30 minutes) Used when deleting the IotHub Certificate.

Import

IoTHub Certificates can be imported using the resourceId, e.g.

terraform import azurerm_iothub_certificate.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Devices/iotHubs/example/certificates/example