From 440389b836b3f7e65c1cfb513f0540759e041ff1 Mon Sep 17 00:00:00 2001 From: Jakeasaurus Date: Tue, 3 Dec 2024 22:58:21 +0000 Subject: [PATCH] chore: terraform fmt and terraform-docs --- modules/aws/api_gateway/README.md | 21 ++++++++++++++++++--- modules/aws/api_gateway/main.tf | 28 ++++++++++++++-------------- modules/aws/api_gateway/variables.tf | 24 ++++++++++++------------ 3 files changed, 44 insertions(+), 29 deletions(-) diff --git a/modules/aws/api_gateway/README.md b/modules/aws/api_gateway/README.md index d4a618d5..d511570a 100644 --- a/modules/aws/api_gateway/README.md +++ b/modules/aws/api_gateway/README.md @@ -109,15 +109,30 @@ No modules. | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| -| [name](#input\_name) | (Required) The name of the API | `string` | n/a | yes | -| [protocol_type](#input\_protocol_type) | (Required) The API protocol. Valid values: HTTP, WEBSOCKET | `string` | n/a | yes | +| [api\_key\_selection\_expression](#input\_api\_key\_selection\_expression) | API key selection expression for the API Gateway | `string` | `""` | no | +| [body](#input\_body) | OpenAPI specification for the API Gateway | `string` | `null` | no | +| [cors\_configuration](#input\_cors\_configuration) | CORS configuration for the API Gateway |
object({
allow_credentials = bool
allow_headers = list(string)
allow_methods = list(string)
allow_origins = list(string)
expose_headers = list(string)
max_age = number
})
|
{
"allow_credentials": false,
"allow_headers": [],
"allow_methods": [],
"allow_origins": [],
"expose_headers": [],
"max_age": 0
}
| no | +| [credentials\_arn](#input\_credentials\_arn) | ARN of the credentials for the API Gateway | `string` | `null` | no | +| [description](#input\_description) | Description of the API Gateway | `string` | `null` | no | +| [disable\_execute\_api\_endpoint](#input\_disable\_execute\_api\_endpoint) | Whether to disable the execute-api endpoint | `bool` | `false` | no | +| [fail\_on\_warnings](#input\_fail\_on\_warnings) | Whether to fail on warnings during API Gateway creation | `bool` | `false` | no | +| [name](#input\_name) | Name of the API Gateway | `string` | n/a | yes | +| [protocol\_type](#input\_protocol\_type) | Protocol type of the API Gateway (HTTP or WEBSOCKET) | `string` | n/a | yes | +| [tags](#input\_tags) | Tags to apply to the API Gateway | `map(string)` | `{}` | no | +| [target](#input\_target) | Target for the API Gateway | `string` | `null` | no | +| [version](#input\_version) | Version of the API Gateway | `string` | `null` | no | ## Outputs | Name | Description | |------|-------------| | [api\_endpoint](#output\_api\_endpoint) | The URI of the API | -| [api\_id](#output\_api\_id) | The API identifier | +| [api\_key\_selection\_expression](#output\_api\_key\_selection\_expression) | The API key selection expression for the API | +| [arn](#output\_arn) | The ARN of the API | +| [cors\_configuration](#output\_cors\_configuration) | The CORS configuration for the API | +| [execution\_arn](#output\_execution\_arn) | The ARN prefix to be used in permission policies | +| [id](#output\_id) | The API identifier | +| [tags\_all](#output\_tags\_all) | Map of tags assigned to the resource | diff --git a/modules/aws/api_gateway/main.tf b/modules/aws/api_gateway/main.tf index 4df41de7..b1806365 100644 --- a/modules/aws/api_gateway/main.tf +++ b/modules/aws/api_gateway/main.tf @@ -26,20 +26,20 @@ resource "aws_apigatewayv2_api" "example" { #Optional api_key_selection_expression = var.api_key_selection_expression cors_configuration { - allow_credentials = lookup(var.cors_configuration, "allow_credentials", null) - allow_headers = lookup(var.cors_configuration, "allow_headers", null) - allow_methods = lookup(var.cors_configuration, "allow_methods", null) - allow_origins = lookup(var.cors_configuration, "allow_origins", null) - expose_headers = lookup(var.cors_configuration, "expose_headers", null) - max_age = lookup(var.cors_configuration, "max_age", null) - } - credentials_arn = var.credentials_arn - description = var.description + allow_credentials = lookup(var.cors_configuration, "allow_credentials", null) + allow_headers = lookup(var.cors_configuration, "allow_headers", null) + allow_methods = lookup(var.cors_configuration, "allow_methods", null) + allow_origins = lookup(var.cors_configuration, "allow_origins", null) + expose_headers = lookup(var.cors_configuration, "expose_headers", null) + max_age = lookup(var.cors_configuration, "max_age", null) + } + credentials_arn = var.credentials_arn + description = var.description disable_execute_api_endpoint = var.disable_execute_api_endpoint - fail_on_warnings = var.fail_on_warnings - tags = var.tags - target = var.target - version = var.version - body = var.body + fail_on_warnings = var.fail_on_warnings + tags = var.tags + target = var.target + version = var.version + body = var.body } diff --git a/modules/aws/api_gateway/variables.tf b/modules/aws/api_gateway/variables.tf index 089475d0..8ff7d313 100644 --- a/modules/aws/api_gateway/variables.tf +++ b/modules/aws/api_gateway/variables.tf @@ -24,21 +24,21 @@ variable "api_key_selection_expression" { variable "cors_configuration" { description = "CORS configuration for the API Gateway" - type = object({ + type = object({ allow_credentials = bool - allow_headers = list(string) - allow_methods = list(string) - allow_origins = list(string) - expose_headers = list(string) - max_age = number + allow_headers = list(string) + allow_methods = list(string) + allow_origins = list(string) + expose_headers = list(string) + max_age = number }) - default = { + default = { allow_credentials = false - allow_headers = [] - allow_methods = [] - allow_origins = [] - expose_headers = [] - max_age = 0 + allow_headers = [] + allow_methods = [] + allow_origins = [] + expose_headers = [] + max_age = 0 } }