Skip to content

Conversation

@o2346
Copy link

@o2346 o2346 commented Jul 4, 2020

Issue #, if available: N/A

Description of changes:

DELETE_FAILED have been observed with event like shown below

AddCustomActionSHResource1 DELETE_FAILED Custom Resource failed to stabilize in expected time

CloudWatch logs:

[ERROR] ResourceConflictException: An error occurred (ResourceConflictException) when calling the CreateActionTarget operation: Action with Id: SendToSlack already exists
Traceback (most recent call last):
File "/var/task/index.py", line 5, in lambda_handler
response = securityhub.create_action_target(Name="Send_To_Slack",Description='Send Messages to ChatApplication via AWS ChatBot',Id='SendToSlack')
File "/var/runtime/botocore/client.py", line 316, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/var/runtime/botocore/client.py", line 626, in _make_api_call
raise error_class(parsed_response, operation_name)

It seemes to attempt to create_action_target on every invocation no matter what RequestType is.
According to below,

https://stackoverflow.com/a/61006173

also please note that Custom Resources are called when the stack is Created, Updated and Deleted. This can lead to some unexpected behaviour, especially during the Delete operation. It's normally a good idea to insert an if statement to only run the code during the Create phase by using:

if event['RequestType'] == 'Create':

Therefore requesting update to behave respectively

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@o2346 o2346 changed the title AddCustomActionSHResource1 DELETE_FAILED at delete-stack of 'SecurityHub_to_AWSChatBot.yml' AddCustomActionSHResource1 DELETE_FAILED at stack deletion of 'SecurityHub_to_AWSChatBot.yml' Jul 4, 2020
@o2346 o2346 marked this pull request as ready for review July 4, 2020 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant