Basic concepts of Terraform

What is Terraform?

Terraform is an infrastructure as code (IaC) tool that allows you to build, change, and version infrastructure safely and efficiently.

IaC is a code (human readable) that deploys your infrastructure resources onto various platforms instead of managing them manually through a user interface.

How to install Terraform locally

  • Download it from here
  • Test it by running command terraform -version
Terraform version check
Terraform version check

You can clone the code from my Github: Terraform Lab

HCL (Language) Basics

  • HCL – Harshi-corp configuration language
  • “.tf” is the extension of the configuration file
HCL Basics
HCL Basics

Terraform Execution Flow

Terraform Execution Flow
Terraform Execution Flow
  • Terraform Initialisation command: terraform init
  • Terraform Plan command: terraform plan
  • Terraform Apply command: terraform apply

Terraform Variable

Declaring a variable

Declaring a variable
Declaring a variable

Referencing a variable

Referencing a variable
Referencing a variable

Variable Type

Variable Type
Variable Type

Configure AWS-CLI

  • Download it from here
  • Check version aws --version
  • Configure keys aws configure
  • Test connection aws sts get-caller-identity

References