715 words
4 minutes

Mastering Terraform Tags Like a True IT Queen

By Senior Developer Advocate · Docker Captain · CNCF Ambassador · IBM Champion
Pink flat-lay desk scene with a white Apple Magic Keyboard and Magic Mouse, white over-ear headphones with white cable, a closed white notebook, and a silver pen arranged on a pastel pink background

Originally published on my earlier blog.

Hey girls!

If you’re as obsessed with Infrastructure as Code (IaC) as I am, then you know that Terraform is THE tool to have in your IT arsenal. And if you’re working with cloud resources, you’ve probably heard about tags - those little key-value labels that help you organize, track expenses, and automate processes.

But let’s be honest: tags can sometimes feel like a necessary evil, especially when you’re managing multiple cloud environments.

Don’t worry, darling! Here’s the rundown on Terraform tags: why you need them, how to use them, and the best practices to follow. So grab your favorite coffee ☕ and let’s go!

Vladimir Mikhalev covered Terraform tags earlier: https://heyvaldemar.com/mastering-terraform-tags-for-infrastructure-excellence/

What Are Terraform Tags?#

Think of Terraform tags as little stickers you can attach to cloud resources to keep things organized and manageable. They are key-value pairs that allow you to classify resources by purpose, environment, or owner.

📌 Example:

tags = {
Environment = "Production"
Owner = "IT Girl Dev Team"
Project = "CoolNewApp"
}

💡 Why do you need this? Because proper tagging makes resource management easier, helps automate processes, and controls access. Plus, it keeps your infrastructure structured and aesthetic - and we don’t want a messy cloud, do we? ❌

Tags vs. tags_all: What’s the Difference?#

Terraform has two types of tags: tags and tags_all. They sound similar but serve different purposes:

  • tags - The tags you define on the resource in your Terraform code.
  • tags_all - A computed, read-only map in the AWS provider: your resource tags plus everything inherited from the provider’s default_tags block. You never set it yourself.

📌 Example (reading all tags of an AWS resource):

aws_vpc.example.tags_all

Not every provider has it: azurerm resources, for example, have tags only.

Why Should You Use Tags?#

Tags aren’t just for aesthetics (although we love that too 💅). Here are some key reasons why tagging is essential:

Organization#

Imagine having thousands of resources in your AWS account without tags. Total chaos, right? Tags help group resources by environment, project, or team.

📌 Example:

tags = {
env = "staging"
owner = "DevOps Team"
purpose = "testing"
}

Cost Management#

Cloud bills can be terrifying 😱, but Terraform tags help you track where your money is going.

📌 Example:

tags = {
cost_center = "Marketing Analytics"
}

Automation#

You know how much I love automation! Tags allow you to manage deployments, shut down unnecessary resources, and set up backups.

📌 Example:

tags = {
auto_shutdown = "true"
deploy = "true"
}

Access Control#

You can configure tags to restrict access to resources using AWS IAM policies.

📌 Example:

tags = {
Environment = "Development"
}

How to Add Tags to Terraform Resources#

It’s super simple! Just use the tags attribute inside the resource block.

📌 Example:

resource "aws_instance" "my_instance" {
tags = {
Environment = "Production"
}
}

Want to Add Multiple Tags? Easy!#

tags = {
Environment = "Development"
Owner = "Leia Organa"
Department = "Rebel Alliance"
}

What Are Terraform Default Tags?#

Default tags are set once in the AWS provider and applied to every resource it creates, so you don’t repeat them in every block.

📌 Example:

provider "aws" {
default_tags {
tags = {
Environment = "Development"
Owner = "IT Girl Dev Team"
}
}
}

How to Override Default Tags?#

Set the tag on the resource. When the same key is in both places, the resource’s own value wins, and tags_all shows the result.

📌 Example:

resource "aws_instance" "my_instance" {
tags = {
Name = "MyAwesomeServer"
Environment = "Production"
}
}

For providers without default_tags, keep a shared map in a variable and combine it with merge(var.common_tags, { Name = "MyAwesomeServer" }).

