Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: make fields of health_check optional #153

Open
daisy1754 opened this issue Mar 11, 2021 · 1 comment
Open

FR: make fields of health_check optional #153

daisy1754 opened this issue Mar 11, 2021 · 1 comment
Labels
enhancement New feature or request P3 medium priority issues triaged Scoped and ready for work upstream Work required on Terraform core or provider

Comments

@daisy1754
Copy link

Currently all fields of mig.healthcheck is mandatory so one has to write a config below:

module "mig" {
  source                  = "terraform-google-modules/vm/google//modules/mig"
  version                 = "1.3.0"
  ...
  health_check = {
    type                = "http"
    initial_delay_sec   = 30
    check_interval_sec  = 5
    timeout_sec         = 5
    healthy_threshold   = 1
    unhealthy_threshold = 5
    response            = ""
    proxy_header        = "NONE"
    port                = 80
    request             = ""
    request_path        = "/"
    host                = ""
  }
}

It's quite verbose compared to plain google_compute_health_check which will be like

resource "google_compute_health_check" "my-service-http-health" {
  provider = google-beta
  name     = "my-service-http-health"

  initial_delay_sec   = 30
  check_interval_sec  = 5
  timeout_sec         = 5
  healthy_threshold   = 1
  unhealthy_threshold = 5

  http_health_check {
    port         = var.image_port
    request_path = "/healthz"
  }
}

It would be great if modules/mig can set sane default and make params optional

@morgante
Copy link
Contributor

I agree this is annoying currently, but unfortunately there isn't an easy solution with Terraform Core currently.

Terraform is working on adding optional attribute support for objects: https://www.terraform.io/docs/language/expressions/type-constraints.html#experimental-optional-object-type-attributes

Once that is non-experimental we should definitely add it to this module.

@morgante morgante added enhancement New feature or request P3 medium priority issues triaged Scoped and ready for work upstream Work required on Terraform core or provider labels Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P3 medium priority issues triaged Scoped and ready for work upstream Work required on Terraform core or provider
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants