Skip to content
Home
Dev Convert Generate Finance Calc Design Security Media

More categories

Productivity 23 SEO Tools 18 Network Tools 17 Text Tools 16 Education Tools 15 PDF Tools 11 Mockups 9

Learn and build

GuidesBlogAPI & MCPCheatsheetsChangelog All categories

Browse

439 tools · 15 categories

Start here

Popular tools New this week 11 All tools 439

Categories

Developer Tools 91 Converters 65 Calculators 32 Finance Tools 32 Generators 31 Media Tools 27 Design Tools 25 Security Tools 25 Productivity 23 SEO Tools 18 Network Tools 17 Text Tools 16 Education Tools 15 PDF Tools 11 Mockups 9

Learn and build

Guides Cheatsheets Blog REST API MCP server Changelog

No matches here.

Keep FindUtils free Sponsors fund new tools
  1. Cheatsheets
Guides Blog API & MCP
Sponsor
FindUtils
Sponsor
  1. Home
  2. Cheatsheets
  3. DevOps & Cloud
  4. Terraform Commands

DevOps & Cloud · Cheatsheet

Terraform Commands Cheatsheet

Infrastructure as Code: init, plan, apply, state management, workspaces, and modules

59 commands 9 sections

On this sheet

Core Workflow 9 State Management 8 Planning & Targeting 7 Workspaces 6 Configuration Basics 7 Providers & Modules 7 Output & Inspection 7 Best Practices 6 Sources 2

No entry matches that filter.

Core Workflow

  • terraform init Initialize working directory and download providers
  • terraform plan Preview changes before applying
  • terraform apply Apply changes to infrastructure
  • terraform apply -auto-approve Apply without confirmation prompt
  • terraform destroy Destroy all managed infrastructure
  • terraform destroy -target=aws_instance.web Destroy specific resource
  • terraform validate Validate configuration syntax
  • terraform fmt Format .tf files to canonical style
  • terraform fmt -recursive Format all .tf files recursively

State Management

  • terraform state list List all resources in state
  • terraform state show aws_instance.web Show details of a resource in state
  • terraform state mv old_name new_name Rename a resource in state
  • terraform state rm aws_instance.web Remove resource from state (keep infra)
  • terraform state pull Output current state to stdout
  • terraform state push local.tfstate Overwrite remote state (dangerous)
  • terraform refresh Deprecated; prefer terraform plan/apply -refresh-only to review state changes
  • terraform import aws_instance.web i-abc123 Import existing resource into state

Planning & Targeting

  • terraform plan -out=plan.tfplan Save plan to file
  • terraform apply plan.tfplan Apply a saved plan file
  • terraform plan -target=aws_instance.web Plan for specific resource only
  • terraform plan -var="region=us-west-2" Pass variable on command line
  • terraform plan -var-file="prod.tfvars" Use variable file
  • terraform plan -destroy Preview what destroy would do
  • terraform plan -refresh-only Detect drift without changes

Workspaces

  • terraform workspace list List all workspaces
  • terraform workspace new staging Create a new workspace
  • terraform workspace select production Switch to a workspace
  • terraform workspace show Show current workspace
  • terraform workspace delete staging Delete a workspace
  • terraform.workspace Reference workspace name in config

Configuration Basics

  • resource "aws_instance" "web" { ami = "..." } Define a resource
  • variable "region" { default = "us-east-1" } Declare an input variable
  • output "ip" { value = aws_instance.web.public_ip } Define an output value
  • data "aws_ami" "latest" { ... } Define a data source query
  • locals { env = "prod" } Define local values
  • module "vpc" { source = "./modules/vpc" } Use a module
  • terraform { required_version = ">= 1.5" } Set required Terraform version

Providers & Modules

  • terraform init -upgrade Upgrade providers to latest allowed
  • terraform providers Show required providers
  • terraform providers lock Generate lock file for providers
  • terraform get Download and update modules
  • terraform get -update Force update modules
  • source = "hashicorp/aws" Use provider from Terraform Registry
  • source = "git::https://example.com/module.git" Use module from Git repo

