我已经使用 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
}
最佳答案
使用 terraform 创建不同角色并为数据库分配不同权限的解决方案。
在子模块中创建了一个“provider.tf”文件并定义 pssql 模块
在根模块 porvider.tf 文件旁边定义 postgresql 提供程序 block 。
运行地形计划
运行 terraform apply。
关于postgresql - Terraform 为 azure Postgressql 灵活服务器配置数据库角色引发错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74260702/