diff --git a/tags/outputs.tf b/tags/outputs.tf index 8149bf4..4c0d122 100644 --- a/tags/outputs.tf +++ b/tags/outputs.tf @@ -2,7 +2,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.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 }, ) } @@ -18,15 +18,15 @@ output "tag_hierarchy" { output "finops_roles" { description = "Map of finops_project_role values based on finops_project_name and finops.roles in YAML" - value = { for r in local.finops_roles : r => { (format("%v_%v_role", local._finops_tags.prefix, "project")) = format("%v_%v", local.finops_tags.project_name, r) } } + value = { for r in local.finops_roles : r => { (format("%v_%v_role", local._finops_tags.prefix, "project")) = format("%v_%v", local.finops_tags.project_name, r) } } } output "finops_tags" { - pescription = "Map of finops tags by short name for individual selection" - value = { for k,v in local.finops_tags : replace(k,"${local._finops_tags.prefix}_","") => { k = v }} + description = "Map of finops tags by short name for individual selection" + value = { for k, v in local.finops_tags : replace(k, "${local._finops_tags.prefix}_", "") => { k = v } } } output "version" { description = "Module version information. Cannot be passed back in tags because it will overwrite other module tags" - value = local.base_tags + value = local.base_tags } diff --git a/tags/tags.finops.tf b/tags/tags.finops.tf index 2e1de43..4920781 100644 --- a/tags/tags.finops.tf +++ b/tags/tags.finops.tf @@ -6,8 +6,8 @@ locals { project_name = try(replace(local._finops.name, "/[^a-z0-9_]/", ""), null) project_role = local._finops.role != null ? replace(replace(local._finops.role, "+", format("%v_", local._finops.name)), "/[^a-z0-9_]/", "") : null } - finops_tags = { for k, v in local._finops_tags : k => v if v != null && k != "prefix" } - finops_roles = [for r in lookup(local.tags_in.finops,"roles",[]): lower(r) ] + finops_tags = { for k, v in local._finops_tags : k => v if v != null && k != "prefix" } + finops_roles = [for r in lookup(local.tags_in.finops, "roles", []) : lower(r)] } resource "terraform_data" "finops" { @@ -28,7 +28,7 @@ resource "terraform_data" "finops_roles" { lifecycle { precondition { - condition = !anytrue([for r in tolist(local.finops_roles): length(regexall("[^0-9a-z_]",r)) > 0 ]) + condition = !anytrue([for r in tolist(local.finops_roles) : length(regexall("[^0-9a-z_]", r)) > 0]) error_message = "Error in one of the finops.roles fields. Each value may contain only 0-9, a-z, and underscore." } } diff --git a/tags/tags.legacy.tf b/tags/tags.legacy.tf index 96f283d..191be7b 100644 --- a/tags/tags.legacy.tf +++ b/tags/tags.legacy.tf @@ -4,21 +4,21 @@ locals { project_name = ["Project Name", "ProjectName"] 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_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) } + 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" { - count = lookup(local.legacy_finops_converted,"project_number",null) != null ? 1 : 0 - input = lookup(local.legacy_finops_converted,"project_number",null) + 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}$",local.legacy_finops_converted["project_number"])) > 0 + condition = length(regexall("^fs\\d{10}$", local.legacy_finops_converted["project_number"])) > 0 error_message = "Invalid legacy finops project_number format." } } diff --git a/tags/tags.map.tf b/tags/tags.map.tf index 30364f7..decdaf3 100644 --- a/tags/tags.map.tf +++ b/tags/tags.map.tf @@ -16,25 +16,25 @@ # * like comm, but but commercial db from ec2 instance to rds locals { -# _map_present = try(local.tags_in.map, false) - map_id = "MSDNVLIJDZ" + # _map_present = try(local.tags_in.map, false) + map_id = "MSDNVLIJDZ" map_tag = "map-migrated" map_values = { - "standard" = format("mig%v",local.map_id) - "ec2_standard" = format("mig_ec2_%v",local.map_id) - "commercial_db" = format("comm%v",local.map_id) - "ec2_commercial_db" = format("comm_ec2_%v",local.map_id) - "oracle" = format("oracle%v",local.map_id) + "standard" = format("mig%v", local.map_id) + "ec2_standard" = format("mig_ec2_%v", local.map_id) + "commercial_db" = format("comm%v", local.map_id) + "ec2_commercial_db" = format("comm_ec2_%v", local.map_id) + "oracle" = format("oracle%v", local.map_id) } } # access these as module.tags.map_tags["commercial_db"] output "map_tags" { - description = "Map of AWS Migration Acceleration Program (MAP) tags by usage. See https://s3.us-west-2.amazonaws.com/map-2.0-customer-documentation/html/AWSMapDocs/Examples.html for more information." - value = { for k,v in local.map_values: k => { (local.map_tag) = v } } + description = "Map of AWS Migration Acceleration Program (MAP) tags by usage. See https://s3.us-west-2.amazonaws.com/map-2.0-customer-documentation/html/AWSMapDocs/Examples.html for more information." + value = { for k, v in local.map_values : k => { (local.map_tag) = v } } } output "map" { description = "Standard AWS Migration Acceleration Program (MAP) tag" - value = { (local.map_tag) = local.map_values.standard } + value = { (local.map_tag) = local.map_values.standard } }