fix: apply dynamodb gsi changes one index per stack update - #925
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
PR Review: fix: apply dynamodb gsi changes one index per stack update (#925)Summary
Correctness (1)major —
|
Intermediate waves now patch currently deployed templates instead of cdk deploying app code, include nested-stack tables, and share deploy-env/CFN helpers. Tests cover the wave loop, restore-on-failure path, and nested template discovery. GitHub OIDC session duration is 2 hours so multi-wave CI does not expire mid-rollout. Co-authored-by: Cursor <cursoragent@cursor.com>
fix: apply DynamoDB GSI changes one index per stack update
Type of Change*
Summary
stagingfailed because CloudFormation tried to add two GSIs (PollStatus_IndexandWorkflowExternalId_Index) to the existinglaboratory-run-tablein one update. DynamoDB allows only one GSI create or delete perUpdateTable.pnpm run deploynow runsdeploy-dynamodb-gsi-wavesbefore the finalcdk deploy. If an existing table would change more than one GSI, it applies those indexes one CloudFormation update at a time, then the normal deploy lands the last remaining index.CreateTablemay define many GSIs).Deploy
You only start one
pnpm build-and-deployor one CI job. That job may run two sequential CloudFormation updates internally (one GSI per update). You do not need to re-trigger CI.The job will take longer because each GSI must become
ACTIVEbefore the next update. If GitHub OIDC hits the 1-hour role limit during backfill, bumprole-duration-seconds.Testing*
stagingand letcicd-release-quality-uatrun onceadd PollStatus_Index) then the final deploy addingWorkflowExternalId_Indexlaboratory-run-tableends with both new indexesACTIVElaboratory-s3-access-table,laboratory-data-tagging-table,workflow-run-preset-table) still create successfullydevelopmentas well so quality/prod pick up the same guardImpact
ACTIVEbefore the next update. Later deploys that do not change GSIs are unchanged.CreateTable.Additional Information
UpdateTablelimit, not a bug in our table schema. CloudFormation cannot add two GSIs in a single stack update on an existing table.UPDATE_ROLLBACK_COMPLETE; the next deploy can proceed.role-duration-secondsis currently 3600. If GSI backfill is slow, that session may expire mid-job and will need a bump.developmentso quality/prod get the same guard for future multi-GSI merges.Checklist*