Skip to content

Commit 78557bb

Browse files
authored
Support ipv6_address_preferred_lease_time for vpc dhcp options set (#70)
1 parent e175c6c commit 78557bb

File tree

4 files changed

+22
-17
lines changed

4 files changed

+22
-17
lines changed

modules/vpc/dhcp-options.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ resource "aws_vpc_dhcp_options" "this" {
2121
? var.dhcp_options.domain_name
2222
: local.default_dhcp_options_domain_name
2323
)
24-
domain_name_servers = var.dhcp_options.domain_name_servers
25-
ntp_servers = var.dhcp_options.ntp_servers
26-
netbios_name_servers = var.dhcp_options.netbios_name_servers
27-
netbios_node_type = var.dhcp_options.netbios_node_type
24+
domain_name_servers = var.dhcp_options.domain_name_servers
25+
ipv6_address_preferred_lease_time = var.dhcp_options.ipv6_address_preferred_lease_time
26+
ntp_servers = var.dhcp_options.ntp_servers
27+
netbios_name_servers = var.dhcp_options.netbios_name_servers
28+
netbios_node_type = var.dhcp_options.netbios_node_type
2829

2930
tags = merge(
3031
{

modules/vpc/outputs.tf

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ output "dhcp_options" {
215215
216216
`domain_name` - The suffix domain name to use by default when resolving non Fully Qualified Domain Names.
217217
`domain_name_servers` - A list of name servers to configure in `/etc/resolv.conf`.
218+
`ipv6_address_preferred_lease_time` - A value for how frequently a running instance with an IPv6 assigned to it goes through DHCPv6 lease renewal.
218219
`netbios_name_servers` - A list of NetBIOS name servers.
219220
`netbios_node_type` - The NetBIOS node type (1, 2, 4, or 8).
220221
`ntp_servers` - A list of NTP servers to configure.
@@ -225,11 +226,12 @@ output "dhcp_options" {
225226
arn = one(aws_vpc_dhcp_options.this[*].arn)
226227
owner = one(aws_vpc_dhcp_options.this[*].owner_id)
227228

228-
domain_name = one(aws_vpc_dhcp_options.this[*].domain_name)
229-
domain_name_servers = one(aws_vpc_dhcp_options.this[*].domain_name_servers)
230-
netbios_name_servers = one(aws_vpc_dhcp_options.this[*].netbios_name_servers)
231-
netbios_node_type = one(aws_vpc_dhcp_options.this[*].netbios_node_type)
232-
ntp_servers = one(aws_vpc_dhcp_options.this[*].ntp_servers)
229+
domain_name = one(aws_vpc_dhcp_options.this[*].domain_name)
230+
domain_name_servers = one(aws_vpc_dhcp_options.this[*].domain_name_servers)
231+
ipv6_address_preferred_lease_time = one(aws_vpc_dhcp_options.this[*].ipv6_address_preferred_lease_time)
232+
netbios_name_servers = one(aws_vpc_dhcp_options.this[*].netbios_name_servers)
233+
netbios_node_type = one(aws_vpc_dhcp_options.this[*].netbios_node_type)
234+
ntp_servers = one(aws_vpc_dhcp_options.this[*].ntp_servers)
233235
}
234236
: null
235237
)

modules/vpc/variables.tf

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -258,18 +258,20 @@ variable "dhcp_options" {
258258
(Optional) `name` - The name of the DHCP option set. Defaults to same name of the VPC.
259259
(Optional) `domain_name` - The suffix domain name to use by default when resolving non Fully Qualified Domain Names. In other words, this is what ends up being the search value in the `/etc/resolv.conf` file. If you're using `AmazonProvidedDNS` in `us-east-1`, specify `ec2.internal`. If you're using `AmazonProvidedDNS` in another Region, specify `{region}.compute.internal`.
260260
(Optional) `domain_name_servers` - A list of name servers to configure in `/etc/resolv.conf`. The IP addresses of up to four domain name servers, or `AmazonProvidedDNS`. If you want to use the default AWS nameservers you should set this to `AmazonProvidedDNS`. Defaults to `["AmazonProvidedDNS"]`.
261+
(Optional) `ipv6_address_preferred_lease_time` - How frequently, in seconds, a running instance with an IPv6 assigned to it goes through DHCPv6 lease renewal. Acceptable values are between 140 and 2147483647 (approximately 68 years). Defaults to `140` seconds. If you use long-term addressing for EC2 instances, you can increase the lease time and avoid frequent lease renewal requests. Lease renewal typically occurs when half of the lease time has elapsed.
261262
(Optional) `netbios_name_servers` - A list of NetBIOS name servers. The IP addresses of up to four NetBIOS name servers.
262263
(Optional) `netbios_node_type` - The NetBIOS node type (1, 2, 4, or 8). AWS recommends to specify 2 since broadcast and multicast are not supported in their network. For more information about these node types, see RFC 2132. Defaults to `2`.
263264
(Optional) `ntp_servers` - A list of NTP servers to configure. The IP addresses of up to four Network Time Protocol (NTP) servers.
264265
EOF
265266
type = object({
266-
enabled = optional(bool, false)
267-
name = optional(string)
268-
domain_name = optional(string)
269-
domain_name_servers = optional(list(string), ["AmazonProvidedDNS"])
270-
netbios_name_servers = optional(list(string), [])
271-
netbios_node_type = optional(number, 2)
272-
ntp_servers = optional(list(string), [])
267+
enabled = optional(bool, false)
268+
name = optional(string)
269+
domain_name = optional(string)
270+
domain_name_servers = optional(list(string), ["AmazonProvidedDNS"])
271+
ipv6_address_preferred_lease_time = optional(number, 140)
272+
netbios_name_servers = optional(list(string), [])
273+
netbios_node_type = optional(number, 2)
274+
ntp_servers = optional(list(string), [])
273275
})
274276
default = {}
275277
nullable = false

modules/vpc/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.3"
7+
version = ">= 5.46"
88
}
99
}
1010
}

0 commit comments

Comments
 (0)