Skip to content

Commit 60e4d13

Browse files
goruhaosterman
authored andcommitted
Support Empty Env List and Return Stable Values (#11)
1 parent c3b709a commit 60e4d13

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

main.tf

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,9 @@ resource "aws_ssm_activation" "ec2" {
129129
}
130130

131131
#
132+
132133
# Other stuff
134+
133135
#
134136

135137
data "aws_iam_policy_document" "default" {
@@ -342,14 +344,24 @@ resource "null_resource" "env_vars" {
342344
count = 50
343345

344346
triggers {
345-
key = "${count.index >= length(keys(var.env_vars)) ? format(var.env_default_key, count.index+1) : element(keys(var.env_vars), count.index)}"
346-
value = "${count.index >= length(values(var.env_vars)) ? var.env_default_value : element(values(var.env_vars), count.index)}"
347+
key = "${count.index < length(var.env_vars) ?
348+
element(concat(keys(var.env_vars),list("")), count.index) :
349+
format(var.env_default_key, count.index+1)
350+
}"
351+
352+
value = "${count.index < length(var.env_vars) ?
353+
lookup(var.env_vars, element(concat(keys(var.env_vars),list("")), count.index), var.env_default_value) :
354+
var.env_default_value
355+
}"
347356
}
348357
}
349358

350359
#
360+
351361
# Full list of options:
362+
352363
# http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options-general.html#command-options-general-elasticbeanstalkmanagedactionsplatformupdate
364+
353365
#
354366

355367
resource "aws_elastic_beanstalk_environment" "default" {

0 commit comments

Comments
 (0)