You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+52-4Lines changed: 52 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -179,6 +179,54 @@ Sometimes it is handy to have public access to Redshift clusters (for example if
179
179
180
180
It is possible to integrate this VPC module with [terraform-aws-transit-gateway module](https://github.com/terraform-aws-modules/terraform-aws-transit-gateway) which handles the creation of TGW resources and VPC attachments. See [complete example there](https://github.com/terraform-aws-modules/terraform-aws-transit-gateway/tree/master/examples/complete).
181
181
182
+
## VPC CIDR from AWS IP Address Manager (IPAM)
183
+
184
+
It is possible to have your VPC CIDR assigned from an [AWS IPAM Pool](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_ipam_pool). However, In order to build subnets within this module Terraform must know subnet CIDRs to properly plan the amount of resources to build. Since CIDR is derived by IPAM by calling CreateVpc this is not possible within a module unless cidr is known ahead of time. You can get around this by "previewing" the CIDR and then using that as the subnet values.
185
+
186
+
_Note: Due to race conditions with `terraform plan`, it is not possible to use `ipv4_netmask_length` or a pools `allocation_default_netmask_length` within this module. You must explicitly set the CIDRs for a pool to use._
187
+
188
+
```hcl
189
+
# Find the pool RAM shared to your account
190
+
# Info on RAM sharing pools: https://docs.aws.amazon.com/vpc/latest/ipam/share-pool-ipam.html
191
+
data "aws_vpc_ipam_pool" "ipv4_example" {
192
+
filter {
193
+
name = "description"
194
+
values = ["*mypool*"]
195
+
}
196
+
197
+
filter {
198
+
name = "address-family"
199
+
values = ["ipv4"]
200
+
}
201
+
}
202
+
203
+
# Preview next CIDR from pool
204
+
data "aws_vpc_ipam_preview_next_cidr" "previewed_cidr" {
| <aname="input_amazon_side_asn"></a> [amazon\_side\_asn](#input\_amazon\_side\_asn)| The Autonomous System Number (ASN) for the Amazon side of the gateway. By default the virtual private gateway is created with the current default Amazon ASN. |`string`|`"64512"`| no |
305
354
| <aname="input_assign_ipv6_address_on_creation"></a> [assign\_ipv6\_address\_on\_creation](#input\_assign\_ipv6\_address\_on\_creation)| Assign IPv6 address on subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\_public\_ip\_on\_launch |`bool`|`false`| no |
306
355
| <aname="input_azs"></a> [azs](#input\_azs)| A list of availability zones names or ids in the region |`list(string)`|`[]`| no |
307
-
| <aname="input_cidr"></a> [cidr](#input\_cidr)| (Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id`|`string`|`"0.0.0.0/0"`| no |
356
+
| <aname="input_cidr"></a> [cidr](#input\_cidr)| (Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id`|`string`|`null`| no |
308
357
| <aname="input_create_database_internet_gateway_route"></a> [create\_database\_internet\_gateway\_route](#input\_create\_database\_internet\_gateway\_route)| Controls if an internet gateway route for public database access should be created |`bool`|`false`| no |
309
358
| <aname="input_create_database_nat_gateway_route"></a> [create\_database\_nat\_gateway\_route](#input\_create\_database\_nat\_gateway\_route)| Controls if a nat gateway route should be created to give internet access to the database subnets |`bool`|`false`| no |
310
359
| <aname="input_create_database_subnet_group"></a> [create\_database\_subnet\_group](#input\_create\_database\_subnet\_group)| Controls if database subnet group should be created (n.b. database\_subnets must also be set) |`bool`|`true`| no |
@@ -403,7 +452,6 @@ No modules.
403
452
| <aname="input_intra_subnet_tags"></a> [intra\_subnet\_tags](#input\_intra\_subnet\_tags)| Additional tags for the intra subnets |`map(string)`|`{}`| no |
404
453
| <aname="input_intra_subnets"></a> [intra\_subnets](#input\_intra\_subnets)| A list of intra subnets |`list(string)`|`[]`| no |
405
454
| <aname="input_ipv4_ipam_pool_id"></a> [ipv4\_ipam\_pool\_id](#input\_ipv4\_ipam\_pool\_id)| (Optional) The ID of an IPv4 IPAM pool you want to use for allocating this VPC's CIDR. |`string`|`null`| no |
406
-
| <aname="input_ipv4_netmask_length"></a> [ipv4\_netmask\_length](#input\_ipv4\_netmask\_length)| (Optional) The netmask length of the IPv4 CIDR you want to allocate to this VPC. Requires specifying a ipv4\_ipam\_pool\_id. |`number`|`null`| no |
407
455
| <aname="input_manage_default_network_acl"></a> [manage\_default\_network\_acl](#input\_manage\_default\_network\_acl)| Should be true to adopt and manage Default Network ACL |`bool`|`false`| no |
408
456
| <aname="input_manage_default_route_table"></a> [manage\_default\_route\_table](#input\_manage\_default\_route\_table)| Should be true to manage default route table |`bool`|`false`| no |
409
457
| <aname="input_manage_default_security_group"></a> [manage\_default\_security\_group](#input\_manage\_default\_security\_group)| Should be true to adopt and manage default security group |`bool`|`false`| no |
0 commit comments