Skip to content

Instantly share code, notes, and snippets.

@userbradley
Created March 16, 2022 18:56
Show Gist options
  • Save userbradley/7251bba29fe5189b7c0379faca630aaa to your computer and use it in GitHub Desktop.
Save userbradley/7251bba29fe5189b7c0379faca630aaa to your computer and use it in GitHub Desktop.
Tags using locals in Terraform
variable "labels" {
description = "Labels to set for all resources"
type = map(string)
default = {}
}
## Locals
locals {
required_labels = {
managed-by = "terraform",
owner = "bradley",
environment = "production"
}
labels = merge(var.labels, local.required_labels)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment