In plain words
Infrastructure as code describes your servers, databases, DNS and permissions in files kept in git, and a tool such as Terraform, OpenTofu or Pulumi creates or changes the real resources to match.
Where you see it
Harbor's staging was set up by hand in a cloud console two years ago, and nobody knows why it differs from production. With the setup in Terraform files, a pull request shows every change to the infrastructure, and terraform plan lists what will be created, changed or destroyed before anything happens.
What goes wrong
- Applying without reading the plan
A renamed resource can show up as destroy and create, which for a database means losing its data. Read every destroy line, use moved blocks for renames, and protect important resources with prevent_destroy.
- Fixing things by hand in the console
A quick change clicked into the AWS console isn't in the code, so the next apply undoes it, or the files stop describing reality. Make every change through the code, and run plan regularly to spot drift.
- Secrets in the state file
Terraform keeps a state file that can hold passwords and keys in plain text. Store it in an encrypted remote backend with limited access, never in git.
What to tell your agent
Quick check
Sign in to earn +10 XP for itterraform plan for a small rename in Harbor's config says 1 to add, 0 to change, 1 to destroy, and the resource is the production database. What do you do?