{
  "id": "terraform-vs-ansible",
  "ids": [
    "terraform",
    "ansible"
  ],
  "title": "Terraform vs Ansible: provisioning, configuration and cost",
  "heading": "HashiCorp Terraform vs Ansible",
  "kicker": "Cloud and DevOps comparison",
  "deck": "Decide which part of infrastructure change each tool should own before comparing features.",
  "description": "Terraform vs Ansible: compare infrastructure provisioning, configuration management, state, playbooks, licences and how the tools can work together.",
  "answerHeading": "Should you choose one or combine them?",
  "answer": "Terraform commonly manages the lifecycle of infrastructure resources through provider APIs and recorded state. Ansible commonly configures systems and runs operational tasks through playbooks. Their capabilities overlap, but they are not equivalent replacements. Many teams can define a useful boundary: provision a server with Terraform, then configure its software with Ansible.",
  "checkedAt": "2026-10-15",
  "researchTag": "Buying requirements comparison",
  "researchLimit": "Published capabilities and commercial conditions are compared. The briefs and acceptance checks are hypothetical, not hands-on tests or performance measurements.",
  "datasetDescription": "Seven practical differences, four illustrative buying briefs and a four-row acceptance checklist.",
  "type": "workflow-buying",
  "rows": [
    [
      "Primary question",
      "Which infrastructure resources should exist?",
      "What configuration or task should be applied?"
    ],
    [
      "Workflow",
      "Review plan, then apply resource changes",
      "Run playbooks against an inventory"
    ],
    [
      "Recorded state",
      "Tracks managed resources in Terraform state",
      "Does not use Terraform’s persistent resource-state model"
    ],
    [
      "Reuse",
      "Modules and provider resources",
      "Roles, collections and playbooks"
    ],
    [
      "Remote interaction",
      "Provider APIs for infrastructure and services",
      "Modules and connection methods for targeted systems"
    ],
    [
      "Licence boundary",
      "Current CLI under BSL; HCP/Enterprise separate",
      "Community open-source automation; Red Hat platform separate"
    ],
    [
      "Combined use",
      "Can hand provisioned resource outputs to configuration tooling",
      "Can consume target inventory and configure provisioned systems"
    ]
  ],
  "scenarios": [
    {
      "name": "New cloud environment",
      "question": "Who creates networks, instances and service resources?",
      "left": "Define resource dependencies and review the resulting plan.",
      "right": "Check available cloud modules where playbook-based provisioning is proposed.",
      "note": "Require clear resource ownership; two tools should not independently change the same setting."
    },
    {
      "name": "Server configuration drift",
      "question": "How will a changed package or service setting be corrected?",
      "left": "Check whether replacing the machine image is the intended response.",
      "right": "Apply a reviewed configuration playbook and inspect its second run.",
      "note": "The acceptance target is known desired configuration, not simply a successful command exit."
    },
    {
      "name": "Shared automation team",
      "question": "Can a colleague understand and approve the change?",
      "left": "Review configuration changes and state access before apply.",
      "right": "Review playbook targets, credentials and affected tasks before execution.",
      "note": "Use a non-production change containing an intentional mistake to test review quality."
    },
    {
      "name": "Combined platform",
      "question": "Where does provisioning end and configuration begin?",
      "left": "Export only the outputs the configuration stage needs.",
      "right": "Build inventory and run configuration after resources are ready.",
      "note": "Document handoff, retry and teardown behaviour as one workflow."
    }
  ],
  "exampleTable": {
    "caption": "Hypothetical evaluation checklist; no performance result or vendor score is implied.",
    "headers": [
      "Requirement",
      "Proof to collect",
      "Acceptance condition"
    ],
    "rows": [
      [
        "Change ownership",
        "A map of resources and settings managed by each tool",
        "No unmanaged overlap or conflicting owner"
      ],
      [
        "Repeatability",
        "Two consecutive runs against the same environment",
        "The second run has only expected changes"
      ],
      [
        "Secrets",
        "A review of state, inventory and logs",
        "Credentials stay within the approved access boundary"
      ],
      [
        "Failure handling",
        "A deliberately interrupted change",
        "The team can explain and repair the partial result"
      ]
    ]
  },
  "sections": [
    {
      "id": "automation-boundary",
      "title": "Separate resource lifecycle from system configuration",
      "navLabel": "Tool boundary",
      "paragraphs": [
        "Start by grouping changes into resource creation, machine configuration and operational actions. A network or hosted database has a lifecycle and provider API. A package configuration or service restart has a different execution and recovery model. Use those distinctions to assign ownership.",
        "Do not turn a useful comparison into a forced replacement project. If both tools already have a clear role, evaluate the handoff and maintenance burden. If adopting only one, demonstrate the most awkward real change rather than counting overlapping integrations."
      ]
    },
    {
      "id": "state-control",
      "title": "Review change records as sensitive operational data",
      "navLabel": "State and access",
      "paragraphs": [
        "A resource plan is useful only when it is based on the intended environment and appropriately protected state. Give reviewers enough context to identify an unexpected replacement or deletion. Keep access to execution credentials distinct from permission to read a proposed change.",
        "For playbooks, inspect inventory selection and module behaviour with equal care. A repeatable task definition does not make every shell command idempotent. Rehearse a partial failure and record which actions can be retried safely before making the workflow routine."
      ]
    }
  ],
  "faqs": [
    {
      "question": "Is Terraform a configuration management replacement?",
      "answer": "It is mainly an infrastructure lifecycle tool. It can overlap with configuration workflows, but provider resource state is different from maintaining packages and services on an existing machine."
    },
    {
      "question": "Can Terraform and Ansible work together?",
      "answer": "Yes. A team can provision infrastructure with Terraform and configure target systems with Ansible, provided ownership, inventory handoff and failure recovery are explicit."
    },
    {
      "question": "Is Terraform open source?",
      "answer": "Current Terraform CLI releases use the Business Source License, a source-available licence with use conditions. Do not confuse that with unrestricted open-source licensing or older release terms."
    },
    {
      "question": "Does free community software include enterprise support?",
      "answer": "No. HCP Terraform, Terraform Enterprise and Red Hat Ansible Automation Platform have separate commercial scope. Compare support, governance and hosting as part of the offer."
    }
  ],
  "sources": [
    {
      "url": "https://developer.hashicorp.com/terraform/intro",
      "facts": "Provider-based infrastructure provisioning, planning, resource state and modules."
    },
    {
      "url": "https://developer.hashicorp.com/terraform/intro/terraform-editions",
      "facts": "CLI, HCP and Enterprise deployment distinctions."
    },
    {
      "url": "https://github.com/hashicorp/terraform/blob/main/LICENSE",
      "facts": "Business Source License and additional use grant."
    },
    {
      "url": "https://www.hashicorp.com/en/license-faq",
      "facts": "Permitted internal use and competitive commercial offering restrictions."
    },
    {
      "url": "https://docs.ansible.com/projects/ansible/latest/getting_started/introduction.html",
      "facts": "Playbooks, configuration automation and remote execution approach."
    },
    {
      "url": "https://github.com/ansible/ansible/blob/devel/COPYING",
      "facts": "Community ansible-core licence."
    },
    {
      "url": "https://www.redhat.com/en/technologies/management/ansible",
      "facts": "Commercial Ansible Automation Platform scope."
    }
  ],
  "relatedLinks": [
    {
      "path": "/guides/software-total-cost/",
      "title": "Build a complete software cost estimate"
    },
    {
      "path": "/guides/software-buying-checklist/",
      "title": "Use a written buying checklist"
    },
    {
      "path": "/categories/cloud-devops/",
      "title": "Browse cloud and DevOps software"
    }
  ]
}
