Day 61 - Terraform Command🔥
In today's blog, we will explore some of the fundamental Terraform commands that you'll frequently use to manage your infrastructure as code. These commands lay the foundation for efficient provisioning, modification, and destruction of resources using Terraform. Let's dive in!
terraform init
This command initializes a new or existing Terraform configuration in your working directory. It downloads necessary provider plugins and sets up the environment for Terraform operations. Think of it as a setup phase that prepares your infrastructure project.
we will understand by example : we will create a file using terraform . create a create_file.tf using vim

Now run terraform init

terraform init -upgrade: Adding the-upgradeflag toterraform initensures that Terraform attempts to upgrade provider plugins to their latest versions. For example:
terraform init -upgrade
terraform plan: This command generates an execution plan by comparing the desired state (as defined in your Terraform configuration) with the current state (as tracked by Terraform). For example:
terraform plan
This will tell you what will be created?

terraform apply: Applying the changes to your infrastructure is done using theterraform applycommand. For example:
It will create a file in our example

terraform validate: Use this command to validate the syntax and configuration of your Terraform files. For example:terraform validate

terraform fmt: Terraform'sfmtcommand automatically formats your Terraform files to follow a consistent style.

terraform destroy: When you no longer need your infrastructure, theterraform destroycommand tears down all the resources created by your Terraform configuration. For example:
before terraform destroy


After terraform destroy command:

That was all for today. see you another day with another project.



