Skip to content

Commit 579c669

Browse files
authored
Merge pull request #26 from getindata/feature/add_uppercase_naming_flag
feat: Add name_scheme.upper flag, update ci
2 parents 4df9214 + effd1b4 commit 579c669

File tree

6 files changed

+16
-13
lines changed

6 files changed

+16
-13
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
11
repos:
22
- repo: https://github.com/gruntwork-io/pre-commit
3-
rev: "v0.1.23" # Get the latest from: https://github.com/gruntwork-io/pre-commit/releases
3+
rev: "v0.1.25" # Get the latest from: https://github.com/gruntwork-io/pre-commit/releases
44
hooks:
55
- id: terraform-validate # It should be the first step as it runs terraform init required by tflint
66
- id: terraform-fmt
77
- id: tflint
8-
# args:
9-
# - "--config=__GIT_ROOT__/.tflint.hcl"
108

119
- repo: https://github.com/terraform-docs/terraform-docs
12-
rev: "v0.18.0" # Get the latest from: https://github.com/terraform-docs/terraform-docs/releases
10+
rev: "v0.19.0" # Get the latest from: https://github.com/terraform-docs/terraform-docs/releases
1311
hooks:
1412
- id: terraform-docs-go
1513
args: ["."]
1614

1715
- repo: https://github.com/bridgecrewio/checkov.git
18-
rev: "3.2.216" # Get the latest from: https://github.com/bridgecrewio/checkov/releases
16+
rev: "3.2.350" # Get the latest from: https://github.com/bridgecrewio/checkov/releases
1917
hooks:
2018
- id: checkov
2119
args: [--skip-check, "CKV_TF_1"] # Terraform module sources do not use a git url with a commit hash revision
2220

