Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

terraform init fails due to constraints on aws module #49

Closed
dylanmtaylor opened this issue Oct 23, 2021 · 2 comments · Fixed by #50
Closed

terraform init fails due to constraints on aws module #49

dylanmtaylor opened this issue Oct 23, 2021 · 2 comments · Fixed by #50

Comments

@dylanmtaylor
Copy link

After doing a git checkout, I get this message:

│ Error: Failed to query available provider packages

│ Could not retrieve the list of available versions for provider hashicorp/aws:
│ locked provider registry.terraform.io/hashicorp/aws 3.53.0 does not match
│ configured version constraint >= 3.15.0, >= 3.20.0, >= 3.40.0, >= 3.56.0;
│ must use terraform init -upgrade to allow selection of new versions

Constraints in this project might need to be adjusted.

@dylanmtaylor
Copy link
Author

This seems to be resolved after running terraform init -upgrade:

[dylan@dylantaylor-precision Projects]$ cd learn-terraform-provision-eks-cluster/
[dylan@dylantaylor-precision learn-terraform-provision-eks-cluster]$ terraform init
Initializing modules...
Downloading terraform-aws-modules/eks/aws 17.22.0 for eks...
- eks in .terraform/modules/eks
- eks.fargate in .terraform/modules/eks/modules/fargate
- eks.node_groups in .terraform/modules/eks/modules/node_groups
Downloading terraform-aws-modules/vpc/aws 3.2.0 for vpc...
- vpc in .terraform/modules/vpc

Initializing the backend...

Initializing provider plugins...
- Reusing previous version of hashicorp/aws from the dependency lock file
- Reusing previous version of hashicorp/kubernetes from the dependency lock file
^[[F- Reusing previous version of hashicorp/cloudinit from the dependency lock file
- Reusing previous version of terraform-aws-modules/http from the dependency lock file
- Reusing previous version of hashicorp/random from the dependency lock file
- Reusing previous version of hashicorp/local from the dependency lock file
- Reusing previous version of hashicorp/null from the dependency lock file
- Installing hashicorp/kubernetes v2.4.1...
- Installed hashicorp/kubernetes v2.4.1 (signed by HashiCorp)
- Installing hashicorp/cloudinit v2.2.0...
- Installed hashicorp/cloudinit v2.2.0 (signed by HashiCorp)
- Installing terraform-aws-modules/http v2.4.1...
- Installed terraform-aws-modules/http v2.4.1 (self-signed, key ID B2C1C0641B6B0EB7)
- Installing hashicorp/random v3.1.0...
- Installed hashicorp/random v3.1.0 (signed by HashiCorp)
- Installing hashicorp/local v2.1.0...
- Installed hashicorp/local v2.1.0 (signed by HashiCorp)
- Installing hashicorp/null v3.1.0...
- Installed hashicorp/null v3.1.0 (signed by HashiCorp)

Partner and community providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:
https://www.terraform.io/docs/cli/plugins/signing.html
╷
│ Error: Failed to query available provider packages
│ 
│ Could not retrieve the list of available versions for provider hashicorp/aws:
│ locked provider registry.terraform.io/hashicorp/aws 3.53.0 does not match
│ configured version constraint >= 3.15.0, >= 3.20.0, >= 3.40.0, >= 3.56.0;
│ must use terraform init -upgrade to allow selection of new versions
╵

[dylan@dylantaylor-precision learn-terraform-provision-eks-cluster]$ terraform init -upgrade
Upgrading modules...
Downloading terraform-aws-modules/eks/aws 17.22.0 for eks...
- eks in .terraform/modules/eks
- eks.fargate in .terraform/modules/eks/modules/fargate
- eks.node_groups in .terraform/modules/eks/modules/node_groups
Downloading terraform-aws-modules/vpc/aws 3.2.0 for vpc...
- vpc in .terraform/modules/vpc

Initializing the backend...

Initializing provider plugins...
- Finding hashicorp/aws versions matching ">= 3.15.0, >= 3.20.0, >= 3.40.0, >= 3.56.0"...
- Finding hashicorp/random versions matching "3.1.0"...
- Finding hashicorp/cloudinit versions matching ">= 2.0.0"...
- Finding terraform-aws-modules/http versions matching ">= 2.4.1"...
- Finding hashicorp/local versions matching ">= 1.4.0, 2.1.0"...
- Finding hashicorp/null versions matching "3.1.0"...
- Finding hashicorp/kubernetes versions matching ">= 1.11.1, >= 2.0.1"...
- Installing hashicorp/cloudinit v2.2.0...
- Installed hashicorp/cloudinit v2.2.0 (signed by HashiCorp)
- Installing terraform-aws-modules/http v2.4.1...
- Installed terraform-aws-modules/http v2.4.1 (self-signed, key ID B2C1C0641B6B0EB7)
- Installing hashicorp/local v2.1.0...
- Installed hashicorp/local v2.1.0 (signed by HashiCorp)
- Installing hashicorp/null v3.1.0...
- Installed hashicorp/null v3.1.0 (signed by HashiCorp)
- Installing hashicorp/kubernetes v2.6.1...
- Installed hashicorp/kubernetes v2.6.1 (signed by HashiCorp)
- Installing hashicorp/aws v3.63.0...
- Installed hashicorp/aws v3.63.0 (signed by HashiCorp)
- Installing hashicorp/random v3.1.0...
- Installed hashicorp/random v3.1.0 (signed by HashiCorp)

Partner and community providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:
https://www.terraform.io/docs/cli/plugins/signing.html

Terraform has made some changes to the provider dependency selections recorded
in the .terraform.lock.hcl file. Review those changes and commit them to your
version control system if they represent changes you intended to make.

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.

@evolart
Copy link

evolart commented Jan 5, 2022

Same issue...following the written directions results in the error:

Could not retrieve the list of available versions for provider hashicorp/aws: locked provider registry.terraform.io/hashicorp/aws 3.63.0 does not match configured version constraint >= 3.15.0, >= 3.20.0, >= 3.64.0; must use terraform init -upgrade to allow selection of new versions

Running terraform init -upgrade does work but the documentation https://learn.hashicorp.com/tutorials/terraform/eks?in=terraform/kubernetes doesn't state to do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants