Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(dynamodb): replicas not created on table replacement #13300
fix(dynamodb): replicas not created on table replacement #13300
Changes from 6 commits
e1662ce
c3d2ba8
d8583e1
eedc28d
5ad6a7b
1a07ea2
b3bd717
da275eb
e61f9a7
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually 2 functional changes, correct?
PhysicalResourceId
also for deletes, now we don't.event.ResourceProperties.Region
as the physical ID, now we return`${event.ResourceProperties.TableName}-${event.ResourceProperties.Region}`
.So, is 1. intentional, or accidental? And what about 2. - what will be the behavior for existing customers of global DB Tables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For existing users of global DB tables if they update to the new the code the only thing that will happen is the replacement of the inline policies with managed policies. This is because nothing changes on the properties of the custom resource so it won't receive any event (Create/Update/Delete).
Now if later a user decides to remove one or more replica regions, the custom resource will receive a Delete event. If we don't change how the physical resource id is returned for a Delete event then CF will receive a new physical resource id (
table-region
instead ofregion
). Changing the physical resource id in a Delete event is not allowed by CF and the Delete will fail (from a CF perspective and this also means that it will not wait forisComplete
). So yes 1. is intentional. (this explanation is also valid for a table replacement when the old replica gets deleted).Returning an empty object on delete ensures that the custom resource provider framework uses the physical resource id from the event (should have been done in the first place).
EDIT: it's the framework, not CF, that doesn't allow to change the physical resource id during a Delete event
aws-cdk/packages/@aws-cdk/custom-resources/lib/provider-framework/runtime/framework.ts
Line 165 in 5d57777
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an awesome trick! I'll have to remember this one to use in other Custom Resources.
I'm just a little worried about the delete order - since this depends on the Table, won't it be deleted first, before the replica?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine because it depends on the role used by
onEventHandler
andisCompleteHandler
, see also #8224 for more context on thisSourceTableAttachedPolicy
See also my test #13300 (comment).