1

尝试使用 cyrilgdn/postgresql 提供程序,但 terraform 继续尝试加载 hashcorp/postgresql,这会导致 init 失败。目前使用 terraform 1.0.0,尽管问题也发生在 14.1 上 - 尚未从 12.x 升级,始终运行 14.1 或更新版本。

我已将代码简化为以下,此文件夹中没有其他内容,但仍然遇到问题

terraform {
  required_version = ">= 0.14.1"

  required_providers {
    postgres = {
      source  = "cyrilgdn/postgresql"
      version = ">=1.13.0"
    }
  }
}

provider "postgresql" {
  host = "TBC"
  port = 5432
  username = "TBC"
  password = "TBC"
}

初始化报告:

Initializing provider plugins...
- Finding cyrilgdn/postgresql versions matching ">= 1.13.0"...
- Finding latest version of hashicorp/postgresql...
- Installing cyrilgdn/postgresql v1.13.0...
- Installed cyrilgdn/postgresql v1.13.0 (self-signed, key ID 3918DD444A3876A6)

Partner and community providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:

https://www.terraform.io/docs/cli/plugins/signing.html
Error: Failed to query available provider packages

Could not retrieve the list of available versions for provider
hashicorp/postgresql: provider registry registry.terraform.io does not have a
provider named registry.terraform.io/hashicorp/postgresql

terraform 提供商报告

Providers required by configuration:
.
├── provider[registry.terraform.io/hashicorp/postgresql]
└── provider[registry.terraform.io/cyrilgdn/postgresql] >= 1.13.0

如何阻止它尝试查找 hashcorp/postgresql ?

4

1 回答 1

0

它应该是postgresql,而不是postgres

terraform {
  required_version = ">= 0.14.1"

  required_providers {
    postgresql = {
      source  = "cyrilgdn/postgresql"
      version = ">=1.13.0"
    }
  }
}
于 2021-06-14T11:05:37.513 回答