Skip to content

Techeons

Imagine | Explore | Innovate

Menu
  • Home
Menu

Cheat Sheet: Essential Terraform Commands

Posted on September 15, 2024

Terraform is an open-source infrastructure as code (IaC) tool that allows you to define and manage cloud and on-premises infrastructure using human-readable configuration files.

Key Features:

  1. Infrastructure as Code (IaC): Manage infrastructure using code, rather than manual processes or GUIs.
  2. Declarative Configuration: Define desired state, and Terraform handles the creation and updates.
  3. Multi-Cloud Support: Supports various cloud providers (AWS, Azure, Google Cloud, etc.) and on-premises infrastructure.
  4. Modular and Reusable: Break down configurations into modules for reuse and easier management.
  5. State Management: Tracks infrastructure state, enabling efficient updates and rollbacks.
  6. Collaboration: Supports team collaboration through version control systems like Git.

Benefits:

  1. Version Control: Track infrastructure changes and collaborate with teams.
  2. Consistency: Ensure consistent infrastructure across environments and deployments.
  3. Efficiency: Automate provisioning and updates, reducing manual errors.
  4. Flexibility: Supports multiple cloud providers and infrastructure types.

Common Use Cases:

  1. Cloud Infrastructure: Manage cloud resources (e.g., VMs, databases, networks).
  2. DevOps: Automate infrastructure provisioning for CI/CD pipelines.
  3. Disaster Recovery: Create and manage disaster recovery environments.

Essential Terraform Commands

Setup and Initialization

Initialize a Terraform working directory:

terraform init

Check Terraform version:

terraform version

Configuration and Planning

Check configuration files for syntax errors:

terraform validate

Generate and show an execution plan:

terraform plan

Generate and show a destruction plan:

terraform plan -destroy

Apply and Destroy

Execute the actions proposed in a Terraform plan:

terraform apply

Execute without prompting for approval:

terraform apply -auto-approve

Destroy Terraform-managed infrastructure:

terraform destroy
Share on Social Media
x facebook pinterest linkedin tumblr reddit emailwhatsapptelegrammastodon

Leave a Reply Cancel reply

You must be logged in to post a comment.

Recent Posts

  • Nginx: How to increase timeout for Nginx
  • Cheat Sheet: Essential Git Commands
  • Setting a default shell in Linux
  • Setting up Composer on Linux
  • Switch easily between Python versions on a Mac using pyenv

Tags

ai alerting aws b2 backblaze certificate cheatsheet cloud commands data-science datalake devops dns docker dremio git gitlab infra jenkins kubernetes linux metabase minikube minio monitoring mount mysql nginx nodejs notebooks openssh php python scala secrets spark ssh ssl ubuntu ufw usb web dev tools windows xampp zeppelin

©2026 Techeons | Design: Newspaperly WordPress Theme