Terraform
What is Terraform and how it works ?
terraform is a infrastructure as a code means managing and setting up your infrastructure (like server, network, cloud services etc) using code instead of manually configuring hardware or using setup tools. It’s like writing a script to automate how your infrastructure is built and maintained.
Why Terraform ?
Terraform is popular it works with many cloud providers like (AWS, Azure and GCP etc) and lets you set up and manage infrastructure with simple code. This makes it easier to automate track changes and collaborate with others.
Overview of Hashicorp Configuration Language (HCL) :
hashicorp configuration language (HCL) is the language used in terraform to write infrastructure code. It is human readable. simple and understand and designed to describe resources configurations and variables for managing cloud infrastructure. HCL is declarative language meaning you define what you want and terraform figures out how to create it.
Key Features of HCL:
easy to read syntax similar to JSON or YAML
support variables, Modules and Functions to make configuration reusable.
Allows you to define cloud resources (Like server, storage) in a structured and readable way.
Here’s a simple example of an S3 bucket definition in HCL:
Resource “AWS_instance” “example“ { ami = “ami-0c55p159cbfafe10” instance_type = “us-east-1” }
Terraform Work Flow:
init, plan, apply, validate, destroy