Skip to content

Commit 0f1e7ff

Browse files
committed
Move tags build from outputs to main
1 parent 613df0b commit 0f1e7ff

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

main.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ locals {
1616
name_org = "${var.namespace-org ? join(var.delimiter, list(local.org, local.name_env)) : local.name_env}"
1717
name_20 = "${substr(replace(local.name_org,"_","-"),0,19 <= length(local.name_org) ? 19 : length(local.name_org))}"
1818
name_32 = "${substr(replace(local.name_org,"_","-"),0,31 <= length(local.name_org) ? 31 : length(local.name_org))}"
19+
tags = "${ merge(
20+
var.tags,
21+
map(
22+
"Name", "${local.name_org}",
23+
"Environment", "${local.env}",
24+
"Organization", "${local.org}",
25+
"Terraform", "true"
26+
))}"
1927
}
2028
/*
2129
resource "null_resource" "pre1" {

outputs.tf

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,5 @@ output "organization" {
6161
}
6262
*/
6363
output "tags" {
64-
value = "${ merge(
65-
var.tags,
66-
map(
67-
"Name", "${local.name_org}",
68-
"Environment", "${local.env}",
69-
"Organization", "${local.org}",
70-
"Terraform", "true"
71-
))}"
64+
value = "${local.tags}"
7265
}

test/main.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ module "labels" {
44
name = "CapMe"
55
environment = "Dev"
66
organization = "CorpXyZ"
7+
namespace-org = true
8+
attributes = ["role", "policy", "use", ""]
9+
tags = "${map("Key", "Value")}"
710
}
811
module "labels-tags" {
912
source = "../"

0 commit comments

Comments
 (0)