Hi all,
I'm usingTerraform v0.11.3 and want to get output for multiple instances in
name1:ip address
name2:ip address
i want to join these outputs
`output "ip" {
value = "${aws_instance.example.*.public_ip}"
}
output "tag" {
value = "${aws_instance.example.*.tags.Name}"
}
`
i created below but getting
name1,
-,
ip address
output "ime" {
value = ["${aws_instance.example.*.tags.Name}","${aws_instance.example.*.public_ip}"]
}
Take a look at "formatlist".
Here's an untested example (based on something similar I've had to do):
output "ime" {
value = "${
formatlist(
"%s:%s",
aws_instance.example.*.tags.Name,
aws_instance.example.*.public_ip4
)
}"
}
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Most helpful comment
Take a look at "formatlist".
Here's an untested example (based on something similar I've had to do):