From 72acf2bcde81726a5407224ab86f57b18aca102e Mon Sep 17 00:00:00 2001 From: David Costa Date: Thu, 1 Aug 2024 14:58:34 +0100 Subject: [PATCH 1/2] feat: add option to expose /healthz without IAP --- README.md | 1 + main.tf | 8 ++++++++ variables.tf | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/README.md b/README.md index 2f4cbea..58a0569 100644 --- a/README.md +++ b/README.md @@ -239,6 +239,7 @@ You can check the status of the certificate in the Google Cloud Console. | [enable\_confidential\_vm](#input\_enable\_confidential\_vm) | Enable Confidential VM. If true, on host maintenance will be set to TERMINATE | `bool` | `false` | no | | [enable\_oslogin](#input\_enable\_oslogin) | Enables OS Login service on the VM | `bool` | `false` | no | | [env\_vars](#input\_env\_vars) | Key-value pairs representing environment variables and their respective values | `map(any)` | n/a | yes | +| [expose\_healthz\_publicly](#input\_expose\_healthz\_publicly) | Exposes the /healthz endpoint publicly even if Atlantis is protected by IAP | `bool` | `false` | no | | [expose\_metrics\_publicly](#input\_expose\_metrics\_publicly) | Exposes the /metrics endpoint publicly even if Atlantis is protected by IAP | `bool` | `false` | no | | [google\_logging\_enabled](#input\_google\_logging\_enabled) | Enable Google Cloud Logging | `bool` | `true` | no | | [google\_logging\_use\_fluentbit](#input\_google\_logging\_use\_fluentbit) | Enable Google Cloud Logging using Fluent Bit | `bool` | `false` | no | diff --git a/main.tf b/main.tf index ea25b07..a349248 100644 --- a/main.tf +++ b/main.tf @@ -405,6 +405,14 @@ resource "google_compute_url_map" "default" { service = google_compute_backend_service.default.id } } + + dynamic "path_rule" { + for_each = var.expose_healthz_publicly ? [1] : [] + content { + paths = ["/healthz"] + service = google_compute_backend_service.default.id + } + } } } } diff --git a/variables.tf b/variables.tf index 1ec7677..4a57c63 100644 --- a/variables.tf +++ b/variables.tf @@ -146,6 +146,12 @@ variable "expose_metrics_publicly" { default = false } +variable "expose_healthz_publicly" { + type = bool + description = "Exposes the /healthz endpoint publicly even if Atlantis is protected by IAP" + default = false +} + variable "google_logging_enabled" { type = bool description = "Enable Google Cloud Logging" From 2eee881d7ea724da4a6488830a2fb3a92d5c1e71 Mon Sep 17 00:00:00 2001 From: David Costa Date: Thu, 1 Aug 2024 15:11:20 +0100 Subject: [PATCH 2/2] chore: skip CKV_TF_2 --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8b565e8..be915a0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -28,7 +28,7 @@ jobs: with: directory: . quiet: true - skip_check: CKV_TF_1,CKV_GCP_32,CKV_GCP_34,CKV2_GCP_18 + skip_check: CKV_TF_1,CKV_TF_2,CKV_GCP_32,CKV_GCP_34,CKV2_GCP_18 framework: terraform # Terraform-docs