This repository was archived by the owner on Jul 11, 2023. It is now read-only.
File tree 3 files changed +23
-4
lines changed
3 files changed +23
-4
lines changed Original file line number Diff line number Diff line change 8
8
*
9
9
*/
10
10
11
+ # Turn something like
12
+ # var.ipv6_cidr_block = 2600:1f14:929:5700::/56
13
+ # into 2600:1f14:929:5700::/64
14
+ locals {
15
+ # TODO map this over each
16
+ # And generate one to match each ipv4 cidr block in the var.cidr_blocks list
17
+ # TODO fix. At the moment this only creates one ipv6 cidr block. And that will break if there is more
18
+ # than one ipv4 address
19
+ ipv6_cidrs = (var. vpc_ipv6_cidr_block == " " ? [] : [" ${ trimsuffix (var. vpc_ipv6_cidr_block , " 56" )} 64" ] )
20
+ }
21
+
11
22
resource "aws_subnet" "main" {
12
23
count = length (var. cidr_blocks )
13
24
vpc_id = var. vpc_id
@@ -22,6 +33,8 @@ resource "aws_subnet" "main" {
22
33
map_public_ip_on_launch = var. public
23
34
24
35
assign_ipv6_address_on_creation = var. assign_ipv6_address_on_creation
25
- ipv6_cidr_block = var. ipv6_cidr_block
36
+
37
+ # TODO fix. This will only work with length(var.cidr_blocks) = 1 at the moment
38
+ ipv6_cidr_block = local. ipv6_cidrs [count . index ]
26
39
}
27
40
Original file line number Diff line number Diff line change @@ -37,8 +37,14 @@ variable "assign_ipv6_address_on_creation" {
37
37
default = false
38
38
}
39
39
40
- variable "ipv6_cidr_block " {
41
- description = " The optional ipv6 cidr block for the subnet "
40
+ variable "vpc_ipv6_cidr_block " {
41
+ description = " The possible ipv6 cidr block for the vpc "
42
42
type = string
43
43
default = " "
44
44
}
45
+
46
+ # variable "ipv6_cidr_blocks" {
47
+ # description = "The optional ipv6 cidr blocks for the subnet"
48
+ # type = list(string)
49
+ # default = []
50
+ # }
Original file line number Diff line number Diff line change @@ -18,5 +18,5 @@ output "dhcp_options_id" {
18
18
# set to true
19
19
output "ipv6_cidr_block" {
20
20
value = (var. assign_generated_ipv6_cidr_block ? aws_vpc. main . ipv6_cidr_block : " " )
21
- description = " Optional IPv6 CIDR block output"
21
+ description = " Optional IPv6 CIDR block output for the VPC "
22
22
}
You can’t perform that action at this time.
0 commit comments