Skip to content

Commit

Permalink
Correct the output from this module to make more sense and give more …
Browse files Browse the repository at this point in the history
…unique results for each invocation. Tagging a new major version as it can break existing stuff
  • Loading branch information
Walter Heck committed Aug 23, 2018
1 parent 5b1eacc commit 4a9c882
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
8 changes: 4 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
resource "null_resource" "default" {
triggers = {
id = "${lower(join(var.delimiter, compact(concat(list(var.client, var.stage, var.name)))))}"
name = "${substr(lower(format("%v", var.name)),0,length(var.name) > 3 ? 3 : -1 )}" # Enforce length of 3
stage = "${substr(lower(format("%v", var.stage)),0, length(var.stage) > 4 ? 4 : -1 )}" # Enforce length of 4
client = "${substr(lower(format("%v", var.client)),0, length(var.client) > 3 ? 3 : -1 )}" # Enforce length of 3
name = "${lower(format("%v", var.name))}" # Enforce length of 3
stage = "${substr(lower(format("%v", var.stage)),0, length(var.stage) > 4 ? 4 : -1 )}" # Enforce length of 4
client = "${substr(lower(format("%v", var.client)),0, length(var.client) > 3 ? 3 : -1 )}" # Enforce length of 3
stack_name = "${lower(format("%v", var.stack_name))}"
}

lifecycle {
create_before_destroy = true
}
}
}
13 changes: 10 additions & 3 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ output "id" {
description = "Disambiguated ID"
}

output "name" {
value = "${null_resource.default.triggers.name}"
description = "Normalized name"
}

output "stage" {
value = "${null_resource.default.triggers.stage}"
description = "Normalized name"
description = "Normalized stage"
}

output "client" {
Expand All @@ -24,7 +29,8 @@ output "tags" {
value = "${
merge(
map(
"Name", "${null_resource.default.triggers.id}",
"Id", "${null_resource.default.triggers.id}",
"Name", "${null_resource.default.triggers.name}",
"Stage", "${null_resource.default.triggers.stage}",
"Client", "${null_resource.default.triggers.client}",
"StackName", "${null_resource.default.triggers.stack_name}",
Expand All @@ -40,7 +46,8 @@ output "tags" {
output "asg_tags" {
value = ["${
list(
map("key", "Name", "value", null_resource.default.triggers.id, "propagate_at_launch", true),
map("key", "Id", "value", null_resource.default.triggers.id, "propagate_at_launch", true),
map("key", "Name", "value", null_resource.default.triggers.name, "propagate_at_launch", true),
map("key", "Stage", "value", null_resource.default.triggers.stage, "propagate_at_launch", true),
map("key", "Client", "value", null_resource.default.triggers.client, "propagate_at_launch", true),
map("key", "StackName", "value", null_resource.default.triggers.stack_name, "propagate_at_launch", true),
Expand Down

0 comments on commit 4a9c882

Please sign in to comment.