Containerization :👈 👉:What-is-Helm

Terraform Overview

What is Terraform?

Terraform is like the blueprint master of cloud infrastructure ๐Ÿ› ๏ธ. It’s an open-source tool developed by HashiCorp that lets you define and provision infrastructure using code—a concept known as Infrastructure as Code (IaC).

๐Ÿง  What Terraform Really Is

Terraform is an Infrastructure as Code (IaC) tool created by HashiCorp. It allows you to define cloud and on-prem infrastructure using declarative configuration files written in HCL (HashiCorp Configuration Language).

Instead of manually provisioning resources, you describe the desired state, and Terraform figures out how to get there.

๐Ÿ› ๏ธ Core Concepts

  • Providers: Plugins that let Terraform interact with APIs of cloud platforms (AWS, Azure, GCP), SaaS services (Datadog, GitHub), and even on-prem systems.
  • Resources: The building blocks—like virtual machines, databases, or DNS records—you define in your configuration.
  • Modules: Reusable sets of Terraform configurations that help organize and scale infrastructure.
  • State File: Terraform keeps track of your infrastructure in a .tfstate file, which is crucial for planning and applying changes.
  • Plan & Apply Workflow:
    • terraform plan: Preview changes
    • terraform apply: Execute changes

๐Ÿงฉ Advanced Features

  • Remote Backends: Store state files securely in remote locations (like AWS S3 or Terraform Cloud) to enable collaboration.
  • Workspaces: Manage multiple environments (e.g., dev, staging, prod) within the same configuration.
  • Data Sources: Pull in dynamic data from external sources to use in your configuration.
  • Terraform Cloud & Enterprise: Offer collaboration, governance, and security features for teams and enterprises.

๐Ÿš€ Real-World Use Cases

  • Multi-cloud deployments: Provision resources across AWS, Azure, and GCP from a single config.
  • CI/CD integration: Automate infrastructure changes as part of your deployment pipeline.
  • Disaster recovery: Recreate entire environments from code in minutes.
  • Compliance & auditing: Track infrastructure changes over time with version control.

๐Ÿ’ก Why It Stands Out

Unlike tools like Ansible or Puppet that focus on configuration management, Terraform is laser-focused on infrastructure provisioning. And unlike AWS CloudFormation, it’s cloud-agnostic, giving you flexibility across platforms.

Essential Terraform CLI Commands ๐Ÿงต

๐Ÿš€ Basic Setup & Initialization

Command Usage
terraform init Initializes a Terraform working directory and downloads necessary plugins.
terraform version Displays the installed Terraform version.
terraform fmt Formats configuration files to canonical HCL style.
terraform validate Checks whether the configuration is syntactically valid.

๐Ÿ“ Planning & Applying Infrastructure

Command Usage
terraform plan Shows what actions Terraform will take before applying changes.
terraform apply Applies the changes required to reach the desired state.
terraform destroy Destroys all resources managed by Terraform.

๐Ÿ“ฆ State Management

Command Usage
terraform state list Lists all resources tracked in the state file.
terraform state show Shows attributes of a specific resource.
terraform state rm Removes a resource from the state file.
terraform refresh Updates the state file with real infrastructure data.

๐Ÿ”„ Resource Manipulation

Command Usage
terraform taint Marks a resource for recreation on next apply.
terraform untaint Removes the taint from a resource.
terraform import
Imports existing infrastructure into Terraform.

๐Ÿง  Workspace & Output

Command Usage
terraform workspace list Lists all available workspaces.
terraform workspace new Creates a new workspace.
terraform workspace select Switches to a different workspace.
terraform output Displays output values from your configuration.

๐Ÿ” Authentication & Remote Operations

Command Usage
terraform login Authenticates with Terraform Cloud.
terraform logout Logs out from Terraform Cloud.

๐Ÿงฐ Debugging & Help

Command Usage
terraform console Opens an interactive console for evaluating expressions.
terraform -help Displays help for Terraform CLI or subcommands.
Back to Index
Containerization :👈 👉:What-is-Helm