Terraform Cheatsheet - Infrastructure as Code Commands

Comprehensive Terraform cheatsheet for Infrastructure as Code. Quickly find commands for apply, variables, and more. Essential for DevOps engineers.

Terraform Cheatsheet

Terraform Command Reference

This cheatsheet provides quick access to essential Terraform commands for managing infrastructure as code. It covers common operations like applying changes and managing variables.

Execute Plan Without Approval

Execute plan without being prompted for approval

Use the -auto-approve flag to automatically confirm the execution plan, useful for automated workflows.

terraform apply -auto-approve

Managing Terraform Variables

Hide password on the command line using environment variables

If you have a terraform.tfvars variable, such as password, you can set its value using an environment variable prefixed with TF_VAR_. This is a secure way to handle sensitive data without exposing it directly in your configuration files or command history.

export TF_VAR_password="not so secret"

After setting the environment variable, when you invoke terraform apply or other Terraform commands that require this variable, it will be automatically used, and you will not be prompted for input.

Additional Terraform Resources

For more in-depth information and advanced usage, refer to the official Terraform documentation: