terraform-google-modules/terraform-google-lb-http

Module requires health_check when some lb configurations do not accept it.

davidlbyrne opened this issue · 0 comments

TL;DR

Hi there, I am using a global endpoint with an internet NEG as the backend and the issue I'm having is that the module is requiring me to specify a health check for my backend. I tried using null and {}. Neither work. Then when I add a health check I get this error from the google API

With health check:

Error: Error creating BackendService: googleapi: Error 400: Invalid value for field 'resource.healthChecks': ''. Health checks are not allowed for GLOBAL HTTP backend services with EXTERNAL load balancing scheme that have an Internet NEG., invalid

With out health check:

The given value is not suitable for module.looker_lb_https.var.backends declared at .terraform/modules/looker_lb_https/variables.tf:81,1-20: element "default": attribute "health_check" is required.

Expected behavior

I expect a successful plan and apply.

Observed behavior

Error from google API

Terraform Configuration

module "looker_lb_https" {
  source  = "GoogleCloudPlatform/lb-http/google"
  version = "~> 9.0"

  name    = "group-http-lb"
  project = var.gcp_project_id

  ssl                             = true
  use_ssl_certificates            = false
  https_redirect                  = true
  managed_ssl_certificate_domains = [google_dns_record_set.looklb.name]


  backends = {
    default = {
      enable_cdn = false

      # health_check = {
      #   check_interval_sec  = 15
      #   timeout_sec         = 15
      #   healthy_threshold   = 4
      #   unhealthy_threshold = 4
      #   logging             = true
      #   protocol            = "HTTPS"
      #   host                = "someurl.looker.com"
      #   request_path        = "/"
      #   port                = 443


      # }

      log_config = {
        enable      = true
        sample_rate = 1.0
      }

      groups = [
        {
          group = google_compute_global_network_endpoint_group.neg.id
        }
      ]

      iap_config = {
        enable = false
      }
    }
  }
}

Terraform Version

(.venv) ➜  prd git:(INFRA-5215) terraform version                             
Terraform v1.4.6
on darwin_amd64
+ provider registry.terraform.io/hashicorp/google v5.20.0
+ provider registry.terraform.io/hashicorp/google-beta v5.20.0
+ provider registry.terraform.io/hashicorp/random v3.6.0

Your version of Terraform is out of date! The latest version
is 1.7.4. You can update by downloading from https://www.terraform.io/downloads.html
(.venv) ➜  prd git:(INFRA-5215)

Additional information

none