Skip to content

Flaconi/terraform-aws-api-gateway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

terraform-module-template

Template for Terraform modules

License

For requirements regarding module structure: style-guide-terraform.md

Providers

Name Version
aws >= 5.0
random >= 3.6

Requirements

Name Version
terraform ~> 1.3
aws >= 5.0
random >= 3.6

Required Inputs

The following input variables are required:

Description: The name of the stage

Type: string

Description: The name of the gateway

Type: string

Optional Inputs

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

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

Type: string

Default: "REGIONAL"

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

Type: string

Default: "INFO"

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

Type: bool

Default: false

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

Type: bool

Default: false

Description: Key-value mapping of tags

Type: map(string)

Default: {}

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"

Description: The IAM policy document for the API.

Type: string

Default: null

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

Type: bool

Default: true

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

Type: list(string)

Default: []

Description: List of Cognito user pool ARNS

Type: set(string)

Default: []

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

Type: bool

Default: false

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

Type: list(string)

Default: []

Description: n/a

Type:

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 The URL to invoke the API pointing to the stage
cognito_authorizer_id The authorizer ID of the REST API's cognito authorizer
id The ID of the REST API
resources_paths_map Map of resource paths to id in api gateway
root_resource_id The resource ID of the REST API's root

License

MIT License

Copyright (c) 2023 Flaconi GmbH