tagging-policy

Category Standards
Latest Version 0.1.0current

Terraform module for tagging-policy on aws

Add to your Terraform configuration
module "tagging_policy" {
  source  = "registry.patterneddesigns.ca/standardnat/tagging-policy/aws"
  version = "0.1.0"

  # Required inputs
}

Overview

The tagging-policy module establishes and enforces consistent tagging standards across your AWS resources, enabling effective cost allocation, resource ownership tracking, and compliance management.

  • Define required tags that must be present on all resources
  • Set organization-wide default tag values
  • Generate validation rules for policy enforcement
  • Optionally enforce lowercase tag values for consistency

Category: Standards Provider: AWS Latest Version: 1.1.0

Quick Start

module "tags" {
  source  = "registry.patterneddesigns.ca/standardnat/tagging-policy/aws"
  version = "1.1.0"

  required_tags = ["Environment", "Owner", "CostCenter", "Project"]

  default_tags = {
    ManagedBy  = "terraform"
    Repository = "infrastructure"
  }

  enforce_lowercase = true
}

# Apply to all resources
provider "aws" {
  default_tags {
    tags = module.tags.merged_tags
  }
}

Key Features

Required Tags

Define mandatory tags that must be present on all resources:

module "tags" {
  source  = "registry.patterneddesigns.ca/standardnat/tagging-policy/aws"
  version = "1.1.0"

  required_tags = [
    "Environment",
    "Owner",
    "CostCenter",
    "Project",
    "Application"
  ]
}

Default Tag Values

Set organization-wide defaults that apply automatically:

module "tags" {
  source  = "registry.patterneddesigns.ca/standardnat/tagging-policy/aws"
  version = "1.1.0"

  required_tags = ["Environment", "Owner"]

  default_tags = {
    ManagedBy    = "terraform"
    Organization = "acme-corp"
    Repository   = "infrastructure"
    CreatedBy    = "platform-team"
  }
}

Case Normalization

Enforce consistent lowercase tag values:

module "tags" {
  source  = "registry.patterneddesigns.ca/standardnat/tagging-policy/aws"
  version = "1.1.0"

  required_tags     = ["Environment", "Owner"]
  enforce_lowercase = true

  default_tags = {
    Environment = "PRODUCTION"  # Normalized to "production"
  }
}

Documentation

Registry

View specification on Registry

Inputs

list(string)

List of tag keys that must be present on all resources

map(string)

Default tag values applied to all resources

Enforce lowercase tag values for consistency

map(list(string))

Allowed values for specific tag keys. Define constraints for tags that have a limited set of valid options (e.g., Environment = ["dev", "staging", "prod"]).

map(string)

Extra tags to include beyond defaults and required tags

Outputs

merged_tags

Combined tags with defaults, required tags, and additional tags

validation_rules

Tag validation rules for policy enforcement (JSON-encoded)

required_tag_keys

List of required tag key names