Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/squidfunk/terraform-aws-api-gateway-enable-cors
Easily add an OPTIONS method to an API Gateway resource to enable CORS
https://github.com/squidfunk/terraform-aws-api-gateway-enable-cors
api-gateway aws cors terraform
Last synced: about 1 month ago
JSON representation
Easily add an OPTIONS method to an API Gateway resource to enable CORS
- Host: GitHub
- URL: https://github.com/squidfunk/terraform-aws-api-gateway-enable-cors
- Owner: squidfunk
- License: mit
- Created: 2018-06-11T18:38:05.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-09-21T06:22:51.000Z (over 1 year ago)
- Last Synced: 2024-11-09T00:42:21.760Z (about 1 month ago)
- Topics: api-gateway, aws, cors, terraform
- Language: HCL
- Homepage:
- Size: 33.2 KB
- Stars: 74
- Watchers: 6
- Forks: 28
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Terraform AWS API Gateway Enable CORS
A Terraform module to add an OPTIONS method to allow Cross-Origin Resource
Sharing (CORS) preflight requests.## Usage
``` hcl
module "cors" {
source = "squidfunk/api-gateway-enable-cors/aws"
version = "0.3.3"api_id = ""
api_resource_id = ""
}
```By default, this will create a new `MOCK` endpoint on the provided API Gateway
resource allowing CORS preflight requests for **all methods** and
**all origins** by default. Of course this can be customized using variables
as stated in the next section.## Configuration
The following variables can be configured:
### Required
#### `api_id`
- **Description**: API identifier
- **Default**: `none`#### `api_resource_id`
- **Description**: API resource identifier
- **Default**: `none`### Optional
#### `allow_headers`
- **Description**: Allow headers (`Access-Control-Allow-Headers`)
- **Default**:``` hcl
[
"Authorization",
"Content-Type",
"X-Amz-Date",
"X-Amz-Security-Token",
"X-Api-Key"
]
```#### `allow_methods`
- **Description**: Allow methods (`Access-Control-Allow-Methods`)
- **Default**:``` hcl
[
"OPTIONS",
"HEAD",
"GET",
"POST",
"PUT",
"PATCH",
"DELETE"
]
```
#### `allow_origin`- **Description**: Allow origin (`Access-Control-Allow-Origin`)
- **Default**: `"*"`#### `allow_max_age`
- **Description**: Allow caching time (`Access-Control-Allow-Max-Age`)
- **Default**: `"7200"`#### `allow_credentials`
- **Description**: Allow credentials (`Access-Control-Allow-Credentials`)
- **Default**: `none`### Outputs
None.
## License
**MIT License**
Copyright (c) 2018-2020 Martin Donath
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.