I have a simple terraform configuration as follows.
# Terraform settings Block
terraform {
required_version = "~> 1.0.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm" # https://registry.terraform.io/providers/hashicorp/azurerm/latest
version = "~> 3.0"
}
}
}
provider "azurerm" {
features { }
}
resource "azurerm_resource_group" "rg" {
name = var.resource_group_name
location = var.resource_group_location
}
When I run
terraform init
I get the following error.
╷
│ Error: Unsupported Terraform Core version
│
│ on main.tf line 3, in terraform:
│ 3: required_version = "~> 1.0.0"
│
│ This configuration does not support Terraform version 1.2.2. To proceed, either choose another supported Terraform version or update this version
│ constraint. Version constraints are normally set for good reason, so updating the constraint may lead to other errors or unexpected behavior.
╵
If the required version is set the following way, it works fine(Changed ~> to >=).
required_version = ">= 1.0.0"
Looked at this doc, but not clear what to do. Should I revert back to required_version = ">= 1.0.0"
Just wanted to ensure that lastest minor is in place. Also read somewhere that for production, the one with tilde(~) is recommended. Bit confused now.
CodePudding user response:
You have already installed TF version 1.2.2
, which obviously is far newer then 1.0.0
. If you want to use such an old version of TF, you have download older version of terraform, and use that to run your scripts.