I’ve always found Terraform meta arguments a bit confusing at first glance—not count, for_each, but things like connection, provisioner, depends_on, source and lifecycle often seem straightforward but can behave unexpectedly in different contexts. That’s why I decided to write this blog post: to break them down clearly, explain what each one does, and show practical examples of how and when to use them effectively. Terraform Meta Arguments Table Meta-Argument Applicable To Description count resource, module, data Create multiple instances of a resource or module using a number. for_each resource, module, data Create multiple instances using a map or set of strings. More flexible than count. provider resource Specify which provider configuration to use if multiple are defined. depends_on resource, module, data Explicitly define dependencies between resources or modules. lifecycle resource Control resource creation and destruction behavior (e.g., prevent_destroy, ignore_changes). provisioner resource Run scripts or commands after a resource is created or destroyed. connection resource Define how to connect to a remote resource (used with provisioners). source module Specify the location of a module (registry, Git, local path, etc.). Usage 🧮 Terraform meta arguments: count resource "aws_instance" "web" { count = 3 ami = "ami-0c55b159cbfafe1f0" instance_type = "t2.micro" tags = { Name = "Web-${count.index}" } } ✅ Creates multiple instances using a simple integer. ⚠️ Attention Notes: count.index starts from 0. Not ideal for working with named collections (use for_each instead). Not supported in provider blocks. 🔁 Terraform meta arguments: for_each resource "aws_s3_bucket" "example" { for_each = toset(["logs", "media", "backups"]) bucket = "my-bucket-${each.key}" acl = "private" } ✅ More flexible…