Terraform

Infrastructure as Code

Terraform Overview

Terraform is an infrastructure as code (IaC) tool that enables you to safely and predictably create, change, and improve infrastructure. It codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.

Developer

HashiCorp

Initial release

July 28, 2014

Written in

Go

License

Mozilla Public License

Key Features

Installation & Setup

Installation Steps:

  1. Download Terraform from official website
  2. Unzip the package (Terraform runs as a single binary)
  3. Move the binary to a directory included in your system's PATH
  4. Verify installation: terraform --version
  5. Configure authentication for your cloud provider
  6. Create your first Terraform configuration file

Core Commands:

terraform init

Initialize a working directory

terraform plan

Generate an execution plan

terraform apply

Build or change infrastructure

terraform destroy

Destroy Terraform-managed infrastructure

Productivity Tips

Remote State

Store state files remotely (S3, GCS, etc.) for team collaboration.

Workspaces

Use workspaces to manage multiple environments with the same configuration.

Modules

Create reusable modules for common infrastructure patterns.

Backend Configuration

Configure backends to properly manage state files.

Learning Resources