diff --git a/README.md b/README.md
index 688348b..1533f72 100644
--- a/README.md
+++ b/README.md
@@ -146,7 +146,7 @@ List od code and variable (API) changes:
| [granted\_to\_roles](#input\_granted\_to\_roles) | Roles which this role is granted to | `list(string)` | `[]` | no |
| [granted\_to\_users](#input\_granted\_to\_users) | Users which this role is granted to | `list(string)` | `[]` | no |
| [name](#input\_name) | Name of the resource | `string` | n/a | yes |
-| [name\_scheme](#input\_name\_scheme) | Naming scheme configuration for the resource. This configuration is used to generate names using context provider:
- `properties` - list of properties to use when creating the name - is superseded by `var.context_templates`
- `delimiter` - delimited used to create the name from `properties` - is superseded by `var.context_templates`
- `context_template_name` - name of the context template used to create the name
- `replace_chars_regex` - regex to use for replacing characters in property-values created by the provider - any characters that match the regex will be removed from the name
- `extra_values` - map of extra label-value pairs, used to create a name |
object({| `{}` | no | +| [name\_scheme](#input\_name\_scheme) | Naming scheme configuration for the resource. This configuration is used to generate names using context provider:
properties = optional(list(string), ["environment", "name"])
delimiter = optional(string, "_")
context_template_name = optional(string, "snowflake-role")
replace_chars_regex = optional(string, "[^a-zA-Z0-9_]")
extra_values = optional(map(string))
})
object({| `{}` | no | | [role\_ownership\_grant](#input\_role\_ownership\_grant) | The name of the role to grant ownership | `string` | `null` | no | | [schema\_grants](#input\_schema\_grants) | Grants on a schema level |
properties = optional(list(string), ["environment", "name"])
delimiter = optional(string, "_")
context_template_name = optional(string, "snowflake-role")
replace_chars_regex = optional(string, "[^a-zA-Z0-9_]")
extra_values = optional(map(string))
uppercase = optional(bool, true)
})
list(object({| `[]` | no | | [schema\_objects\_grants](#input\_schema\_objects\_grants) | Grants on a schema object level
all_privileges = optional(bool)
with_grant_option = optional(bool, false)
privileges = optional(list(string), null)
all_schemas_in_database = optional(bool, false)
future_schemas_in_database = optional(bool, false)
database_name = string
schema_name = optional(string, null)
}))
schema_objects_grants = {Note: If you don't provide a schema\_name, the grants will be created for all objects of that type in the database.
"TABLE" = [
{
privileges = ["SELECT"]
object_name = snowflake_table.table_1.name
schema_name = snowflake_schema.this.name
},
{
all_privileges = true
object_name = snowflake_table.table_2.name
schema_name = snowflake_schema.this.name
}
]
"ALERT" = [
{
all_privileges = true
on_future = true
on_all = true
}
]
}
map(list(object({| `{}` | no | @@ -166,7 +166,7 @@ No modules. | Name | Version | |------|---------| | [context](#provider\_context) | >=0.4.0 | -| [snowflake](#provider\_snowflake) | ~> 0.94 | +| [snowflake](#provider\_snowflake) | >= 0.94 | ## Requirements @@ -174,7 +174,7 @@ No modules. |------|---------| | [terraform](#requirement\_terraform) | >= 1.3 | | [context](#requirement\_context) | >=0.4.0 | -| [snowflake](#requirement\_snowflake) | ~> 0.94 | +| [snowflake](#requirement\_snowflake) | >= 0.94 | ## Resources diff --git a/examples/complete/main.tf b/examples/complete/main.tf index e779af5..565f720 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -158,13 +158,14 @@ module "snowflake_role_1" { module "snowflake_role_2" { source = "../../" - name = "SAMPLE_TEST_2" + name = "sample_test_2" context_templates = var.context_templates name_scheme = { context_template_name = "snowflake-project-role" extra_values = { - project = "PROJECT" + project = "project" } + uppercase = false } account_grants = [ @@ -186,7 +187,7 @@ module "snowflake_role_2" { module "snowflake_role_3" { source = "../../" - name = "SAMPLE-TEST-3" + name = "sample-test-3" name_scheme = { properties = ["name", "schema", "environment"] delimiter = "_" diff --git a/main.tf b/main.tf index 96b3cb1..93e6781 100644 --- a/main.tf +++ b/main.tf @@ -12,7 +12,7 @@ data "context_label" "this" { } resource "snowflake_account_role" "this" { - name = data.context_label.this.rendered + name = var.name_scheme.uppercase ? upper(data.context_label.this.rendered) : data.context_label.this.rendered comment = var.comment } moved { diff --git a/variables.tf b/variables.tf index d28eeca..2af6f35 100644 --- a/variables.tf +++ b/variables.tf @@ -189,6 +189,7 @@ variable "name_scheme" { context_template_name = optional(string, "snowflake-role") replace_chars_regex = optional(string, "[^a-zA-Z0-9_]") extra_values = optional(map(string)) + uppercase = optional(bool, true) }) default = {} } diff --git a/versions.tf b/versions.tf index 77e3221..a0f09f7 100644 --- a/versions.tf +++ b/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { snowflake = { source = "Snowflake-Labs/snowflake" - version = "~> 0.94" + version = ">= 0.94" } context = { source = "cloudposse/context"
all_privileges = optional(bool)
with_grant_option = optional(bool)
privileges = optional(list(string))
object_name = optional(string)
on_all = optional(bool, false)
schema_name = optional(string)
database_name = string
on_future = optional(bool, false)
})))