forked from cloudposse/terraform-terraform-label
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
18 lines (17 loc) · 728 Bytes
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
locals {
enabled = "${var.enabled == "true" ? true : false }"
id = "${local.enabled ? lower(join(var.delimiter, compact(concat(list(var.namespace, var.stage, var.name), var.attributes)))) : ""}"
name = "${local.enabled ? lower(format("%v", var.name)) : ""}"
namespace = "${local.enabled ? lower(format("%v", var.namespace)) : ""}"
stage = "${local.enabled ? lower(format("%v", var.stage)) : ""}"
attributes = "${local.enabled ? lower(format("%v", join(var.delimiter, compact(var.attributes)))) : ""}"
tags = "${
merge(
map(
"Name", "${local.id}",
"Namespace", "${local.namespace}",
"Stage", "${local.stage}"
), var.tags
)
}"
}