Skip to content

Terraform Naming & Tagging Standards

Status: Adopted Last Updated: March 2026 Owner: IT / Security
Applies To: All Azure and AWS infrastructure managed via Terraform


1. Why This Matters

Consistent naming and tagging enables:

  • Cost allocation and chargeback visibility
  • Compliance audit evidence (resource ownership, data classification)
  • Operational clarity — knowing what something is without opening Terraform
  • Automated policy enforcement via Azure Policy and AWS Config

2. Naming Conventions

2.1 General Pattern

{resource-type}-{environment}-{workload/purpose}-{region-shortcode}-{optional-index}

All lowercase. Hyphens as separators. No underscores (Azure resource names vary — use hyphens where allowed).

2.2 Environment Codes

CodeMeaning
prodProduction (Azure primary tenant — ciriusgroup.com)
ddeDDE / Customer-facing (Azure DDE tenant — ciriusdde.com)
devDevelopment / Test
mgmtManagement
drDisaster Recovery (AWS)
sharedShared services (identity, firewall, etc.)

2.3 Region Shortcodes

Azure RegionCodeAWS RegionCode
US West 2usw2us-west-2usw2
US Centraluscus-east-1use1

2.4 Resource Type Prefixes

ResourcePrefixExample
Virtual Networkvnetvnet-prod-hub-usw2
Subnetsnetsnet-prod-firewall-usw2
Network Security Groupnsgnsg-prod-app-usw2
Virtual Machinevmvm-prod-app-usw2-01
Storage Accountststprodtfstateusw2 (no hyphens — Azure limit)
Key Vaultkvkv-prod-secrets-usw2
Resource Grouprgrg-prod-network-usw2
Public IPpippip-prod-firewall-usw2
Route Tablertrt-prod-spoke-usw2
Network Interfacenicnic-prod-app-usw2-01
Log Analytics Workspacelawlaw-prod-security-usw2
Recovery Services Vaultrsvrsv-prod-backup-usw2
AWS
VPCvpcvpc-dr-main-usw2
Subnetsnetsnet-dr-app-usw2
EC2 Instanceec2ec2-dr-app-usw2-01
S3 Buckets3s3-dr-tfstate-usw2
IAM Rolerolerole-dr-github-actions

Storage Account exception: Azure storage account names cannot contain hyphens and are limited to 24 characters. Use concatenated lowercase: st{env}{purpose}{region}.


3. Required Tags

Every resource must have all required tags. Optional tags should be applied where relevant.

3.1 Required Tags

Tag KeyDescriptionAllowed Values / Format
environmentDeployment environmentproduction, development, management, dr, shared
ownerTeam or individual responsiblee.g. it-security, platform
managed-byHow the resource is managedterraform (all IaC resources)
data-classificationSensitivity of data handledphi, confidential, internal, public
cost-centerCost allocatione.g. it, operations — align with finance
compliance-scopeCompliance frameworks in scopehipaa, soc2, hitrust, hipaa-soc2-hitrust

3.2 Optional Tags (Apply Where Relevant)

Tag KeyDescriptionExample
workloadSpecific application or servicepalo-alto, domain-services, scrapy
dr-pairPaired DR resource identifierazure-prod-01
backup-policyBackup schedule applieddaily-30day, weekly-90day
patch-groupPatch management groupgroup-a, group-b
created-dateResource creation date (ISO 8601)2026-02-01

3.3 Terraform Default Tags Pattern

Apply required tags via a locals block and merge at the resource level:

hcl
locals {
  required_tags = {
    environment       = var.environment
    owner             = "it-security"
    managed-by        = "terraform"
    data-classification = var.data_classification
    cost-center       = "it"
    compliance-scope  = "hipaa-soc2-hitrust"
  }
}

# Merge at resource level — allows resource-specific tag overrides
resource "azurerm_resource_group" "example" {
  name     = "rg-prod-network-usw2"
  location = "westus2"

  tags = merge(local.required_tags, {
    workload = "networking"
  })
}

4. Terraform Variable Standards

4.1 Variable Naming

PatternUse
snake_caseAll variable names
Descriptive, not abbreviatedvirtual_network_name not vnet_nm
Boolean vars prefixed with enable_ or is_enable_diagnostics, is_public

4.2 Required Variables (All Modules)

hcl
variable "environment" {
  description = "Deployment environment (production, development, management, dr, shared)"
  type        = string
  validation {
    condition     = contains(["production", "development", "management", "dr", "shared"], var.environment)
    error_message = "Environment must be one of: production, development, management, dr, shared."
  }
}

variable "location" {
  description = "Azure region for resource deployment"
  type        = string
}

variable "data_classification" {
  description = "Data classification for resources (phi, confidential, internal, public)"
  type        = string
  default     = "internal"
  validation {
    condition     = contains(["phi", "confidential", "internal", "public"], var.data_classification)
    error_message = "Data classification must be one of: phi, confidential, internal, public."
  }
}

5. What the Audit Will Check

When we run the Terraform audit against these standards, we're looking for:

  • Resources missing required tags
  • Resources with tags using non-standard keys (e.g. Env instead of environment)
  • Resource names that don't match the naming pattern
  • Resources using hardcoded values that should be variables
  • Inconsistent environment/region codes across repos

Document History

DateAuthorChange
Apr 2026KobeAdded dde environment code for Azure DDE tenant (ciriusdde.com)
Mar 2026RoryUpdated status to Adopted after code audit of 301+ files
Feb 2026RoryInitial draft

Internal use only — Cirius Group