Skip to content

Commit 62f0981

Browse files
author
Eduardo Lopez
authored
[feature]Snowflake: ALL modules output privileges granted (#277)
### Summary ALL modules output privileges granted ### Test Plan Using in internal repo
1 parent 8221db9 commit 62f0981

File tree

26 files changed

+132
-9
lines changed

26 files changed

+132
-9
lines changed

scripts/snowflake_generate_grant_all/main.go

+9
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ type ModuleTemplate struct {
4545

4646
// required_providers: provider_name: version
4747
Terraform map[string]map[string]map[string]string `json:"terraform,omitempty"`
48+
49+
// output name: arguments : values
50+
Outputs map[string]map[string]interface{} `json:"output,omitempty"`
4851
}
4952

5053
func main() {
@@ -116,6 +119,12 @@ func generateModule(name string, grant *resources.TerraformGrantResource) ([]byt
116119
Locals: map[string]interface{}{
117120
"privileges": privileges,
118121
},
122+
Outputs: map[string]map[string]interface{}{
123+
"privileges": {
124+
"value": "${local.privileges}",
125+
"description": "Privileges that make up the ALL set.",
126+
},
127+
},
119128
Terraform: map[string]map[string]map[string]string{
120129
"required_providers": {
121130
"snowflake": map[string]string{

snowflake-account-grant-all/README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
## Outputs
2323

24-
No output.
24+
| Name | Description |
25+
|------|-------------|
26+
| privileges | Privileges that make up the ALL set. |
2527

2628
<!-- END -->

snowflake-account-grant-all/main.tf.json

+6
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,11 @@
4747
"version": "\u003e= 0.20.0"
4848
}
4949
}
50+
},
51+
"output": {
52+
"privileges": {
53+
"description": "Privileges that make up the ALL set.",
54+
"value": "${local.privileges}"
55+
}
5056
}
5157
}

snowflake-database-grant-all/README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
## Outputs
2525

26-
No output.
26+
| Name | Description |
27+
|------|-------------|
28+
| privileges | Privileges that make up the ALL set. |
2729

2830
<!-- END -->

snowflake-database-grant-all/main.tf.json

+6
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,11 @@
5757
"version": "\u003e= 0.20.0"
5858
}
5959
}
60+
},
61+
"output": {
62+
"privileges": {
63+
"description": "Privileges that make up the ALL set.",
64+
"value": "${local.privileges}"
65+
}
6066
}
6167
}

snowflake-external-table-grant-all/main.tf.json

+6
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,11 @@
7070
"version": "\u003e= 0.20.0"
7171
}
7272
}
73+
},
74+
"output": {
75+
"privileges": {
76+
"description": "Privileges that make up the ALL set.",
77+
"value": "${local.privileges}"
78+
}
7379
}
7480
}

snowflake-file-format-grant-all/main.tf.json

+6
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,11 @@
6464
"version": "\u003e= 0.20.0"
6565
}
6666
}
67+
},
68+
"output": {
69+
"privileges": {
70+
"description": "Privileges that make up the ALL set.",
71+
"value": "${local.privileges}"
72+
}
6773
}
6874
}

snowflake-function-grant-all/main.tf.json

+6
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,11 @@
8282
"version": "\u003e= 0.20.0"
8383
}
8484
}
85+
},
86+
"output": {
87+
"privileges": {
88+
"description": "Privileges that make up the ALL set.",
89+
"value": "${local.privileges}"
90+
}
8591
}
8692
}

snowflake-integration-grant-all/README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
## Outputs
2424

25-
No output.
25+
| Name | Description |
26+
|------|-------------|
27+
| privileges | Privileges that make up the ALL set. |
2628

2729
<!-- END -->

snowflake-integration-grant-all/main.tf.json

+6
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,11 @@
4646
"version": "\u003e= 0.20.0"
4747
}
4848
}
49+
},
50+
"output": {
51+
"privileges": {
52+
"description": "Privileges that make up the ALL set.",
53+
"value": "${local.privileges}"
54+
}
4955
}
5056
}

snowflake-materialized-view-grant-all/main.tf.json

+6
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,11 @@
7070
"version": "\u003e= 0.20.0"
7171
}
7272
}
73+
},
74+
"output": {
75+
"privileges": {
76+
"description": "Privileges that make up the ALL set.",
77+
"value": "${local.privileges}"
78+
}
7379
}
7480
}

snowflake-procedure-grant-all/main.tf.json

