diff --git a/terraform_modules/digitalocean_database_cluster/main.tf b/terraform_modules/digitalocean_database_cluster/main.tf index 2d34649..9114a10 100644 --- a/terraform_modules/digitalocean_database_cluster/main.tf +++ b/terraform_modules/digitalocean_database_cluster/main.tf @@ -39,13 +39,23 @@ resource "digitalocean_database_user" "default_users" { name = each.key provisioner "local-exec" { - command = "GRANT ALL ON DATABASE ${each.key} TO ${each.key}" - interpreter = ["psql", "${local.base_connection_string}/${each.key}"] + command = "GRANT ALL ON DATABASE ${each.key} TO ${each.key};" + interpreter = [ + "psql", + "-v", "ON_ERROR_STOP=1", + "${local.base_connection_string}/${each.key}", + "-c" + ] } provisioner "local-exec" { 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