Skip to content

Commit

Permalink
add in checks for legacy
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Nov 8, 2024
1 parent fc8c88a commit 66f3f0b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tags/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
output "tags" {
description = "Map of processed tag key/value pairs"
value = merge(
# local.base_tags,
{ for k,v in local.legacy_finops_converted: format("%v_%v", local._finops_tags.prefix, k) => v },
{ for k, v in local.finops_tags : format("%v_%v", local._finops_tags.prefix, k) => v },
)
}
Expand Down
12 changes: 12 additions & 0 deletions tags/tags.legacy.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,15 @@ locals {
_legacy_finops1 = [for k, v in var.legacy_tags : { legacy_key = k, value = v, key = lookup(local.legacy_finops_tags_map, k, null) }]
legacy_finops_converted = merge([for t in local._legacy_finops1 : { (t.key) = lower(t.value) } if t.key != null]...)
}

resource "terraform_data" "legacy_finops_number" {
count = lookup(local.legacy_finops_converted,"project_number",null) != null ? 1 : 0
input = lookup(local.legacy_finops_converted,"project_number",null)

lifecycle {
precondition {
condition = length(regexall("^fs\d{10}$",lookup(local.legacy_finops_converted,"project_number",null))) == 0
error_message = "Invalid legacy finops project_number format."
}
}
}

0 comments on commit 66f3f0b

Please sign in to comment.