@@ -102,6 +102,46 @@ resource "redshift_grant" "public" {
102
102
})
103
103
}
104
104
105
+ func TestAccRedshiftGrant_TableToPublic (t * testing.T ) {
106
+ config := `
107
+ resource "redshift_grant" "public" {
108
+ group = "public"
109
+
110
+ schema = "pg_catalog"
111
+ object_type = "table"
112
+ objects = ["pg_user_info"]
113
+ privileges = ["select", "update", "insert", "delete", "drop", "references", "rule", "trigger"]
114
+ }
115
+ `
116
+ resource .Test (t , resource.TestCase {
117
+ PreCheck : func () { testAccPreCheck (t ) },
118
+ Providers : testAccProviders ,
119
+ CheckDestroy : func (s * terraform.State ) error { return nil },
120
+ Steps : []resource.TestStep {
121
+ {
122
+ Config : config ,
123
+ Check : resource .ComposeTestCheckFunc (
124
+ resource .TestCheckResourceAttr ("redshift_grant.public" , "id" , "gn:public_ot:table_pg_catalog_pg_user_info" ),
125
+ resource .TestCheckResourceAttr ("redshift_grant.public" , "group" , "public" ),
126
+ resource .TestCheckResourceAttr ("redshift_grant.public" , "schema" , "pg_catalog" ),
127
+ resource .TestCheckResourceAttr ("redshift_grant.public" , "object_type" , "table" ),
128
+ resource .TestCheckResourceAttr ("redshift_grant.public" , "objects.#" , "1" ),
129
+ resource .TestCheckTypeSetElemAttr ("redshift_grant.public" , "objects.*" , "pg_user_info" ),
130
+ resource .TestCheckResourceAttr ("redshift_grant.public" , "privileges.#" , "8" ),
131
+ resource .TestCheckTypeSetElemAttr ("redshift_grant.public" , "privileges.*" , "select" ),
132
+ resource .TestCheckTypeSetElemAttr ("redshift_grant.public" , "privileges.*" , "update" ),
133
+ resource .TestCheckTypeSetElemAttr ("redshift_grant.public" , "privileges.*" , "insert" ),
134
+ resource .TestCheckTypeSetElemAttr ("redshift_grant.public" , "privileges.*" , "delete" ),
135
+ resource .TestCheckTypeSetElemAttr ("redshift_grant.public" , "privileges.*" , "drop" ),
136
+ resource .TestCheckTypeSetElemAttr ("redshift_grant.public" , "privileges.*" , "references" ),
137
+ resource .TestCheckTypeSetElemAttr ("redshift_grant.public" , "privileges.*" , "rule" ),
138
+ resource .TestCheckTypeSetElemAttr ("redshift_grant.public" , "privileges.*" , "trigger" ),
139
+ ),
140
+ },
141
+ },
142
+ })
143
+ }
144
+
105
145
func TestAccRedshiftGrant_BasicDatabase (t * testing.T ) {
106
146
groupNames := []string {
107
147
strings .ReplaceAll (acctest .RandomWithPrefix ("tf_acc_group" ), "-" , "_" ),
0 commit comments