hi when i tried to run terraform plan in my azure ADF code, this error is popping out
please refer the attached image for more details
hi when i tried to run terraform plan in my azure ADF code, this error is popping out
please refer the attached image for more details
The error from the screenshot is:
Error: resource version managed by newer provider version
Error description:
The resource was created using a newer provider version than you have on your machine. You specify which providers to use like azurerm >= 2.7, so if you have 2.7 in your local environment terraform will not update the provider you have downloaded when you run the INIT, however, if the resource was created using azurerm 2.8 by someone else, a pipeline, etc, you will receive the error because they just downloaded the most recent provider, which you don't have.
Quick Fix:
Delete the file .terraform.lock.hcl
and the folder .terraform
from the folder you store your terraform files and run terraform init
once again. Terraform will recreate the lock file and download the newest providers.
How to avoid it in the future:
Include the file .terraform.lock.hcl
as part of the source code, this way everyone will use the same provider versions.
sources:
I was using terragrunt with remote s3 state and dynamo db and sadly this does not work for me.
I have to re-generate the provider with the desired version
terraform {
source = "git::git@gitlab.com:abc/postgres?ref=1.39.2"
}
locals {
aws-provider = yamldecode(file("${find_in_parent_folders("aws-provider.yaml")}"))
}
inputs = {
aws_region = local.aws-provider.aws_region
version = local.aws-provider.version
profile = local.aws-provider.profile
environment = local.common-vars.environment
......
}
generate "provider" {
path = "provider.tf"
if_exists = "overwrite"
contents = <<EOF
provider "aws" {
region = "${local.aws-provider.aws_region}"
profile = "${local.aws-provider.profile}"
version = "${local.aws-provider.version}"
}
EOF
}