Terraform

An open-source infrastructure as code (IaC) tool by HashiCorp.

Terraform is an open-source Infrastructure as Code (IaC) tool developed by HashiCorp. It enables users to define and provision infrastructure using a declarative configuration language (HCL - HashiCorp Configuration Language, or JSON). Terraform allows you to build, change, and version infrastructure safely and efficiently across multiple cloud providers (like AWS, Azure, Google Cloud) and on-premises environments. The core workflow involves writing configuration files, planning the execution of changes, and applying those changes to create or update infrastructure resources. Terraform maintains a state file that tracks the current state of the managed infrastructure, allowing it to make incremental changes and detect drift. Its modularity, extensive provider ecosystem, and focus on a consistent workflow across diverse platforms make it a powerful tool for managing complex infrastructure deployments, automating provisioning, and ensuring infrastructure consistency and repeatability.

        graph LR
  Center["Terraform"]:::main
  classDef main fill:#7c3aed,stroke:#8b5cf6,stroke-width:2px,color:white,font-weight:bold,rx:5,ry:5;
  classDef pre fill:#0f172a,stroke:#3b82f6,color:#94a3b8,rx:5,ry:5;
  classDef child fill:#0f172a,stroke:#10b981,color:#94a3b8,rx:5,ry:5;
  classDef related fill:#0f172a,stroke:#8b5cf6,stroke-dasharray: 5 5,color:#94a3b8,rx:5,ry:5;
  linkStyle default stroke:#4b5563,stroke-width:2px;

      

🧠 Проверка знаний

1 / 4

🧒 Простыми словами

Terraform is like a blueprint for building your computer systems in the cloud. You write down exactly what you want (like servers, databases, and networks), and Terraform builds it for you automatically and can even update it later.

🤓 Expert Deep Dive

Terraform's declarative approach contrasts with imperative IaC tools by focusing on the desired end-state rather than the sequence of commands to achieve it. Its state management is crucial; the state file acts as a real-time mapping of configured resources to actual infrastructure objects. This state allows Terraform to perform diffing operations, identifying discrepancies between the configuration and the live environment for planning and applying changes. Providers are plugins that abstract the APIs of various cloud and service providers, enabling Terraform's multi-cloud capabilities. The execution plan generated before applying changes provides a critical safety net, detailing resource creation, modification, and destruction. Advanced features include modules for code reuse, workspaces for managing multiple environments, and a registry for sharing modules and providers.

📚 Источники