Terraform

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

TerraformはHashiCorpによって開発されたオープンソースのInfrastructure as Code (IaC) ツールです。宣言型の設定言語(HCL - HashiCorp Configuration Language、またはJSON)を使用して、インフラストラクチャを定義およびプロビジョニングできます。Terraformを使用すると、AWS、Azure、Google Cloudなどの複数のクラウドプロバイダーやオンプレミス環境全体で、インフラストラクチャを安全かつ効率的に構築、変更、バージョン管理できます。コアワークフローは、設定ファイルを作成し、変更の実行を計画し、それらの変更を適用してインフラストラクチャリソースを作成または更新することを含みます。Terraformは、管理されているインフラストラクチャの現在の状態を追跡するstate fileを維持し、これにより段階的な変更を行い、driftを検出できます。そのモジュール性、広範なプロバイダーエコシステム、および多様なプラットフォームにわたる一貫したワークフローへの焦点は、複雑なインフラストラクチャデプロイメントの管理、プロビジョニングの自動化、およびインフラストラクチャの一貫性と再現性の確保のための強力なツールとなります。

        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

🧒 5歳でもわかるように説明

Terraformは、クラウド上のコンピューターシステムを構築するための設計図のようなものです。必要なもの(サーバー、データベース、ネットワークなど)を正確に書き込むと、Terraformが自動的に構築し、後で更新することもできます。

🤓 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.

📚 出典