Recently I was exploring Terraform. I was searching for a way to understand it deeply and stumbled upon this youtube video. I am just going to show the very basics of what Terraform can do.
Terraform is an open-source infrastructure as code (IaC) tool created by HashiCorp. It allows users to define and manage cloud infrastructure resources using a declarative language. In otherwords you can create, manage and destroy infrastructure using the code written in HCL (Hashi Corp Language).
Downloading Terraform
Terraform comes as one single exe in reality. You can go to download section of https://www.terraform.io/
Once there you can download the compatible file. I am using Windows 11, so I could download the zip file and extract it. If you open the extracted file, you will see one executable.

Set the path variable in Windows settings to whichever directory where you have kept this exe.
Validating the Installation
Execute the following command in the command prompt.
terraform version You will see whatever the version of the terraform you have installed.
Writing First Terraform Configuration File
Create a file in called main.tf in whichever directory you want. File extension .tf will be recognized by Terraform.
Paste the following code into the file. You can set any existing directory path you want.
resource "local_file" "my-sport" { filename = "C:\\temp\\my-sport.txt" content = "My favorite sport is cricket" } Execute the following command in the directory where you have the .tf file.
terraform init This will install the provider needed for creating the resource.
Next execute the following command to see how Terraform is going to create the resource.
terraform plan This will show you the plan of execution to create resource.

Next execute the following command to create the resource. In this case it will be a file in the path

It will prompt you to enter yes. Enter “yes”.
If you go to the folder you should see the file created.

Ending Note
Intention of this blog is to give you a glimpse of Terraform. You can follow the youtube tutorial for details. You can create any kind of resource varying from docker container, EC2 on AWS cloud, networking resource, Azure resource, GCP resource etc using your code.