Providing the physicalResourceId on AwsCustomResource onUpdate / onDelete
See original GitHub issueHow should a physicalResourceId be provided to AwsCustomResource onUpdate / onDelete
AwsCustomResource
works well for resource creation.
But how should onUpdate
and onDelete
supply the physicalResourceId
that was returned during the onCreate phase?
Take this example. How should the DirectoryId
to be deleted be provided in the onDelete
phase?
I am not sure if this just isn’t documented yet, or isn’t possible. If it isn’t possible, I feel it should be, and if it isn’t possible, what should we do instead? It would definitely be a shame if there was no intent to add this as functionality, as AwsCustomResource
is extremely useful.
var adConnector = new AwsCustomResource(this, "ADConnector", {
onCreate: {
service: 'DirectoryService',
action: 'connectDirectory',
parameters: { ... },
physicalResourceId: PhysicalResourceId.fromResponse('DirectoryId')
},
onDelete: {
service: 'DirectoryService',
action: 'deleteDirectory',
parameters: {
DirectoryId: ???,
}
}
}
);
Environment
CDK CLI 1.30.0 Module Version: 1.30.0 OS: all Language: all
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Referencing the physical resource ID in a ... - Stack Overflow
In the onCreate I can see that to return the OU's Id as the physical resource ID I can specify a physicalResourceIdPath ,...
Read more >interface AwsCustomResourceProps · AWS CDK
Properties for AwsCustomResource. Note that at least onCreate, onUpdate or onDelete must be specified. ... physicalResourceId: cr.PhysicalResourceId.of('.
Read more >AWS Custom Resource using CDK AwsCustomResource ...
Method fromSdkCalls adds actions configured in onCreate , onUpdate and onDelete properties, to the custom resource lambda IAM policy. Based on ...
Read more >How to use the PhysicalResourceId for CloudFormation ...
The PhysicalResourceId is an oft-overlooked feature of Custom Resources. ... At first, I didn't give too much attention to it.
Read more >Managing Missing CloudFormation Support with the AWS CDK
The AWS CDK provides a Custom Resource module out of the box, ... updateThingGroup on update and deleteThingGroup on delete.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
PhysicalResourceIdReference should be used and can be made into a single AwsCustomResource https://docs.aws.amazon.com/cdk/api/latest/docs/custom-resources-readme.html#physical-resource-id-parameter
Example here https://github.com/aws-samples/aws-iam-permissions-guardrails/blob/master/iam_permissions_guardrails/constructs/service_control_policies/scp_policy_resource.py#L49
This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.