Search code examples
terraformaws-nlb

How do I configure an AWS Network Load Balancer to preserve client IP addresses using Terraform?


The AWS console allows an NLB target group to be configured to preserve client IP addresses:

Preserve client IP addresses

However, this setting doesn't appear to be available in Terraform's load balancer target group: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_target_group

How can I enable this option through Terraform, or is it not supported?

Preserve client IP addresses is an option within the Attributes section of a load balancer target group. Other options there are Proxy protocol v2, Stickiness, Connection termination on deregistration and Deregistration delay. The Terraform LB target group includes proxy_protocol_v2, stickiness and deregistration_delay, but not the other two options (as far as I can see).

EC2 Target Group properties


Solution

  • As of v3.35.0 of the AWS provider, it is now possible.