Skip to content

azurermAvailabilitySet

Manages an Availability Set for Virtual Machines.

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 azurermAvailabilitySetExample =
  new azurerm.availabilitySet.AvailabilitySet(this, "example_1", {
    location: azurermResourceGroupExample.location,
    name: "example-aset",
    resource_group_name: azurermResourceGroupExample.name,
    tags: {
      environment: "Production",
    },
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermAvailabilitySetExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

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

  • resourceGroupName - (Required) The name of the resource group in which to create the availability set. Changing this forces a new resource to be created.

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

  • platformUpdateDomainCount - (Optional) Specifies the number of update domains that are used. Defaults to 5. Changing this forces a new resource to be created.

\~> NOTE: The number of Update Domains varies depending on which Azure Region you're using - a list can be found here.

  • platformFaultDomainCount - (Optional) Specifies the number of fault domains that are used. Defaults to 3. Changing this forces a new resource to be created.

\~> NOTE: The number of Fault Domains varies depending on which Azure Region you're using - a list can be found here.

  • proximityPlacementGroupId - (Optional) The ID of the Proximity Placement Group to which this Virtual Machine should be assigned. Changing this forces a new resource to be created.

  • managed - (Optional) Specifies whether the availability set is managed or not. Possible values are true (to specify aligned) or false (to specify classic). Default is true. Changing this forces a new resource to be created.

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

Attributes Reference

The following attributes are exported:

  • id - The ID of the Availability Set.

Timeouts

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

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

Import

Availability Sets can be imported using the resourceId, e.g.

terraform import azurerm_availability_set.group1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Compute/availabilitySets/webAvailSet