2321
- repo: https://github.com/pre-commit/pre-commit-hooks
24-
rev: "v4.6.0" # Get the latest from: https://github.com/pre-commit/pre-commit-hooks/releases
22+
rev: "v5.0.0" # Get the latest from: https://github.com/pre-commit/pre-commit-hooks/releases
2523
hooks:
2624
- id: check-merge-conflict
2725
args: ["--assume-in-merge"]

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ List od code and variable (API) changes:
113113
| <a name="input_max_concurrency_level"></a> [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 |
114114
| <a name="input_min_cluster_count"></a> [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 |
115115
| <a name="input_name"></a> [name](#input\_name) | Name of the resource | `string` | n/a | yes |
116-
| <a name="input_name_scheme"></a> [name\_scheme](#input\_name\_scheme) | Naming scheme configuration for the resource. This configuration is used to generate names using context provider:<br> - `properties` - list of properties to use when creating the name - is superseded by `var.context_templates`<br> - `delimiter` - delimited used to create the name from `properties` - is superseded by `var.context_templates`<br> - `context_template_name` - name of the context template used to create the name<br> - `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<br> - `extra_values` - map of extra label-value pairs, used to create a name | <pre>object({<br> properties = optional(list(string), ["environment", "name"])<br> delimiter = optional(string, "_")<br> context_template_name = optional(string, "snowflake-warehouse")<br> replace_chars_regex = optional(string, "[^a-zA-Z0-9_]")<br> extra_values = optional(map(string))<br> })</pre> | `{}` | no |
116+
| <a name="input_name_scheme"></a> [name\_scheme](#input\_name\_scheme) | Naming scheme configuration for the resource. This configuration is used to generate names using context provider:<br/> - `properties` - list of properties to use when creating the name - is superseded by `var.context_templates`<br/> - `delimiter` - delimited used to create the name from `properties` - is superseded by `var.context_templates`<br/> - `context_template_name` - name of the context template used to create the name<br/> - `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<br/> - `extra_values` - map of extra label-value pairs, used to create a name<br/> - `uppercase` - convert name to uppercase | <pre>object({<br/> properties = optional(list(string), ["environment", "name"])<br/> delimiter = optional(string, "_")<br/> context_template_name = optional(string, "snowflake-warehouse")<br/> replace_chars_regex = optional(string, "[^a-zA-Z0-9_]")<br/> extra_values = optional(map(string))<br/> uppercase = optional(bool, true)<br/> })</pre> | `{}` | no |
117117
| <a name="input_query_acceleration_max_scale_factor"></a> [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 |
118118
| <a name="input_resource_monitor"></a> [resource\_monitor](#input\_resource\_monitor) | Specifies the name of a resource monitor that is explicitly assigned to the warehouse. | `string` | `null` | no |
119-
| <a name="input_roles"></a> [roles](#input\_roles) | Account roles created on the warehouse level | <pre>map(object({<br> name_scheme = optional(object({<br> properties = optional(list(string))<br> delimiter = optional(string)<br> context_template_name = optional(string)<br> replace_chars_regex = optional(string)<br> extra_labels = optional(map(string))<br> }))<br> comment = optional(string)<br> role_ownership_grant = optional(string)<br> granted_roles = optional(list(string))<br> granted_to_roles = optional(list(string))<br> granted_to_users = optional(list(string))<br> warehouse_grants = optional(object({<br> all_privileges = optional(bool)<br> with_grant_option = optional(bool, false)<br> privileges = optional(list(string))<br> }))<br> }))</pre> | `{}` | no |
119+
| <a name="input_roles"></a> [roles](#input\_roles) | Account roles created on the warehouse level | <pre>map(object({<br/> name_scheme = optional(object({<br/> properties = optional(list(string))<br/> delimiter = optional(string)<br/> context_template_name = optional(string)<br/> replace_chars_regex = optional(string)<br/> extra_labels = optional(map(string))<br/> uppercase = optional(bool)<br/> }))<br/> comment = optional(string)<br/> role_ownership_grant = optional(string)<br/> granted_roles = optional(list(string))<br/> granted_to_roles = optional(list(string))<br/> granted_to_users = optional(list(string))<br/> warehouse_grants = optional(object({<br/> all_privileges = optional(bool)<br/> with_grant_option = optional(bool, false)<br/> privileges = optional(list(string))<br/> }))<br/> }))</pre> | `{}` | no |
120120
| <a name="input_scaling_policy"></a> [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 |
121121
| <a name="input_statement_queued_timeout_in_seconds"></a> [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 |
122122
| <a name="input_statement_timeout_in_seconds"></a> [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:
128128
| Name | Source | Version |
129129
|------|--------|---------|
130130
| <a name="module_roles_deep_merge"></a> [roles\_deep\_merge](#module\_roles\_deep\_merge) | Invicton-Labs/deepmerge/null | 0.1.5 |
131-
| <a name="module_snowflake_custom_role"></a> [snowflake\_custom\_role](#module\_snowflake\_custom\_role) | getindata/role/snowflake | 3.0.0 |
132-
| <a name="module_snowflake_default_role"></a> [snowflake\_default\_role](#module\_snowflake\_default\_role) | getindata/role/snowflake | 3.0.0 |
131+
| <a name="module_snowflake_custom_role"></a> [snowflake\_custom\_role](#module\_snowflake\_custom\_role) | getindata/role/snowflake | 3.1.0 |
132+
| <a name="module_snowflake_default_role"></a> [snowflake\_default\_role](#module\_snowflake\_default\_role) | getindata/role/snowflake | 3.1.0 |
133133

134134
## Outputs
135135

examples/complete/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ module "terraform_snowflake_warehouse_2" {
6969
extra_values = {
7070
project = "project"
7171
}
72+
uppercase = false
7273
}
7374
context_templates = var.context_templates
7475

locals.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ locals {
88
prefix = "whs"
99
warehouse = var.name
1010
}
11+
uppercase = var.name_scheme.uppercase
1112
}
1213

1314
default_roles_definition = {

main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ data "context_label" "this" {
1212
}
1313

1414
resource "snowflake_warehouse" "this" {
15-
name = data.context_label.this.rendered
15+
name = var.name_scheme.uppercase ? upper(data.context_label.this.rendered) : data.context_label.this.rendered
1616
comment = var.comment
1717

1818
warehouse_size = var.warehouse_size
@@ -45,7 +45,7 @@ module "snowflake_default_role" {
4545
for_each = local.default_roles #{ for role_name, role in local.default_roles : role_name => role if var.create_default_roles }
4646

4747
source = "getindata/role/snowflake"
48-
version = "3.0.0"
48+
version = "3.1.0"
4949

5050
context_templates = var.context_templates
5151

@@ -74,7 +74,7 @@ module "snowflake_custom_role" {
7474
for_each = local.custom_roles
7575

7676
source = "getindata/role/snowflake"
77-
version = "3.0.0"
77+
version = "3.1.0"
7878

7979
context_templates = var.context_templates
8080

variables.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ variable "roles" {
106106
context_template_name = optional(string)
107107
replace_chars_regex = optional(string)
108108
extra_labels = optional(map(string))
109+
uppercase = optional(bool)
109110
}))
110111
comment = optional(string)
111112
role_ownership_grant = optional(string)
@@ -135,13 +136,15 @@ variable "name_scheme" {
135136
- `context_template_name` - name of the context template used to create the name
136137
- `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
137138
- `extra_values` - map of extra label-value pairs, used to create a name
139+
- `uppercase` - convert name to uppercase
138140
EOT
139141
type = object({
140142
properties = optional(list(string), ["environment", "name"])
141143
delimiter = optional(string, "_")
142144
context_template_name = optional(string, "snowflake-warehouse")
143145
replace_chars_regex = optional(string, "[^a-zA-Z0-9_]")
144146
extra_values = optional(map(string))
147+
uppercase = optional(bool, true)
145148
})
146149
default = {}
147150
}

0 commit comments

Comments
 (0)