grafclouds.com / documents / training / devops-challenges / terraform-import-vs-recreate

Terraform Doesn't Know About the Manually-Made DB. Just Let It Recreate It?

Intermediate ~12 min read
TerraformDatabases

Scenario

Months ago, someone stood up a production RDS instance by hand in the console — probably under deadline pressure — and it has been quietly serving live customer traffic ever since. Now the team is codifying everything in Terraform. An engineer writes the aws_db_instance resource block, runs terraform plan, and Terraform announces it will create a database — because as far as its state file knows, none exists. Depending on naming collisions and how the apply plays out, the path from here runs through creating a duplicate or destroying and rebuilding the real one. Either way, Terraform has no idea the most important database in the company is standing right where it wants to build.

The Quick Fix on the Table

A colleague shrugs: just run the apply. Terraform will build a matching database from the code, everything ends up consistent and codified, and the manual-infrastructure problem is gone. The end state is the goal, so why fuss over how we get there?

Interview · Round 1

The quick fix is on the table and the room is waiting for your call. Would you sign off on it? Take a position and justify it — out loud or on paper — before revealing the analysis.