Calling any Cloudformation/CDK experts. We've made...
# general
r
Calling any Cloudformation/CDK experts. We've made a change to the projection of a GSI for DynamoDB. CDK doesn't allow us to apply this and tells us we need to rename the index but I want to delete and replace it with a GSI by the same name. I assume deleting the GSI manually from the table and retrying won't work as CDK will compare the stack contents rather than the actual table. So, is there a way to actually do this?
My assumption was right, I somehow need to tell CloudFormation that the table has already been updated
s
Does drift detection do anything to help with this?
r
Not really sure to be honest. I've gone through the process of removing it and adding it
m
The only way I know of is to remove the gsi, deploy, then add it back (updated) and deploy. Kind of pain if there are multiple environments because the subsequent deploys have to roll out in order. We've decided to basically deprecate GSI's. Add new ones, update the code, and roll it out. After confirmation remove the old one if needed. That being said I generally use generic indexes like GSI1, GSI2, GSI3 and take advantage of index overloading.
r
Thanks Mike. That's what we did in the end, i.e. removed and re-added. I didn't want to have to change the references in the calling code to use a new name.