Skip to content

Commit

Permalink
Add simple format check for Terragrunt files (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCutter authored Aug 27, 2024
1 parent 0cfc433 commit e70cb06
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 10 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/terragrunt_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: 'Terragrunt format check'
on:
- pull_request

env:
tf_version: '1.5.7'
tg_version: '0.55.1'

jobs:
checks:
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Check terragrunt HCL
uses: gruntwork-io/terragrunt-action@cf355638dbd066b6a70eb01f31ad9293870a0e34 # v2
with:
tf_version: ${{ env.tf_version }}
tg_version: ${{ env.tg_version }}
tg_command: 'hclfmt --terragrunt-check --terragrunt-diff'
8 changes: 4 additions & 4 deletions deployment/live/gcp/cloudbuild/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ terraform {
}

locals {
project_id = "trillian-tessera"
region = "us-central1"
env = path_relative_to_include()
project_id = "trillian-tessera"
region = "us-central1"
env = path_relative_to_include()
}

remote_state {
Expand All @@ -18,7 +18,7 @@ remote_state {
prefix = "${path_relative_to_include()}-terraform.tfstate"

gcs_bucket_labels = {
name = "terraform_state_storage"
name = "terraform_state_storage"
}
}
}
2 changes: 1 addition & 1 deletion deployment/live/gcp/example-gcp/ci/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ inputs = merge(
include.root.locals,
{
example_gcp_docker_image = "us-central1-docker.pkg.dev/trillian-tessera/docker-prod/example-gcp:latest"
log_origin = "example-gcp"
log_origin = "example-gcp"
}
)
10 changes: 5 additions & 5 deletions deployment/live/gcp/example-gcp/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ terraform {
}

locals {
env = path_relative_to_include()
project_id = get_env("GOOGLE_PROJECT", "trillian-tessera")
location = get_env("GOOGLE_REGION", "us-central1")
base_name = get_env("TESSERA_BASE_NAME", "${local.env}-example-gcp")
env = path_relative_to_include()
project_id = get_env("GOOGLE_PROJECT", "trillian-tessera")
location = get_env("GOOGLE_REGION", "us-central1")
base_name = get_env("TESSERA_BASE_NAME", "${local.env}-example-gcp")
}

remote_state {
Expand All @@ -19,7 +19,7 @@ remote_state {
prefix = "${local.env}/terraform.tfstate"

gcs_bucket_labels = {
name = "terraform_state_storage"
name = "terraform_state_storage"
}
}
}

0 comments on commit e70cb06

Please sign in to comment.