How to Handle Point-in-Time Restore with Azure PostgreSQL and Terraform?

Kamal Rathnayake 31 Reputation points MVP
2024-05-22T12:49:03.72+00:00

Hello,

I'm using an Azure PostgreSQL database and need to perform a point-in-time restore (PITR) as part of a disaster recovery drill. I can successfully restore the database to a new server and update my application to point to this new server. However, I have a few concerns and would love some advice:

I'm deploying the database server using Infrastructure as Code (Terraform). After performing a PITR, I end up with a new server that is not represented in my Terraform code.

Is there a way to properly replace the existing server with the point-in-time data state while keeping my Terraform code in sync?

What do you think is the best approach to handle this situation? Any insights or best practices would be greatly appreciated!

Thanks in advance!

Azure Database for PostgreSQL
{count} vote

1 answer

Sort by: Most helpful
  1. GeethaThatipatri-MSFT 28,537 Reputation points Microsoft Employee
    2024-05-22T18:20:34.04+00:00

    @Kamal Rathnayake Welcome to Microsoft Q&A thanks for posting your question.

    While there are no specific guidelines on keeping Terraform code in sync after a PITR operation, a common practice is to manually update the Terraform state file after the restore operation with terraform import. However, I will check with my Internal team and get back on this.

    Regards

    Geetha

    1 person found this answer helpful.
    0 comments No comments