How do I change the Terraform Provider.aws version

Viewed 1508

I have a pipeline in Jenkins that allows me to change my AWS infrastructure with Terraform. The build failed yesterday because and I noticed the provider.aws changed from:

provider.aws: version = "~> 3.15"

to

provider.aws: version = "~> 3.20".

I understand that this includes breaking changes.

Does anyone know how I can manually change that number manually back to 3.15?

1 Answers

In Terraform 0.11 it was done with version attribute when the provider was declared, e.g.:

provider "aws" {
  version = "3.15"
}

These days e.g. Terraform 0.13 it is done in the required_providers section, e.g.

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "3.15"
    }
  }
}

Not sure, but I think in Terraform 0.12 both could be used.

Related