Skip to content

GitOps, CI/CD and automation ยท Practice and architecture

Terraform and Ansible: what belongs in each tool?

Terraform is often used to define infrastructure resources, while Ansible configures systems and services. The tools do not impose that boundary. The team needs to define it so changes remain predictable.

A practical division of responsibilities

Terraform provisions networks, machines and cloud dependencies. Ansible takes inventory of those hosts and manages packages, accounts, services and system monitoring. Both stages can be versioned and reviewed independently.

Where ownership conflicts arise

Conflicts occur when both workflows own the same settings or when one does not know the other replaced a resource. Document information passed between the tools and keep secrets in the proper store rather than passing them through broadly visible outputs.

After replacing a server, check both that the host was recreated and that its configuration and application were restored. Declaring that a machine exists is not a complete service recovery procedure.

Approving changes for production

Terraform plan review answers what will change in infrastructure. An Ansible test addresses how hosts will be configured. Separate acceptance checks and ordered stages let teams stop before an additional change is applied.

Official documentation

Discuss your infrastructure

Choose a deployment, audit or maintenance scope for your environment. HLS works remotely with teams across Poland.

Service catalog