Skip to content

Commit df3865b

Browse files
Extend README, refactor variables and outputs
1 parent f9e23d5 commit df3865b

File tree

5 files changed

+56
-58
lines changed

5 files changed

+56
-58
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -583,8 +583,8 @@ No modules.
583583
| <a name="input_single_nat_gateway"></a> [single\_nat\_gateway](#input\_single\_nat\_gateway) | Should be true if you want to provision a single shared NAT Gateway across all of your private networks | `bool` | `false` | no |
584584
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no |
585585
| <a name="input_use_ipam_pool"></a> [use\_ipam\_pool](#input\_use\_ipam\_pool) | Determines whether IPAM pool is used for CIDR allocation | `bool` | `false` | no |
586-
| <a name="input_vpc_block_public_access_exclusions"></a> [vpc\_block\_public\_access\_exclusions](#input\_vpc\_block\_public\_access\_exclusions) | List of VPC Block Public Access Exclusions e.g. to exclude the VPC:<pre>vpc_block_public_access_exclusions = {<br/> exclude_vpc = {<br/> exclude_vpc = true<br/> internet_gateway_exclusion_mode = "allow-bidirectional"<br/> }<br/> }</pre>or to exclude specific subnets:<pre>vpc_block_public_access_exclusions = {<br/> exclude_subnet_private1 = {<br/> exclude_subnet = true<br/> subnet_type = "private"<br/> subnet_index = 1<br/> internet_gateway_exclusion_mode = "allow-egress"<br/> }<br/> exclude_subnet_private2 = {<br/> exclude_subnet = true<br/> subnet_type = "private"<br/> subnet_index = 2<br/> internet_gateway_exclusion_mode = "allow-egress"<br/> }<br/> }</pre>One of `exclude_vpc` or `exclude_subnet` must be set to true.<br/> Value of `subnet_type` can be `public`, `private`, `database`, `redshift`, `elasticache`, `intra` or `custom`.<br/> Value of `subnet_index` is the index of the subnet in the corresponding subnet list.<br/> Value of `internet_gateway_exclusion_mode` can be `allow-egress` and `allow-bidirectional`. | `map(any)` | `{}` | no |
587-
| <a name="input_vpc_block_public_access_options"></a> [vpc\_block\_public\_access\_options](#input\_vpc\_block\_public\_access\_options) | Map of VPC Block Public Access Options e.g.:<pre>vpc_block_public_access_options = {<br/> internet_gateway_block_mode = "block-bidirectional"<br/> }</pre>Currently only `internet_gateway_block_mode` is supported, for which<br/> valid values are `block-bidirectional`, `block-ingress` and `off`. | `map(string)` | `{}` | no |
586+
| <a name="input_vpc_block_public_access_exclusions"></a> [vpc\_block\_public\_access\_exclusions](#input\_vpc\_block\_public\_access\_exclusions) | A map of VPC block public access exclusions | `map(any)` | `{}` | no |
587+
| <a name="input_vpc_block_public_access_options"></a> [vpc\_block\_public\_access\_options](#input\_vpc\_block\_public\_access\_options) | A map of VPC block public access options | `map(string)` | `{}` | no |
588588
| <a name="input_vpc_flow_log_iam_policy_name"></a> [vpc\_flow\_log\_iam\_policy\_name](#input\_vpc\_flow\_log\_iam\_policy\_name) | Name of the IAM policy | `string` | `"vpc-flow-log-to-cloudwatch"` | no |
589589
| <a name="input_vpc_flow_log_iam_policy_use_name_prefix"></a> [vpc\_flow\_log\_iam\_policy\_use\_name\_prefix](#input\_vpc\_flow\_log\_iam\_policy\_use\_name\_prefix) | Determines whether the name of the IAM policy (`vpc_flow_log_iam_policy_name`) is used as a prefix | `bool` | `true` | no |
590590
| <a name="input_vpc_flow_log_iam_role_name"></a> [vpc\_flow\_log\_iam\_role\_name](#input\_vpc\_flow\_log\_iam\_role\_name) | Name to use on the VPC Flow Log IAM role created | `string` | `"vpc-flow-log-role"` | no |
@@ -703,7 +703,7 @@ No modules.
703703
| <a name="output_vgw_arn"></a> [vgw\_arn](#output\_vgw\_arn) | The ARN of the VPN Gateway |
704704
| <a name="output_vgw_id"></a> [vgw\_id](#output\_vgw\_id) | The ID of the VPN Gateway |
705705
| <a name="output_vpc_arn"></a> [vpc\_arn](#output\_vpc\_arn) | The ARN of the VPC |
706-
| <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 |
706+
| <a name="output_vpc_block_public_access_exclusions"></a> [vpc\_block\_public\_access\_exclusions](#output\_vpc\_block\_public\_access\_exclusions) | A map of VPC block public access exclusions |
707707
| <a name="output_vpc_cidr_block"></a> [vpc\_cidr\_block](#output\_vpc\_cidr\_block) | The CIDR block of the VPC |
708708
| <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 |
709709
| <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: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,58 @@ $ terraform apply
1818

1919
Note that this example may create resources which can cost money (AWS Elastic IP, for example). Run `terraform destroy` when you don't need these resources.
2020

21-
After deployment, VPC Block Public Access Options can be verified with the following command:
21+
In the example below, a map of VPC block public access options is configured:
22+
23+
```
24+
vpc_block_public_access_options = {
25+
internet_gateway_block_mode = "block-bidirectional"
26+
}
27+
```
28+
29+
Currently only `internet_gateway_block_mode` is supported, for which valid values are `block-bidirectional`, `block-ingress` and `off`.
30+
31+
VPC block public access exclusions can be applied at the VPC level e.g.:
32+
33+
```
34+
vpc_block_public_access_exclusions = {
35+
exclude_vpc = {
36+
exclude_vpc = true
37+
internet_gateway_exclusion_mode = "allow-bidirectional"
38+
}
39+
}
40+
```
41+
42+
or at the subnet level e.g.:
43+
44+
```
45+
vpc_block_public_access_exclusions = {
46+
exclude_subnet_private1 = {
47+
exclude_subnet = true
48+
subnet_type = "private"
49+
subnet_index = 1
50+
internet_gateway_exclusion_mode = "allow-egress"
51+
}
52+
exclude_subnet_private2 = {
53+
exclude_subnet = true
54+
subnet_type = "private"
55+
subnet_index = 2
56+
internet_gateway_exclusion_mode = "allow-egress"
57+
}
58+
}
59+
```
60+
61+
One of `exclude_vpc` or `exclude_subnet` must be set to true.
62+
Value of `subnet_type` can be `public`, `private`, `database`, `redshift`, `elasticache`, `intra` or `custom`.
63+
Value of `subnet_index` is the index of the subnet in the corresponding subnet list.
64+
Value of `internet_gateway_exclusion_mode` can be `allow-egress` and `allow-bidirectional`.
65+
66+
After deployment, VPC block public access options can be verified with the following command:
2267

2368
```bash
2469
aws ec2 --region eu-west-1 describe-vpc-block-public-access-options
2570
```
2671

27-
Similarly, VPC Block Public Access Exclusions can be checked by obtaining the exclusion ID from the Terraform output and running commands:
72+
Similarly, VPC block public access exclusions can be checked by obtaining the exclusion ID from the Terraform output and running commands:
2873

2974
```bash
3075
terraform output vpc_block_public_access_exclusions
@@ -159,7 +204,7 @@ No inputs.
159204
| <a name="output_vgw_arn"></a> [vgw\_arn](#output\_vgw\_arn) | The ARN of the VPN Gateway |
160205
| <a name="output_vgw_id"></a> [vgw\_id](#output\_vgw\_id) | The ID of the VPN Gateway |
161206
| <a name="output_vpc_arn"></a> [vpc\_arn](#output\_vpc\_arn) | The ARN of the VPC |
162-
| <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 |
207+
| <a name="output_vpc_block_public_access_exclusions"></a> [vpc\_block\_public\_access\_exclusions](#output\_vpc\_block\_public\_access\_exclusions) | A map of VPC block public access exclusions |
163208
| <a name="output_vpc_cidr_block"></a> [vpc\_cidr\_block](#output\_vpc\_cidr\_block) | The CIDR block of the VPC |
164209
| <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 |
165210
| <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/outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ output "vpc_owner_id" {
6969
}
7070

7171
output "vpc_block_public_access_exclusions" {
72-
description = "List of VPC block public access exclusions"
72+
description = "A map of VPC block public access exclusions"
7373
value = module.vpc.vpc_block_public_access_exclusions
7474
}
7575

outputs.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ output "vpc_owner_id" {
7979
}
8080

8181
output "vpc_block_public_access_exclusions" {
82-
description = "List of VPC block public access exclusions"
83-
value = [for k, v in aws_vpc_block_public_access_exclusion.this : v.id]
82+
description = "A map of VPC block public access exclusions"
83+
value = { for k, v in aws_vpc_block_public_access_exclusion.this : k => v.id }
8484
}
8585

8686
################################################################################

variables.tf

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -117,60 +117,13 @@ variable "tags" {
117117
}
118118

119119
variable "vpc_block_public_access_options" {
120-
description = <<EOF
121-
Map of VPC Block Public Access Options e.g.:
122-
123-
```
124-
vpc_block_public_access_options = {
125-
internet_gateway_block_mode = "block-bidirectional"
126-
}
127-
```
128-
129-
Currently only `internet_gateway_block_mode` is supported, for which
130-
valid values are `block-bidirectional`, `block-ingress` and `off`.
131-
EOF
120+
description = "A map of VPC block public access options"
132121
type = map(string)
133122
default = {}
134123
}
135124

136125
variable "vpc_block_public_access_exclusions" {
137-
description = <<EOF
138-
List of VPC Block Public Access Exclusions e.g. to exclude the VPC:
139-
140-
```
141-
vpc_block_public_access_exclusions = {
142-
exclude_vpc = {
143-
exclude_vpc = true
144-
internet_gateway_exclusion_mode = "allow-bidirectional"
145-
}
146-
}
147-
```
148-
149-
or to exclude specific subnets:
150-
151-
```
152-
vpc_block_public_access_exclusions = {
153-
exclude_subnet_private1 = {
154-
exclude_subnet = true
155-
subnet_type = "private"
156-
subnet_index = 1
157-
internet_gateway_exclusion_mode = "allow-egress"
158-
}
159-
exclude_subnet_private2 = {
160-
exclude_subnet = true
161-
subnet_type = "private"
162-
subnet_index = 2
163-
internet_gateway_exclusion_mode = "allow-egress"
164-
}
165-
}
166-
```
167-
168-
One of `exclude_vpc` or `exclude_subnet` must be set to true.
169-
Value of `subnet_type` can be `public`, `private`, `database`, `redshift`, `elasticache`, `intra` or `custom`.
170-
Value of `subnet_index` is the index of the subnet in the corresponding subnet list.
171-
Value of `internet_gateway_exclusion_mode` can be `allow-egress` and `allow-bidirectional`.
172-
173-
EOF
126+
description = "A map of VPC block public access exclusions"
174127
type = map(any)
175128
default = {}
176129
}

0 commit comments

Comments
 (0)