├── CHANGELOG ├── LICENSE ├── .github └── FUNDING.yml ├── .gitignore ├── .editorconfig ├── .travis.yml ├── headers.tf ├── variables.tf ├── main.tf ├── CONTRIBUTING.md ├── README.md └── CODE_OF_CONDUCT.md /CHANGELOG: -------------------------------------------------------------------------------- 1 | terraform-aws-api-gateway-enable-cors-0.3.3 (2021-04-18) 2 | 3 | * Fixed #12: Switch to terraform-0.15.x `tomap` syntax 4 | 5 | terraform-aws-api-gateway-enable-cors-0.3.2 (2021-04-06) 6 | 7 | * Fixed #10: 500 error on OPTIONS when using */* in binary media types 8 | 9 | terraform-aws-api-gateway-enable-cors-0.3.1 (2020-01-27) 10 | 11 | * Fixed terraform-0.12.6 deprecations 12 | 13 | terraform-aws-api-gateway-enable-cors-0.3.0 (2019-06-10) 14 | 15 | * Upgraded to terraform-0.12.x 16 | 17 | terraform-aws-api-gateway-enable-cors-0.2.0 (2018-12-24) 18 | 19 | * Added support for Access-Control-Allow-Credentials header 20 | * Renamed allowed_* variables to allow_* to match header names 21 | 22 | terraform-aws-api-gateway-enable-cors-0.1.0 (2018-06-12) 23 | 24 | * Initial release 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018-2020 Martin Donath 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to 5 | deal in the Software without restriction, including without limitation the 6 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | sell copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | IN THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018-2020 Martin Donath 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to 5 | # deal in the Software without restriction, including without limitation the 6 | # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | # sell copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in 11 | # all copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | # IN THE SOFTWARE. 20 | 21 | github: squidfunk 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018-2020 Martin Donath 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to 5 | # deal in the Software without restriction, including without limitation the 6 | # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | # sell copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in 11 | # all copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | # IN THE SOFTWARE. 20 | 21 | # macOS internals 22 | .DS_Store 23 | 24 | # Terraform runtime 25 | .terraform 26 | .terraform.tfstate.lock.info 27 | 28 | # Terraform state 29 | *.tfstate 30 | *.tfstate.backup 31 | 32 | # Development-related 33 | .env 34 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018-2020 Martin Donath 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to 5 | # deal in the Software without restriction, including without limitation the 6 | # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | # sell copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in 11 | # all copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | # IN THE SOFTWARE. 20 | 21 | # Top-level config 22 | root = true 23 | 24 | # Default 25 | [*] 26 | charset = utf-8 27 | indent_style = space 28 | indent_size = 2 29 | end_of_line = lf 30 | insert_final_newline = true 31 | trim_trailing_whitespace = true 32 | 33 | # Makefiles 34 | [Makefile] 35 | indent_style = tab 36 | indent_size = 8 37 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018-2020 Martin Donath 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to 5 | # deal in the Software without restriction, including without limitation the 6 | # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | # sell copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in 11 | # all copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | # IN THE SOFTWARE. 20 | 21 | sudo: false 22 | 23 | # Limit clone depth to 5, to speed up build 24 | git: 25 | depth: 5 26 | 27 | # Install Terraform 28 | install: 29 | - curl -fSL "https://releases.hashicorp.com/terraform/0.15.0/terraform_0.15.0_linux_amd64.zip" -o terraform.zip 30 | - sudo unzip terraform.zip -d /opt/terraform 31 | - sudo ln -s /opt/terraform/terraform /usr/bin/terraform 32 | - rm -f terraform.zip 33 | 34 | # Perform Terraform validation 35 | script: 36 | - terraform init 37 | - AWS_REGION=us-east-1 terraform validate 38 | -------------------------------------------------------------------------------- /headers.tf: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018-2020 Martin Donath 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to 5 | # deal in the Software without restriction, including without limitation the 6 | # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | # sell copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in 11 | # all copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | # IN THE SOFTWARE. 20 | 21 | # ----------------------------------------------------------------------------- 22 | # Locals 23 | # ----------------------------------------------------------------------------- 24 | 25 | # local.* 26 | locals { 27 | headers = { 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 | } 34 | 35 | # Pick non-empty header values 36 | header_values = compact(values(local.headers)) 37 | 38 | # Pick names that from non-empty header values 39 | header_names = matchkeys( 40 | keys(local.headers), 41 | values(local.headers), 42 | local.header_values 43 | ) 44 | 45 | # Parameter names for method and integration responses 46 | parameter_names = formatlist("method.response.header.%s", local.header_names) 47 | 48 | # Map parameter list to "true" values 49 | true_list = split("|", 50 | replace(join("|", local.parameter_names), "/[^|]+/", "true") 51 | ) 52 | 53 | # Integration response parameters 54 | integration_response_parameters = zipmap( 55 | local.parameter_names, 56 | local.header_values 57 | ) 58 | 59 | # Method response parameters 60 | method_response_parameters = zipmap( 61 | local.parameter_names, 62 | local.true_list 63 | ) 64 | } 65 | -------------------------------------------------------------------------------- /variables.tf: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018-2020 Martin Donath 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to 5 | # deal in the Software without restriction, including without limitation the 6 | # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | # sell copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in 11 | # all copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | # IN THE SOFTWARE. 20 | 21 | # ----------------------------------------------------------------------------- 22 | # Variables: API Gateway 23 | # ----------------------------------------------------------------------------- 24 | 25 | # var.api_id 26 | variable "api_id" { 27 | description = "API identifier" 28 | } 29 | 30 | # var.api_resource_id 31 | variable "api_resource_id" { 32 | description = "API resource identifier" 33 | } 34 | 35 | # ----------------------------------------------------------------------------- 36 | # Variables: CORS-related 37 | # ----------------------------------------------------------------------------- 38 | 39 | # var.allow_headers 40 | variable "allow_headers" { 41 | description = "Allow headers" 42 | type = list(string) 43 | 44 | default = [ 45 | "Authorization", 46 | "Content-Type", 47 | "X-Amz-Date", 48 | "X-Amz-Security-Token", 49 | "X-Api-Key", 50 | ] 51 | } 52 | 53 | # var.allow_methods 54 | variable "allow_methods" { 55 | description = "Allow methods" 56 | type = list(string) 57 | 58 | default = [ 59 | "OPTIONS", 60 | "HEAD", 61 | "GET", 62 | "POST", 63 | "PUT", 64 | "PATCH", 65 | "DELETE", 66 | ] 67 | } 68 | 69 | # var.allow_origin 70 | variable "allow_origin" { 71 | description = "Allow origin" 72 | type = string 73 | default = "*" 74 | } 75 | 76 | # var.allow_max_age 77 | variable "allow_max_age" { 78 | description = "Allow response caching time" 79 | type = string 80 | default = "7200" 81 | } 82 | 83 | # var.allowed_credentials 84 | variable "allow_credentials" { 85 | description = "Allow credentials" 86 | default = false 87 | } 88 | -------------------------------------------------------------------------------- /main.tf: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018-2020 Martin Donath 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to 5 | # deal in the Software without restriction, including without limitation the 6 | # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | # sell copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in 11 | # all copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | # IN THE SOFTWARE. 20 | 21 | # ----------------------------------------------------------------------------- 22 | # Resources: API Gateway 23 | # ----------------------------------------------------------------------------- 24 | 25 | # aws_api_gateway_method._ 26 | resource "aws_api_gateway_method" "_" { 27 | rest_api_id = var.api_id 28 | resource_id = var.api_resource_id 29 | http_method = "OPTIONS" 30 | authorization = "NONE" 31 | } 32 | 33 | # aws_api_gateway_integration._ 34 | resource "aws_api_gateway_integration" "_" { 35 | rest_api_id = var.api_id 36 | resource_id = var.api_resource_id 37 | http_method = aws_api_gateway_method._.http_method 38 | content_handling = "CONVERT_TO_TEXT" 39 | 40 | type = "MOCK" 41 | 42 | request_templates = { 43 | "application/json" = "{ \"statusCode\": 200 }" 44 | } 45 | } 46 | 47 | # aws_api_gateway_integration_response._ 48 | resource "aws_api_gateway_integration_response" "_" { 49 | rest_api_id = var.api_id 50 | resource_id = var.api_resource_id 51 | http_method = aws_api_gateway_method._.http_method 52 | status_code = 200 53 | 54 | response_parameters = local.integration_response_parameters 55 | 56 | depends_on = [ 57 | aws_api_gateway_integration._, 58 | aws_api_gateway_method_response._, 59 | ] 60 | } 61 | 62 | # aws_api_gateway_method_response._ 63 | resource "aws_api_gateway_method_response" "_" { 64 | rest_api_id = var.api_id 65 | resource_id = var.api_resource_id 66 | http_method = aws_api_gateway_method._.http_method 67 | status_code = 200 68 | 69 | response_parameters = local.method_response_parameters 70 | 71 | response_models = { 72 | "application/json" = "Empty" 73 | } 74 | 75 | depends_on = [ 76 | aws_api_gateway_method._, 77 | ] 78 | } 79 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Interested in contributing to this project? Want to report a bug? Before you do, 4 | please read the following guidelines. 5 | 6 | ## Submission context 7 | 8 | ### Got a question or problem? 9 | 10 | For quick questions there's no need to open an issue as you can reach us on 11 | [gitter.im][1]. 12 | 13 | [1]: https://gitter.im/squidfunk/terraform-aws-api-gateway-enable-cors 14 | 15 | ### Found a bug? 16 | 17 | If you found a bug, you can help us by submitting an issue to the 18 | [issue tracker][2] in our GitHub repository. Even better, you can submit 19 | a pull request with a fix. However, before doing so, please read the 20 | [submission guidelines][3]. 21 | 22 | [2]: https://github.com/squidfunk/terraform-aws-api-gateway-enable-cors/issues 23 | [3]: #submission-guidelines 24 | 25 | ### Missing a feature? 26 | 27 | You can request a new feature by submitting an issue to our GitHub Repository. 28 | If you would like to implement a new feature, please submit an issue with a 29 | proposal for your work first, to be sure that it is of use for everyone. 30 | Please consider what kind of change it is: 31 | 32 | * For a **major feature**, first open an issue and outline your proposal so 33 | that it can be discussed. This will also allow us to better coordinate our 34 | efforts, prevent duplication of work and help you to craft the change so 35 | that it is successfully accepted into the project. 36 | 37 | * **Small features and bugs** can be crafted and directly submitted as a pull 38 | request (PR). However, there is no guarantee that your feature will make it 39 | into the master, as it's always a matter of opinion whether if benefits the 40 | overall functionality of this project. 41 | 42 | ## Submission guidelines 43 | 44 | ### Submitting an issue 45 | 46 | Before you submit an issue, please search the issue tracker. Maybe the problem 47 | you are encountering is already known and the discussion might inform you of 48 | workarounds readily available. 49 | 50 | We want to address all the issues as soon as possible, but before fixing a bug 51 | we first need to reproduce and confirm it. In order to reproduce bugs we will 52 | systematically ask you to provide a minimal reproduction scenario using the 53 | custom issue template. Please stick to the issue template. 54 | 55 | Unfortunately we are not able to investigate / fix bugs without a minimal 56 | reproduction scenario, so if we don't hear back from you we may close the issue. 57 | 58 | ### Submitting a pull request 59 | 60 | Search GitHub for an open or closed PR that relates to your submission. You 61 | don't want to duplicate effort. If you do not find a related issue or PR, 62 | go ahead. 63 | 64 | 1. Fork the project, make your changes in a separate git branch and add 65 | descriptive messages to your commits. 66 | 67 | 2. Push your branch to GitHub and send a PR to 68 | `terraform-aws-api-gateway-enable-cors:master`. If we suggest changes, rebase 69 | your branch and push the changes to your GitHub repository, which will 70 | automatically update your PR. 71 | 72 | After your PR is merged, you can safely delete your branch and pull the changes 73 | from the main (upstream) repository. 74 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Terraform AWS API Gateway Enable CORS 2 | 3 | A Terraform module to add an OPTIONS method to allow Cross-Origin Resource 4 | Sharing (CORS) preflight requests. 5 | 6 | ## Usage 7 | 8 | ``` hcl 9 | module "cors" { 10 | source = "squidfunk/api-gateway-enable-cors/aws" 11 | version = "0.3.3" 12 | 13 | api_id = "" 14 | api_resource_id = "" 15 | } 16 | ``` 17 | 18 | By default, this will create a new `MOCK` endpoint on the provided API Gateway 19 | resource allowing CORS preflight requests for **all methods** and 20 | **all origins** by default. Of course this can be customized using variables 21 | as stated in the next section. 22 | 23 | ## Configuration 24 | 25 | The following variables can be configured: 26 | 27 | ### Required 28 | 29 | #### `api_id` 30 | 31 | - **Description**: API identifier 32 | - **Default**: `none` 33 | 34 | #### `api_resource_id` 35 | 36 | - **Description**: API resource identifier 37 | - **Default**: `none` 38 | 39 | ### Optional 40 | 41 | #### `allow_headers` 42 | 43 | - **Description**: Allow headers (`Access-Control-Allow-Headers`) 44 | - **Default**: 45 | 46 | ``` hcl 47 | [ 48 | "Authorization", 49 | "Content-Type", 50 | "X-Amz-Date", 51 | "X-Amz-Security-Token", 52 | "X-Api-Key" 53 | ] 54 | ``` 55 | 56 | #### `allow_methods` 57 | 58 | - **Description**: Allow methods (`Access-Control-Allow-Methods`) 59 | - **Default**: 60 | 61 | ``` hcl 62 | [ 63 | "OPTIONS", 64 | "HEAD", 65 | "GET", 66 | "POST", 67 | "PUT", 68 | "PATCH", 69 | "DELETE" 70 | ] 71 | ``` 72 | #### `allow_origin` 73 | 74 | - **Description**: Allow origin (`Access-Control-Allow-Origin`) 75 | - **Default**: `"*"` 76 | 77 | #### `allow_max_age` 78 | 79 | - **Description**: Allow caching time (`Access-Control-Allow-Max-Age`) 80 | - **Default**: `"7200"` 81 | 82 | #### `allow_credentials` 83 | 84 | - **Description**: Allow credentials (`Access-Control-Allow-Credentials`) 85 | - **Default**: `none` 86 | 87 | ### Outputs 88 | 89 | None. 90 | 91 | ## License 92 | 93 | **MIT License** 94 | 95 | Copyright (c) 2018-2020 Martin Donath 96 | 97 | Permission is hereby granted, free of charge, to any person obtaining a copy 98 | of this software and associated documentation files (the "Software"), to 99 | deal in the Software without restriction, including without limitation the 100 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 101 | sell copies of the Software, and to permit persons to whom the Software is 102 | furnished to do so, subject to the following conditions: 103 | 104 | The above copyright notice and this permission notice shall be included in 105 | all copies or substantial portions of the Software. 106 | 107 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 108 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 109 | FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE 110 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 111 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 112 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 113 | IN THE SOFTWARE. 114 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, gender identity and expression, level of 9 | experience, nationality, personal appearance, race, religion, or sexual 10 | identity and orientation. 11 | 12 | ## Our standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or reject 41 | comments, commits, code, wiki edits, issues, and other contributions that are 42 | not aligned to this Code of Conduct, or to ban temporarily or permanently any 43 | contributor for other behaviors that they deem inappropriate, threatening, 44 | offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an 52 | appointed representative at an online or offline event. Representation of a 53 | project may be further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at 59 | https://gitter.im/squidfunk/terraform-aws-api-gateway-enable-cors. The project 60 | team will review and investigate all complaints, and will respond in a way that 61 | it deems appropriate to the circumstances. The project team is obligated to 62 | maintain confidentiality with regard to the reporter of an incident. Further 63 | details of specific enforcement policies may be posted separately. 64 | 65 | Project maintainers who do not follow or enforce the Code of Conduct in good 66 | faith may face temporary or permanent repercussions as determined by other 67 | members of the project's leadership. 68 | 69 | ## Attribution 70 | 71 | This Code of Conduct is adapted from the [Contributor Covenant][1], version 1.4, 72 | available at [http://contributor-covenant.org/version/1/4][2] 73 | 74 | [1]: http://contributor-covenant.org 75 | [2]: http://contributor-covenant.org/version/1/4/ 76 | --------------------------------------------------------------------------------