Skip to content

Latest commit

 

History

History
191 lines (94 loc) · 7.19 KB

README.md

File metadata and controls

191 lines (94 loc) · 7.19 KB

README Header

tf-mod-aws-lambda-rest-api

Module description

Use the tf-mod-lambda-rest-api module to create an AWS Gateway REST API & Deployment for existing lambda functions.

Additionally, it optionally creates the neccessary lambda permissions, security keys, and a usageplan.

Project: %!s() : [%!s()] | [%!s()]

Usage

IMPORTANT: The master branch is used in source just as an example. In your code, do not pin to master because there may be breaking changes between releases. Instead pin to the release tag (e.g. ?ref=tags/x.y.z) of one of our latest releases.

The below values shown in the usage of this module are purely representative, please replace desired values as required.

TO-DO

Examples

Simple and advanced examples of this project.

Advanced Example 1:

TO-DO

Providers

Name Version
aws ~> 2.0 >= 2.7.0
local n/a
template n/a

Inputs

Name Description Type Default Required
api_name (Required) - The name of the REST API string n/a yes
availability_zones (Required) - The AWS avaialbility zones (e.g. ap-southeast-2a/b/c). Autoloaded from region.tfvars. list(string) n/a yes
function_names (Required) - Name of the Lambda function whose resource policy you are updating list(string) n/a yes
api_key_source (Optional) - The source of the API key for requests. Valid values are HEADER (default) and AUTHORIZER. string "HEADER" no
attributes (Optional) - Additional attributes (e.g. 1) list(string) [] no
aws_account_id The AWS account id of the provider being deployed to (e.g. 12345678). Autoloaded from account.tfvars string "" no
aws_assume_role_arn (Optional) - ARN of the IAM role when optionally connecting to AWS via assumed role. Autoloaded from account.tfvars. string "" no
aws_assume_role_external_id (Optional) - The external ID to use when making the AssumeRole call. string "" no
aws_assume_role_session_name (Optional) - The session name to use when making the AssumeRole call. string "" no
aws_region The AWS region (e.g. ap-southeast-2). Autoloaded from region.tfvars. string "" no
binary_media_types (Optional) - The list of binary media types supported by the RestApi. By default, the RestApi supports only UTF-8-encoded text payloads. list(string) [] no
body (Optional) - An OpenAPI specification that defines the set of routes and integrations to create as part of the REST API. string "" no
cognito_userpool_arn Cognito userpool ARN for user authentication string "" no
delimiter (Optional) - Delimiter to be used between namespace, environment, stage, name and attributes string "-" no
description (Optional) - The description of the role. string "Managed by Terraform" no
enabled (Optional) - A Switch that decides whether to create a terraform resource or run a provisioner. Default is true bool true no
endpoint_type (Optional) - (Required) A list of endpoint types. This resource currently only supports managing a single value. Valid values: EDGE, REGIONAL or PRIVATE. If unspecified, defaults to EDGE. string "REGIONAL" no
environment (Optional) - Environment, e.g. 'dev', 'qa', 'staging', 'prod' string "" no
minimum_compression_size (Optional) Minimum response size to compress for the REST API. Integer between -1 and 10485760 (10MB). Setting a value greater than -1 will enable compression, -1 disables compression (default). string "-1" no
name (Optional) - Solution name, e.g. 'vault', 'consul', 'keycloak', 'k8s', or 'baseline' string "" no
namespace (Optional) - Namespace, which could be your abbreviated product team, e.g. 'rci', 'mi', 'hp', or 'core' string "" no
policy (Optional) - JSON formatted policy document that controls access to the API Gateway. string "" no
quota_settings (Optional) - Quota Settings Arguments. Full details can be found here https://www.terraform.io/docs/providers/aws/r/api\_gateway\_usage\_plan.html
object({
limit = number
offset = number
period = string
})
{
"limit": 1000000,
"offset": 1,
"period": "MONTH"
}
no
tags (Optional) - Additional tags map(string) {} no
throttle_settings (Optional) - Throttle Settings Arguments. Full details can be found here https://www.terraform.io/docs/providers/aws/r/api\_gateway\_usage\_plan.html
object({
burst_limit = number
rate_limit = number
})
{
"burst_limit": 10,
"rate_limit": 20
}
no
vpc_endpoint_ids (Optional) - A list of VPC Endpoint Ids. It is only supported for PRIVATE endpoint type. string "" no

Outputs

Name Description
api_id The ID of the REST API
arn The Amazon Resource Name (ARN)
created_date The creation date of the REST API
execution_arn The execution ARN part to be used in lambda_permission's source_arn when allowing API Gateway to invoke a Lambda function, e.g. arn:aws:execute-api:eu-west-2:123456789012:z4675bid1j, which can be concatenated with allowed stage, method and resource path.

Related Projects

You can find more Terraform Modules by vising the link.

Additionally, check out these other related, and maintained projects.

Help

Got a question? We got answers.

File a Github issue, or message us on Slack

Contributors

Callum Robertson
Callum Robertson


README Footer