Skip to content

Commit a9e92d2

Browse files
authored
Add minimum support for IPv6 to VPC (#156)
* Added support for IPv6 to VPC
1 parent 78584e5 commit a9e92d2

File tree

7 files changed

+37
-13
lines changed

7 files changed

+37
-13
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ Terraform version 0.10.3 or newer is required for this module to work.
163163

164164
| Name | Description | Type | Default | Required |
165165
|------|-------------|:----:|:-----:|:-----:|
166+
| assign_generated_ipv6_cidr_block | Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. You cannot specify the range of IP addresses, or the size of the CIDR block | string | `false` | no |
166167
| azs | A list of availability zones in the region | string | `<list>` | no |
167168
| cidr | The CIDR block for the VPC. Default value is a valid CIDR, but not acceptable by AWS and should be overridden | string | `0.0.0.0/0` | no |
168169
| create_database_subnet_group | Controls if database subnet group should be created | string | `true` | no |
@@ -278,6 +279,8 @@ Terraform version 0.10.3 or newer is required for this module to work.
278279
| vpc_endpoint_s3_pl_id | The prefix list for the S3 VPC endpoint. |
279280
| vpc_id | VPC |
280281
| vpc_instance_tenancy | Tenancy of instances spin up within VPC |
282+
| vpc_ipv6_association_id | The association ID for the IPv6 CIDR block |
283+
| vpc_ipv6_cidr_block | The IPv6 CIDR block |
281284
| vpc_main_route_table_id | The ID of the main route table associated with this VPC |
282285

283286
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

examples/simple-vpc/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ Note that this example may create resources which can cost money (AWS Elastic IP
2525
| nat_public_ips | NAT gateways |
2626
| private_subnets | Subnets |
2727
| public_subnets | List of IDs of public subnets |
28+
| vpc_cidr_block | CIDR blocks |
2829
| vpc_id | VPC |
30+
| vpc_ipv6_cidr_block | The IPv6 CIDR block |
2931

3032
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

examples/simple-vpc/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ module "vpc" {
1313
private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
1414
public_subnets = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"]
1515

16+
assign_generated_ipv6_cidr_block = true
17+
1618
enable_nat_gateway = true
1719
single_nat_gateway = true
1820

examples/simple-vpc/outputs.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ output "vpc_id" {
44
value = "${module.vpc.vpc_id}"
55
}
66

7+
# CIDR blocks
8+
output "vpc_cidr_block" {
9+
description = "The CIDR block of the VPC"
10+
value = ["${module.vpc.vpc_cidr_block}"]
11+
}
12+
13+
output "vpc_ipv6_cidr_block" {
14+
description = "The IPv6 CIDR block"
15+
value = ["${module.vpc.vpc_ipv6_cidr_block}"]
16+
}
17+
718
# Subnets
819
output "private_subnets" {
920
description = "List of IDs of private subnets"

main.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ locals {
1313
resource "aws_vpc" "this" {
1414
count = "${var.create_vpc ? 1 : 0}"
1515

16-
cidr_block = "${var.cidr}"
17-
instance_tenancy = "${var.instance_tenancy}"
18-
enable_dns_hostnames = "${var.enable_dns_hostnames}"
19-
enable_dns_support = "${var.enable_dns_support}"
16+
cidr_block = "${var.cidr}"
17+
instance_tenancy = "${var.instance_tenancy}"
18+
enable_dns_hostnames = "${var.enable_dns_hostnames}"
19+
enable_dns_support = "${var.enable_dns_support}"
20+
assign_generated_ipv6_cidr_block = "${var.assign_generated_ipv6_cidr_block}"
2021

2122
tags = "${merge(map("Name", format("%s", var.name)), var.vpc_tags, var.tags)}"
2223
}

outputs.tf

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ output "vpc_main_route_table_id" {
4949
value = "${element(concat(aws_vpc.this.*.main_route_table_id, list("")), 0)}"
5050
}
5151

52-
//output "vpc_ipv6_association_id" {
53-
// description = "The association ID for the IPv6 CIDR block"
54-
// value = "${element(concat(aws_vpc.this.*.ipv6_association_id, list("")), 0)}"
55-
//}
56-
//
57-
//output "vpc_ipv6_cidr_block" {
58-
// description = "The IPv6 CIDR block"
59-
// value = "${element(concat(aws_vpc.this.*.ipv6_cidr_block, list("")), 0)}"
60-
//}
52+
output "vpc_ipv6_association_id" {
53+
description = "The association ID for the IPv6 CIDR block"
54+
value = "${element(concat(aws_vpc.this.*.ipv6_association_id, list("")), 0)}"
55+
}
56+
57+
output "vpc_ipv6_cidr_block" {
58+
description = "The IPv6 CIDR block"
59+
value = "${element(concat(aws_vpc.this.*.ipv6_cidr_block, list("")), 0)}"
60+
}
6161

6262
# Subnets
6363
output "private_subnets" {

variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ variable "cidr" {
1313
default = "0.0.0.0/0"
1414
}
1515

16+
variable "assign_generated_ipv6_cidr_block" {
17+
description = "Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. You cannot specify the range of IP addresses, or the size of the CIDR block"
18+
default = false
19+
}
20+
1621
variable "instance_tenancy" {
1722
description = "A tenancy option for instances launched into the VPC"
1823
default = "default"

0 commit comments

Comments
 (0)