Answers for "terraform element function"

3

element function in terraform

#Element retrieves single element from the list
element(list, index)

#Example to Understand
element(["a", "b", "c"], 1)
b

element(["a", "b" , "c"], 0)
a
Posted by: Guest on September-15-2020
0

terraform element function

resource "aws_instance" "ec2_instance" {

count = 2
user_data = element([data.template_file.user_data_file1.rendered, 
                     data.template_file.user_data_file2.rendered], 
                     count.index)

tags = {
    Name = element(var.ec2_instance_names, count.index)
  }

}
Posted by: Guest on May-24-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language