custom resource provider: custom physical resource ID for failed events
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
`@aws-cdk/custom-resources.Provider` currently does not support specifying a custom resource physical ID when the user handler fails. This is because failure is signalled through any unhandled exception of the user handler lambda function.
**Please +1 this issue if this is something you need.**
### Use Case
Theoretically, it might be useful to be able to customize the physical resource ID for failures, but probably a very rare requirement. For example, if CREATE fails after only a portion of the resource has already been created, the provider might wish to clean up by handling the subsequent DELETE operation issued by CloudFormation with some specific resource ID.
The current implementation of the custom resource provider framework makes it impossible to specify the `PhysicalResourceId` when submitting a FAILED response. It defaults to the one passed in by CloudFormation, which is what you want in most cases.
For failed CREATE events, when there is no physical resource ID passed by CloudFormation, the framework uses a marker and automatically ignores the subsequent DELETE operation, which is mostly what people want. Otherwise, they have to special-case this DELETE.
### Proposed Implementation
One way to support this is to allow attaching a `PhysicalResourceId` to the exception thrown, but this is language-specific and we need to investigate it a bit further.
---
This is a :rocket: Feature Request
Contributor guide
Research direction
Start by reading the implementation of @aws-cdk/custom-resources.Provider and trace how an unhandled user-handler exception becomes a FAILED response to CloudFormation. Investigate how a failure could carry a custom PhysicalResourceId across supported languages. Done means failed events can use the requested ID while preserving the existing default and DELETE behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100