Skip to content

Commit

Permalink
db_subnet_group: fix failing output expressions (#22)
Browse files Browse the repository at this point in the history
Accessing aws_db_subnet_group.this when its count = 0 is an error, so we
need to instead access it via splat syntax and then apply a default value
for when the resulting list is empty.
  • Loading branch information
apparentlymart authored and antonbabenko committed Nov 16, 2017
1 parent 6e3527a commit 7d1ad36
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/db_subnet_group/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# DB subnet group
output "this_db_subnet_group_id" {
description = "The db subnet group name"
value = "${var.count == 0 ? "" : aws_db_subnet_group.this.id}"
value = "${element(concat(aws_db_subnet_group.this.*.id, list("")), 0)}"
}

output "this_db_subnet_group_arn" {
description = "The ARN of the db subnet group"
value = "${aws_db_subnet_group.this.arn}"
value = "${element(concat(aws_db_subnet_group.this.*.arn, list("")), 0)}"
}

0 comments on commit 7d1ad36

Please sign in to comment.