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’