https://github.com/mewa/terraform-aws-serverless-resource
This module simplifies the setup required to deploy Lambda functions under API Gateway. It also sets up CORS for created resources and methods.
https://github.com/mewa/terraform-aws-serverless-resource
api-gateway aws-lambda lambda serverless terraform terraform-modules
Last synced: 12 months ago
JSON representation
This module simplifies the setup required to deploy Lambda functions under API Gateway. It also sets up CORS for created resources and methods.
- Host: GitHub
- URL: https://github.com/mewa/terraform-aws-serverless-resource
- Owner: mewa
- Created: 2018-04-14T23:40:15.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-06-17T19:24:59.000Z (about 6 years ago)
- Last Synced: 2025-05-08T20:58:08.935Z (about 1 year ago)
- Topics: api-gateway, aws-lambda, lambda, serverless, terraform, terraform-modules
- Language: HCL
- Homepage: https://registry.terraform.io/modules/mewa/serverless-resource/aws
- Size: 7.81 KB
- Stars: 3
- Watchers: 1
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Terraform Serverless Resource module
This module simplifies the setup required to deploy Lambda functions under API Gateway (v1/REST). It also sets up CORS for created resources and methods.
It creates resources and sets up HTTP methods to invoke supplied Lambdas.
# Examples
```hcl
# /test
module "test" {
source = "mewa/serverless-resource/aws"
version = "2.0.0"
api = aws_api_gateway_rest_api.api.id
root_resource = aws_api_gateway_rest_api.api.root_resource_id
api_key_required = true # false by default
resource = "test"
origin = "https://example.com" # optional, defaults to "*"
methods = [
{
method = "PUT" # HTTP method
type = "AWS" # lambda integration type
invoke_arn = aws_lambda_function.test_put_lambda.invoke_arn # lambda invoke ARN
},
{
method = "DELETE"
type = null # if null defaults to "AWS_PROXY"
invoke_arn = aws_lambda_function.test_delete_lambda.invoke_arn
}
]
}
```