Skip to main content

Command Palette

Search for a command to run...

πŸš€ Terraform Series – Day 3

Published
β€’2 min read
πŸš€ Terraform Series – Day 3

Terraform Blocks, Labels, and Arguments

In Day 2, we installed Terraform.
Now, before writing real infrastructure code, we must understand how Terraform actually reads and executes configurations.

πŸ‘‰ Every Terraform file is built using 3 core concepts:

  • Blocks

  • Labels

  • Arguments

πŸ”Ή 1. What is a Block?

πŸ‘‰ A block is the main building unit in Terraform used to define infrastructure or configuration.

πŸ“Œ Example:

resource "aws_instance" "my_vm" {
}

πŸ‘‰ Meaning:

  • Block tells Terraform what you want to create

πŸ“Œ Common blocks:

  • resource

  • provider

  • variable

  • output

πŸ”Ή 2. What are Labels?

πŸ‘‰ Labels are identifiers of a block that define resource type and name.

πŸ“Œ Example:

resource "aws_instance" "my_vm" {
}

πŸ‘‰ Meaning:

  • aws_instance β†’ resource type

  • my_vm β†’ resource name

πŸ‘‰ Used to uniquely identify resources

πŸ”Ή 3. What are Arguments?

πŸ‘‰ Arguments are key-value pairs inside a block used to configure the resource.

πŸ“Œ Example:

instance_type = "t2.micro"

πŸ‘‰ Meaning:

  • Defines how the resource should be created

  • Controls behavior and properties

πŸ”— Combined Example

resource "aws_instance" "my_vm" {
  instance_type = "t2.micro"
}

πŸ‘‰ Breakdown:

  • Block β†’ resource

  • Labels β†’ aws_instance, my_vm

  • Argument β†’ instance_type

πŸ‘¨β€πŸ’» About the Author

β€œA complete Terraform series covering everything from fundamentals to advanced real-world infrastructure automation in a DevOps environment.”

πŸ“¬ Let's Stay Connected

Terraform

Part 6 of 8

πŸš€ Terraform Series – Automate Your Infrastructure Starting a complete **Terraform series** where I’ll cover everything from **basic to advanced level** with real-world practicals. In this series, you will learn: β€’ What is Infrastructure as Code (IaC) & why it matters β€’ Terraform fundamentals (providers, resources, state) β€’ Writing and managing Terraform configurations β€’ Variables, outputs & modules β€’ Remote state & state management β€’ Provisioning infrastructure on AWS β€’ Automation & real-world use cases β€’ Advanced concepts like workspaces, modules, and best practices 🎯 Goal: Help you automate infrastructure and become job-ready in DevOps. Perfect for **beginners, students, and DevOps learners** who want hands-on experience. Stay tuned and let’s build infrastructure the smart way βš‘πŸ’» #Terraform #DevOps #Cloud #AWS #InfrastructureAsCode #Automation

Up next

πŸš€ Terraform Series – Day 2

Terraform Setup on AWS EC2 & Local (Ubuntu , window ) In Day 1, we understood the fundamentals of Terraform and Infrastructure as Code (IaC).Now, in Day 2, we will set up Terraform in real environment