Output & Inspection

  • terraform output Show all output values
  • terraform output -json Show outputs as JSON
  • terraform output ip_address Show specific output value
  • terraform show Show current state in human-readable form
  • terraform show -json plan.tfplan Show plan as JSON
  • terraform graph | dot -Tpng > graph.png Generate resource dependency graph
  • terraform console Interactive expression evaluator

Best Practices

  • terraform { backend "s3" { ... } } Use remote state backend
  • terraform plan -detailed-exitcode Exit code 2 if changes detected (CI)
  • TF_LOG=DEBUG terraform plan Enable debug logging
  • TF_VAR_region="us-west-2" terraform plan Set variable via environment
  • -lock=false Skip state locking (use with caution)
  • -parallelism=10 Set the concurrent operation limit to 10, the documented default

Sources

  • https://developer.hashicorp.com/terraform/cli/commands/plan Terraform plan: review workflow, targeting limits, and parallelism settings.
  • https://developer.hashicorp.com/terraform/cli/commands/refresh Terraform refresh: deprecated command and the refresh-only alternative.

Related cheatsheets

  • Docker Commands54 commands
  • Kubernetes Commands72 commands
  • Apache HTTP Server64 commands

Guides that use these commands

  • Load Balancer Design: Nginx, HAProxy, and Caddy ConfigsGuide · 11 min read
  • Cron Expression Generator: Build and Check Five-Field SchedulesGuide · 6 min read
  • Yolobox Configurator: Generate AI Sandbox Configs in SecondsGuide · 10 min read

From FindUtils

More to explore

Products and services from the team behind FindUtils.

Promote your tool
Featured product seeranks.com SeeRanks — transparent product discovery A public ranking board where paid placement is always labeled and every product keeps its earned position. View SeeRanks Public rank board #1 Sponsored #2 #3 #4 Paid placement is always labeled Free favicon tool emojifavicons.com Emoji Favicons Turn any emoji into a favicon with one HTML line. SVG, PNG or ICO, no sign-up. <link rel="icon" href=".../🦊.svg"> Create a favicon
FindUtils service findutils.com Articles for software tools A sourced article for your channels, or a sponsored FindUtils publication with editorial review. Compare packages Domain portfolio findutils.com Domain names for sale .com.dev.sh.app.io Unused names across dev tools, AI, PDF and commerce. Make an offer. Browse the list Playable ranking towerscore.io TowerScore — stack the skyline Play to climb, or buy a floor. Paid floors are labeled. Open TowerScore

Missing a tool you need?

Tell us what to build next. Most requests ship as a free browser tool, an API endpoint and an MCP tool.

Request a tool
FindUtils

Free, fast utilities. Most tools process your files in the browser; lookup tools say what they send, and pages load analytics and ads.

  • No sign-up for free tools
  • Most tools run in your browser
  • 369 tools on the REST API, 369 on MCP

Tools

DevelopersConvertPDFDesignSecurityAll tools →

Learn

GuidesBlogCheatsheetsChangelog

Build

REST APIMCP serverAPI referenceWorkflowsStatus

FindUtils

AboutLibraries we useSponsorRequest a toolDomains for saleContact
© 2026 FindUtils PrivacyTermsSitemap
Service status
FindUtils

Free, fast utilities that respect your data. Most tools run in your browser.

Build with it

REST APIMCP serverGuidesChangelog

FindUtils

AboutSponsorPrivacyContact
Theme
© 2026 FindUtils Terms
FindUtils
Guides Blog REST API MCP server Changelog

Categories

Developers 91 Convert 65 Calculate 32 Finance 32 Generate 31 Media 27
All 15 categories →

Keep it free

Sponsorship keeps every tool free and funds the new ones we ship each week.

Sponsor Back the project
Tools API Sponsor