-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Network Load Balancer stickiness not configurable with Terraform (but supported by AWS) #12726
Comments
I had a look at the code and just adding support for the options is probably quite straightforward, but it seems like there is currently some special cases around TCP load balancers with stickiness enabled. Basically, the stickiness configuration block is ignored for TCP load balancers. Those special cases will probably need to be handled really carefully not to break existing configurations, so I don't really feel confident going ahead and trying to implement this. At least not without some guidance about how the maintainers would like them handled. |
@anderscarling hey since you mention this is pretty straightforward, why don't you go ahead and implement this and make a pr, then let the maintainers review the PR with the guidance they might provide about handling those edge cases? |
@joshnuna No promises, but I'll try to find time to do that. :) |
Any news on this.. I am trying to deploy new NLBs and this is stopping me |
Sorry, I've not been able to find any time yet - and honestly I think it will be a while before I do. The workaround we're using is basically setting up the target group manually using the awscli (that allows us to keep a record of the command using to set it up as a comment in the terraform config) - and referencing it using a As the target group only relies on the VPC being available and you can connected the instances and listeners to it using terraform, it's not too bad. Setting it all up using terraform would obviously be better though. To create the target group and configure stickiness, we use something like this (this exact script has not been tested though, so use caution): TARGET_GROUP_NAME="my-target-group"
aws elbv2 create-target-group \
--name "$TARGET_GROUP_NAME" \
--protocol UDP \
--port 1234 \
--vpc-id vpc-NNNNNN \
--health-check-protocol HTTP \
--health-check-port 80 \
--health-check-enabled \
--health-check-interval-seconds 10 \
--health-check-timeout-seconds 6 \
--health-check-path "/probe" \
--healthy-threshold-count 2 \
--unhealthy-threshold-count 2 \
--matcher '{"HttpCode": "200-399"}' \
--target-type instance
aws elbv2 modify-target-group-attributes \
--target-group-arn "$(aws elbv2 describe-target-groups | jq -r ".TargetGroups[] | select(.TargetGroupName == \"$TARGET_GROUP_NAME\").TargetGroupArn")" \
--attributes '[{"Key": "stickiness.enabled", "Value": "true"}, {"Key": "stickiness.type", "Value": "source_ip"}]' |
When I define an "aws_lb_target_group" resource with "TLS" protocol, and do not define a "stickiness" block, I can attach it to a Network Load Balancer.
If I define it thus:
I get error that cookie_duration cannot be 0 and type is not in the set [lb_cookie]. We must be able to create a TLS target_group, and set the values appropriately. Clearly TF is more restrictive than AWS in this case. |
Does anyone solve this problem? Error: Error modifying Target Group Attributes: InvalidConfigurationRequest: The provided target group attribute is not supported
status code: 400, request id: d8bae57f-1420-4430-beb7-22a32015c4df |
I'm closing this as this was fixed in #15295, v.3.10.0. If you continue to have related issues, please let us know with a new issue. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Community Note
Terraform Version
Terraform v0.12.24
provider.aws v2.53.0
Affected Resource(s)
Terraform Configuration Files
Expected Behavior
Terraform should be able to configure network load balancer with stickiness enabled, as described in AWS documentation:
Actual Behavior
Terraform claims stickiness is only supported for Application Load Balancers, and only using type = "lb_cookie". This is the documented behavior of the terraform aws provider, but is not true as the feature is supported by AWS.
References
These issues are related, as the fix will probably fix them to, but they do not describe the same issue:
The text was updated successfully, but these errors were encountered: