gpt4 book ai didi

postgresql - Terraform 为 azure Postgressql 灵活服务器配置数据库角色引发错误

转载 作者:行者123 更新时间:2023-12-03 06:44:09 26 4
gpt4 key购买 nike

我已经使用 terraform 将 Azure PostgresSQL 灵活服务器部署为 PAAS,运行良好。现在我想使用 terraform 创建不同的角色并为数据库分配不同的权限。但它引发了下面提到的错误。请查看并建议我正确的 terraform 配置和解决方案所需的提供程序。

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
Did you intend to use cyrilgdn/postgresql? If so, you must specify that source address in each module which requires that provider. To see which modules are currently depending on hashicorp/postgresql, run the following command:
terraform provider

terraform {
required_version = ">= 1.1.6"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">=3.20.0"
}

postgresql = {
source = "cyrilgdn/postgresql"
version = "1.15.0"
}

}
}

provider "postgresql" {
host = module.az_pssql_flex.azurerm_postgresql_flexible_server
port = 5432
database = var.databases_names
username = ""
password = ""
sslmode = "require"
connect_timeout = 120
superuser = false

}

enter image description here

最佳答案

使用 terraform 创建不同角色并为数据库分配不同权限的解决方案。

  1. 在子模块中创建了一个“provider.tf”文件并定义 pssql 模块 enter image description here

  2. 在根模块 porvider.tf 文件旁边定义 postgresql 提供程序 block 。

  3. enter image description here

  4. 运行地形计划

  5. 运行 terraform apply。

关于postgresql - Terraform 为 azure Postgressql 灵活服务器配置数据库角色引发错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74260702/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com