Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 478
davidm_uk Avatar asked Oct 18 '25 06:10

davidm_uk


2 Answers

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

like image 139
m1keil Avatar answered Oct 22 '25 00:10

m1keil


Looks like it's not possible to configure via Terraform at the moment, but at least it doesn't get overwritten if you set it manually.

like image 32
kmajic Avatar answered Oct 22 '25 00:10

kmajic