I have set an output on my vpc module:
output "instance_eip_id"{
value = aws_eip.instance_eip.*.id
}
how do I essentially carry that output over to the root module so after my tf apply I can run tf output and see the output of the eips created?
I have set an output on my vpc module:
output "instance_eip_id"{
value = aws_eip.instance_eip.*.id
}
how do I essentially carry that output over to the root module so after my tf apply I can run tf output and see the output of the eips created?
The only way to do that (99% sure) is to define an output on the root:
output "vpc_instance_eip_id" {
value = module.vpc.instance_eip_id
}
Do you do this in the main.tf under the module area?
^^ I put output in main.tf and this was the outcome:
Changes to Outputs:
+ eip = [
+ "eipalloc-0afae8d218390d143",
+ "eipalloc-0bccc2e3db79cb85c",
]
How do you display the actually IP addresses?
Hi @stevenjw0228001,
Since you’ve exported the id
attribute here you’re getting the opaque IDs assigned by the remote API here. But looking in the aws_eip
docs I see there are private_ip
and public_ip
attributes too, so you should be able to follow the same pattern if you swap out id
for one of those two attributes, depending on which of the two IP addresses you want to export.