Skip to content
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

Can't create a load balancer target group for network load balancer #9050

Closed
hamstah opened this issue Jun 19, 2019 · 5 comments
Closed

Can't create a load balancer target group for network load balancer #9050

hamstah opened this issue Jun 19, 2019 · 5 comments
Milestone

Comments

@hamstah
Copy link
Contributor

hamstah commented Jun 19, 2019

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform v0.12.2
+ provider.archive v1.2.2
+ provider.aws v2.15.0

Affected Resource(s)

  • aws_lb_target_group

Terraform Configuration Files

resource "aws_lb_target_group" "default" {
  name     = "default-tg"
  protocol = "TCP"
  port     = "80"
  vpc_id   = var.vpc_id

  depends_on = [aws_lb.nlb]
}

Debug Output

Panic Output

Expected Behavior

The target group is created

Actual Behavior

The target group is not created with the following error

Error: Network Load Balancers do not support Stickiness

I've tried the work around from
#2746

  • setting stickiness to [] or {} is invalid since 0.12
  on modules/aws/ec2/nlb/nlb.tf line 16, in resource "aws_lb_target_group" "default":
  16:   stickiness = {}

An argument named "stickiness" is not expected here. Did you mean to define a
block of type "stickiness"?
  • Creating an empty stickiness block
  on modules/aws/ec2/nlb/nlb.tf line 16, in resource "aws_lb_target_group" "default":
  16:   stickiness{}

The argument "type" is required, but no definition was found.
  • Creating a stickiness with enabled=false
resource "aws_lb_target_group" "default" {
  name     = "default-tg"
  protocol = "TCP"
  port     = "80"
  vpc_id   = var.vpc_id

  stickiness{
    enabled = false
    type = "lb_cookie"
  }

  depends_on = [aws_lb.nlb]
}
Error: Network Load Balancers do not support Stickiness

  on modules/aws/ecs/service/alb.tf line 1, in resource "aws_alb_target_group" "target_group":
   1: resource "aws_alb_target_group" "target_group" {

The doc says

NOTE: To help facilitate the authoring of modules that support target groups of any protocol, you can define stickiness regardless of the protocol chosen. However, for TCP target groups, enabled must be false.

and the code at https://github.com/terraform-providers/terraform-provider-aws/blob/master/aws/resource_aws_lb_target_group.go#L422


		// In CustomizeDiff we allow LB stickiness to be declared for TCP target
		// groups, so long as it's not enabled. This allows for better support for
		// modules, but also means we need to completely skip sending the data to the
		// API if it's defined on a TCP target group.

Yet this check still fails
https://github.com/terraform-providers/terraform-provider-aws/blob/master/aws/resource_aws_lb_target_group.go#L682

When I look at my debug output, I can see the following for an ALB I also have which doesn't have any stickiness block in the HCL

2019/06/19 13:12:25 [WARN] Provider "aws" produced an invalid plan for module.external_services_alb.aws_alb_target_group.default, but we are tolerating it because it is using the legacy plugin SDK.
    The following problems may be the cause of any confusing errors from downstream operations:
      - .stickiness: block count in plan (1) disagrees with count in config (0)

I do see this warning in the target group related to my TCP load balancer

#       - .stickiness[0].cookie_duration: planned value cty.NumberIntVal(86400) does not match config value cty.NullVal(cty.Number)

But nothing else

Steps to Reproduce

  1. terraform apply

Important Factoids

References

  • #0000
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Jun 19, 2019
@hamstah
Copy link
Contributor Author

hamstah commented Jun 19, 2019

Actually setting it with enabled = false ended up working, I had multiple target groups that needed updating.

😞

@hamstah hamstah closed this as completed Jun 19, 2019
@skang0601
Copy link

This seems like an issue...the default setting for the target groups assume an ALB which breaks the NLB configuration.
This should likely get documented in the resource docs: https://www.terraform.io/docs/providers/aws/r/lb_target_group.html
Or perhaps separate out the resources for a NLB vs. an ALB?

@aeschright aeschright removed needs-triage Waiting for first response or review from a maintainer. labels Jun 21, 2019
@oonisim
Copy link

oonisim commented Jun 22, 2019

Why is this closed?

@hamstah
Copy link
Contributor Author

hamstah commented Jun 22, 2019 via email

@ghost
Copy link

ghost commented Nov 3, 2019

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!

@ghost ghost locked and limited conversation to collaborators Nov 3, 2019
@YakDriver YakDriver added this to the v3.10.0 milestone Oct 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants