Azure AVM for terraform - you still face versioning issues with providers
Azure Verified module for terraform is great but it does not mean you get everything for free. You still run into isssues like provider versioning and terraform cli versioninig issues.
1. Terraform required providers versioning issue - (same old, same old) - where I started off using old version like 0.1.2. Then I run terraform init and terraform plan - looking good.
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.0"
}
}
}
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "example" {
name = "rg-example"
location = "East US"
}
module "storage_account" {
source = "Azure/avm-res-storage-storageaccount/azurerm"
version = "= 0.1.2" # Pin to exact version
# Required inputs
name = "stexample001"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
account_tier = "Standard"
account_replication_type = "GRS"
}
Then I upgraded AVM to 0.7.4 and it started to asking for azurerm provider to be upgraded to version 4.0. Then I also need to remove a parameter "resource_group_name" that is no longer required. The reason for this is, resource_group_name has changed to parent_id.
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 4.0"
}
}
}
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "example" {
name = "rg-example"
location = "australiaeast"
}
module "storage_account" {
source = "Azure/avm-res-storage-storageaccount/azurerm"
version = "= 0.7.4" # Pin to exact version
name = "stexample001"
location = azurerm_resource_group.example.location
account_tier = "Standard"
account_replication_type = "GRS"
parent_id = azurerm_resource_group.example.id
}
As you can see here, I just testing out with Azure AVM storage account.
2. terraform cli version compatibility is also required. What this means here is that AVM recent ones like 0.7.4 requires specific version of terraform.
Comments