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

circular dependency between aws_lb_listener_rule and aws_lb_target_group when replacing aws_lb_target_group #21588

Open
khumps opened this issue Nov 2, 2021 · 5 comments
Labels
service/elbv2 Issues and PRs that pertain to the elbv2 service.

Comments

@khumps
Copy link

khumps commented Nov 2, 2021

When trying to do anything that causes the target group to be replaced (changing the name, port, etc) It detects that the listener rule can be updated in place but the target group can not be deleted until the listener rule is not depending on it.

The output of the terraform plan/apply is https://pastebin.com/yN6tHvM8 and will result in the provider timing out trying to delete the target group due to the relationship to the listener rule. To fix this, any change to listener_rule.target_group_arn needs to force replacement of the listener rule

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 other comments that do not add relevant new information or questions, 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 CLI and Terraform AWS Provider Version

Terraform v1.0.4
on darwin_amd64

  • provider registry.terraform.io/hashicorp/aws v3.48.0
  • provider registry.terraform.io/hashicorp/template v2.2.0

Affected Resource(s)

aws_lb_listener_rule
aws_lb_target_group

Terraform Configuration Files

resource "aws_lb_target_group" "my_target_group" {
  name     = NAME
  port     = PORT
  protocol = "HTTP"
  vpc_id   = VPC_ID
}

resource "aws_lb_listener_rule" "my_listener_rule" {
  listener_arn = var.listener_arn

  action {
    type             = "forward"
    target_group_arn = aws_lb_target_group.my_target_group.arn
  }

  condition {
    host_header {
      values = ["DOMAIN_NAME"]
    }
  }
}

Terraform logs (with TF_LOG=DEBUG)

https://pastebin.com/CZzrTSEc

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/elbv2 Issues and PRs that pertain to the elbv2 service. labels Nov 2, 2021
@khumps
Copy link
Author

khumps commented Nov 2, 2021

I believe this would be fixed by adding ForceNew: true here

@justinretzolk
Copy link
Member

Hey @khumps 👋 Thank you for taking the time to file this issue. Can you update the issue description with debug output as well so that we have all of the information necessary to investigate this?

Additionally, it looks like you may have redacted/changed some of the Terraform config, based on the output you provided (totally understand needing to do this sometimes!). Can you confirm whether aws_lb_listener_rule.my_listener_rule.action.target_group_arn is an interpolation of the other resource, or is a hardcoded ARN?

@justinretzolk justinretzolk added waiting-response Maintainers are waiting on response from community or contributor. and removed needs-triage Waiting for first response or review from a maintainer. labels Nov 2, 2021
@khumps
Copy link
Author

khumps commented Nov 2, 2021

Hey @khumps 👋 Thank you for taking the time to file this issue. Can you update the issue description with debug output as well so that we have all of the information necessary to investigate this?

Additionally, it looks like you may have redacted/changed some of the Terraform config, based on the output you provided (totally understand needing to do this sometimes!). Can you confirm whether aws_lb_listener_rule.my_listener_rule.action.target_group_arn is an interpolation of the other resource, or is a hardcoded ARN?

Hey Justin, I can definitely get some debug input when I get in tomorrow. LISTENER_ARN and TARGET_ARN are both just substitutions to redact code. in code they actually are a direct reference to a terraform resource. I have updated OP to be a little clearer on that

@github-actions github-actions bot removed the waiting-response Maintainers are waiting on response from community or contributor. label Nov 2, 2021
@khumps
Copy link
Author

khumps commented Nov 4, 2021

@justinretzolk I have appended the relevant part of the debug logs to OP

@lindlaaa
Copy link

Any update on this? Having a similar issue but with a Listener instead of a Rule.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service/elbv2 Issues and PRs that pertain to the elbv2 service.
Projects
None yet
Development

No branches or pull requests

3 participants