从 0.12 升级到 0.13:无法实例化提供程序 "registry.terraform.io/-/aws" 以获取
upgrade from 0.12 to 0.13: Failed to instantiate provider "registry.terraform.io/-/aws" to obtain
我正在尝试从 terraform 0.12 升级到 0.13。
当我运行 terraform 0.13upgrade
什么都没有改变时,似乎没有语法问题。
只添加了一个文件version.tf
+terraform {
+ required_providers {
+ aws = {
+ source = "hashicorp/aws"
+ }
+ }
+ required_version = ">= 0.13"
+}
当我 运行 terraform plan
我得到了
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".
2 problems:
- Failed to instantiate provider "registry.terraform.io/-/aws" to obtain
schema: unknown provider "registry.terraform.io/-/aws"
- Failed to instantiate provider "registry.terraform.io/-/template" to obtain
schema: unknown provider "registry.terraform.io/-/template"
运行宁terraform providers
显示
Providers required by configuration:
.
├── provider[registry.terraform.io/hashicorp/aws]
├── module.bastion
│ ├── provider[registry.terraform.io/hashicorp/template]
│ └── provider[registry.terraform.io/hashicorp/aws]
└── module.vpc
└── provider[registry.terraform.io/hashicorp/aws] >= 2.68.*
Providers required by state:
provider[registry.terraform.io/-/aws]
provider[registry.terraform.io/-/template]
所以我的猜测是出于某种原因,我的 tfstate 中有 -/aws
而不是 hashicorp/aws
,但是我在 tfstate 中根本找不到这个特定的字符串。
我试过了:
- 运行宁
terraform init
terraform init -reconfigure
- 正在删除
.terraform
文件夹
- 正在删除
~/.terraform.d
文件夹
所以我运行不知道如何解决这个问题
我按照步骤here
terraform state replace-provider registry.terraform.io/-/template registry.terraform.io/hashicorp/template
terraform state replace-provider registry.terraform.io/-/aws registry.terraform.io/hashicorp/aws
它解决了我的问题。
我正在尝试从 terraform 0.12 升级到 0.13。
当我运行 terraform 0.13upgrade
什么都没有改变时,似乎没有语法问题。
只添加了一个文件version.tf
+terraform {
+ required_providers {
+ aws = {
+ source = "hashicorp/aws"
+ }
+ }
+ required_version = ">= 0.13"
+}
当我 运行 terraform plan
我得到了
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".
2 problems:
- Failed to instantiate provider "registry.terraform.io/-/aws" to obtain
schema: unknown provider "registry.terraform.io/-/aws"
- Failed to instantiate provider "registry.terraform.io/-/template" to obtain
schema: unknown provider "registry.terraform.io/-/template"
运行宁terraform providers
显示
Providers required by configuration:
.
├── provider[registry.terraform.io/hashicorp/aws]
├── module.bastion
│ ├── provider[registry.terraform.io/hashicorp/template]
│ └── provider[registry.terraform.io/hashicorp/aws]
└── module.vpc
└── provider[registry.terraform.io/hashicorp/aws] >= 2.68.*
Providers required by state:
provider[registry.terraform.io/-/aws]
provider[registry.terraform.io/-/template]
所以我的猜测是出于某种原因,我的 tfstate 中有 -/aws
而不是 hashicorp/aws
,但是我在 tfstate 中根本找不到这个特定的字符串。
我试过了:
- 运行宁
terraform init
terraform init -reconfigure
- 正在删除
.terraform
文件夹 - 正在删除
~/.terraform.d
文件夹
所以我运行不知道如何解决这个问题
我按照步骤here
terraform state replace-provider registry.terraform.io/-/template registry.terraform.io/hashicorp/template
terraform state replace-provider registry.terraform.io/-/aws registry.terraform.io/hashicorp/aws
它解决了我的问题。