Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add conditional null to database-role-name #7

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
repos:
- repo: https://github.com/gruntwork-io/pre-commit
# When updating, also check if tflint version in pre-commit workflow can be updated.
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:
- "--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
Expand All @@ -14,7 +15,7 @@ repos:
args: ["."]

- repo: https://github.com/bridgecrewio/checkov.git
rev: "3.2.194" # Get the latest from: https://github.com/bridgecrewio/checkov/releases
rev: "3.2.216" # 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
Expand Down
7 changes: 0 additions & 7 deletions .tflint.hcl
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
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
}
2 changes: 1 addition & 1 deletion locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ locals {
lookup(module.role_label.descriptors, var.descriptor_name, module.role_label.id), "/${module.role_label.delimiter}${module.role_label.delimiter}+/", module.role_label.delimiter
), module.role_label.delimiter) : null

database_role_name = "\"${one(snowflake_database_role.this[*].database)}\".\"${one(snowflake_database_role.this[*].name)}\""
database_role_name = module.this.enabled ? "\"${one(snowflake_database_role.this[*].database)}\".\"${one(snowflake_database_role.this[*].name)}\"" : null

database_grants = var.database_grants.all_privileges == null && var.database_grants.privileges == null ? {} : {
var.database_grants.all_privileges == true ? "ALL" : "CUSTOM" = var.database_grants
Expand Down
Loading