Skip to content

Commit

Permalink
add legacy_remaining options to remove the finops tags from the legac…
Browse files Browse the repository at this point in the history
…y tags and preserve the remaining values
  • Loading branch information
badra001 committed Feb 5, 2025
1 parent 9df3f69 commit 92542d1
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@

- 0.0.1 -- 2024-10-18
- initial creation with tags for finops

- 0.0.6 -- 2024-11-22
- add finops.roles

- 0.0.7 -- 2025-02-05
- add legacy_remaining options to remove the finops tags from the legacy tags and preserve the remaining values

2 changes: 1 addition & 1 deletion common/version.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
locals {
_module_version = "0.0.6"
_module_version = "0.0.7"
_module_name = "boc-nts"
}
File renamed without changes.
2 changes: 2 additions & 0 deletions tags/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
output "tags" {
description = "Map of processed tag key/value pairs"
value = merge(
local.legacy_tags_remaining,
{ 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 All @@ -11,6 +12,7 @@ output "tag_hierarchy" {
value = {
"base" = local.base_tags
"finops" = local.finops_tags
"legacy" = local.legacy_tags_remaining
}
}

Expand Down
2 changes: 2 additions & 0 deletions tags/tags.legacy.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ locals {
project_role = ["Project Role", "ProjectRole"]
}
legacy_finops_tags_map = { for k, v in transpose(local.legacy_finops_tags) : k => v[0] }
legacy_finops_tags_keys = flatten([ for k, v in local.legacy_finops_tags: v ])

_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]...)
legacy_tags_remaining = { for k,v in var.legacy_tags: k => v if !contains(local.legacy_finops_tags_keys,k) }
}

resource "terraform_data" "legacy_finops_number" {
Expand Down

0 comments on commit 92542d1

Please sign in to comment.