2 min read

Announcing the Terraform AzureRM 2.0 Provider release

On behalf of HashiCorp and Microsoft, I am excited to announce the release of version 2.0 of the Azure Provider for Terraform. Version 2.0 is a major version upgrade that incorporates a number of features that customers have been asking for, as well as a whole host of smaller but impactful changes. Our goal in releasing version 2.0 is to improve the experience of managing Microsoft Azure with Terraform.

Azure has grown significantly since the Terraform AzureRM provider’s inception in December 2015 and the breadth of services offered has continued to evolve. Although we have added more than 300 resources and almost 100 data sources to the 1.x provider, we have accrued a large list of changes to existing resources and new cross-cutting features that necessitate a new major version.

In addition to new resources and data sources, this release has some highlights that we’ll explore below:

Resource level custom timeouts

In prior versions of the AzureRM provider, resource timeouts were restricted to 1 hour and did not accept overrides. A customizable setting in v2.0 allows users to override the default timeouts for resources. This change is most useful for resources that require extended windows for deletion.

To set a custom timeout for a resource, follow the example below:

resource "azurerm_resource_group" "example" {
  name     = "example-resource-group"
  location = "West Europe"
 
  timeouts {
    create = "10m"
    delete = "30m"
  }
}

Consistent experience when importing resources

Version 2.0 of the Terraform Azure Provider aims to solve an issue in which it’s possible to unintentionally import resources into the state by running Terraform apply.

In order to match the behavior of other Terraform providers, version 2.0 of the AzureRM Provider will require that existing resources are imported into the state prior to use. As of version 2.0, Terraform will check for the presence of an existing resource prior to creating it and will return an error similar to below:

A resource with the ID /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1 already exists - to be managed via Terraform this resource needs to be imported into the State. Please see the resource documentation for `azurerm_resource_group` for more information.

New virtual machine and virtual machine scale set resources

We are introducing additional resources to provision virtual machines and virtual machine scale sets. Users are now able to select a resource that corresponds to the OS of the virtual machine they would like to use. Prior versions of the provider included catch-all resources for virtual machines and virtual machine scale sets. Those resources are still available in the provider as of v2.0 but will be deprecated in the future.

The new virtual machine and virtual machine scale set resources in this version are:

• azurerm_linux_virtual_machine • azurerm_windows_virtual_machine • azurerm_linux_virtual_machine_scale_set • azurerm_windows_virtual_machine_scale_set • azurerm_virtual_machine_scale_set_extension

Removal of deprecated fields

As version 2.0 is a major version, we will remove resources, data sources, and fields that have been deprecated over the course of the provider’s lifetime.

A complete list of fields that will no longer be included in the provider can be found here. You can start using this version in your Terraform configurations today by simply adjusting your version in the provider block as follows:

provider "azurerm" {
  version = "=2.0.0"
}

For the full list of changes, additions, and guidance on upgrading to this version, check out the AzureRM v2.0 Upgrade Guide topic in the Terraform provider documentation.

We hope you like the changes. If you have any feedback, please let us know on GitHub.