terraform_modules/digitalocean_database_cluster: pass necessary flags to psql

This commit is contained in:
ryan-distrust.co 2023-05-15 00:03:44 -04:00
parent 624a23d729
commit c06e656e62
Signed by untrusted user who does not match committer: ryan
GPG Key ID: 8E401478A3FBEF72
1 changed files with 13 additions and 3 deletions

View File

@ -39,13 +39,23 @@ resource "digitalocean_database_user" "default_users" {
name = each.key name = each.key
provisioner "local-exec" { provisioner "local-exec" {
command = "GRANT ALL ON DATABASE ${each.key} TO ${each.key}" command = "GRANT ALL ON DATABASE ${each.key} TO ${each.key};"
interpreter = ["psql", "${local.base_connection_string}/${each.key}"] interpreter = [
"psql",
"-v", "ON_ERROR_STOP=1",
"${local.base_connection_string}/${each.key}",
"-c"
]
} }
provisioner "local-exec" { provisioner "local-exec" {
command = "GRANT ALL ON SCHEMA public TO ${each.key}" command = "GRANT ALL ON SCHEMA public TO ${each.key}"
interpreter = ["psql", "${local.base_connection_string}/${each.key}"] interpreter = [
"psql",
"-v", "ON_ERROR_STOP=1",
"${local.base_connection_string}/${each.key}",
"-c"
]
} }
# Note: provisioners depend on databases existing # Note: provisioners depend on databases existing