Support dualstack NLBs with Terraform

This commit is contained in:
John Gardiner Myers 2023-05-10 21:48:09 -07:00
parent 9d61e527e8
commit af4f9671e6
6 changed files with 9 additions and 0 deletions

View File

@ -524,6 +524,7 @@ resource "aws_launch_template" "nodes-minimal-ipv6-example-com" {
resource "aws_lb" "api-minimal-ipv6-example-com" {
enable_cross_zone_load_balancing = false
internal = false
ip_address_type = "dualstack"
load_balancer_type = "network"
name = "api-minimal-ipv6-example--jhj9te"
subnet_mapping {

View File

@ -524,6 +524,7 @@ resource "aws_launch_template" "nodes-minimal-ipv6-example-com" {
resource "aws_lb" "api-minimal-ipv6-example-com" {
enable_cross_zone_load_balancing = false
internal = false
ip_address_type = "dualstack"
load_balancer_type = "network"
name = "api-minimal-ipv6-example--jhj9te"
subnet_mapping {

View File

@ -524,6 +524,7 @@ resource "aws_launch_template" "nodes-minimal-ipv6-example-com" {
resource "aws_lb" "api-minimal-ipv6-example-com" {
enable_cross_zone_load_balancing = false
internal = false
ip_address_type = "dualstack"
load_balancer_type = "network"
name = "api-minimal-ipv6-example--jhj9te"
subnet_mapping {

View File

@ -524,6 +524,7 @@ resource "aws_launch_template" "nodes-minimal-ipv6-example-com" {
resource "aws_lb" "api-minimal-ipv6-example-com" {
enable_cross_zone_load_balancing = false
internal = false
ip_address_type = "dualstack"
load_balancer_type = "network"
name = "api-minimal-ipv6-example--jhj9te"
subnet_mapping {

View File

@ -506,6 +506,7 @@ resource "aws_launch_template" "nodes-minimal-ipv6-example-com" {
resource "aws_lb" "api-minimal-ipv6-example-com" {
enable_cross_zone_load_balancing = false
internal = false
ip_address_type = "dualstack"
load_balancer_type = "network"
name = "api-minimal-ipv6-example--jhj9te"
subnet_mapping {

View File

@ -733,6 +733,7 @@ type terraformNetworkLoadBalancer struct {
Name string `cty:"name"`
Internal bool `cty:"internal"`
Type string `cty:"load_balancer_type"`
IPAddressType *string `cty:"ip_address_type"`
SubnetMappings []terraformNetworkLoadBalancerSubnetMapping `cty:"subnet_mapping"`
CrossZoneLoadBalancing bool `cty:"enable_cross_zone_load_balancing"`
AccessLog *terraformNetworkLoadBalancerAccessLog `cty:"access_logs"`
@ -768,6 +769,9 @@ func (_ *NetworkLoadBalancer) RenderTerraform(t *terraform.TerraformTarget, a, e
Tags: e.Tags,
CrossZoneLoadBalancing: fi.ValueOf(e.CrossZoneLoadBalancing),
}
if fi.ValueOf(e.IpAddressType) == "dualstack" {
nlbTF.IPAddressType = e.IpAddressType
}
for _, subnetMapping := range e.SubnetMappings {
nlbTF.SubnetMappings = append(nlbTF.SubnetMappings, terraformNetworkLoadBalancerSubnetMapping{