# Day 61- Terraform🔥

![Por que devemos usar mais o Terraform Cloud?](https://www.cloudsquad.com.br/content/images/size/w1200/2022/05/1620073844-blog-library-product-terraform-cloud-tfc-black-gradient.jpg align="left")

### **Introduction**

Welcome back to Day 61 of the 90 Days of DevOps journey! Today, let's dive deeper into Terraform, focusing not only on essential commands but also exploring its competitive landscape. We're about to unravel the intricacies of infrastructure as code with Terraform!

### Terraform Commands:

#### 1\. `terraform init`

The command that kicks off your Terraform project. It initializes the working directory, downloads necessary providers, and sets up the backend.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1706077772734/8124cee6-79e5-4bf2-adfd-8c9394909fbf.png align="center")

#### 2\. `terraform init -upgrade`

Update your Terraform plugins to the latest versions. Helpful when you want to make sure you're using the latest features and improvements.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1706077764354/df309913-1240-4d2d-9b81-227b1ce6af8d.png align="center")

#### 3\. `terraform plan`

This command creates an execution plan, showing what actions Terraform will take to bring your infrastructure to the desired state. A crucial step before applying changes.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1706077892571/b52c0f7e-41e7-478a-bf68-51d7957299c1.png align="center")

#### 4\. `terraform apply`

The magic happens here. Apply executes the changes proposed in the plan. Your infrastructure starts shaping up according to the Terraform script.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1706083884686/408dc364-44fe-4a35-a4d8-a2e29d797cb9.png align="center")

#### 5\. `terraform validate`

Checks your configuration files for syntax errors and other issues. A quick validation step to catch errors early.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1706084858578/e649d228-ba10-4d9d-a8c8-e4ce4c02eaa9.png align="center")

#### 6\. `terraform fmt`

Formatting matters. This command ensures consistent formatting across your Terraform configuration files

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1706084909665/f1eb4a99-051f-4c6e-be75-2791bd9d5b5e.png align="center")

#### 7\. `terraform destroy`

The undo button. Destroys the Terraformed infrastructure, reverting it back to the state before applying the changes.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1706084989467/34f2bb0e-be61-412d-a112-595ca4df2615.png align="center")

### **Terraform in the Landscape**

Now, let's explore Terraform's main competitors:

#### Ansible

Ansible excels in configuration management, automating tasks such as software provisioning, configuration, and application deployment. Its agentless approach simplifies management across diverse systems.

#### Packer

Packer complements Terraform by specializing in creating machine images for multiple platforms. It ensures consistency in infrastructure by providing pre-configured images.

#### Cloud Foundry

As a robust platform-as-a-service (PaaS) solution, Cloud Foundry streamlines application deployment and management, simplifying the developer experience.

#### Kubernetes

While Kubernetes is primarily an orchestration tool, it competes in the infrastructure management space, especially for containerized applications. It excels in container orchestration and scaling.

## **Crafting Your Terraform Journey**

Understanding the intricacies of Terraform commands is pivotal. Initiate, plan, apply, and validate your way to successful infrastructure management. The `fmt` command ensures your code remains clean and readable, while `destroy` provides an exit strategy when needed.

In the broader landscape, consider Terraform's competitors. Each tool brings unique strengths to the table, and the choice depends on your specific needs and preferences.

Keep blazing through the 90 Days of DevOps! Stay tuned for more in-depth insights and hands-on experiences.

  
Happy Learning, Terraformers! 🚀💻

Lokesh Telange ✨✨
