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
}
}
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
Detailed design
Additional information
This would require Terraform 1.3 or higher.