[英]Create a Azure PostgreSQL schema using terraform on a Azure PostgreSQL Database
I am able to create a azurerm_postgresql_flexible_server
and azurerm_postgresql_flexible_server_database
using terraform.我能够使用 terraform 创建
azurerm_postgresql_flexible_server
和azurerm_postgresql_flexible_server_database
。
I am not able to create a schema using TF but not able to get much help on documentation.我无法使用 TF 创建模式,但无法获得有关文档的太多帮助。 I also checked https://registry.terraform.io/providers/cyrilgdn/postgresql/latest/docs/resources/postgresql_schema
我还检查了https://registry.terraform.io/providers/cyrilgdn/postgresql/latest/docs/resources/postgresql_schema
but that uses a different provider.但这使用不同的提供者。 I am not sure what am I missing here.
我不确定我在这里错过了什么。
This is the TF template which creates the Azure PostgreSQL server and DB -这是创建 Azure PostgreSQL 服务器和数据库的 TF 模板 -
module "common_modules" {
source = "../modules/Main"
}
provider "azurerm" {
features {}
}
locals {
#Construct Tag Data for Resource
resourceTags = {
environment = var.environment
createdBy = var.createdBy
managedBy = var.managedBy
colorBand = var.colorBand
purpose = var.purpose
lastUpdateOn = formatdate("DD-MM-YYYY hh:mm:ss ZZZ", timestamp())
}
}
resource "azurerm_postgresql_flexible_server" "postgreSQL" {
name = var.postgreSQL
location = var.location
resource_group_name = var.ckeditorResorceGroup
administrator_login = var.postgreSQLAdmin
administrator_password = var.password
sku_name = "B_Standard_B1ms"
version = "13"
storage_mb = 32768
backup_retention_days = 7
geo_redundant_backup_enabled = false
tags = local.resourceTags
}
resource "azurerm_postgresql_flexible_server_database" "postgreSQLDB" {
name = var.postgreSQLDB
server_id = azurerm_postgresql_flexible_server.postgreSQL.id
collation = "en_US.utf8"
charset = "utf8"
}
resource "azurerm_postgresql_flexible_server_firewall_rule" "postgreSQLFirewallRule" {
name = "allow_access_to_azure_services"
server_id = azurerm_postgresql_flexible_server.postgreSQL.id
start_ip_address = "0.0.0.0"
end_ip_address = "0.0.0.0"
}
have a look at https://registry.terraform.io/providers/cyrilgdn/postgresql or https://github.com/cyrilgdn/terraform-provider-postgresql看看https://registry.terraform.io/providers/cyrilgdn/postgresql或https://github.com/cyrilgdn/terraform-provider-postgresql
usable, but you need.network connectivity to resolve names (azure private dns zone) and to connect with postgresql flexible server.可用,但您需要网络连接来解析名称(Azure 专用 dns 区域)并连接到 postgresql 灵活服务器。 The terraform code should run in same .net like flexi server.
terraform 代码应该像 flexi 服务器一样在相同的 .net 中运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.