Solved: Terraform, How to output multiple private ips


I use “terraform-aws-modules/ec2-instance/aws” to provision two ec2 instances. How to output these two private IPs?
The code below does not work.
Error: Unsupported attribute module.ec2_jekins_agent is object with 2 attributes This object does not have an attribute named “private_ip”.

Best Answer:

Since you’ve used for_each, you can use values:

If you have better answer, please add a comment about this, thank you!