OpenTofu: Introduction & Getting Started
OpenTofu is an open-source infrastructure as code (IaC) tool, forked from Terraform, designed to provision and manage cloud and on-premises resources declaratively.
Why Use OpenTofu?
- Open-source alternative to Terraform
- Manage infrastructure as code across multiple providers
- Declarative, version-controlled infrastructure
How OpenTofu Works
- Uses HCL (HashiCorp Configuration Language) for configuration files
- Providers enable support for different platforms (AWS, Azure, etc.)
- State files track resource status
Quick Start Example
- Install OpenTofu:
- Write a simple configuration (
main.tf
): - Initialize and apply: