Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions examples/block-public-access/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ or at the subnet level e.g.:
vpc_block_public_access_exclusions = {
exclude_subnet_private1 = {
exclude_subnet = true
exclude_name = "private-subnet-1"
subnet_type = "private"
subnet_index = 1
internet_gateway_exclusion_mode = "allow-egress"
}
exclude_subnet_private2 = {
exclude_subnet = true
exclude_name = "private-subnet-2"
subnet_type = "private"
subnet_index = 2
internet_gateway_exclusion_mode = "allow-egress"
Expand All @@ -62,6 +64,7 @@ One of `exclude_vpc` or `exclude_subnet` must be set to true.
Value of `subnet_type` can be `public`, `private`, `database`, `redshift`, `elasticache`, `intra` or `custom`.
Value of `subnet_index` is the index of the subnet in the corresponding subnet list.
Value of `internet_gateway_exclusion_mode` can be `allow-egress` and `allow-bidirectional`.
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.

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

Expand Down
2 changes: 2 additions & 0 deletions examples/block-public-access/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ module "vpc" {
# vpc_block_public_access_exclusions = {
# exclude_subnet_private1 = {
# exclude_subnet = true
# exclude_name = "private-subnet-1"
# subnet_type = "private"
# subnet_index = 1
# internet_gateway_exclusion_mode = "allow-egress"
# }
# exclude_subnet_private2 = {
# exclude_subnet = true
# exclude_name = "private-subnet-2"
# subnet_type = "private"
# subnet_index = 2
# internet_gateway_exclusion_mode = "allow-egress"
Expand Down
4 changes: 3 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ resource "aws_vpc_block_public_access_exclusion" "this" {

internet_gateway_exclusion_mode = each.value.internet_gateway_exclusion_mode

tags = var.tags
tags = merge(
{ "Name" = try(coalesce(each.value.exclude_name), "${var.name}-bpa-exclusion") },
var.tags, )
}

################################################################################
Expand Down
Loading