diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2692f2a..1e6b876 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,27 +1,25 @@ repos: - repo: https://github.com/gruntwork-io/pre-commit - rev: "v0.1.23" # Get the latest from: https://github.com/gruntwork-io/pre-commit/releases + rev: "v0.1.25" # 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: - # - "--config=__GIT_ROOT__/.tflint.hcl" - repo: https://github.com/terraform-docs/terraform-docs - rev: "v0.18.0" # Get the latest from: https://github.com/terraform-docs/terraform-docs/releases + rev: "v0.19.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: "3.2.216" # Get the latest from: https://github.com/bridgecrewio/checkov/releases + rev: "3.2.350" # 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.6.0" # Get the latest from: https://github.com/pre-commit/pre-commit-hooks/releases + rev: "v5.0.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/README.md b/README.md index a4f33e4..00000a8 100644 --- a/README.md +++ b/README.md @@ -113,10 +113,10 @@ List od code and variable (API) changes: | [max\_concurrency\_level](#input\_max\_concurrency\_level) | Object parameter that specifies the concurrency level for SQL statements (i.e. queries and DML) executed by a warehouse. | `number` | `null` | no | | [min\_cluster\_count](#input\_min\_cluster\_count) | Specifies the minimum number of server clusters for the warehouse (only applies to multi-cluster warehouses). | `number` | `1` | 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({
properties = optional(list(string), ["environment", "name"])
delimiter = optional(string, "_")
context_template_name = optional(string, "snowflake-warehouse")
replace_chars_regex = optional(string, "[^a-zA-Z0-9_]")
extra_values = optional(map(string))
})
| `{}` | no | +| [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
- `uppercase` - convert name to uppercase |
object({
properties = optional(list(string), ["environment", "name"])
delimiter = optional(string, "_")
context_template_name = optional(string, "snowflake-warehouse")
replace_chars_regex = optional(string, "[^a-zA-Z0-9_]")
extra_values = optional(map(string))
uppercase = optional(bool, true)
})
| `{}` | no | | [query\_acceleration\_max\_scale\_factor](#input\_query\_acceleration\_max\_scale\_factor) | Specifies the maximum scale factor for leasing compute resources for query acceleration. The scale factor is used as a multiplier based on warehouse size. | `number` | `null` | no | | [resource\_monitor](#input\_resource\_monitor) | Specifies the name of a resource monitor that is explicitly assigned to the warehouse. | `string` | `null` | no | -| [roles](#input\_roles) | Account roles created on the warehouse level |
map(object({
name_scheme = optional(object({
properties = optional(list(string))
delimiter = optional(string)
context_template_name = optional(string)
replace_chars_regex = optional(string)
extra_labels = optional(map(string))
}))
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))
warehouse_grants = optional(object({
all_privileges = optional(bool)
with_grant_option = optional(bool, false)
privileges = optional(list(string))
}))
}))
| `{}` | no | +| [roles](#input\_roles) | Account roles created on the warehouse level |
map(object({
name_scheme = optional(object({
properties = optional(list(string))
delimiter = optional(string)
context_template_name = optional(string)
replace_chars_regex = optional(string)
extra_labels = optional(map(string))
uppercase = optional(bool)
}))
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))
warehouse_grants = optional(object({
all_privileges = optional(bool)
with_grant_option = optional(bool, false)
privileges = optional(list(string))
}))
}))
| `{}` | no | | [scaling\_policy](#input\_scaling\_policy) | Specifies the policy for automatically starting and shutting down clusters in a multi-cluster warehouse running in Auto-scale mode. Valid values are `STANDARD` and `ECONOMY`. | `string` | `null` | no | | [statement\_queued\_timeout\_in\_seconds](#input\_statement\_queued\_timeout\_in\_seconds) | Object parameter that specifies the time, in seconds, a SQL statement (query, DDL, DML, etc.) can be queued on a warehouse before it is canceled by the system. | `number` | `null` | no | | [statement\_timeout\_in\_seconds](#input\_statement\_timeout\_in\_seconds) | Specifies the time, in seconds, after which a running SQL statement (query, DDL, DML, etc.) is canceled by the system | `number` | `null` | no | @@ -128,8 +128,8 @@ List od code and variable (API) changes: | 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 | 3.0.0 | -| [snowflake\_default\_role](#module\_snowflake\_default\_role) | getindata/role/snowflake | 3.0.0 | +| [snowflake\_custom\_role](#module\_snowflake\_custom\_role) | getindata/role/snowflake | 3.1.0 | +| [snowflake\_default\_role](#module\_snowflake\_default\_role) | getindata/role/snowflake | 3.1.0 | ## Outputs diff --git a/examples/complete/main.tf b/examples/complete/main.tf index 8e81eba..0d4459a 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -69,6 +69,7 @@ module "terraform_snowflake_warehouse_2" { extra_values = { project = "project" } + uppercase = false } context_templates = var.context_templates diff --git a/locals.tf b/locals.tf index 41e1784..d2f7754 100644 --- a/locals.tf +++ b/locals.tf @@ -8,6 +8,7 @@ locals { prefix = "whs" warehouse = var.name } + uppercase = var.name_scheme.uppercase } default_roles_definition = { diff --git a/main.tf b/main.tf index b3e87e5..a16f901 100644 --- a/main.tf +++ b/main.tf @@ -12,7 +12,7 @@ data "context_label" "this" { } resource "snowflake_warehouse" "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 warehouse_size = var.warehouse_size @@ -45,7 +45,7 @@ module "snowflake_default_role" { for_each = local.default_roles #{ for role_name, role in local.default_roles : role_name => role if var.create_default_roles } source = "getindata/role/snowflake" - version = "3.0.0" + version = "3.1.0" context_templates = var.context_templates @@ -74,7 +74,7 @@ module "snowflake_custom_role" { for_each = local.custom_roles source = "getindata/role/snowflake" - version = "3.0.0" + version = "3.1.0" context_templates = var.context_templates diff --git a/variables.tf b/variables.tf index 86286fc..1b5c161 100644 --- a/variables.tf +++ b/variables.tf @@ -106,6 +106,7 @@ variable "roles" { context_template_name = optional(string) replace_chars_regex = optional(string) extra_labels = optional(map(string)) + uppercase = optional(bool) })) comment = optional(string) role_ownership_grant = optional(string) @@ -135,6 +136,7 @@ variable "name_scheme" { - `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 + - `uppercase` - convert name to uppercase EOT type = object({ properties = optional(list(string), ["environment", "name"]) @@ -142,6 +144,7 @@ variable "name_scheme" { context_template_name = optional(string, "snowflake-warehouse") replace_chars_regex = optional(string, "[^a-zA-Z0-9_]") extra_values = optional(map(string)) + uppercase = optional(bool, true) }) default = {} }