hashicorp / terraform

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
https://www.terraform.io/
Other
42.32k stars 9.49k forks source link

terraform 0.13upgrade tool incorrectly handling the special addressing scheme for built-in providers #25210

Closed TheComice closed 4 years ago

TheComice commented 4 years ago

Terraform Version

0.13.0-beta1

Terraform Configuration Files

terraform 0.13upgrade produces following required_providers block: -

terraform {
  required_providers {
    aws = {
      source = "hashicorp/aws"
    }
    mongodbatlas = {
      source = "terraform-providers/mongodbatlas"
    }
    terraform = {
      source = "terraform.io/builtin/terraform"
    }
  }
  required_version = ">= 0.13"
}

Debug Output

Error: Incompatible provider version

No compatible versions of provider registry.terraform.io/hashicorp/terraform
were found.

Crash Output

Expected Behavior

I was expecting the required_providers to include an addressing scheme source as follows: -

source = "terraform.io/builtin/terraform"

Actual Behavior

terraform 0.13upgrade has incorrectly generated the source = "hashicorp/terraform" which results in Error: Incompatible provider version

Steps to Reproduce

  1. Run terraform 0.13upgrade on 0.12.20 configured module block.
  2. With new required_providers block appended to versions.tf file run terraform init
  3. Error will be presented.

Additional Context

References

mildwonkey commented 4 years ago

Thank you for reporting this issue, @TheComice , and I'm sorry you ran into it!

As a workaround for now you can remove the terraform block from required_providers, and we'll get this fixed for the next release.

ghost commented 4 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.