pulumi: Error deleting Target Group: ResourceInUse: Target group is currently in use by a listener or a rule

aws:alb:TargetGroup (stack-tg2):
    error: deleting urn:pulumi:dev::stack::aws:alb/targetGroup:TargetGroup::stack-tg2: 1 error occurred:
    	* Error deleting Target Group: ResourceInUse: Target group 'arn:aws:elasticloadbalancing:*:*:targetgroup/stack-tg2/fdcc6be49a381f35' is currently in use by a listener or a rule
    	status code: 400, request id: 15e6ebc6-8993-48cb-a041-2bbfc2702d39

Expected Behavior

When I modify port definitions on a target group, first the listener should be removed, then the target group should be modified, and the listener re-added.

Current Behavior

When I modify the port definitions on a target group, pulumi tries to replace the target group with a new one, but this doesn’t work because there is still a listener that makes use of the target group.

Steps to Reproduce

  1. Create ALB with targetgroup/listener (to anywhere)
  2. Modify the target group to cause it to be replaced.
  3. Failure

Context (Environment)

It’s not the end of the world, but fairly annoying to have to manually delete the listeners, refresh the stack, then re-run update to make sure that the target groups can be replaced without issues.

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 8
  • Comments: 23 (11 by maintainers)

Most upvoted comments

Is there a reliable workaround here yet?

@mikhailshilkov Adding { replaceOnChanges: ["targetGroupArn"] } to my listener seemed to work for me. Thanks! 🙏

I am having the same issue. @leezen setting DeleteBeforeReplace to true does not work.