Name | Version |
---|---|
terraform | >= 1.0.2 |
azurerm | ~> 3.58 |
postgresql | ~> 1.17 |
random | ~> 3.5 |
Name | Version |
---|---|
azurerm | ~> 3.58 |
postgresql | ~> 1.17 |
random | ~> 3.5 |
Name | Type |
---|---|
azurerm_postgresql_flexible_server.main | resource |
azurerm_postgresql_flexible_server_active_directory_administrator.admin | resource |
azurerm_postgresql_flexible_server_database.databases | resource |
azurerm_postgresql_flexible_server_firewall_rule.allow_all | resource |
azurerm_postgresql_flexible_server_firewall_rule.firewall | resource |
postgresql_grant.database_grants | resource |
postgresql_role.roles | resource |
random_password.db_admin | resource |
random_password.roles | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
ad_admin | n/a | object({ |
n/a | yes |
databases | n/a | map(object({ |
n/a | yes |
firewall | n/a | object({ |
n/a | yes |
maintenance_window | n/a | object({ |
{} |
no |
resource_group | n/a | object({ |
n/a | yes |
server | n/a | object({ |
n/a | yes |
tags | n/a | map(string) |
n/a | yes |
Name | Description |
---|---|
ad_roles | n/a |
ad_setup_config | n/a |
ad_setup_script | n/a |
administrator_login | n/a |
administrator_password | n/a |
postresql_server_id | n/a |
roles | n/a |
server_fqdn | n/a |
server_id | n/a |
Postgres provider cannot create AD roles (it cannot login via AD). Instead a setup script is generated. Two outputs are defined
ad_setup_script
- contents of provision_psql.shad_setup_config
- setup SQL script and credentials to the server
To use the script you need to output them in the root module.
module "postgresql" {
source = "../postgresql"
// clipped
}
output "postgres_ad_roles_config" {
value = module.postgresql.ad_setup_config
sensitive = true
}
// Script assumes this output name by default
output "postgres_ad_roles_script" {
value = module.postgresql.ad_setup_script
sensitive = false
}
You can setup roles via a one-liner tf output -raw postgres_ad_roles_script | bash
or export the script to a file.
You need to have psql
CLI installed to run the script.