DynamoDB restore to a new table and update Terraform


I am working on using Point In Time Recovery(PITR) for AWS DynamoDB.

DynamoDB Table A was provisioned using Terraform. After PITR is enabled on table A, I managed to restore it to a new table A-Backup using CLI based on the instruction from AWS Documentation.

After the restore is done, I have updated lambda to use the new table name A-Backup as the new value for the table environment variables.

But now the question is how to sync this change in Terraform to make sure Terraform reflects the change that is made, which is a new table that has been created from PITR?

What’s the best practice here?


Here is the process I have used to keep Terraform up-to-date when restoring a DynamoDB table.

Example Terraform table

Restore backup with AWS CLI

Update Terraform state and apply missing settings

Terraform is a great compliment to the AWS recovery process because AWS does not copy all table settings to the backups. Terraform will tell you what’s missing and update your tables.

Leave a Reply