+6
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,11 @@
8282
"version": "\u003e= 0.20.0"
8383
}
8484
}
85+
},
86+
"output": {
87+
"privileges": {
88+
"description": "Privileges that make up the ALL set.",
89+
"value": "${local.privileges}"
90+
}
8591
}
8692
}

snowflake-resource-monitor-grant-all/README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
## Outputs
2424

25-
No output.
25+
| Name | Description |
26+
|------|-------------|
27+
| privileges | Privileges that make up the ALL set. |
2628

2729
<!-- END -->

snowflake-resource-monitor-grant-all/main.tf.json

+6
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,11 @@
4646
"version": "\u003e= 0.20.0"
4747
}
4848
}
49+
},
50+
"output": {
51+
"privileges": {
52+
"description": "Privileges that make up the ALL set.",
53+
"value": "${local.privileges}"
54+
}
4955
}
5056
}

snowflake-schema-grant-all/README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
## Outputs
2727

28-
No output.
28+
| Name | Description |
29+
|------|-------------|
30+
| privileges | Privileges that make up the ALL set. |
2931

3032
<!-- END -->

snowflake-schema-grant-all/main.tf.json

+6
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,11 @@
8181
"version": "\u003e= 0.20.0"
8282
}
8383
}
84+
},
85+
"output": {
86+
"privileges": {
87+
"description": "Privileges that make up the ALL set.",
88+
"value": "${local.privileges}"
89+
}
8490
}
8591
}

snowflake-sequence-grant-all/main.tf.json

+6
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,11 @@
6464
"version": "\u003e= 0.20.0"
6565
}
6666
}
67+
},
68+
"output": {
69+
"privileges": {
70+
"description": "Privileges that make up the ALL set.",
71+
"value": "${local.privileges}"
72+
}
6773
}
6874
}

snowflake-stage-grant-all/README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626

2727
## Outputs
2828

29-
No output.
29+
| Name | Description |
30+
|------|-------------|
31+
| privileges | Privileges that make up the ALL set. |
3032

3133
<!-- END -->

snowflake-stage-grant-all/main.tf.json

+6
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,11 @@
7272
"version": "\u003e= 0.20.0"
7373
}
7474
}
75+
},
76+
"output": {
77+
"privileges": {
78+
"description": "Privileges that make up the ALL set.",
79+
"value": "${local.privileges}"
80+
}
7581
}
7682
}

snowflake-stream-grant-all/main.tf.json

+6
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,11 @@
6464
"version": "\u003e= 0.20.0"
6565
}
6666
}
67+
},
68+
"output": {
69+
"privileges": {
70+
"description": "Privileges that make up the ALL set.",
71+
"value": "${local.privileges}"
72+
}
6773
}
6874
}

snowflake-table-grant-all/README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626

2727
## Outputs
2828

29-
No output.
29+
| Name | Description |
30+
|------|-------------|
31+
| privileges | Privileges that make up the ALL set. |
3032

3133
<!-- END -->

snowflake-table-grant-all/main.tf.json

+6
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,11 @@
7575
"version": "\u003e= 0.20.0"
7676
}
7777
}
78+
},
79+
"output": {
80+
"privileges": {
81+
"description": "Privileges that make up the ALL set.",
82+
"value": "${local.privileges}"
83+
}
7884
}
7985
}

snowflake-view-grant-all/README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626

2727
## Outputs
2828

29-
No output.
29+
| Name | Description |
30+
|------|-------------|
31+
| privileges | Privileges that make up the ALL set. |
3032

3133
<!-- END -->

snowflake-view-grant-all/main.tf.json

+6
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,11 @@
7070
"version": "\u003e= 0.20.0"
7171
}
7272
}
73+
},
74+
"output": {
75+
"privileges": {
76+
"description": "Privileges that make up the ALL set.",
77+
"value": "${local.privileges}"
78+
}
7379
}
7480
}

snowflake-warehouse-grant-all/README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
## Outputs
2424

25-
No output.
25+
| Name | Description |
26+
|------|-------------|
27+
| privileges | Privileges that make up the ALL set. |
2628

2729
<!-- END -->

snowflake-warehouse-grant-all/main.tf.json

+6
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,11 @@
4949
"version": "\u003e= 0.20.0"
5050
}
5151
}
52+
},
53+
"output": {
54+
"privileges": {
55+
"description": "Privileges that make up the ALL set.",
56+
"value": "${local.privileges}"
57+
}
5258
}
5359
}

0 commit comments

Comments
 (0)