Skip to content
This repository was archived by the owner on Jan 17, 2025. It is now read-only.

Commit 74a2b71

Browse files
committed
Add documentation and example usage
1 parent dde62d4 commit 74a2b71

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

docs/resources/grant.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,22 @@ resource "redshift_grant" "group" {
2828
}
2929
3030
# Granting permissions to execute functions or procedures requires providing their arguments' types
31-
3231
resource "redshift_grant" "user" {
3332
user = "john"
3433
schema = "my_schema"
3534
object_type = "function"
3635
objects = ["my_function(float)"]
3736
privileges = ["execute"]
3837
}
38+
39+
# Granting permission to PUBLIC (GRANT ... TO PUBLIC)
40+
resource "redshift_grant" "public" {
41+
group = "public" // "public" here indicates we want grant TO PUBLIC, not "public" group.
42+
43+
schema = "my_schema"
44+
object_type = "schema"
45+
privileges = ["usage"]
46+
}
3947
```
4048

4149
<!-- schema generated by tfplugindocs -->
@@ -48,7 +56,7 @@ resource "redshift_grant" "user" {
4856

4957
### Optional
5058

51-
- **group** (String) The name of the group to grant privileges on. Either `group` or `user` parameter must be set.
59+
- **group** (String) The name of the group to grant privileges on. Either `group` or `user` parameter must be set. Settings the group name to `public` will result in a `GRANT ... TO PUBLIC` statement.
5260
- **id** (String) The ID of this resource.
5361
- **objects** (Set of String) The objects upon which to grant the privileges. An empty list (the default) means to grant permissions on all objects of the specified type. Ignored when `object_type` is one of (`database`, `schema`).
5462
- **schema** (String) The database schema to grant privileges on.

examples/resources/redshift_grant/resource.tf

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,19 @@ resource "redshift_grant" "group" {
1313
}
1414

1515
# Granting permissions to execute functions or procedures requires providing their arguments' types
16-
1716
resource "redshift_grant" "user" {
1817
user = "john"
1918
schema = "my_schema"
2019
object_type = "function"
2120
objects = ["my_function(float)"]
2221
privileges = ["execute"]
2322
}
23+
24+
# Granting permission to PUBLIC (GRANT ... TO PUBLIC)
25+
resource "redshift_grant" "public" {
26+
group = "public" // "public" here indicates we want grant TO PUBLIC, not "public" group.
27+
28+
schema = "my_schema"
29+
object_type = "schema"
30+
privileges = ["usage"]
31+
}

redshift/resource_redshift_grant.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Defines access privileges for users and groups. Privileges include access optio
6868
Optional: true,
6969
ForceNew: true,
7070
ExactlyOneOf: []string{grantUserAttr, grantGroupAttr},
71-
Description: "The name of the group to grant privileges on. Either `group` or `user` parameter must be set.",
71+
Description: "The name of the group to grant privileges on. Either `group` or `user` parameter must be set. Settings the group name to `public` will result in a `GRANT ... TO PUBLIC` statement.",
7272
},
7373
grantSchemaAttr: {
7474
Type: schema.TypeString,

0 commit comments

Comments
 (0)