diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml
index 652dff0..4e06095 100644
--- a/.github/workflows/pre-commit.yml
+++ b/.github/workflows/pre-commit.yml
@@ -13,6 +13,6 @@ jobs:
main:
uses: getindata/github-workflows/.github/workflows/tf-pre-commit.yml@v1
with:
- # tflint v0.46.0 is the latest version we can use with pre-commit v0.1.20
+ # tflint v0.52.0 is the latest version we can use with pre-commit v0.1.23
# See .pre-commit-config.yaml for more details.
- tflint-version: v0.46.0
+ tflint-version: v0.52.0
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 2c59029..1f08dec 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,30 +1,26 @@
repos:
- repo: https://github.com/gruntwork-io/pre-commit
- # Stick to v0.1.20 until this bug is fixed: https://github.com/gruntwork-io/pre-commit/issues/102
# When updating, also check if tflint version in pre-commit workflow can be updated.
- rev: "v0.1.20" # Get the latest from: https://github.com/gruntwork-io/pre-commit/releases
+ rev: "v0.1.23" # Get the latest from: https://github.com/gruntwork-io/pre-commit/releases
hooks:
- id: terraform-validate # It should be the first step as it runs terraform init required by tflint
- id: terraform-fmt
- id: tflint
- args:
- - --module
- - --config=.tflint.hcl
- repo: https://github.com/terraform-docs/terraform-docs
- rev: "v0.16.0" # Get the latest from: https://github.com/terraform-docs/terraform-docs/releases
+ rev: "v0.18.0" # Get the latest from: https://github.com/terraform-docs/terraform-docs/releases
hooks:
- id: terraform-docs-go
args: ["."]
- repo: https://github.com/bridgecrewio/checkov.git
- rev: "2.5.13" # Get the latest from: https://github.com/bridgecrewio/checkov/releases
+ rev: "3.2.192" # Get the latest from: https://github.com/bridgecrewio/checkov/releases
hooks:
- id: checkov
args: [--skip-check, "CKV_TF_1"] # Terraform module sources do not use a git url with a commit hash revision
- repo: https://github.com/pre-commit/pre-commit-hooks
- rev: "v4.5.0" # Get the latest from: https://github.com/pre-commit/pre-commit-hooks/releases
+ rev: "v4.6.0" # Get the latest from: https://github.com/pre-commit/pre-commit-hooks/releases
hooks:
- id: check-merge-conflict
args: ["--assume-in-merge"]
diff --git a/.terraform-docs.yml b/.terraform-docs.yml
index 5d31cc9..f6ffcef 100644
--- a/.terraform-docs.yml
+++ b/.terraform-docs.yml
@@ -6,6 +6,10 @@ sections:
hide: []
show: [all]
+recursive:
+ enabled: true
+ path: examples
+
content: |-
{{ .Header }}
diff --git a/.tflint.hcl b/.tflint.hcl
deleted file mode 100644
index 6a33dcb..0000000
--- a/.tflint.hcl
+++ /dev/null
@@ -1,16 +0,0 @@
-config {
- ignore_module = {
- "Invicton-Labs/deepmerge/null" = true
- }
-}
-
-plugin "terraform" {
- enabled = true
- version = "0.5.0"
- source = "github.com/terraform-linters/tflint-ruleset-terraform"
- preset = "all"
-}
-
-rule "terraform_standard_module_structure" {
- enabled = false # Fails on context.tf
-}
diff --git a/README.md b/README.md
index 6222c10..169dcac 100644
--- a/README.md
+++ b/README.md
@@ -15,11 +15,11 @@
Terraform module for Snowflake stage management.
* Creates Snowflake stage
-* Can create custom Snowflake roles with role-to-role, role-to-user assignments
+* Can create custom Snowflake databse-roles with role-to-role assignments
* Can create a set of default roles to simplify access management:
* `READONLY` - granted `USAGE` or `READ` privilages
* `READWRITE` - granted `WRITE` privilages
- * `ADMIN` - Full access, including schema options like `url` and `credentials`
+ * `ADMIN` -
## USAGE
@@ -59,7 +59,7 @@ module "snowflake_stage" {
| [comment](#input\_comment) | Specifies a comment for the stage | `string` | `null` | no |
| [context](#input\_context) | Single object for setting entire context at once.
See description of individual variables for details.
Leave string and numeric variables as `null` to use default value.
Individual variable settings (non-null) override settings in context object,
except for attributes, tags, and additional\_tag\_map, which are merged. | `any` |
{
"additional_tag_map": {},
"attributes": [],
"delimiter": null,
"descriptor_formats": {},
"enabled": true,
"environment": null,
"id_length_limit": null,
"label_key_case": null,
"label_order": [],
"label_value_case": null,
"labels_as_tags": [
"unset"
],
"name": null,
"namespace": null,
"regex_replace_chars": null,
"stage": null,
"tags": {},
"tenant": null
}
| no |
| [copy\_options](#input\_copy\_options) | Specifies the copy options for the stage | `string` | `null` | no |
-| [create\_default\_roles](#input\_create\_default\_roles) | Whether the default roles should be created | `bool` | `false` | no |
+| [create\_default\_databse\_roles](#input\_create\_default\_databse\_roles) | Whether the default database roles should be created | `bool` | `false` | no |
| [credentials](#input\_credentials) | Specifies the credentials for the stage | `string` | `null` | no |
| [database](#input\_database) | The database in which to create the stage | `string` | n/a | yes |
| [delimiter](#input\_delimiter) | Delimiter to be used between ID elements.
Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no |
@@ -78,10 +78,11 @@ module "snowflake_stage" {
| [name](#input\_name) | ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.
This is the only ID element not also included as a `tag`.
The "name" tag is set to the full `id` string. There is no tag with the value of the `name` input. | `string` | `null` | no |
| [namespace](#input\_namespace) | ID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp', to help ensure generated IDs are globally unique | `string` | `null` | no |
| [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.
Characters matching the regex will be removed from the ID elements.
If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no |
-| [roles](#input\_roles) | Roles created in the database scope | map(object({
enabled = optional(bool, true)
comment = optional(string)
role_ownership_grant = optional(string)
granted_roles = optional(list(string))
granted_to_roles = optional(list(string))
granted_to_users = optional(list(string))
stage_grants = optional(list(string))
}))
| `{}` | no |
+| [roles](#input\_roles) | Database roles created in the stage scope | map(object({
with_grant_option = optional(bool)
parent_database_role = optional(string)
granted_database_roles = optional(list(string))
stage_grants = optional(list(string))
all_privileges = optional(bool)
on_all = optional(bool, false)
schema_name = optional(string)
on_future = optional(bool, false)
}))
| `{}` | no |
| [schema](#input\_schema) | The schema in which to create the stage | `string` | n/a | yes |
| [snowflake\_iam\_user](#input\_snowflake\_iam\_user) | Specifies the Snowflake IAM user | `string` | `null` | no |
| [stage](#input\_stage) | ID element. Usually used to indicate role, e.g. 'prod', 'staging', 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no |
+| [stage\_ownership\_grant](#input\_stage\_ownership\_grant) | To which role the stage ownership should be granted | `string` | `null` | no |
| [storage\_integration](#input\_storage\_integration) | Specifies the name of the storage integration used to delegate authentication responsibility for external cloud storage to a Snowflake identity and access management (IAM) entity | `string` | `null` | no |
| [tags](#input\_tags) | Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).
Neither the tag keys nor the tag values will be modified by this module. | `map(string)` | `{}` | no |
| [tenant](#input\_tenant) | ID element \_(Rarely used, not included by default)\_. A customer identifier, indicating who this instance of a resource is for | `string` | `null` | no |
@@ -92,8 +93,7 @@ module "snowflake_stage" {
| Name | Source | Version |
|------|--------|---------|
| [roles\_deep\_merge](#module\_roles\_deep\_merge) | Invicton-Labs/deepmerge/null | 0.1.5 |
-| [snowflake\_custom\_role](#module\_snowflake\_custom\_role) | getindata/role/snowflake | 1.0.3 |
-| [snowflake\_default\_role](#module\_snowflake\_default\_role) | getindata/role/snowflake | 1.0.3 |
+| [snowflake\_database\_role](#module\_snowflake\_database\_role) | getindata/database-role/snowflake | 1.0.0 |
| [stage\_label](#module\_stage\_label) | cloudposse/label/null | 0.25.0 |
| [this](#module\_this) | cloudposse/label/null | 0.25.0 |
@@ -108,21 +108,21 @@ module "snowflake_stage" {
| Name | Version |
|------|---------|
-| [snowflake](#provider\_snowflake) | ~> 0.54 |
+| [snowflake](#provider\_snowflake) | ~> 0.90 |
## Requirements
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.3 |
-| [snowflake](#requirement\_snowflake) | ~> 0.54 |
+| [snowflake](#requirement\_snowflake) | ~> 0.90 |
## Resources
| Name | Type |
|------|------|
+| [snowflake_grant_ownership.stage_ownership](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/resources/grant_ownership) | resource |
| [snowflake_stage.this](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/resources/stage) | resource |
-| [snowflake_stage_grant.this](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/resources/stage_grant) | resource |
## CONTRIBUTING
diff --git a/examples/complete/.env.dist b/examples/complete/.env.dist
index 9bace73..7776535 100644
--- a/examples/complete/.env.dist
+++ b/examples/complete/.env.dist
@@ -2,4 +2,4 @@ SNOWFLAKE_USER=
SNOWFLAKE_PASSWORD=
SNOWFLAKE_ROLE=
SNOWFLAKE_ACCOUNT=
-SNOWFLAKE_REGION=
\ No newline at end of file
+SNOWFLAKE_REGION=
diff --git a/examples/complete/README.md b/examples/complete/README.md
index 5beace4..e056d4f 100644
--- a/examples/complete/README.md
+++ b/examples/complete/README.md
@@ -1,56 +1,92 @@
# Complete Example
-```terraform
-module "snowflake_admin_role" {
- source = "getindata/role/snowflake"
- version = "1.0.3"
- context = module.this.context
- name = "admin"
-}
-
-module "snowflake_dev_role" {
- source = "getindata/role/snowflake"
- version = "1.0.3"
- context = module.this.context
- name = "dev"
-}
-
-resource "snowflake_database" "this" {
- name = "MY_DATABASE"
-}
-
-resource "snowflake_schema" "this" {
- name = "MY_SCHEMA"
- database = snowflake_database.this.name
-}
-
-module "internal_stage" {
- source = "../../"
- context = module.this.context
-
- name = "my_stage"
- schema = snowflake_schema.this.name
- database = snowflake_database.this.name
-
- comment = "This is my stage"
-
- create_default_roles = true
- roles = {
- readonly = {
- granted_to_roles = [module.snowflake_dev_role.name]
- }
- admin = {
- granted_to_roles = [module.snowflake_admin_role.name]
- }
- }
-}
-```
+This is complete usage example of `snowflake-stage` terraform module.
## Usage
Populate `.env` file with Snowflake credentials and make sure it's sourced to your shell.
+## How to plan
+
+```shell
+terraform init
+terraform plan -var-file=fixtures.tfvars
```
+
+## How to apply
+
+```shell
terraform init
-terraform plan -var-file fixtures.tfvars -out tfplan
-terraform apply tfplan
+terraform apply -var-file=fixtures.tfvars
+```
+
+## How to destroy
+If `stage_ownership_grant` was used, first you need to hash out this line, `terraform apply -var-file=fixtures.tfvars` and then:
+```shell
+terraform destroy -var-file=fixtures.tfvars
```
+
+
+
+
+
+
+
+## Inputs
+
+| Name | Description | Type | Default | Required |
+|------|-------------|------|---------|:--------:|
+| [additional\_tag\_map](#input\_additional\_tag\_map) | Additional key-value pairs to add to each map in `tags_as_list_of_maps`. Not added to `tags` or `id`.
This is for some rare cases where resources want additional configuration of tags
and therefore take a list of maps with tag key, value, and additional configuration. | `map(string)` | `{}` | no |
+| [attributes](#input\_attributes) | ID element. Additional attributes (e.g. `workers` or `cluster`) to add to `id`,
in the order they appear in the list. New attributes are appended to the
end of the list. The elements of the list are joined by the `delimiter`
and treated as a single ID element. | `list(string)` | `[]` | no |
+| [context](#input\_context) | Single object for setting entire context at once.
See description of individual variables for details.
Leave string and numeric variables as `null` to use default value.
Individual variable settings (non-null) override settings in context object,
except for attributes, tags, and additional\_tag\_map, which are merged. | `any` | {
"additional_tag_map": {},
"attributes": [],
"delimiter": null,
"descriptor_formats": {},
"enabled": true,
"environment": null,
"id_length_limit": null,
"label_key_case": null,
"label_order": [],
"label_value_case": null,
"labels_as_tags": [
"unset"
],
"name": null,
"namespace": null,
"regex_replace_chars": null,
"stage": null,
"tags": {},
"tenant": null
}
| no |
+| [delimiter](#input\_delimiter) | Delimiter to be used between ID elements.
Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no |
+| [descriptor\_formats](#input\_descriptor\_formats) | Describe additional descriptors to be output in the `descriptors` output map.
Map of maps. Keys are names of descriptors. Values are maps of the form
`{
format = string
labels = list(string)
}`
(Type is `any` so the map values can later be enhanced to provide additional options.)
`format` is a Terraform format string to be passed to the `format()` function.
`labels` is a list of labels, in order, to pass to `format()` function.
Label values will be normalized before being passed to `format()` so they will be
identical to how they appear in `id`.
Default is `{}` (`descriptors` output will be empty). | `any` | `{}` | no |
+| [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no |
+| [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no |
+| [id\_length\_limit](#input\_id\_length\_limit) | Limit `id` to this many characters (minimum 6).
Set to `0` for unlimited length.
Set to `null` for keep the existing setting, which defaults to `0`.
Does not affect `id_full`. | `number` | `null` | no |
+| [label\_key\_case](#input\_label\_key\_case) | Controls the letter case of the `tags` keys (label names) for tags generated by this module.
Does not affect keys of tags passed in via the `tags` input.
Possible values: `lower`, `title`, `upper`.
Default value: `title`. | `string` | `null` | no |
+| [label\_order](#input\_label\_order) | The order in which the labels (ID elements) appear in the `id`.
Defaults to ["namespace", "environment", "stage", "name", "attributes"].
You can omit any of the 6 labels ("tenant" is the 6th), but at least one must be present. | `list(string)` | `null` | no |
+| [label\_value\_case](#input\_label\_value\_case) | Controls the letter case of ID elements (labels) as included in `id`,
set as tag values, and output by this module individually.
Does not affect values of tags passed in via the `tags` input.
Possible values: `lower`, `title`, `upper` and `none` (no transformation).
Set this to `title` and set `delimiter` to `""` to yield Pascal Case IDs.
Default value: `lower`. | `string` | `null` | no |
+| [labels\_as\_tags](#input\_labels\_as\_tags) | Set of labels (ID elements) to include as tags in the `tags` output.
Default is to include all labels.
Tags with empty values will not be included in the `tags` output.
Set to `[]` to suppress all generated tags.
**Notes:**
The value of the `name` tag, if included, will be the `id`, not the `name`.
Unlike other `null-label` inputs, the initial setting of `labels_as_tags` cannot be
changed in later chained modules. Attempts to change it will be silently ignored. | `set(string)` | [
"default"
]
| no |
+| [name](#input\_name) | ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.
This is the only ID element not also included as a `tag`.
The "name" tag is set to the full `id` string. There is no tag with the value of the `name` input. | `string` | `null` | no |
+| [namespace](#input\_namespace) | ID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp', to help ensure generated IDs are globally unique | `string` | `null` | no |
+| [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.
Characters matching the regex will be removed from the ID elements.
If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no |
+| [stage](#input\_stage) | ID element. Usually used to indicate role, e.g. 'prod', 'staging', 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no |
+| [tags](#input\_tags) | Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).
Neither the tag keys nor the tag values will be modified by this module. | `map(string)` | `{}` | no |
+| [tenant](#input\_tenant) | ID element \_(Rarely used, not included by default)\_. A customer identifier, indicating who this instance of a resource is for | `string` | `null` | no |
+
+## Modules
+
+| Name | Source | Version |
+|------|--------|---------|
+| [internal\_stage](#module\_internal\_stage) | ../../ | n/a |
+| [this](#module\_this) | cloudposse/label/null | 0.25.0 |
+
+## Outputs
+
+| Name | Description |
+|------|-------------|
+| [internal\_stage](#output\_internal\_stage) | Internal stage module outputs |
+
+## Providers
+
+| Name | Version |
+|------|---------|
+| [snowflake](#provider\_snowflake) | ~> 0.90 |
+
+## Requirements
+
+| Name | Version |
+|------|---------|
+| [terraform](#requirement\_terraform) | >= 1.3 |
+| [snowflake](#requirement\_snowflake) | ~> 0.90 |
+
+## Resources
+
+| Name | Type |
+|------|------|
+| [snowflake_database.this](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/resources/database) | resource |
+| [snowflake_database_role.db_role_1](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/resources/database_role) | resource |
+| [snowflake_database_role.db_role_2](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/resources/database_role) | resource |
+| [snowflake_database_role.db_role_3](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/resources/database_role) | resource |
+| [snowflake_schema.this](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/resources/schema) | resource |
+
diff --git a/examples/complete/main.tf b/examples/complete/main.tf
index d2e9b49..9f8784d 100644
--- a/examples/complete/main.tf
+++ b/examples/complete/main.tf
@@ -57,7 +57,7 @@ module "internal_stage" {
}
user_2 = { # User created database role
parent_database_role = snowflake_database_role.db_role_3.name
- stage_grants = [ "READ", "WRITE" ]
+ stage_grants = ["READ", "WRITE"]
with_grant_option = false
on_future = true
on_all = false
diff --git a/examples/simple/.env.dist b/examples/simple/.env.dist
index 9bace73..7776535 100644
--- a/examples/simple/.env.dist
+++ b/examples/simple/.env.dist
@@ -2,4 +2,4 @@ SNOWFLAKE_USER=
SNOWFLAKE_PASSWORD=
SNOWFLAKE_ROLE=
SNOWFLAKE_ACCOUNT=
-SNOWFLAKE_REGION=
\ No newline at end of file
+SNOWFLAKE_REGION=
diff --git a/examples/simple/README.md b/examples/simple/README.md
index e6c2767..6062554 100644
--- a/examples/simple/README.md
+++ b/examples/simple/README.md
@@ -1,20 +1,60 @@
-# Simple Example
+# Simple example
-```terraform
-module "internal_stage" {
- source = "../../"
+This is simple usage example of `snowflake-stage` terraform module.
- name = "my_stage"
- schema = "my_schema"
- database = "my_db"
-}
+## How to plan
+
+```shell
+terraform init
+terraform plan
```
-## Usage
-Populate `.env` file with Snowflake credentials and make sure it's sourced to your shell.
+## How to apply
-```
+```shell
terraform init
-terraform plan -out tfplan
-terraform apply tfplan
+terraform apply
+```
+
+## How to destroy
+
+```shell
+terraform destroy
```
+
+
+
+
+
+
+## Inputs
+
+No inputs.
+
+## Modules
+
+| Name | Source | Version |
+|------|--------|---------|
+| [internal\_stage](#module\_internal\_stage) | ../../ | n/a |
+
+## Outputs
+
+| Name | Description |
+|------|-------------|
+| [internal\_stage](#output\_internal\_stage) | Internal stage module outputs |
+
+## Providers
+
+No providers.
+
+## Requirements
+
+| Name | Version |
+|------|---------|
+| [terraform](#requirement\_terraform) | >= 1.3 |
+| [snowflake](#requirement\_snowflake) | ~> 0.90 |
+
+## Resources
+
+No resources.
+
diff --git a/locals.tf b/locals.tf
index e5e9a44..3b79b8e 100644
--- a/locals.tf
+++ b/locals.tf
@@ -4,7 +4,6 @@ locals {
name_from_descriptor = module.stage_label.enabled ? trim(replace(
lookup(module.stage_label.descriptors, var.descriptor_name, module.stage_label.id), "/${module.stage_label.delimiter}${module.stage_label.delimiter}+/", module.stage_label.delimiter
), module.stage_label.delimiter) : null
- create_default_databse_roles = module.this.enabled && var.create_default_databse_roles
schema_object_stage_name = "\"${one(snowflake_stage.this[*].database)}\".\"${one(snowflake_stage.this[*].schema)}\".\"${one(snowflake_stage.this[*].name)}\""
@@ -26,32 +25,12 @@ locals {
for k, v in role : k => v
if v != null
} }
-
- roles_definition = module.roles_deep_merge.merged
-
- # default_roles = {
- # for role_name, role in local.roles_definition : role_name => role
- # if contains(keys(local.default_roles_definition), role_name)
- # }
- # custom_roles = {
- # for role_name, role in local.roles_definition : role_name => role
- # if !contains(keys(local.default_roles_definition), role_name)
- # }
+ roles_definition = module.roles_deep_merge.merged
roles = {
for role_name, role in local.roles_definition : role_name => role
- # if !contains(keys(local.default_roles_definition), role_name)
}
-
- # roles = {
- # for role_name, role in merge(
- # # module.snowflake_default_database_role,
- # # module.snowflake_custom_database_role
- # module.snowflake_database_role
- # ) : role_name => role
- # if role.name != null
- # }
}
module "roles_deep_merge" {
diff --git a/main.tf b/main.tf
index 8b95165..9d3eea2 100644
--- a/main.tf
+++ b/main.tf
@@ -27,14 +27,11 @@ resource "snowflake_stage" "this" {
url = var.url
}
-# module "snowflake_default_database_role" {
-
module "snowflake_database_role" {
- # for_each = local.create_default_roles ? local.default_roles : {}
for_each = local.roles
- source = "git::ssh://git@github.com/getindata/terraform-snowflake-database-role.git"
- # version = "1.0.0"
+ source = "getindata/database-role/snowflake"
+ version = "1.0.0"
context = module.this.context
database_name = one(snowflake_stage.this[*].database)
@@ -63,43 +60,10 @@ module "snowflake_database_role" {
}
}
-# module "snowflake_custom_database_role" {
-# for_each = local.custom_roles
-
-# source = "git::ssh://git@github.com/getindata/terraform-snowflake-database-role.git"
-# # version = "1.0.0"
-# context = module.this.context
-
-# database_name = one(snowflake_stage.this[*].database)
-# name = each.key
-
-# parent_database_role = lookup(each.value, "parent_database_role", null)
-# granted_database_roles = lookup(each.value, "granted_database_roles", [])
-
-# attributes = [
-# one(snowflake_stage.this[*].schema),
-# one(snowflake_stage.this[*].name)
-# ]
-
-# schema_objects_grants = {
-# "STAGE" = [
-# {
-# privileges = lookup(each.value, "stage_grants", null)
-# all_privileges = lookup(each.value, "all_privileges", null)
-# with_grant_option = lookup(each.value, "with_grant_option", false)
-# on_future = lookup(each.value, "on_future", false)
-# on_all = lookup(each.value, "on_all", false)
-# object_name = (lookup(each.value, "on_future", false) || lookup(each.value, "on_all", false)) ? null : one(snowflake_stage.this[*].name)
-# schema_name = one(snowflake_stage.this[*].schema)
-# }
-# ]
-# }
-# }
-
resource "snowflake_grant_ownership" "stage_ownership" {
count = var.stage_ownership_grant != null ? 1 : 0
- database_role_name = module.snowflake_database_role[var.stage_ownership_grant].fully_qualified_name
+ database_role_name = module.snowflake_database_role[var.stage_ownership_grant].fully_qualified_name
outbound_privileges = "REVOKE"
on {
object_type = "STAGE"
diff --git a/variables.tf b/variables.tf
index 7be9f2f..3c2c40f 100644
--- a/variables.tf
+++ b/variables.tf
@@ -99,4 +99,4 @@ variable "stage_ownership_grant" {
description = "To which role the stage ownership should be granted"
type = string
default = null
-}
\ No newline at end of file
+}