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

Terraform validate fails with google_compute_health_check and dynamic blocks #6295

Closed
mbrancato opened this issue May 5, 2020 · 6 comments
Closed
Assignees
Labels

Comments

@mbrancato
Copy link

mbrancato commented May 5, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.

Terraform Version

Terraform v0.12.24
+ provider.google v3.20.0

Affected Resource(s)

  • google_compute_health_check

Terraform Configuration Files

resource "google_compute_health_check" "hc" {
  #used for internal backend
  project             = var.project
  name                = "health-check"
  check_interval_sec  = 10
  timeout_sec         = 5
  healthy_threshold   = 2
  unhealthy_threshold = 10
  dynamic "https_health_check" {
    for_each = var.tls_enable ? ["enabled"] : []
    content {
      request_path = var.health_check
      port         = 8200
    }
  }
  dynamic "http_health_check" {
    for_each = var.tls_enable ? [] : ["enabled"]
    content {
      request_path = var.health_check
      port         = 8200
    }
  }
}

Expected Behavior

Validate should pass

Actual Behavior

Error: "http2_health_check": only one of `http2_health_check,http_health_check,https_health_check,ssl_health_check,tcp_health_check` can be specified, but `http_health_check,https_health_check` were specified.
on .terraform/modules/gcp/lb.tf line 16, in resource "google_compute_health_check" "hc":
16: resource "google_compute_health_check" "hc" {
Error: "https_health_check": only one of `http2_health_check,http_health_check,https_health_check,ssl_health_check,tcp_health_check` can be specified, but `http_health_check,https_health_check` were specified.
on .terraform/modules/gcp/lb.tf line 16, in resource "google_compute_health_check" "hc":
16: resource "google_compute_health_check" "hc" {
Error: "tcp_health_check": only one of `http2_health_check,http_health_check,https_health_check,ssl_health_check,tcp_health_check` can be specified, but `http_health_check,https_health_check` were specified.
on .terraform/modules/gcp/lb.tf line 16, in resource "google_compute_health_check" "hc":
16: resource "google_compute_health_check" "hc" {
Error: "http_health_check": only one of `http2_health_check,http_health_check,https_health_check,ssl_health_check,tcp_health_check` can be specified, but `http_health_check,https_health_check` were specified.
on .terraform/modules/gcp/lb.tf line 16, in resource "google_compute_health_check" "hc":
16: resource "google_compute_health_check" "hc" {
Error: "ssl_health_check": only one of `http2_health_check,http_health_check,https_health_check,ssl_health_check,tcp_health_check` can be specified, but `http_health_check,https_health_check` were specified.
on .terraform/modules/gcp/lb.tf line 16, in resource "google_compute_health_check" "hc":
16: resource "google_compute_health_check" "hc" {

Steps to Reproduce

  1. terraform validate

Important Factoids

This was working in 3.19.

@venkykuberan
Copy link
Contributor

venkykuberan commented May 5, 2020

https_health_check conflicts with http_health_check, you need to use one of them. We have that validation in place for some time, i can repro that error in version 3.5 and later.

Can you share your plan output of the working version ?

@morgante
Copy link

morgante commented May 5, 2020

I believe this was likely fixed with #6286.

@ghost ghost removed the waiting-response label May 5, 2020
@mbrancato
Copy link
Author

Hi @venkykuberan - these are dynamic blocks with alternate results in the conditional set. It is impossible for them to both be set at the same time.

@venkykuberan
Copy link
Contributor

I see that @mbrancato, as @morgante pointed out it will be fixed in that PR.

@Pradeepta93
Copy link

This is is not yet resolved, Can we expect any official update on this. Also, most of the LB modules are not working as expected. By when can we expect a fix to these issues. As we are planning to use the CFT module of GCP for the load balancer.

@ghost
Copy link

ghost commented Jun 5, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Jun 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants