Skip to content

Commit

Permalink
Healthcheck toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
pondzix committed Apr 26, 2024
1 parent 873b335 commit aefabf9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 5 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ resource "google_bigquery_dataset_iam_member" "dataset_bigquery_data_editor_bind
# --- CE: Firewall rules

resource "google_compute_firewall" "ingress_health_check" {
name = "${var.name}-traffic-in"
count = var.healthcheck_enabled == true ? 1 : 0
name = "${var.name}-traffic-in"

network = var.network
target_tags = [var.name]
Expand Down Expand Up @@ -245,7 +246,7 @@ module "service" {
service_account_email = google_service_account.sa.email
associate_public_ip_address = var.associate_public_ip_address

named_port_http = "http"
ingress_port = local.ingress_port
health_check_path = "/"
named_port_http = var.healthcheck_enabled == true ? "http" : ""
ingress_port = var.healthcheck_enabled == true ? local.ingress_port : -1
health_check_path = var.healthcheck_enabled == true ? "/" : ""
}
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,9 @@ variable "skip_schemas" {
type = list(string)
default = []
}

variable "healthcheck_enabled" {
description = "Whether or not to enable health check probe for GCP instance group"
type = bool
default = true
}

0 comments on commit aefabf9

Please sign in to comment.