Terraform is an open-source HashiCorp infrastructure as code (IaC) tool that uses declarative HashiCorp Configuration Language (HCL) to define, provision, and manage cloud/on-premises resources. It allows safely building, changing, and versioning infrastructure—such as VMs, networks, and SaaS features—across multiple providers. Key benefits include automation, reusability, consistency, and reduced risk
Terraform Architecture & Function
- Core Components: It has a modular architecture consisting of the CLI and a graph engine.
- State Management: Terraform uses a state file (
.tfstate) to map real-world infrastructure to configuration, allowing it to track changes and manage resource lifecycles. - Workflow: The process involves init (initialize plugins), plan (preview changes), apply (provision), and destroy (remove).
Terraform Configuration
- Language: Written in HCL, a human-readable language designed for declaring resource states rather than procedural commands.
- Structure: Configurations are stored in
.tffiles, defining providers, resources, variables, and modules for reusability.
Key Benefits
- Multi-Cloud: Supports major providers like AWS, Google Cloud, Azure, DigitalOcean, and Oracle.
- Safe Execution: Generates an execution plan before making changes to prevent accidental, high-risk modifications.
- Collaboration: Enables version control (Git) for infrastructure code and supports remote state backends for team collaboration.
Key Information
- Language: HashiCorp Configuration Language (HCL).
- Primary Goal: Declarative infrastructure provisioning.
- Mechanism: State file management.