Terraform
An open-source infrastructure as code (IaC) tool by HashiCorp.
Terraform to narzędzie Infrastructure as Code (IaC) typu open-source opracowane przez HashiCorp. Umożliwia użytkownikom definiowanie i provisionowanie infrastruktury za pomocą deklaratywnego języka konfiguracji (HCL - HashiCorp Configuration Language lub JSON). Terraform pozwala na bezpieczne i efektywne budowanie, modyfikowanie i wersjonowanie infrastruktury w wielu dostawcach chmury (takich jak AWS, Azure, Google Cloud) oraz w środowiskach on-premises. Podstawowy workflow obejmuje pisanie plików konfiguracyjnych, planowanie wykonania zmian i stosowanie tych zmian w celu tworzenia lub aktualizowania zasobów infrastruktury. Terraform utrzymuje plik stanu (state file), który śledzi aktualny stan zarządzanej infrastruktury, umożliwiając wprowadzanie zmian przyrostowych i wykrywanie dryfu (drift). Jego modularność, rozbudowany ekosystem providerów i skupienie na spójnym workflow w różnych platformach czynią go potężnym narzędziem do zarządzania złożonymi wdrożeniami infrastruktury, automatyzacji provisioningu oraz zapewnienia spójności i powtarzalności infrastruktury.
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;
🧠 Sprawdzenie wiedzy
🧒 Wyjaśnij jak 5-latkowi
Terraform jest jak plan budowy dla Twoich systemów komputerowych w chmurze. Piszesz, czego dokładnie potrzebujesz (np. serwerów, baz danych i sieci), a Terraform buduje to dla Ciebie automatycznie i może to nawet później aktualizować.
🤓 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.