I am using Terraform to create a primary and read replica for an AWS RDS Oracle instance. I am trying to perform a switchover to the read replica through Terraform, but I am unable to find the relevant information on how to do this.
I can successfully perform the switchover to the read replica using the AWS Management Console or AWS CLI. However, after the switchover, I need to refresh the Terraform state file and the Terraform code. If I don’t, Terraform will mistakenly promote the read replica to a standalone database during subsequent plan/apply operations.
Questions:
- How can I perform the switchover directly through Terraform?
- If I perform the switchover using the AWS Console or CLI, what steps do I need to follow to ensure Terraform correctly recognizes the new state (without treating the read replica as a standalone database)?