squidfunk / terraform-aws-api-gateway-enable-cors

Easily add an OPTIONS method to an API Gateway resource to enable CORS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error in versions > v0.12 Terraform

davetc4k opened this issue · comments

On using the terraform-aws-api-gateway-enable-cors module and running terraform plan
│ on .terraform/modules/cors/headers.tf line 27, in locals:
│ 27: headers = map(
│ 28: "Access-Control-Allow-Headers", "'${join(",", var.allow_headers)}'",
│ 29: "Access-Control-Allow-Methods", "'${join(",", var.allow_methods)}'",
│ 30: "Access-Control-Allow-Origin", "'${var.allow_origin}'",
│ 31: "Access-Control-Max-Age", "'${var.allow_max_age}'",
│ 32: "Access-Control-Allow-Credentials", var.allow_credentials ? "'true'" : ""
│ 33: )
│ ├────────────────
│ │ var.allow_credentials will be known only after apply
│ │ var.allow_headers is a list of string, known only after apply
│ │ var.allow_max_age is a string, known only after apply
│ │ var.allow_methods is a list of string, known only after apply
│ │ var.allow_origin is a string, known only after apply

│ Call to function "map" failed: the "map" function was deprecated in Terraform v0.12 and is no longer available; use tomap({ ... }) syntax to write a
│ literal map.

headers = tomap(
"Access-Control-Allow-Headers" = "'${join(",", var.allow_headers)}'",
"Access-Control-Allow-Methods" = "'${join(",", var.allow_methods)}'",
"Access-Control-Allow-Origin"= "'${var.allow_origin}'",
"Access-Control-Max-Age" = "'${var.allow_max_age}'",
"Access-Control-Allow-Credentials"= var.allow_credentials ? "'true'" : ""

Will do a PR if required

Yes, a PR would be great!

But a revert has been done on April last year. Shouldn't we provide different versions of this one ?

The revert you're speaking of been done in #14. I'm currently not using this module myself, so I'm not sure how we should proceed here.

I think it's better to have the 'latest' module version working for 'latest' terraform version, no?
If so, you could document which versions works for which terraform version?

I'm afraid I have no time to work on this. I can give you collaborator access if you like.

ezoic increase your site revenue