Terraform

Terraform Cheat sheet

Terraform Cheatsheet with pdf. You can download Terraform Cheatsheet pdf with all Terraform CLI commands needed.

The mentioned list is the most used Terraform commands. If you need more additional information on each of the commands you can find it in the below link.

  • terraform version : Get terraform version
  • terraform -help : Get the list of all commands with descriptions.
  • terraform init : Initalizes terraform working directory
  • terraform init -migrate-state : Reconfigure the backend and will migrate the backend
  • terraform validate : Validates syntax and arguments of terraform files
  • terraform plan : Runs execution plan
  • terraform plan -out=pathofplan : Runs execution plan and saves in a file
  • terraform plan -destroy : Runs an execution plan for destroy
  • terraform apply : Create and update infrastructure
  • terraform apply -auto-approve : Updates infrastructure without expecting ‘yes’
  • terraform apply -var=”instance_type=t2.micro” : Runs apply with value for the variable
  • terraform apply -var-file=”varfile.tfvars” : Runs apply with variable values mentioned in the file
  • terraform apply filename : Runs apply over the plan output created in file
  • terraform apply -target=”aws_instance.this” : Runs apply only to particular resource
  • terraform apply -parallelism=5 : Creates resources paralley. Default value is 10
  • terraform destroy : Destroys all resources in statefile
  • terraform destroy –auto-approve : Destroys infrastructure without expecting ‘yes’
  • terraform destroy -target=”aws_instance.this” : Destroys particular resource
  • terraform fmt : Formats terraform code
  • terraform fmt –recursive : Formats terraform code including subdirectories
  • terraform fmt  –diff : Displays difference after formating
  • terraform get : Downloads modules
Gokul Deepak S

Published by
Gokul Deepak S

Recent Posts

Running crontab on AWS auto scaling group

Linux has a convenient feature of running cronjob which will get executed at the correct…

4 months ago

Learn with Gokul

As famous Tamil poet Auvaiyar said "Katradhu Kai Mann Alavu, Kallathathu Ulaga Alavu" which is…

4 months ago

Strategy to prepare for Terraform Associate Exam Preparation

I was planning to do Terraform certification a long time ago. I have worked on…

4 months ago

Runcloud vs SiteGround Comparision

As a user of both of these services has got multiple benefits with both of…

1 year ago

Important Docker Commands to remember

You need not memorize these important docker commands. Repeated usage will make it easy for…

1 year ago

AWS Instance Types

There are different types of AWS instances. Here you will also know for which requirement…

2 years ago

This website uses cookies.