Module net-lb-app-ext variables do not match Terraform resource properties
Closed this issue · 2 comments
Describe the bug
Module variables do not match Terraform resource properties for urlmap_config.path_matchers[<name>].default_route_action.cors_policy
.
A URL Map requires at least the following properties to be a list(string)
: allow_methods
, allow_headers
, expose_headers
The URL Map resource proxies the variables as is, therefore, they are incorrect (input is an optional(string)
, expected list(string)
).
Environment
output from `terraform -version`
Terraform v1.7.3
on darwin_arm64
+ provider registry.terraform.io/hashicorp/google v5.16.0
+ provider registry.terraform.io/hashicorp/google-beta v5.16.0
+ provider registry.terraform.io/hashicorp/local v2.4.1
output from `git rev-parse --short HEAD`
e02d871d
module source = "git::ssh://git@github.com/GoogleCloudPlatform/cloud-foundation-fabric.git//modules/net-lb-app-ext?ref=daily-2024.02.16"
To Reproduce
Use the net-lb-app-ext
module, and fill out a cors_policy
.
Expected behavior
The URL Map should be created with the configured CORS policy.
Result
╷
│ Error: Incorrect attribute value type
│
│ on .terraform/modules/load_balancer/modules/net-lb-app-ext/urlmap.tf line 280, in resource "google_compute_url_map" "default":
│ 280: allow_headers = cors_policy.value.allow_headers
│
│ Inappropriate value for attribute "allow_headers": list of string required.
╵
╷
│ Error: Incorrect attribute value type
│
│ on .terraform/modules/load_balancer/modules/net-lb-app-ext/urlmap.tf line 281, in resource "google_compute_url_map" "default":
│ 281: allow_methods = cors_policy.value.allow_methods
│
│ Inappropriate value for attribute "allow_methods": list of string required.
╵
╷
│ Error: Incorrect attribute value type
│
│ on .terraform/modules/load_balancer/modules/net-lb-app-ext/urlmap.tf line 285, in resource "google_compute_url_map" "default":
│ 285: expose_headers = cors_policy.value.expose_headers
│
│ Inappropriate value for attribute "expose_headers": list of string required.
Good catch, that is probably the most complex resource ever (much worse than GKE clusters). Thanks for reporting this. If you have the time to send a PR go for it, otherwise we'll try and have the fix in ASAP.
Great, thanks for fixing this! I had changed it locally to test if it solved my issue, but ran into another issue (not related to foundation fabric) and didn't create a PR (but was about to) :) But glad that it's solved!