为什么我在 Terraform 中收到 random_id b64 属性的错误?

Aar*_*lin 5 terraform

我没有对我的 terraform 脚本进行任何更改,并且部署开始失败并出现如下错误:

2020/10/09 05:00:42 [DEBUG] Using modified User-Agent: Terraform/0.12.26 TFE/v202007-2
Error: Unsupported attribute
  on .terraform/modules/rds.rds/main.tf line 3, in locals:
   3:   master_password      = var.password == "" ? random_id.master_password.b64 : var.password
This object has no argument, nested block, or exported attribute named "b64".

Run Code Online (Sandbox Code Playgroud)

Aar*_*lin 9

根据 v3.0.0 版本的变更日志:

https://github.com/hashicorp/terraform-provider-random/blob/master/CHANGELOG.md#300-october-09-2020

删除不推荐使用的 b64 属性

Terraform 有帮助地建议:

The following providers do not have any version constraints in configuration,
so the latest version was installed.
To prevent automatic upgrades to new major versions that may contain breaking
changes, it is recommended to add version = "..." constraints to the
corresponding provider blocks in configuration, with the constraint strings
suggested below.
* provider.null: version = "~> 3.0"
* provider.random: version = "~> 3.0"
* provider.template: version = "~> 2.2"
* provider.tfe: version = "~> 0.22"
Run Code Online (Sandbox Code Playgroud)

该错误的直接解决方案是通过添加required_providersterraform块来回滚随机提供程序,可能在main.tf

terraform {
  required_providers {
    random = {
      version = "~> 2.3.0"
    }
  }
}
Run Code Online (Sandbox Code Playgroud)