Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

“Invest in yourself — your confidence is always worth it.”

Explore Cosmetic Hospitals

Start your journey today — compare options in one place.

Terraform Tutorials: Basic Workflow Getting Started Guide

  • init – Init. Initialize the (local) Terraform environment. Usually executed only once per session.
  • plan – Plan. Compare the Terraform state with the as-is state in the cloud, build and display an execution plan. This does not change change the deployment (read-only).
  • apply – Apply the plan from the plan phase. This potentially changes the deployment (read and write).
  • destroy – Destroy all resources that are governed by this specific terraform environment.

Terraform workflow

Step – 1 – Install terraform

Step – 2 – Decide a providers name which you want to work with?

  • Create one directory under your workspace
  • Inside directory, create one file called “providers.tf”
  • Content of the providers.tf are as follow
  • run init command to download aws providers. $ terraform init

terraform {
  required_providers {
    aws = {
      source = "hashicorp/aws"
      version = "4.61.0"
    }
	github = {
      source = "integrations/github"
      version = "5.18.3"
    }
  }
}

provider "aws" {
  region     = "us-east-1"
  access_key = ""
  secret_key = ""
}

provider "github" {
  # Configuration options
}
Code language: PHP (php)

Step – 3 – Create 1 AWS ec2 instance using Terraform

  • Create aws.tf file in the same directory where providers.tf is located
  • Put the following content. Modify AMI id as per your region

resource "aws_instance" "web" {
  ami           = "ami-007855ac798b5175e"
  instance_type = "t2.micro"

  tags = {
    Name = "HelloWorld-DevOpsSchool"
  }
}Code language: JavaScript (javascript)

Step – 4 – PLAN (DRY RUN) using terraform plan

  • RUN a Dry run command $ terraform plan

Step – 5 – APPLY (Create a Resoureces) using terraform apply

  • Run apply command to create resources $ terraform apply

Step – 6 – Verify a AWS ec2 instance at AWS

Step – 7 – APPLY (Update a Resoureces) using terraform apply

  • Update tag info in your aws.tf code
  • Run $ terraform apply

resource "aws_instance" "web" {
  ami           = "ami-007855ac798b5175e"
  instance_type = "t2.micro"

  tags = {
    Name = "HelloWorld-Terraform"
  }
}Code language: JavaScript (javascript)

Step – 8 – Terraform show

Check Statefile in the same directory

Step – 9 – Terraform destroy

Check AWS Account if AWS ec2-instance is destroyed or not

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

Terraform workspace explained!!!

What is Terraform workspace? Have you worked with terraform workflow? such as terraform init/plan/apply/destroy with terraform configuration file? If Yes, you already have worked with Terraform workspace….

Read More

Terraform Tutorials: Templating in Terraform

Top 10 Templating Engines Across Major Programming Languages # Templating Engine Programming Language Common Framework / Ecosystem Typical Real Use 1 Jinja2 Python Flask, Ansible HTML generation,…

Read More

Terraform provisioners Tutorials and Complete Guide

Terraform provisioners are used to execute scripts or shell commands on a local or remote machine as part of resource creation/deletion. They are similar to “EC2 instance…

Read More

Terraform Tutorials: Local Values using Local Block

What is local value in terraform? In Terraform, a locals block is used to define local variables within a module, allowing you to create reusable expressions and…

Read More

Terraform Tutorials: Module Complete Guide

A Terraform module is a collection of configuration files that encapsulate resources used together to achieve a specific outcome. Modules promote reusability, organization, and maintainability in infrastructure…

Read More

What is Terrafile?

Terrafile is a tool used to manage Terraform modules as dependencies. It simplifies the process of downloading and managing Terraform modules by automating the fetching of modules…

Read More