Skip to content

Commit 060e1dd

Browse files
author
Gary Mclean
committed
Updated to allow Name tag creation of the BPA Resource
1 parent 961c9b5 commit 060e1dd

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

examples/block-public-access/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@ or at the subnet level e.g.:
4545
vpc_block_public_access_exclusions = {
4646
exclude_subnet_private1 = {
4747
exclude_subnet = true
48+
exclude_name = "private-subnet-1"
4849
subnet_type = "private"
4950
subnet_index = 1
5051
internet_gateway_exclusion_mode = "allow-egress"
5152
}
5253
exclude_subnet_private2 = {
5354
exclude_subnet = true
55+
exclude_name = "private-subnet-2"
5456
subnet_type = "private"
5557
subnet_index = 2
5658
internet_gateway_exclusion_mode = "allow-egress"
@@ -62,6 +64,7 @@ One of `exclude_vpc` or `exclude_subnet` must be set to true.
6264
Value of `subnet_type` can be `public`, `private`, `database`, `redshift`, `elasticache`, `intra` or `custom`.
6365
Value of `subnet_index` is the index of the subnet in the corresponding subnet list.
6466
Value of `internet_gateway_exclusion_mode` can be `allow-egress` and `allow-bidirectional`.
67+
Value of `exclude_name` is string value of the Name tag for the resource. If omitted, the default name of VPC Name-bpa-exclusion is applied.
6568

6669
After deployment, VPC block public access options can be verified with the following command:
6770

examples/block-public-access/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,14 @@ module "vpc" {
4848
# vpc_block_public_access_exclusions = {
4949
# exclude_subnet_private1 = {
5050
# exclude_subnet = true
51+
# exclude_name = "private-subnet-1"
5152
# subnet_type = "private"
5253
# subnet_index = 1
5354
# internet_gateway_exclusion_mode = "allow-egress"
5455
# }
5556
# exclude_subnet_private2 = {
5657
# exclude_subnet = true
58+
# exclude_name = "private-subnet-2"
5759
# subnet_type = "private"
5860
# subnet_index = 2
5961
# internet_gateway_exclusion_mode = "allow-egress"

main.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ resource "aws_vpc_block_public_access_exclusion" "this" {
8686

8787
internet_gateway_exclusion_mode = each.value.internet_gateway_exclusion_mode
8888

89-
tags = var.tags
89+
tags = merge(
90+
{ "Name" = try(coalesce(each.value.exclude_name), "${var.name}-bpa-exclusion") },
91+
var.tags, )
9092
}
9193

9294
################################################################################

0 commit comments

Comments
 (0)