Skip to content

Commit

Permalink
refactor: use boc-nts tags module outputs for resource tagging
Browse files Browse the repository at this point in the history
- tags.tf: set legacy_tags = var.tags (replaces account/infra/app var merge)
- locals.tf: replace manual finops_tags + base_tags with module.tags.tags
  and per-resource role via module.tags.finops_roles[role]
- variables.tf: remove finops_project_name and finops_project_number variables
  (finops config now lives in tags.yml)
  • Loading branch information
Dave Arnold committed Jul 8, 2026
1 parent 964e551 commit 518da42
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 30 deletions.
19 changes: 6 additions & 13 deletions locals.tf
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
locals {
# ─── Tagging ────────────────────────────────────────────────────────────────
finops_tags = {
finops_project_name = var.finops_project_name
finops_project_number = var.finops_project_number
}

base_tags = merge({ "boc:created_by" = "terraform" }, var.tags)

tags_rds = merge(local.base_tags, local.finops_tags, { finops_project_role = "${var.name_prefix}_rds" })
tags_kms = merge(local.base_tags, local.finops_tags, { finops_project_role = "${var.name_prefix}_kms" })
tags_sqs = merge(local.base_tags, local.finops_tags, { finops_project_role = "${var.name_prefix}_sqs" })
tags_lambda = merge(local.base_tags, local.finops_tags, { finops_project_role = "${var.name_prefix}_lambda" })
tags_cloudwatch = merge(local.base_tags, local.finops_tags, { finops_project_role = "${var.name_prefix}_cloudwatch" })
tags_iam = merge(local.base_tags, local.finops_tags, { finops_project_role = "${var.name_prefix}_iam" })
tags_rds = merge(module.tags.tags, module.tags.finops_roles["rds"])
tags_kms = merge(module.tags.tags, module.tags.finops_roles["kms"])
tags_sqs = merge(module.tags.tags, module.tags.finops_roles["sqs"])
tags_lambda = merge(module.tags.tags, module.tags.finops_roles["lambda"])
tags_cloudwatch = merge(module.tags.tags, module.tags.finops_roles["cloudwatch"])
tags_iam = merge(module.tags.tags, module.tags.finops_roles["iam"])

# ─── Resource Names ─────────────────────────────────────────────────────────
lambda_dispatcher_name = "${var.name_prefix}-dispatcher"
Expand Down
6 changes: 1 addition & 5 deletions tags.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,5 @@ module "tags" {
source = "git@github.e.it.census.gov:terraform-modules/boc-nts//tags"
filename = format("%v/%v", path.root, "tags.yml")

legacy_tags = merge(
var.account_tags,
var.infrastructure_tags,
var.application_tags,
)
legacy_tags = var.tags
}
12 changes: 0 additions & 12 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,6 @@ variable "name_prefix" {
default = "csvd-patch40"
}

# ─── FinOps Tags (required) ───────────────────────────────────────────────────

variable "finops_project_name" {
description = "FinOps project name tag value (e.g. 'csvd_patch4'). Must NOT be a catchall value."
type = string
}

variable "finops_project_number" {
description = "FinOps project number tag value (e.g. 'fs0000000009'). Must NOT be a catchall value."
type = string
}

# ─── Additional Tags ──────────────────────────────────────────────────────────

variable "tags" {
Expand Down

0 comments on commit 518da42

Please sign in to comment.