
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:
resourceprovidervariableoutput
πΉ 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 typemy_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 β
resourceLabels β
aws_instance,my_vmArgument β
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
π§ Email: gujjarapurv181@gmail.com
π GitHub: github.com/ApurvGujjar07
πΌ LinkedIn: linkedin.com/in/apurv-gujjar
About the author
- Gujjar Apurv is a passionate DevOps Engineer in the making, dedicated to automating infrastructure, streamlining software delivery, and building scalable cloud-native systems. With hands-on experience in tools like AWS, Docker, Kubernetes, Jenkins, Git, and Linux, he thrives at the intersection of development and operations. Driven by curiosity and continuous learning, Apurv shares insights, tutorials, and real-world solutions from his journeyβmaking complex tech simple and accessible. Whether it's writing YAML, scripting in Python, or deploying on the cloud, he believes in doing it the right way. "Infrastructure is code, but reliability is art."
Comments
Join the discussionNo comments yet. Be the first to comment.
Terraform
π 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






