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

ELB Target Group deletion fails #3559

Open
ghost opened this issue Feb 21, 2019 · 4 comments
Open

ELB Target Group deletion fails #3559

ghost opened this issue Feb 21, 2019 · 4 comments

Comments

@ghost
Copy link

ghost commented Feb 21, 2019

Whenever I try to delete an ELB and a target group is attached, deletion of the target group fails. Below a sample for an ALB.

The following is the relevant part of the policy

- name: untagged-alb-delete
   resource: app-elb
   filters:
    - "tag:NoCustodian": absent
   actions:
    - type: delete
      force: true
 - name: untagged-alb-target-group-delete
   resource: app-elb-target-group
   filters:
    - "tag:NoCustodian": absent
   actions:
    - delete

Error output is the following

2019-02-21 15:06:58,549: custodian.policy:INFO policy: untagged-alb-target-group-delete resource:app-elb-target-group region:eu-west-1 count:1 time:0.48
2019-02-21 15:06:58,711: custodian.output:ERROR Error while executing policy
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/c7n/policy.py", line 264, in run
results = a.process(resources)
File "/usr/local/lib/python3.7/site-packages/c7n/resources/appelb.py", line 1013, in process
self.process_target_group(client, tg)
File "/usr/local/lib/python3.7/site-packages/c7n/resources/appelb.py", line 1018, in process_target_group
TargetGroupArn=target_group['TargetGroupArn'])
File "/usr/local/lib/python3.7/site-packages/c7n/utils.py", line 374, in _retry
return func(*args, **kw)
File "/usr/local/lib/python3.7/site-packages/botocore/client.py", line 357, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/usr/local/lib/python3.7/site-packages/botocore/client.py", line 661, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.errorfactory.ResourceInUseException: An error occurred (ResourceInUse) when calling the DeleteTargetGroup operation: Target group 'arn:aws:elasticloadbalancing:eu-west-1:1234567890:targetgroup/NukerTest/80e577bc233ae165' is currently in use by a listener or a rule

Is there any way of forcing deletion of target groups?

@kapilt
Copy link
Collaborator

kapilt commented Feb 21, 2019

noted, is the target group here referenced from multiple load balancers? just trying to understand if its a delay in the association due to the deleting alb or if its multi-parented across several albs. a force configuration is going to need a code/change pull request, contributions welcome.

@ghost
Copy link
Author

ghost commented Feb 22, 2019

Hi @kapilt, thanks for the quick reply!
Nope, the test was done with a single LB.

@kapilt
Copy link
Collaborator

kapilt commented Feb 22, 2019

okay, so its likely some degree of delay for the alb deletion itself, if you run the policy again, i assume it then converges/works?

@ghost
Copy link
Author

ghost commented Feb 22, 2019

Correct, when I reran the policy the target group was deleted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant