Monday, August 30, 2021

Syntax change in provider section of terraform

 Old code:


main.tf

--

provider "azurerm"{

 version = "=2.36.0"

 features {}

}


resource "azurerm_resource_group" "rg"{

 name = "myFirstResourceGroup"

 location = "westeurope"

}



New code for provider, change the provider version part to the required providers part.


main.tf

--

provider "azurerm"{

 features {}

}


terraform{

required_providers{

  azurerm={

   source = "hashicorp/azurerm"

   version = "=2.40.0"

 }

}

}

No comments:

Post a Comment