Skip to content

Commit 761ad94

Browse files
author
Steven Nemetz
committed
Another ASG tags attempt
1 parent f7f1960 commit 761ad94

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

main.tf

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,17 @@ locals {
8080
*/
8181
}
8282

83-
/*
84-
Could use null_resource to create? Would need enable/disable so only done when needed
85-
Can only assign strings (NOT maps or lists)
86-
*/
87-
/*
83+
/* Try template_file, it supports count
84+
Can only assign a single value (NOT maps or lists)
85+
data "template_file" "asg_tags" {
86+
count = "${var.autoscaling_group ? length(keys(local.tags)) : 0}"
87+
template = "${map("key", element(keys(local.tags),count.index), "value", element(values(local.tags),count.index), "propagate_at_launch", true)}"
88+
}
89+
#"${data.template_file.data_id.*.rendered}"
90+
/**/
91+
92+
/* Could use null_resource to create? Would need enable/disable so only done when needed
93+
Can only assign strings (NOT maps or lists)
8894
resource "null_resource" "asg_tags" {
8995
count = "${var.autoscaling_group ? length(keys(local.tags)) : 0}"
9096
triggers = {
@@ -95,6 +101,7 @@ resource "null_resource" "asg_tags" {
95101
}
96102
}
97103
*/
104+
98105
/* locals doesn't currently support count
99106
locals {
100107
count = "${length(keys(local.tags))}"

0 commit comments

Comments
 (0)