Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/flaconi/terraform-aws-api-gateway

Create api gateway for sharing in sls configs
https://github.com/flaconi/terraform-aws-api-gateway

api aws flaconi-lite terraform terraform-module

Last synced: about 4 hours ago
JSON representation

Create api gateway for sharing in sls configs

Awesome Lists containing this project

README

        

# terraform-module-template
Template for Terraform modules

[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)

For requirements regarding module structure: [style-guide-terraform.md](https://github.com/Flaconi/devops-docs/blob/master/doc/conventions/style-guide-terraform.md)

## Providers

| Name | Version |
|------|---------|
| [aws](#provider\_aws) | >= 5.0 |
| [random](#provider\_random) | >= 3.6 |

## Requirements

| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | ~> 1.3 |
| [aws](#requirement\_aws) | >= 5.0 |
| [random](#requirement\_random) | >= 3.6 |

## Required Inputs

The following input variables are required:

### [stage\_name](#input\_stage\_name)

Description: The name of the stage

Type: `string`

### [name](#input\_name)

Description: The name of the gateway

Type: `string`

## Optional Inputs

The following input variables are optional (have default values):

### [endpoint\_type](#input\_endpoint\_type)

Description: The type of the endpoint. One of - PUBLIC, PRIVATE, REGIONAL

Type: `string`

Default: `"REGIONAL"`

### [logging\_level](#input\_logging\_level)

Description: The logging level of the API. One of - OFF, INFO, ERROR

Type: `string`

Default: `"INFO"`

### [metrics\_enabled](#input\_metrics\_enabled)

Description: A flag to indicate whether to enable metrics collection.

Type: `bool`

Default: `false`

### [xray\_tracing\_enabled](#input\_xray\_tracing\_enabled)

Description: A flag to indicate whether to enable X-Ray tracing.

Type: `bool`

Default: `false`

### [tags](#input\_tags)

Description: Key-value mapping of tags

Type: `map(string)`

Default: `{}`

### [access\_log\_format](#input\_access\_log\_format)

Description: The format of the access log file.

Type: `string`

Default: `" {\n\t\"requestTime\": \"$context.requestTime\",\n\t\"requestId\": \"$context.requestId\",\n\t\"httpMethod\": \"$context.httpMethod\",\n\t\"path\": \"$context.path\",\n\t\"resourcePath\": \"$context.resourcePath\",\n\t\"status\": $context.status,\n\t\"responseLatency\": $context.responseLatency,\n \"xrayTraceId\": \"$context.xrayTraceId\",\n \"integrationRequestId\": \"$context.integration.requestId\",\n\t\"functionResponseStatus\": \"$context.integration.status\",\n \"integrationLatency\": \"$context.integration.latency\",\n\t\"integrationServiceStatus\": \"$context.integration.integrationStatus\",\n \"authorizeResultStatus\": \"$context.authorize.status\",\n\t\"authorizerServiceStatus\": \"$context.authorizer.status\",\n\t\"authorizerLatency\": \"$context.authorizer.latency\",\n\t\"authorizerRequestId\": \"$context.authorizer.requestId\",\n \"ip\": \"$context.identity.sourceIp\",\n\t\"userAgent\": \"$context.identity.userAgent\",\n\t\"principalId\": \"$context.authorizer.principalId\",\n\t\"cognitoUser\": \"$context.identity.cognitoIdentityId\",\n \"user\": \"$context.identity.user\"\n}\n"`

### [rest\_api\_policy](#input\_rest\_api\_policy)

Description: The IAM policy document for the API.

Type: `string`

Default: `null`

### [enabled](#input\_enabled)

Description: Set to false to prevent the module from creating any resources

Type: `bool`

Default: `true`

### [vpc\_endpoint\_ids](#input\_vpc\_endpoint\_ids)

Description: list of vpc endpoint ids for a private api to be assigned

Type: `list(string)`

Default: `[]`

### [cognito\_provider\_arns](#input\_cognito\_provider\_arns)

Description: List of Cognito user pool ARNS

Type: `set(string)`

Default: `[]`

### [default\_integration\_enabled](#input\_default\_integration\_enabled)

Description: Set to true to enable a initial default integration to allow policy deployments for a sharded gateway

Type: `bool`

Default: `false`

### [resource\_paths](#input\_resource\_paths)

Description: a list of root resource paths to be used in sharded environment

Type: `list(string)`

Default: `[]`

### [gateway\_response](#input\_gateway\_response)

Description: n/a

Type:

```hcl
map(object({
status_code = number
#https://docs.aws.amazon.com/apigateway/latest/developerguide/supported-gateway-response-types.html
response_templates = object({
json = string
})
}))
```

Default: `{}`

## Outputs

| Name | Description |
|------|-------------|
| [api\_url](#output\_api\_url) | The URL to invoke the API pointing to the stage |
| [cognito\_authorizer\_id](#output\_cognito\_authorizer\_id) | The authorizer ID of the REST API's cognito authorizer |
| [id](#output\_id) | The ID of the REST API |
| [resources\_paths\_map](#output\_resources\_paths\_map) | Map of resource paths to id in api gateway |
| [root\_resource\_id](#output\_root\_resource\_id) | The resource ID of the REST API's root |

## License

**[MIT License](LICENSE)**

Copyright (c) 2023 **[Flaconi GmbH](https://github.com/flaconi)**