Welcome to the world of Terraform, the popular Infrastructure as Code (IaC) tool that has revolutionised the way we manage and provision infrastructure! If you’ve heard of Terraform but are not sure how to get started, you’re in the right place. This beginner’s guide will introduce you to the fundamentals of Terraform, providing you with a solid foundation to build upon as you dive deeper into this powerful tool.

What is Terraform?

Terraform is an open-source tool created by HashiCorp that enables users to define, provision, and manage infrastructure resources in a predictable and consistent manner. By representing infrastructure as code, Terraform allows you to automate the creation, modification, and destruction of resources, making it easier to manage and scale your infrastructure.

Why Use Terraform?

Some of the key benefits of using Terraform include:

  1. Version Control: By representing your infrastructure as code, you can track changes, collaborate with others, and rollback when necessary.
  2. Scalability: Terraform enables you to efficiently manage and scale your infrastructure with minimal manual intervention.
  3. Platform Agnostic: Terraform supports a wide range of cloud providers and platforms, allowing you to use a single tool for multiple environments.
  4. Reusability: Terraform modules make it easy to create reusable, shareable, and composable infrastructure components.

Getting Started with Terraform

To start using Terraform, follow these steps:

  1. Install Terraform: Download and install Terraform from the official website (

  2. Configure your provider: Choose your desired cloud provider (e.g., AWS, Azure, GCP) and create a configuration file ( to set up the provider.

For example, here’s a simple configuration for AWS:

provider "aws" {
  region = "eu-west-1"
  1. Define resources: Resources are the main building blocks of your infrastructure. Add resources to your file.

For example, here’s how to create an AWS S3 bucket:

resource "aws_s3_bucket" "marks_bucket" {
  bucket = "marks-example-bucket"
  acl    = "private"
  1. Initialise Terraform: In your terminal, run the following command to initialise Terraform:
terraform init

This command downloads the necessary provider plugins and sets up the backend for storing your Terraform state.

  1. Plan your infrastructure: In your terminal, run the following command to see the changes that will be made to your infrastructure:
terraform plan
  1. Apply your changes: Run the following command to create or update your resources:
terraform apply
  1. Destroy your resources: When you’re done with your resources and want to avoid incurring unnecessary costs, run the following command:
terraform destroy


Congratulations! You’ve taken the first steps in learning how to use Terraform for Infrastructure as Code. As you explore further, you’ll discover additional features and best practices that will help you manage your infrastructure even more effectively. Keep learning and experimenting, and don’t be afraid to dive into the Terraform documentation and community for support. Happy Terraforming