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

Module net-lb-app-ext variables do not match Terraform resource properties #2092

Closed
trietsch opened this issue Feb 19, 2024 · 2 comments · Fixed by #2098
Closed

Module net-lb-app-ext variables do not match Terraform resource properties #2092

trietsch opened this issue Feb 19, 2024 · 2 comments · Fixed by #2098

Comments

@trietsch
Copy link

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://[email protected]/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.
@ludoo
Copy link
Collaborator

ludoo commented Feb 19, 2024

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.

@trietsch
Copy link
Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants