10000 "Unknown provider" when upgrading to 0.13 with a non-default state file name · Issue #25920 · hashicorp/terraform · GitHub
[go: up one dir, main page]

Skip to content
"Unknown provider" when upgrading to 0.13 with a non-default state file name #25920
@kmoe

Description

@kmoe

Terraform 0.13 commands cannot be run on a state file created under Terraform 0.12 with a non-default name, because the provider FQNs are not migrated.

Terraform Version

terraform012: 0.12.29
terraform013: 189f9fa (0.13.1-dev)

Terraform Configuration Files

resource null_resource "foo" {
}

Steps to Reproduce

  1. terraform012 init
  2. terraform012 apply -state=foo
  3. terraform013 init
  4. terraform013 apply -state=foo

Expected Behavior

All commands should be successful.

Without -state=foo, i.e. using the default state file name, this works.

Actual Behavior

Init is successful, but final apply is not:

❤ @up ➜  tfbug  $GOPATH/bin/terraform apply -state=foo

Error: Could not load plugin


Plugin reinitialization required. Please run "terraform init".

Plugins are external binaries that Terraform uses to access and manipulate
resources. The configuration provided requires plugins which can't be located,
don't satisfy the version constraints, or are otherwise incompatible.

Terraform automatically discovers provider requirements from your
configuration, including providers used in child modules. To see the
requirements and constraints, run "terraform providers".

Failed to instantiate provider "registry.terraform.io/-/null" to obtain
schema: unknown provider "registry.terraform.io/-/null"

All other commands involving the state file, such as terraform show foo, also fail.

State file

After performing all four steps, the state file is:

❤ @up ➜  tfbug  cat foo
{
  "version": 4,
  "terraform_version": "0.12.29",
  "serial": 1,
  "lineage": "f88b2c1c-b8ee-ab86-f4b5-0bd49bda07fd",
  "outputs": {},
  "resources": [
    {
      "mode": "managed",
      "type": "null_resource",
      "name": "foo",
      "provider": "provider.null",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "id": "5921273781850838351",
            "triggers": null
          },
          "private": "bnVsbA=="
        }
      ]
    }
  ]
}

This is despite the correct provider being present in the .terraform directory as detected from config.

Metadata

Metadata

Assignees

Labels

confirmeda Terraform Core team member has reproduced this issuedocumentationexplaineda Terraform Core team member has described the root cause of this issue in code

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0