diff --git a/examples/tags/main.tf b/examples/tags/main.tf index ba443e5..6617c9f 100644 --- a/examples/tags/main.tf +++ b/examples/tags/main.tf @@ -1,8 +1,8 @@ module "tags" { - source = "../../" - names = ["CapMe"] - environment = "Dev" - organization = "CorpXyZ" - attributes = ["role", "policy", "use", ""] - tags = "${map("Key", "Value")}" + source = "../../" + names = ["CapMe"] + environment = "Dev" + organization = "CorpXyZ" + attributes = ["role", "policy", "use", ""] + tags = "${map("Key", "Value")}" } diff --git a/main.tf b/main.tf index 1678321..2f290b5 100644 --- a/main.tf +++ b/main.tf @@ -118,9 +118,11 @@ data "null_data_source" "ids-trunc-attr" { # TODO: need to change to list of maps for all label names data "null_data_source" "tags" { count = "${module.enabled.value ? length(var.names) : 0}" + inputs = { #TODO: only add Organization if not "" tag_keys = "Name,Environment,Organization,Terraform" + tag_vals = "${join(",",list( element(data.null_data_source.ids.*.outputs.id, count.index), local.env, @@ -129,6 +131,7 @@ data "null_data_source" "tags" { )}" } } + /* data "null_data_source" "tag_list" { count = "${module.enabled.value ? length(var.names) : 0}" @@ -157,3 +160,4 @@ resource "null_resource" "this" { } } */ + diff --git a/outputs.tf b/outputs.tf index ef53327..c555ed2 100644 --- a/outputs.tf +++ b/outputs.tf @@ -56,7 +56,8 @@ output "organization" { # TODO: need to change to list of maps for all label names output "tags" { description = "Tags map merged with standard tags" - value = "${merge( + + value = "${merge( zipmap( split(",", element(concat(data.null_data_source.tags.*.outputs.tag_keys, list("")),0)), split(",", element(concat(data.null_data_source.tags.*.outputs.tag_vals, list("")),0))),