Serverless Negs Backends don't work as expected
nxhuy-github opened this issue · 1 comments
nxhuy-github commented
TL;DR
In this code block, it must be lookup(each.value, "description", null)
instead of lookup(backend.value, "description", null)
!?! The fact that backend.value
doesn't make any sense in this context I believe !!
Expected behavior
Use each.value
instead of backend.value
in the code block dynamic "backend" { ... }
of the resource "google_compute_backend_service"
in the main.tf.
Observed behavior
No response
Terraform Configuration
dynamic "backend" {
for_each = toset(each.value["groups"])
content {
description = lookup(backend.value, "description", null)
group = lookup(backend.value, "group")
}
}
Terraform Version
terraform {
required_version = ">= 1.3"
required_providers {
google = {
source = "hashicorp/google"
version = ">= 4.50, < 5.0"
}
google-beta = {
source = "hashicorp/google-beta"
version = ">= 4.50, < 5.0"
}
random = {
source = "hashicorp/random"
version = ">= 2.1"
}
}
provider_meta "google" {
module_name = "blueprints/terraform/terraform-google-lb-http:serverless_negs/v9.1.0"
}
provider_meta "google-beta" {
module_name = "blueprints/terraform/terraform-google-lb-http:serverless_negs/v9.1.0"
}
}
Additional information
No response
imrannayer commented
@nxhuy-github r u getting any error? Both syntaxes r fine for dynamic block. See TF docs.