terraform init step with "no available releases match the given constraints ~> 2.1.28"

Viewed 7263

Actually - received the replaced apple mac laptop (the original one crashed due to bad storage) and i am re-setting up everything with configure, i am stuck and blocked with this "terraform init" step,

Installed terraform version is 0.13.6 Installed AWS CLI is 2.1.32

When "terraform init" is triggered i am getting this below error, any help is appreciated so that i can unblock my work.

Initializing modules...

Initializing the backend...

Initializing provider plugins...
- Using previously-installed hashicorp/kubernetes v1.13.3
- Using previously-installed hashicorp/external v1.1.2
- Finding hashicorp/aws versions matching "~> 2.1.28"...

Error: Failed to query available provider packages

Could not retrieve the list of available versions for provider hashicorp/aws: no available releases match the given constraints ~>
2.1.28
2 Answers

By using ~> 2.1.28, you're saying that you will use any 2.1.x version, as long as the bugfix version is higher than 28. The highest 2.1 version is 2.1.0.

Are you sure you don't mean ~> 2.28.1?

create a config.tf file and add this line

  required_providers {
    aws = {
      source  = "registry.terraform.io/hashicorp/aws"
      version = "=2.28.0" ## or whatever version you need
    }
  }
Related