Skip to content

Commit 829734b

Browse files
authored
fix: escape the role and database names (#14)
Signed-off-by: Yoan Blanc <yblanc@edgelab.ch>
1 parent 40d69cb commit 829734b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ In particular:
2626

2727
```hcl
2828
module "foo" {
29-
source = "git@github.com:edgelaboratories/terraform-postgresql-db?ref=v0.4.2"
29+
source = "git@github.com:edgelaboratories/terraform-postgresql-db?ref=v0.4.3"
3030
3131
database = "foo"
3232
owner = "admin" # Optional, default to database name

vault.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ resource "vault_database_secret_backend_role" "owner" {
1414
db_name = var.vault_db_connection_name
1515

1616
creation_statements = concat([
17-
"CREATE ROLE \"{{name}}\" IN ROLE ${each.value} LOGIN PASSWORD '{{password}}' INHERIT VALID UNTIL '{{expiration}}';",
17+
"CREATE ROLE \"{{name}}\" IN ROLE \"${each.value}\" LOGIN PASSWORD '{{password}}' INHERIT VALID UNTIL '{{expiration}}';",
1818

1919
# Automatically SET ROLE to db owner at login
20-
"ALTER ROLE \"{{name}}\" IN DATABASE ${postgresql_database.this.name} SET ROLE ${each.value}",
20+
"ALTER ROLE \"{{name}}\" IN DATABASE \"${postgresql_database.this.name}\" SET ROLE \"${each.value}\";",
2121
])
2222

2323
renew_statements = [

0 commit comments

Comments
 (0)