aws-cloudformation / aws-cloudformation/custom-resource-helper
PhysicalResourceId generated on failures
- Dominant language
- Python
- Stars
- 383
- Forks
- 61
- PR merge metrics
- No merged PRs in 30d
Description
I am having an issue with the way PhysicalResourceId is generated.
I am currently using `crhelper` within a lambda written to implement a custom resource that use the boto3 SDK to create an ECS service. The problem I have encountered is that when `create` fails, like for instance when a parameter is missing or invalid, the function `_cfn_response` sees that there is no PhysicalResourceId and decides to generate one before returning the failure to Cloudformation.
When Cloudformation sees the response, it decides:
- To rollback the change (since it encountered an error)
- To invoke `delete` passing the generated PhysicalResourceId which also fails since PhysicalResourceId is not a real one, unless I add some extra code to detect and ignore failures when attempting to delete the ECS service (which is not great/ideal).
Would it be possible to not generated a PhysicalResourceId if there is none, on failures?
Contributor guide
Research direction
Trace the _cfn_response path used by the Python custom resource helper when create fails, focusing on how it handles a missing PhysicalResourceId. Reproduce the missing or invalid parameter failure with the boto3 ECS service scenario and verify that the failure response no longer causes an invalid identifier to trigger an unusable delete request.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100