Environment
Terraform: v0.12.19
terraform-google-lb-http: 4.0.0
Error started happening: May 5th 2020 - 07:00 GMT
google-beta provider: 3.20
Last time working: May 4th 2020 - 16:00 GMT
google-beta provider: 3.19
Error output
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 `http2_health_check,http_health_check,https_health_check` were specified.
on .terraform/modules/lb_https/terraform-google-lb-http-4.0.0/main.tf line 132, in resource "google_compute_health_check" "default":
132: resource "google_compute_health_check" "default" {
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 `http2_health_check,http_health_check,https_health_check` were specified.
on .terraform/modules/lb_https/terraform-google-lb-http-4.0.0/main.tf line 132, in resource "google_compute_health_check" "default":
132: resource "google_compute_health_check" "default" {
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 `http2_health_check,http_health_check,https_health_check` were specified.
on .terraform/modules/lb_https/terraform-google-lb-http-4.0.0/main.tf line 132, in resource "google_compute_health_check" "default":
132: resource "google_compute_health_check" "default" {
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 `http2_health_check,http_health_check,https_health_check` were specified.
on .terraform/modules/lb_https/terraform-google-lb-http-4.0.0/main.tf line 132, in resource "google_compute_health_check" "default":
132: resource "google_compute_health_check" "default" {
Workaround
Download module to project, and edit the main.tf file.
As long as we are using "http_health_check", on the resource "google_compute_health_check" remove the dynamic "https_health_check" and "http2_health_check" blocks.
diff --git a/main.tf b/main.tf
index bc609ad..913cdc4 100644
--- a/main.tf
+++ b/main.tf
@@ -155,38 +155,6 @@ resource "google_compute_health_check" "default" {
}
}
- dynamic "https_health_check" {
- for_each = each.value["protocol"] == "HTTPS" ? [
- {
- host = lookup(each.value["health_check"], "host", null)
- request_path = lookup(each.value["health_check"], "request_path", null)
- port = lookup(each.value["health_check"], "port", null)
- }
- ] : []
-
- content {
- host = lookup(https_health_check.value, "host", null)
- request_path = lookup(https_health_check.value, "request_path", null)
- port = lookup(https_health_check.value, "port", null)
- }
- }
-
- dynamic "http2_health_check" {
- for_each = each.value["protocol"] == "HTTP2" ? [
- {
- host = lookup(each.value["health_check"], "host", null)
- request_path = lookup(each.value["health_check"], "request_path", null)
- port = lookup(each.value["health_check"], "port", null)
- }
- ] : []
-
- content {
- host = lookup(http2_health_check.value, "host", null)
- request_path = lookup(http2_health_check.value, "request_path", null)
- port = lookup(http2_health_check.value, "port", null)
- }
- }
-
}
resource "google_compute_firewall" "default-hc" {
Possible explanation
Seems since latest google-beta provider's version the "google_compute_health_check" parameter has been enforced to accept one (and only one) kind of health_check per backend.
Even though each dynamic block is conditioned by a for_each clause, looks like the component is being generated anyways