Interview Prep/Ansible/Architecture Decisions and Tool Comparisons

Ansible or Terraform: where do you draw the line?

BeginnerProductionArchitecture Decisions and Tool Comparisons
Answer

Terraform creates and destroys infrastructure; Ansible configures what runs on it.

Terraform Ansible
Model Declarative with a state file Procedural tasks, mostly idempotent modules
Best at VPCs, instances, IAM, managed services, DNS OS config, packages, app deploys, orchestration
Knows what exists Yes, via state and plan No, checks on each run
Deletes removed resources Yes Only if you write a task for it

In production we use Terraform for the cloud layer and Ansible for what is inside the instances and for ordered operations (rolling restarts, patching). Using Ansible cloud modules for long-lived infrastructure works but you lose plan and drift visibility.

All Ansible questions Roadmap: Ansible

More on Architecture Decisions and Tool Comparisons