4

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

davidm_uk
  • 658
  • 6
  • 19
  • Where exactly is this screenshot coming from? – Marcin Feb 10 '21 at 00:59
  • This is from the AWS console _Load Balancers (EC2 feature)_, select _Target Groups_, choose an NLB target group, then on the _Group details_ tab there is an _Attributes_ section including this _Preserve client IP address_ option. The screenshot shows the checkbox which appears on clicking _Edit_. – davidm_uk Feb 10 '21 at 09:44

2 Answers2

1

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.

kmajic
  • 61
  • 5
1

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

m1keil
  • 4,515
  • 22
  • 26