Master Terraform Basic Commands: Essential CLI Guide for Infrastructure as Code

Logan Jul 13, 2026

Terraform, an Infrastructure as Code (IaC) software tool, enables you to safely and predictably create, change, and version infrastructure. It's like having a blueprint for your infrastructure, ensuring consistency across environments. Let's delve into some basic Terraform commands to get you started on your IaC journey.

Terraform commands for DevOps Engineer
Terraform commands for DevOps Engineer

Terraform uses its own configuration language, which is human-readable and compatible with JSON, making it easy to understand and automate. Here, we'll explore fundamental commands to help you manage your Terraform projects efficiently.

Important Terraform Commands that we should know (a CheatSheet)
Important Terraform Commands that we should know (a CheatSheet)

Initializing and Planning

Before you start working with Terraform, you need to initialize your working directory. This command prepares Terraform to interact with external tools needed for your infrastructure configuration.

an info sheet with information about the different types of items in each language, including text and
an info sheet with information about the different types of items in each language, including text and

The command to initialize your directory is:

terraform init

a poster with different types of functions in it
a poster with different types of functions in it

Configure Providers

Providers are plugins that enable Terraform to interact with external services like AWS, Azure, or GCP. You configure the providers using the required_providers block in your Terraform configuration files.

Example configuration:

a poster with the words terraform cli, and other information on it's side
a poster with the words terraform cli, and other information on it's side
terraform { required_providers { aws = "~> 3.0" }

Planning Infrastructure Changes

Once you've configured your providers and infrastructure resources, the next step is to plan the changes Terraform needs to make. This command helps you understand what will change in your infrastructure before actually applying those changes.

How Does Terraform Works?
How Does Terraform Works?

The command to plan infrastructure changes is:

terraform plan

Terraform Best Practices The 20 Practices You Should Adopt - Click IT
Terraform Best Practices The 20 Practices You Should Adopt - Click IT
Terraform Modules - Their Roles and Functions!
Terraform Modules - Their Roles and Functions!
Terraform vs Ansible: Which one does WHAT in DevOps?
Terraform vs Ansible: Which one does WHAT in DevOps?
Terraform: Up & Running, 2nd Edition
Terraform: Up & Running, 2nd Edition
Terraform for Beginners in 1 Hour
Terraform for Beginners in 1 Hour
Terraform Cheat Sheet | Terraform CLI Commands
Terraform Cheat Sheet | Terraform CLI Commands
An Introduction to Terraform Using AWS - myTechMint
An Introduction to Terraform Using AWS - myTechMint
Terraform explained in 15 mins | Terraform Tutorial for Beginners
Terraform explained in 15 mins | Terraform Tutorial for Beginners
Terraform Cheat Sheet
Terraform Cheat Sheet
a poster describing how to use terraformm in the cloud computing system, with information about it
a poster describing how to use terraformm in the cloud computing system, with information about it
#terraform #devops #cloudengineering #infrastructureascode #iac #terraformtips #terraforminterview #devopslearning #cloudcareers #platformengineering #cicd #aws #devopscommunity | Karuna Shreshth
#terraform #devops #cloudengineering #infrastructureascode #iac #terraformtips #terraforminterview #devopslearning #cloudcareers #platformengineering #cicd #aws #devopscommunity | Karuna Shreshth
the book terraformm up and running
the book terraformm up and running
an info sheet with information about the different types of cheethhets and how to use them
an info sheet with information about the different types of cheethhets and how to use them
a blue and green brochure with the words transform cheethhete on it
a blue and green brochure with the words transform cheethhete on it
the linux command commands are displayed in purple
the linux command commands are displayed in purple
Terraform Workflow Process Explained
Terraform Workflow Process Explained
a poster with instructions on how to use the termform file and folder structure for teaching
a poster with instructions on how to use the termform file and folder structure for teaching
a purple and black poster with the words,'essentials for an informative text
a purple and black poster with the words,'essentials for an informative text

Application and Destruction

After planning your infrastructure changes, you can apply them. This command performs the actions required to achieve the desired state of your infrastructure.

The command to apply infrastructure changes is:

terraform apply

Automating Approval

When applying significant or sensitive changes, it's crucial to ensure an approval process. Terraform supports automated approvals through the -auto-approve=false flag, which prevents automatic execution of the terraform apply command without manual confirmation.

Destroying Resources

When you no longer need your infrastructure resources, you can use Terraform to destroy them. This command removes the resources that are no longer required, ensuring a clean state.

The command to destroy infrastructure resources is:

terraform destroy

Terraform's basic commands are essential for managing your infrastructure as code. With these core commands, you can initialize, plan, apply, and destroy your infrastructure with confidence. Happy coding!