@@ -23,6 +23,10 @@ func TestAccPostgresqlDefaultPrivileges(t *testing.T) {
2323 // Set default privileges to the test role then to public (i.e.: everyone)
2424 for _ , role := range []string {roleName , "public" } {
2525 t .Run (role , func (t * testing.T ) {
26+ withGrant := true
27+ if role == "public" {
28+ withGrant = false
29+ }
2630
2731 // We set PGUSER as owner as he will create the test table
2832 var tfConfig = fmt .Sprintf (`
@@ -32,9 +36,10 @@ resource "postgresql_default_privileges" "test_ro" {
3236 role = "%s"
3337 schema = "test_schema"
3438 object_type = "table"
39+ with_grant_option = %t
3540 privileges = %%s
3641}
37- ` , dbName , config .Username , role )
42+ ` , dbName , config .Username , role , withGrant )
3843
3944 resource .Test (t , resource.TestCase {
4045 PreCheck : func () {
@@ -56,6 +61,7 @@ resource "postgresql_default_privileges" "test_ro" {
5661 return testCheckTablesPrivileges (t , dbName , roleName , tables , []string {"SELECT" })
5762 },
5863 resource .TestCheckResourceAttr ("postgresql_default_privileges.test_ro" , "object_type" , "table" ),
64+ resource .TestCheckResourceAttr ("postgresql_default_privileges.test_ro" , "with_grant_option" , fmt .Sprintf ("%t" , withGrant )),
5965 resource .TestCheckResourceAttr ("postgresql_default_privileges.test_ro" , "privileges.#" , "1" ),
6066 resource .TestCheckResourceAttr ("postgresql_default_privileges.test_ro" , "privileges.3138006342" , "SELECT" ),
6167 ),
0 commit comments