@scaffoldly/terraform-aws-serverless-api-stage
v1.0.49
Published
Configure API Gateway for a Serverless API on a given stage:
Downloads
9
Readme
Description
Configure API Gateway for a Serverless API on a given stage:
- Rest API
- Cloudwatch Log Group
- Generalized CORS Response Templates
- Health Endpoint
- First deployment for the Health Endpoint
- A Stage with Logging Configuration
- The Base Path Mapping
- IAM Roles
Usage
module "stage" {
source = "scaffoldly/serverless-api-stage/aws"
for_each = var.stage_domains
domain = lookup(each.value, "serverless_api_domain", "unknown-domain")
stage_env_vars = lookup(each.value, "stage_env_vars", {})
name = var.name
stage = each.key
repository_name = module.repository.name
depends_on = [
module.repository
]
}
Requirements
| Name | Version | |------|---------| | terraform | >= 1.2, < 1.7 |
Providers
| Name | Version | |------|---------| | aws | 3.55.0 |
Modules
| Name | Source | Version | |------|--------|---------| | bucket | scaffoldly/s3-private-versioned/aws | 1.0.9 | | health | scaffoldly/api-gateway-static-endpoint/aws | 1.0.3 | | iam | scaffoldly/serverless-api-stage-iam/aws | 1.0.16 | | websocket | scaffoldly/serverless-api-stage-websocket/aws | 1.0.9 |
Resources
| Name | Type | |------|------| | aws_api_gateway_base_path_mapping.mapping | resource | | aws_api_gateway_deployment.deployment | resource | | aws_api_gateway_gateway_response.cors_responses | resource | | aws_api_gateway_method_settings.settings | resource | | aws_api_gateway_rest_api.api | resource | | aws_api_gateway_stage.stage | resource | | aws_cloudwatch_log_group.execution_group | resource | | aws_cloudwatch_log_group.group | resource | | aws_sns_topic.topic | resource | | aws_sns_topic_policy.policy | resource | | aws_caller_identity.current | data source | | aws_partition.current | data source |
Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| bucket_allow_public_access | Allow Objects in the bucket with a Public ACL | bool
| false
| no |
| bucket_name | Set the bucket name, default: var.repository_name | string
| ""
| no |
| create_bucket | Create an S3 Bucket for the Service | bool
| true
| no |
| create_topic | Create SNS Topics for the service | bool
| true
| no |
| domain | The domain for the Serverless API | string
| ""
| no |
| path | The name of the Serverless API | string
| ""
| no |
| regional | If true, create a regional Serverless API | bool
| false
| no |
| repository_name | The GitHub Repository Name | string
| n/a | yes |
| root_principal | The root prinicipal. In most cases leave this as 'root' | string
| "root"
| no |
| saml_trust | Output of trust from saml-to/iam/aws module | object({ trust_actions = list(string) trust_principal_identifiers = list(string) trust_principal_type = string trust_condition_saml_test = string trust_condition_saml_variable = string trust_condition_saml_values = list(string) } ) | null
| no |
| stage | The stage (e.g. live, nonlive) | string
| n/a | yes |
| stage_kms_key_id | The KMS Key ID for the stage (optional) | string
| ""
| no |
| websocket | (Optional) Enable a websocket for this stage | bool
| false
| no |
| websocket_domain | (Optional) The custom domain for the websocket (if using a custom domain) | string
| ""
| no |
Outputs
| Name | Description | |------|-------------| | api_id | The Rest API ID | | base_path | Computed path for the service, below the domain (/{servicename}) | | bucket_name | n/a | | domain | Computed domain name (https://{domain}) | | name | Re-output of the stage name | | repository_name | Re-output of the repository name | | rest_url | Full HTTP url to the service | | role_arn | n/a | | root_resource_id | The Rest API Root Resource ID | | s3_topic_arn | n/a | | stage | Re-output of the var.stage | | topic_arn | n/a | | url | Full HTTP url to the service (https://{domain}/{servicename}) | | websocket_api_id | The websocket API ID, if enabled, otherwise null | | websocket_url | The websocket URL, if enabled, otherwise null |