How to Update Azure Terraform Provider Version

In this blog post, I will show you how to update the Azure Terraform provider version in a Terraform configuration file.

Provider

In Terraform every module (including main) must declare which provider it is using for the configuration to work.

Azure Provider

In the configuration below, I am using the Microsoft Azure provider. If you look closely at the below configuration you will see that I’m using version 2.40.0.

terraform {
  required_providers {
    azurerm = {
      source = "hashicorp/azurerm"
      version = ">= 2.40.0"
    }
  }
}

I can also check the provider version using the following Terraform command.

terraform.exe providers

Update Provider Version

To update the Azure provider version, I will first check the latest provider version from the Terraform provider page. In our case I will use the following link.

https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs

The version number appears in top section as shown below.

To update, I will edit the provider version and run terraform init.

terraform {
  required_providers {
    azurerm = {
      source = "hashicorp/azurerm"
      version = ">= 2.41.0"
    }
  }
}

Posted

in

by