Skip to content

Commit 849840c

Browse files
Add example with block public access
1 parent 247fc3c commit 849840c

File tree

8 files changed

+831
-2
lines changed

8 files changed

+831
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,7 @@ No modules.
704704
| <a name="output_vgw_arn"></a> [vgw\_arn](#output\_vgw\_arn) | The ARN of the VPN Gateway |
705705
| <a name="output_vgw_id"></a> [vgw\_id](#output\_vgw\_id) | The ID of the VPN Gateway |
706706
| <a name="output_vpc_arn"></a> [vpc\_arn](#output\_vpc\_arn) | The ARN of the VPC |
707+
| <a name="output_vpc_block_public_access_exclusions"></a> [vpc\_block\_public\_access\_exclusions](#output\_vpc\_block\_public\_access\_exclusions) | List of VPC block public access exclusions |
707708
| <a name="output_vpc_cidr_block"></a> [vpc\_cidr\_block](#output\_vpc\_cidr\_block) | The CIDR block of the VPC |
708709
| <a name="output_vpc_enable_dns_hostnames"></a> [vpc\_enable\_dns\_hostnames](#output\_vpc\_enable\_dns\_hostnames) | Whether or not the VPC has DNS hostname support |
709710
| <a name="output_vpc_enable_dns_support"></a> [vpc\_enable\_dns\_support](#output\_vpc\_enable\_dns\_support) | Whether or not the VPC has DNS support |

examples/block-public-access/README.md

Lines changed: 208 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
provider "aws" {
2+
region = local.region
3+
}
4+
5+
data "aws_availability_zones" "available" {}
6+
7+
locals {
8+
name = "ex-${basename(path.cwd)}"
9+
region = "eu-west-1"
10+
11+
vpc_cidr = "10.0.0.0/16"
12+
azs = slice(data.aws_availability_zones.available.names, 0, 3)
13+
14+
tags = {
15+
Example = local.name
16+
GithubRepo = "terraform-aws-vpc"
17+
GithubOrg = "terraform-aws-modules"
18+
}
19+
}
20+
21+
################################################################################
22+
# VPC Module
23+
################################################################################
24+
25+
module "vpc" {
26+
source = "../../"
27+
28+
name = local.name
29+
cidr = local.vpc_cidr
30+
31+
azs = local.azs
32+
private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 4, k)]
33+
34+
### VPC Block Public Access Options
35+
# internet_gateway_block_enabled = true
36+
# internet_gateway_block_mode = "block-bidirectional"
37+
38+
### VPC Block Public Access Exclusion at the VPC level
39+
# vpc_block_public_access_exclusions = {
40+
# exclude_vpc = {
41+
# exclude_vpc = true
42+
# internet_gateway_exclusion_mode = "allow-bidirectional"
43+
# }
44+
# }
45+
46+
### VPC Block Public Access Exclusion at the subnet level
47+
vpc_block_public_access_exclusions = {
48+
exclude_subnet_private1 = {
49+
exclude_subnet = true
50+
subnet_type = "private"
51+
subnet_index = 1
52+
internet_gateway_exclusion_mode = "allow-egress"
53+
}
54+
exclude_subnet_private2 = {
55+
exclude_subnet = true
56+
subnet_type = "private"
57+
subnet_index = 2
58+
internet_gateway_exclusion_mode = "allow-egress"
59+
}
60+
}
61+
62+
tags = local.tags
63+
}

0 commit comments

Comments
 (0)