Skip to content

Commit

Permalink
[feature]Snowflake: ALL modules output privileges granted (#277)
Browse files Browse the repository at this point in the history
### Summary
ALL modules output privileges granted

### Test Plan
Using in internal repo
  • Loading branch information
Eduardo Lopez authored Jan 19, 2021
1 parent 8221db9 commit 62f0981
Show file tree
Hide file tree
Showing 26 changed files with 132 additions and 9 deletions.
9 changes: 9 additions & 0 deletions scripts/snowflake_generate_grant_all/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ type ModuleTemplate struct {

// required_providers: provider_name: version
Terraform map[string]map[string]map[string]string `json:"terraform,omitempty"`

// output name: arguments : values
Outputs map[string]map[string]interface{} `json:"output,omitempty"`
}

func main() {
Expand Down Expand Up @@ -116,6 +119,12 @@ func generateModule(name string, grant *resources.TerraformGrantResource) ([]byt
Locals: map[string]interface{}{
"privileges": privileges,
},
Outputs: map[string]map[string]interface{}{
"privileges": {
"value": "${local.privileges}",
"description": "Privileges that make up the ALL set.",
},
},
Terraform: map[string]map[string]map[string]string{
"required_providers": {
"snowflake": map[string]string{
Expand Down
4 changes: 3 additions & 1 deletion snowflake-account-grant-all/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

## Outputs

No output.
| Name | Description |
|------|-------------|
| privileges | Privileges that make up the ALL set. |

<!-- END -->
6 changes: 6 additions & 0 deletions snowflake-account-grant-all/main.tf.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,11 @@
"version": "\u003e= 0.20.0"
}
}
},
"output": {
"privileges": {
"description": "Privileges that make up the ALL set.",
"value": "${local.privileges}"
}
}
}
4 changes: 3 additions & 1 deletion snowflake-database-grant-all/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

## Outputs

No output.
| Name | Description |
|------|-------------|
| privileges | Privileges that make up the ALL set. |

<!-- END -->
6 changes: 6 additions & 0 deletions snowflake-database-grant-all/main.tf.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,11 @@
"version": "\u003e= 0.20.0"
}
}
},
"output": {
"privileges": {
"description": "Privileges that make up the ALL set.",
"value": "${local.privileges}"
}
}
}
6 changes: 6 additions & 0 deletions snowflake-external-table-grant-all/main.tf.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,11 @@
"version": "\u003e= 0.20.0"
}
}
},
"output": {
"privileges": {
"description": "Privileges that make up the ALL set.",
"value": "${local.privileges}"
}
}
}
6 changes: 6 additions & 0 deletions snowflake-file-format-grant-all/main.tf.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,11 @@
"version": "\u003e= 0.20.0"
}
}
},
"output": {
"privileges": {
"description": "Privileges that make up the ALL set.",
"value": "${local.privileges}"
}
}
}
6 changes: 6 additions & 0 deletions snowflake-function-grant-all/main.tf.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,11 @@
"version": "\u003e= 0.20.0"
}
}
},
"output": {
"privileges": {
"description": "Privileges that make up the ALL set.",
"value": "${local.privileges}"
}
}
}
4 changes: 3 additions & 1 deletion snowflake-integration-grant-all/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

## Outputs

No output.
| Name | Description |
|------|-------------|
| privileges | Privileges that make up the ALL set. |

<!-- END -->
6 changes: 6 additions & 0 deletions snowflake-integration-grant-all/main.tf.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,11 @@
"version": "\u003e= 0.20.0"
}
}
},
"output": {
"privileges": {
"description": "Privileges that make up the ALL set.",
"value": "${local.privileges}"
}
}
}
6 changes: 6 additions & 0 deletions snowflake-materialized-view-grant-all/main.tf.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,11 @@
"version": "\u003e= 0.20.0"
}
}
},
"output": {
"privileges": {
"description": "Privileges that make up the ALL set.",
"value": "${local.privileges}"
}
}
}
6 changes: 6 additions & 0 deletions snowflake-procedure-grant-all/main.tf.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,11 @@
"version": "\u003e= 0.20.0"
}
}
},
"output": {
"privileges": {
"description": "Privileges that make up the ALL set.",
"value": "${local.privileges}"
}
}
}
4 changes: 3 additions & 1 deletion snowflake-resource-monitor-grant-all/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

