terraform-google-modules / terraform-google-lb-internal

Creates an internal load balancer for Compute Engine by using forwarding rules
https://registry.terraform.io/modules/terraform-google-modules/lb-internal/google
Apache License 2.0
81 stars 91 forks source link

Offer reasonable default values for attributes in var.health_check #109

Closed jeheyer closed 1 year ago

jeheyer commented 2 years ago

TL;DR

var.health_check is defined as an object, but does not use optionals. Therefor, all attribute values must be provided even when the attribute is not relevant, or provider default values are suitable.

Terraform Resources

google_compute_health_check

Detailed design

// variables.tf for child module
variable "health_check" {
  type = object({
    name                = string
    type                = optional(string, "TCP")
    port                = optional(number, 80)
    check_interval_sec  = optional(number, 5)
    healthy_threshold   = optional(number, 2)
    proxy_header        = optional(string, "NONE")
    enable_log          = optional(bool, false)
  })
}

// Example call from parent module
module "gce-ilb" {
  source  = "GoogleCloudPlatform/lb-internal/google"
  version = "~> 2.0"
  name    = "smtp-relays"
  health_check = {
    name                = "smtp-hc"
    port                = 25
    check_interval_sec  = 15
  }
}

Additional information

This would require Terraform 1.3 or higher.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days