Stuck upgrading from 0.13 to 0.14 due to unqualified providers

I’m working on getting from 0.12 to 1.0, made it from 12 to 13 no problem but now going from 13 to 14 I’m stuck due to complaints about mis-specified providers. Specifically four:

-/aws
-/null
-/tls
-/template

However none of these appear in any module configuration, and “terraform providers” lists all providers with correct/fully-qualified paths. Using terraform-0.13.7 when I do a “terraform init” it does show both the unqualified and fully-qualified providers:

  • Finding latest version of -/template…
  • Finding latest version of hashicorp/archive…
  • Finding latest version of hashicorp/null…
  • Finding latest version of -/aws…
  • Finding latest version of hashicorp/tls…
  • Finding latest version of vancluever/acme…
  • Finding latest version of hashicorp/local…
  • Finding latest version of -/null…
  • Finding latest version of hashicorp/template…
  • Finding latest version of hashicorp/random…
  • Finding latest version of -/tls…
  • Finding latest version of hashicorp/aws…
  • Finding latest version of hashicorp/cloudinit…

note the duplicate output for those four providers. The state does not appear to contain those unqualified providers:

Providers required by state:

provider[registry.terraform.io/hashicorp/cloudinit]
provider[registry.terraform.io/hashicorp/null]
provider[registry.terraform.io/hashicorp/random]
provider[registry.terraform.io/hashicorp/template]
provider[registry.terraform.io/hashicorp/tls]
provider[registry.terraform.io/hashicorp/archive]
provider[registry.terraform.io/hashicorp/aws]
provider[registry.terraform.io/hashicorp/local]
provider[registry.terraform.io/vancluever/acme]

I tried doing “terraform state replace_provider” for each of them, but it claims the unqualified providers are not found (which matches the output from “terraform providers”).

I’ve looked through all of the terraform module files, there is no mention of the “-/aws” type provider path. The output of “terraform graph” does not mention the unqualified providers.

How do I track down where these are coming from? I’m stuck getting from 13 to 14 until this is resolved as 14 rejects the unqualified providers at init.

Thanks.

-Jeff

Update…

It turns out that doing the “terraform state replace_provider” using terraform-0.13 doesn’t do anything but doing this with terraform-0.14 actually works:

terraform state replace-provider 'registry.terraform.io/-/aws' 'registry.terraform.io/hashicorp/aws'

So the resolution is to use 0.14 to get rid of those providers.

Hi @jeff.thomas,

I can’t explain why that command didn’t work on Terraform v0.13 – it should have – but I’m glad you got it working with v0.14 anyway.

I also wanted to add a note about what was going on here: Terraform v0.13 would normally have fixed these up the first time you ran a terraform apply with changes under Terraform v0.13, but I guess in your case you were skipping quickly through versions and so you didn’t remain on Terraform v0.13 long enough for that state upgrade to get rolled in to some other change you made. Therefore terraform state replace-provider is indeed a reasonable way to “force” it, making Terraform immediately create a new state snapshot rather than waiting until it would’ve done so for some other reason.

Actually I did apply a trivial change at each upgrade step, I wasn’t sure if doing a plan/apply with nothing to change would actually result in the state getting updated so I added a minor route53 change so it would have something to do.

The output of “terraform providers” on 0.14 showed just the “…/-/aws” type providers, not the fully-qualified ones shown by 0.13 on the same state, so I figured I’d try the replace_providers with the 0.14 binary and that worked.

-Jeff