## Outputs

No output.
| Name | Description |
|------|-------------|
| privileges | Privileges that make up the ALL set. |

<!-- END -->
6 changes: 6 additions & 0 deletions snowflake-resource-monitor-grant-all/main.tf.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,11 @@
"version": "\u003e= 0.20.0"
}
}
},
"output": {
"privileges": {
"description": "Privileges that make up the ALL set.",
"value": "${local.privileges}"
}
}
}
4 changes: 3 additions & 1 deletion snowflake-schema-grant-all/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

## Outputs

No output.
| Name | Description |
|------|-------------|
| privileges | Privileges that make up the ALL set. |

<!-- END -->
6 changes: 6 additions & 0 deletions snowflake-schema-grant-all/main.tf.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,11 @@
"version": "\u003e= 0.20.0"
}
}
},
"output": {
"privileges": {
"description": "Privileges that make up the ALL set.",
"value": "${local.privileges}"
}
}
}
6 changes: 6 additions & 0 deletions snowflake-sequence-grant-all/main.tf.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,11 @@
"version": "\u003e= 0.20.0"
}
}
},
"output": {
"privileges": {
"description": "Privileges that make up the ALL set.",
"value": "${local.privileges}"
}
}
}
4 changes: 3 additions & 1 deletion snowflake-stage-grant-all/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

## Outputs

No output.
| Name | Description |
|------|-------------|
| privileges | Privileges that make up the ALL set. |

<!-- END -->
6 changes: 6 additions & 0 deletions snowflake-stage-grant-all/main.tf.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,11 @@
"version": "\u003e= 0.20.0"
}
}
},
"output": {
"privileges": {
"description": "Privileges that make up the ALL set.",
"value": "${local.privileges}"
}
}
}
6 changes: 6 additions & 0 deletions snowflake-stream-grant-all/main.tf.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,11 @@
"version": "\u003e= 0.20.0"
}
}
},
"output": {
"privileges": {
"description": "Privileges that make up the ALL set.",
"value": "${local.privileges}"
}
}
}
4 changes: 3 additions & 1 deletion snowflake-table-grant-all/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

## Outputs

No output.
| Name | Description |
|------|-------------|
| privileges | Privileges that make up the ALL set. |

<!-- END -->
6 changes: 6 additions & 0 deletions snowflake-table-grant-all/main.tf.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,11 @@
"version": "\u003e= 0.20.0"
}
}
},
"output": {
"privileges": {
"description": "Privileges that make up the ALL set.",
"value": "${local.privileges}"
}
}
}
4 changes: 3 additions & 1 deletion snowflake-view-grant-all/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

## Outputs

No output.
| Name | Description |
|------|-------------|
| privileges | Privileges that make up the ALL set. |

<!-- END -->
6 changes: 6 additions & 0 deletions snowflake-view-grant-all/main.tf.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,11 @@
"version": "\u003e= 0.20.0"
}
}
},
"output": {
"privileges": {
"description": "Privileges that make up the ALL set.",
"value": "${local.privileges}"
}
}
}
4 changes: 3 additions & 1 deletion snowflake-warehouse-grant-all/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

## Outputs

No output.
| Name | Description |
|------|-------------|
| privileges | Privileges that make up the ALL set. |

<!-- END -->
6 changes: 6 additions & 0 deletions snowflake-warehouse-grant-all/main.tf.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,11 @@
"version": "\u003e= 0.20.0"
}
}
},
"output": {
"privileges": {
"description": "Privileges that make up the ALL set.",
"value": "${local.privileges}"
}
}
}

0 comments on commit 62f0981

Please sign in to comment.