(custom_resources): AwsCustomResource does not allow proper function configuration and overall seems overly complex / outdated in resources it needs
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
Across the cdk exists custom resource implementations that allows on construct instantiation passing in FunctionProps. This isn't the case in AwsCustomResource and only allows configuration of a few function properties directly on its props. This is problematic for organizations that have compliance requirements for lambda configuration to leverage the solution without re-building their own custom resource to do aws sdk calls.
On top of this, there are several bugs with the dependency resources generated tied to the custom resource lambda handler. One example is a secondary lambda is created to configure LogRetention on the custom resource lambda (which seems unnecessary now since configuring log retention is directly available on the lambda CF api?), but if you configure AwsCustomResource to use a vpc; it will only set up the core lambda with the vpc and the log retention lambda does not get the vpc config making the construct unusable for us.
### Regression Issue
- [ ] Select this option if this issue appears to be a regression.
### Last Known Working CDK Version
N/A
### Expected Behavior
A simplified AwsCustomResourceV2 that doesn't have the baggage of the original AwsCustomResource with a much more simplified set of dependency resources and allows full function configuration of the handler. Since this is such a common custom resource pattern to make Aws Sdk calls to cover CloudFormation gaps.
We are finding multiple use cases where we need a custom resource Aws calls for our org so it will be a common pattern for us and will need to build our own to meet our requirements. Though this seems with how standard of a feature that Aws would want to own this or build the functionality into the cloud formation service as an available resource option without.
For now, I'm planning to build a custom resource for aws sdk calls and deploy it to my organization through a stack set so our app developers have it available to them which is a lot of leg work when this type of functionality could probably be built into an aws service.
### Current Behavior
see bug description
### Reproduction Steps
for my specific example, instantiate AWSCustomResource with vpc and logRetention fields specified.
### Possible Solution
_No response_
### Additional Information/Context
_No response_
### CDK CLI Version
2.178.0
### Framework Version
_No response_
### Node.js Version
22
### OS
MacOS
### Language
TypeScript
### Language Version
_No response_
### Other information
_No response_
Contributor guide
Research direction
Start by reproducing AwsCustomResource with vpc and logRetention configured, then inspect the AwsCustomResource implementation and the generated custom-resource and LogRetention dependencies. Done should provide full FunctionProps configuration for the handler, make VPC and log-retention behavior consistent, and simplify the dependency resources without regressing existing use cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100