Skip to content

Commit d8773fb

Browse files
authored
Merge pull request #19 from getindata/feature/add_uppercase_name_flag
feat: Add name_scheme.uppercase flag + bump CI + bump submodules
2 parents 0471a46 + 4b4df31 commit d8773fb

File tree

6 files changed

+18
-11
lines changed

6 files changed

+18
-11
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
repos:
22
- repo: https://github.com/gruntwork-io/pre-commit
33
# When updating, also check if tflint version in pre-commit workflow can be updated.
4-
rev: "v0.1.23" # Get the latest from: https://github.com/gruntwork-io/pre-commit/releases
4+
rev: "v0.1.25" # Get the latest from: https://github.com/gruntwork-io/pre-commit/releases
55
hooks:
66
- id: terraform-validate # It should be the first step as it runs terraform init required by tflint
77
- id: terraform-fmt
88
- id: tflint
99

1010
- repo: https://github.com/terraform-docs/terraform-docs
11-
rev: "v0.18.0" # Get the latest from: https://github.com/terraform-docs/terraform-docs/releases
11+
rev: "v0.19.0" # Get the latest from: https://github.com/terraform-docs/terraform-docs/releases
1212
hooks:
1313
- id: terraform-docs-go
1414
args: ["."]
1515

1616
- repo: https://github.com/bridgecrewio/checkov.git
17-
rev: "3.2.192" # Get the latest from: https://github.com/bridgecrewio/checkov/releases
17+
rev: "3.2.350" # Get the latest from: https://github.com/bridgecrewio/checkov/releases
1818
hooks:
1919
- id: checkov
2020
args: [--skip-check, "CKV_TF_1"] # Terraform module sources do not use a git url with a commit hash revision
2121

2222
- repo: https://github.com/pre-commit/pre-commit-hooks
23-
rev: "v4.6.0" # Get the latest from: https://github.com/pre-commit/pre-commit-hooks/releases
23+
rev: "v5.0.0" # Get the latest from: https://github.com/pre-commit/pre-commit-hooks/releases
2424
hooks:
2525
- id: check-merge-conflict
2626
args: ["--assume-in-merge"]

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ module "snowflake_storage_integration" {
8888
| <a name="input_create_default_roles"></a> [create\_default\_roles](#input\_create\_default\_roles) | Whether the default roles should be created | `bool` | `false` | no |
8989
| <a name="input_enabled"></a> [enabled](#input\_enabled) | Whether the storage integration is enabled | `bool` | `true` | no |
9090
| <a name="input_name"></a> [name](#input\_name) | Name of the resource | `string` | n/a | yes |
91-
| <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 |
92-
| <a name="input_roles"></a> [roles](#input\_roles) | Roles created in the database scope | <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> integration_grants = optional(object({<br> all_privileges = optional(bool)<br> with_grant_option = optional(bool, false)<br> privileges = optional(list(string))<br> }))<br> }))</pre> | `{}` | no |
91+
| <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 |
92+
| <a name="input_roles"></a> [roles](#input\_roles) | Roles created in the database scope | <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/> integration_grants = optional(object({<br/> all_privileges = optional(bool)<br/> with_grant_option = optional(bool, false)<br/> privileges = optional(list(string))<br/> }))<br/> }))</pre> | `{}` | no |
9393
| <a name="input_storage_allowed_locations"></a> [storage\_allowed\_locations](#input\_storage\_allowed\_locations) | Explicitly limits external stages that use the integration to reference one or more storage locations | `list(string)` | n/a | yes |
9494
| <a name="input_storage_aws_object_acl"></a> [storage\_aws\_object\_acl](#input\_storage\_aws\_object\_acl) | Value of "bucket-owner-full-control" enables support for AWS access control lists (ACLs) to grant the bucket owner full control | `string` | `null` | no |
9595
| <a name="input_storage_aws_role_arn"></a> [storage\_aws\_role\_arn](#input\_storage\_aws\_role\_arn) | AWS Role ARN | `string` | `null` | no |
@@ -102,8 +102,8 @@ module "snowflake_storage_integration" {
102102
| Name | Source | Version |
103103
|------|--------|---------|
104104
| <a name="module_roles_deep_merge"></a> [roles\_deep\_merge](#module\_roles\_deep\_merge) | Invicton-Labs/deepmerge/null | 0.1.5 |
105-
| <a name="module_snowflake_custom_role"></a> [snowflake\_custom\_role](#module\_snowflake\_custom\_role) | getindata/role/snowflake | 3.0.1 |
106-
| <a name="module_snowflake_default_role"></a> [snowflake\_default\_role](#module\_snowflake\_default\_role) | getindata/role/snowflake | 3.0.1 |
105+
| <a name="module_snowflake_custom_role"></a> [snowflake\_custom\_role](#module\_snowflake\_custom\_role) | getindata/role/snowflake | 3.1.0 |
106+
| <a name="module_snowflake_default_role"></a> [snowflake\_default\_role](#module\_snowflake\_default\_role) | getindata/role/snowflake | 3.1.0 |
107107

108108
## Outputs
109109

examples/complete/main.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ module "storage_integration" {
2020
roles = {
2121
readonly = {
2222
granted_to_roles = [snowflake_account_role.dev_role.name]
23+
name_scheme = {
24+
uppercase = false
25+
}
2326
}
2427
}
2528
}

locals.tf

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

1314
#This needs to be the same as an object in roles variable

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_storage_integration" "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
enabled = var.enabled
1818

@@ -35,7 +35,7 @@ module "snowflake_default_role" {
3535
for_each = local.default_roles
3636

3737
source = "getindata/role/snowflake"
38-
version = "3.0.1"
38+
version = "3.1.0"
3939

4040
context_templates = var.context_templates
4141

@@ -64,7 +64,7 @@ module "snowflake_custom_role" {
6464
for_each = local.custom_roles
6565

6666
source = "getindata/role/snowflake"
67-
version = "3.0.1"
67+
version = "3.1.0"
6868

6969
context_templates = var.context_templates
7070

variables.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ variable "roles" {
7575
context_template_name = optional(string)
7676
replace_chars_regex = optional(string)
7777
extra_labels = optional(map(string))
78+
uppercase = optional(bool)
7879
}))
7980
comment = optional(string)
8081
role_ownership_grant = optional(string)
@@ -98,13 +99,15 @@ variable "name_scheme" {
9899
- `context_template_name` - name of the context template used to create the name
99100
- `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
100101
- `extra_values` - map of extra label-value pairs, used to create a name
102+
- `uppercase` - convert name to uppercase
101103
EOT
102104
type = object({
103105
properties = optional(list(string), ["environment", "name"])
104106
delimiter = optional(string, "_")
105107
context_template_name = optional(string, "snowflake-warehouse")
106108
replace_chars_regex = optional(string, "[^a-zA-Z0-9_]")
107109
extra_values = optional(map(string))
110+
uppercase = optional(bool, true)
108111
})
109112
default = {}
110113
}

0 commit comments

Comments
 (0)