I use Azure ARM templates for deploying Azure resources. Now I have been asked to convert a few of the ARM templates into Terraform files.
I am new to terraform world. I just went through some online examples of creating Azure resources using Terraform's AzureRM provider. but, nowhere did I find a way to set the API version for the Azure resource provider.
For example, In the ARM template, we can specify "apiVersion" for any resources but in the Terraform there is no option to choose the API version.
Does anyone know how to choose API Version in Terraform for Azure?
CodePudding user response:
In Terrform we don't speficy the api version
for each resource likewise we do in ARM template.
In terraform we only use the AzureRM provider version. If you are not mentioning specific version it will take the latest AzureRM provider version
The Azure Provider can be used to configure infrastructure in Microsoft Azure using the Azure Resource Manager API's.
Like below
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "=3.10.0"
}
}
}
provider "azurerm" {
features {}
}
data "azurerm_resource_group" "example" {
name = "v-rasXXXXree"
#location = "West Europe"
}
resource "azurerm_virtual_network" "example-2" {
name = "peternetwork2"
resource_group_name = data.azurerm_resource_group.example.name
address_space = ["10.0.2.0/24"]
location = data.azurerm_resource_group.example.location
}
For more information please refer this official terarform document