From 1dcaa566acb74b2f718c548507997bb67ac2f45f Mon Sep 17 00:00:00 2001 From: Joshua Kite Date: Sat, 25 Oct 2025 17:48:08 +0100 Subject: [PATCH 1/3] add bool for including default tag --- examples/complete-http/main.tf | 11 +++++++++++ main.tf | 2 +- variables.tf | 6 ++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/examples/complete-http/main.tf b/examples/complete-http/main.tf index 07cd360..05c8aaf 100644 --- a/examples/complete-http/main.tf +++ b/examples/complete-http/main.tf @@ -195,6 +195,17 @@ module "api_gateway_disabled" { create = false } +module "api_gateway_without_default_tags" { + source = "../../" + + name = "${local.name}-no-default-tags" + include_default_tags = false + + tags = { + CustomTag = "custom-value" + } +} + ################################################################################ # Supporting Resources ################################################################################ diff --git a/main.tf b/main.tf index 0e5c206..ade7ca5 100644 --- a/main.tf +++ b/main.tf @@ -42,7 +42,7 @@ resource "aws_apigatewayv2_api" "this" { version = var.api_version tags = merge( - { terraform-aws-modules = "apigateway-v2" }, + var.include_default_tags ? { terraform-aws-modules = "apigateway-v2" } : {}, var.tags, ) } diff --git a/variables.tf b/variables.tf index 3e2219d..27ac8bc 100644 --- a/variables.tf +++ b/variables.tf @@ -4,6 +4,12 @@ variable "create" { default = true } +variable "include_default_tags" { + description = "Set to false to not include the default tag in the tags map." + type = bool + default = true +} + variable "tags" { description = "A mapping of tags to assign to API gateway resources" type = map(string) From 432c0658f2b5693f47d4d219bc19c0e2058b2b3f Mon Sep 17 00:00:00 2001 From: Joshua Kite Date: Sat, 25 Oct 2025 17:57:15 +0100 Subject: [PATCH 2/3] terraform-docs --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2f37273..a0a7393 100644 --- a/README.md +++ b/README.md @@ -235,6 +235,7 @@ module "api_gateway" { | [domain\_name\_ownership\_verification\_certificate\_arn](#input\_domain\_name\_ownership\_verification\_certificate\_arn) | ARN of the AWS-issued certificate used to validate custom domain ownership (when certificate\_arn is issued via an ACM Private CA or mutual\_tls\_authentication is configured with an ACM-imported certificate.) | `string` | `null` | no | | [fail\_on\_warnings](#input\_fail\_on\_warnings) | Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to `false`. Applicable for HTTP APIs | `bool` | `null` | no | | [hosted\_zone\_name](#input\_hosted\_zone\_name) | Optional domain name of the Hosted Zone where the domain should be created | `string` | `null` | no | +| [include\_default\_tags](#input\_include\_default\_tags) | Set to false to not include the default tag in the tags map. | `bool` | `true` | no | | [ip\_address\_type](#input\_ip\_address\_type) | The IP address types that can invoke the API. Valid values: ipv4, dualstack. Use ipv4 to allow only IPv4 addresses to invoke your API, or use dualstack to allow both IPv4 and IPv6 addresses to invoke your API. Defaults to ipv4. | `string` | `null` | no | | [mutual\_tls\_authentication](#input\_mutual\_tls\_authentication) | The mutual TLS authentication configuration for the domain name | `map(string)` | `{}` | no | | [name](#input\_name) | The name of the API. Must be less than or equal to 128 characters in length | `string` | `""` | no | From 273c8245e1118a3ea1728814106fab6cb749b26b Mon Sep 17 00:00:00 2001 From: Joshua Kite Date: Sat, 25 Oct 2025 18:01:08 +0100 Subject: [PATCH 3/3] singluar tag not plural --- README.md | 2 +- examples/complete-http/main.tf | 4 ++-- main.tf | 2 +- variables.tf | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a0a7393..dfe84a2 100644 --- a/README.md +++ b/README.md @@ -235,7 +235,7 @@ module "api_gateway" { | [domain\_name\_ownership\_verification\_certificate\_arn](#input\_domain\_name\_ownership\_verification\_certificate\_arn) | ARN of the AWS-issued certificate used to validate custom domain ownership (when certificate\_arn is issued via an ACM Private CA or mutual\_tls\_authentication is configured with an ACM-imported certificate.) | `string` | `null` | no | | [fail\_on\_warnings](#input\_fail\_on\_warnings) | Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to `false`. Applicable for HTTP APIs | `bool` | `null` | no | | [hosted\_zone\_name](#input\_hosted\_zone\_name) | Optional domain name of the Hosted Zone where the domain should be created | `string` | `null` | no | -| [include\_default\_tags](#input\_include\_default\_tags) | Set to false to not include the default tag in the tags map. | `bool` | `true` | no | +| [include\_default\_tag](#input\_include\_default\_tag) | Set to false to not include the default tag in the tags map. | `bool` | `true` | no | | [ip\_address\_type](#input\_ip\_address\_type) | The IP address types that can invoke the API. Valid values: ipv4, dualstack. Use ipv4 to allow only IPv4 addresses to invoke your API, or use dualstack to allow both IPv4 and IPv6 addresses to invoke your API. Defaults to ipv4. | `string` | `null` | no | | [mutual\_tls\_authentication](#input\_mutual\_tls\_authentication) | The mutual TLS authentication configuration for the domain name | `map(string)` | `{}` | no | | [name](#input\_name) | The name of the API. Must be less than or equal to 128 characters in length | `string` | `""` | no | diff --git a/examples/complete-http/main.tf b/examples/complete-http/main.tf index 05c8aaf..4b1246d 100644 --- a/examples/complete-http/main.tf +++ b/examples/complete-http/main.tf @@ -198,8 +198,8 @@ module "api_gateway_disabled" { module "api_gateway_without_default_tags" { source = "../../" - name = "${local.name}-no-default-tags" - include_default_tags = false + name = "${local.name}-no-default-tags" + include_default_tag = false tags = { CustomTag = "custom-value" diff --git a/main.tf b/main.tf index ade7ca5..6f8e131 100644 --- a/main.tf +++ b/main.tf @@ -42,7 +42,7 @@ resource "aws_apigatewayv2_api" "this" { version = var.api_version tags = merge( - var.include_default_tags ? { terraform-aws-modules = "apigateway-v2" } : {}, + var.include_default_tag ? { terraform-aws-modules = "apigateway-v2" } : {}, var.tags, ) } diff --git a/variables.tf b/variables.tf index 27ac8bc..d3665da 100644 --- a/variables.tf +++ b/variables.tf @@ -4,7 +4,7 @@ variable "create" { default = true } -variable "include_default_tags" { +variable "include_default_tag" { description = "Set to false to not include the default tag in the tags map." type = bool default = true