Skip to content

Commit 1dcaa56

Browse files
committed
add bool for including default tag
1 parent 431c09f commit 1dcaa56

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

examples/complete-http/main.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,17 @@ module "api_gateway_disabled" {
195195
create = false
196196
}
197197

198+
module "api_gateway_without_default_tags" {
199+
source = "../../"
200+
201+
name = "${local.name}-no-default-tags"
202+
include_default_tags = false
203+
204+
tags = {
205+
CustomTag = "custom-value"
206+
}
207+
}
208+
198209
################################################################################
199210
# Supporting Resources
200211
################################################################################

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ resource "aws_apigatewayv2_api" "this" {
4242
version = var.api_version
4343

4444
tags = merge(
45-
{ terraform-aws-modules = "apigateway-v2" },
45+
var.include_default_tags ? { terraform-aws-modules = "apigateway-v2" } : {},
4646
var.tags,
4747
)
4848
}

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ variable "create" {
44
default = true
55
}
66

7+
variable "include_default_tags" {
8+
description = "Set to false to not include the default tag in the tags map."
9+
type = bool
10+
default = true
11+
}
12+
713
variable "tags" {
814
description = "A mapping of tags to assign to API gateway resources"
915
type = map(string)

0 commit comments

Comments
 (0)