squidfunk / terraform-aws-api-gateway-enable-cors Goto Github PK
View Code? Open in Web Editor NEWEasily add an OPTIONS method to an API Gateway resource to enable CORS
License: MIT License
Easily add an OPTIONS method to an API Gateway resource to enable CORS
License: MIT License
On using the terraform-aws-api-gateway-enable-cors module and running terraform plan
Error
│ 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.
hey man,
you solved me a problem with a 10' internet search and 6 lines of code. It works like a charm and just wanted to say thank you for releasing this module. keep up with the good work!
❤️
After upgrading Terraform to 0.12 there appears to be multiple deprecation warnings coming from this library:
Warning: Interpolation-only expressions are deprecated
Warning: Quoted references are deprecated
Warning: Quoted type constraints are deprecated
Are there any plans to address these?
Update: I see there is an open PR for this already:
https://github.com/squidfunk/terraform-aws-api-gateway-enable-cors/pull/6/files
Thanks
When I use the module to enable CORS on both a resource and its parent, I get the following error:
Error creating API Gateway Deployment: BadRequestException: No integration defined for method
Terraform 0.15 removed the deprecated map()
function, hence this module is not working. Error log below:
╷
│ Error: Error in function call
│
│ on .terraform/modules/cors_policy_item/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.
By using Binary Media Types set to */*
in API Gateway cause OPTIONS requests failing with 500 errors. As a solution, the content_handling should be set to CONVERT_TO_TEXT in the aws_api_gateway_integration resource, see:
https://forums.aws.amazon.com/thread.jspa?threadID=256140
Hello,
I had this error after the apply
Error: Error creating API Gateway Method: NotFoundException: Invalid Resource identifier specified
do you have any idea ?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.