How to Ignore Tag Changes in Terraform?#

If external systems modify your tags (Azure Databricks, I see you 👀), tell Terraform to ignore them!

📌 Example:

resource "aws_instance" "my_instance" {
lifecycle {
ignore_changes = [tags]
}
}

Or ignore them at the provider level:

provider "aws" {
ignore_tags {
keys = ["CostCenter"]
}
}

Best Practices for Terraform Tags#

💡 Tips to keep your cloud tagging strategy clean and effective:

✔ Be consistent 👑 - Use the same key names across resources.
✔ Document your tags 📚 - Define what each tag means.
✔ Automate tagging ⚙️ - Use Terraform modules.
✔ Use Default Tags ✅ - Follow the DRY (Don’t Repeat Yourself) principle.

Conclusion#

Terraform tags may seem small, but they make a huge difference in cloud resource management. Start using them correctly, and your future IT-self will thank you!

Share your favorite Terraform hacks in the comments or on Twitter! 💬💻

Until next time, keep slaying the IT world! 🚀💖


Tatiana Mikhaleva

Docker CaptainCNCF AmbassadorIBM Champion

DevOps.Pink — Signal over noise in cloud-native & AI.

I'm a Docker Captain, CNCF Ambassador, IBM Champion, AWS Community Builder and a GitKraken, Cypress, Notion and Platform Engineering ambassador. Vendors don't review my posts; sponsored posts say so at the top. Referral links are labeled as such and earn me a commission.

Pink Signal

The cloud-native stack, without the gatekeeping

Docker, Kubernetes, and the agentic-AI era — hands-on and clearly explained, for engineers who actually ship. Pink Signal lands in your inbox when there's something worth knowing.

Related Posts

Same category
  1. 1
    Nobody Knows What CSTNM Means. IBM Bob Was Built for That File
    DevOps & Cloud · Most AI coding demos start in an empty folder. IBM Bob is aimed at the old COBOL, RPG and Java that runs every night. What it does there, and what it costs.
  2. 2
    I Told My AI Agent It Was Read-Only. The Audit Log Said 25 Writes
    DevOps & Cloud · An AI agent skill told to work read-only made 25 changes to a database and reported none of them. Why a rule in prose does not hold, and what held instead.
  3. 3
    The Terminal Was Never the Point: Managing Parallel AI Coding Agents
    DevOps & Cloud · Claude Code, Codex, and Copilot agents now edit your repo in parallel, and a terminal shows one at a time. Why visual Git tooling became the control tower.
  4. 4
    The Runbook You Didn't Write Is Already Running in Production
    DevOps & Cloud · Your vendor's opinion of how to run their product now ships as an executable AI agent skill. Six places it breaks in production, and six questions to ask first.

Random Posts

Random
  1. 1
    Your First Git Commit - A Beginner-Friendly Guide to Version Control
    DevOps & Cloud · A simple Git tutorial for beginners. Learn how to install Git, set it up, and make your first commit — no experience needed.
  2. 2
    Kubernetes Use Fell From 36% to 30% Among Backend Developers: The 2025 Cloud Native Report (CNCF x SlashData)
    DevOps & Cloud · Kubernetes use among backend developers fell from its 36% peak to 30%. The 2025 CNCF x SlashData report on backend growth, DevOps adoption and the AI gaps.
  3. 3
    AI for Beginners - How It Works, Learns, and Makes Decisions
    AI & MLOps · Simple guide to AI and machine learning for beginners. Learn how it works with clear explanations and easy-to-understand examples.
  4. 4
    Top Machine Learning YouTube Courses to Fuel Your Tech Passion
    AI & MLOps · A complete pathway for learners at every stage of the machine learning and deep learning journey — navigate and excel in the evolving world of tech.
Mastering Terraform Tags Like a True IT Queen
https://devops.pink/mastering-terraform-tags-like-a-true-it-queen/
Author
Tatiana Mikhaleva
Published
2025-03-04
Updated
2026-11-15
License
CC BY-NC-SA 4.0