Resources across accounts have inconsistent names and missing tags. How do you enforce standards?
BeginnerScenarioMulti-env and multi-account
Answer
Situation read → Tags drive cost allocation, ownership and automation. Enforcement has to happen at creation time, plus a cleanup of what exists.
What I'd do →
- Define a small required set:
team,env,service,cost-center. - Apply them by default in Terraform:
provider "aws" {
default_tags {
tags = { team = "payments", env = "prod", service = "checkout", managed-by = "terraform" }
}
}
- Enforce: AWS Organizations tag policies for allowed values, and SCP conditions requiring tags on key create actions.
- CI check: Checkov or a custom OPA policy fails PRs missing required tags.
- Backfill existing resources and report untagged spend monthly.
Why → default_tags makes compliance automatic for everything Terraform creates.
Interview tip → Mention default_tags; it's the lowest-effort, highest-impact step.
More on Multi-env and multi-account
Design the AWS account structure for a 50-engineer startup that's growing fast.IntermediateHow do you promote the same build from dev to staging to prod?BeginnerBugs keep passing staging and appearing in production. How do you make staging closer to prod?IntermediateHow do you structure Terraform for dev, staging and prod? Workspaces, directories or Terragrunt?IntermediateDevelopers want a preview environment for every pull request. How would you build it?AdvancedHelm values files or Kustomize overlays for per-environment config?Beginner