Skip to content

Commit 2d2e9fb

Browse files
authored
Add with_grant_option to postgresql_default_privileges (#10)
1 parent 3e4580e commit 2d2e9fb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

postgresql/resource_postgresql_default_privileges.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ func resourcePostgreSQLDefaultPrivileges() *schema.Resource {
6565
MinItems: 1,
6666
Description: "The list of privileges to apply as default privileges",
6767
},
68+
"with_grant_option": {
69+
Type: schema.TypeBool,
70+
Optional: true,
71+
ForceNew: true,
72+
Default: false,
73+
Description: "Permit the grant recipient to grant it to others",
74+
},
6875
},
6976
}
7077
}
@@ -242,6 +249,10 @@ func grantRoleDefaultPrivileges(txn *sql.Tx, d *schema.ResourceData) error {
242249
pq.QuoteIdentifier(role),
243250
)
244251

252+
if d.Get("with_grant_option").(bool) == true {
253+
query = query + " WITH GRANT OPTION"
254+
}
255+
245256
_, err := txn.Exec(
246257
query,
247258
)

0 commit comments

Comments
 (0)