Let’s define an output to show us the public IP address of the elastic IP address that we create. Add this to any of your *.tf files:
output “ip” {
value = “${aws_eip.ip.public_ip}”
}
This defines an output variable named “ip”. The name of the variable must conform to Terraform variable naming conventions if it is to be used as an input to other modules. The value field specifies what the value will be, and almost always contains one or more interpolations, since the output data is typically dynamic. In this case, we’re outputting the public_ip attribute of the elastic IP address.
Multiple output blocks can be defined to specify multiple output variables.