Back to course

Output Values: Getting Data Back

Infrastructure as Code (Terraform & OpenTofu Mastery)

Exporting Information

When you create a server, AWS assigns it an IP address. How do you find it without looking at the console?

The Output Block

hcl output "server_public_ip" { value = aws_instance.my_server.public_ip description = "The public IP address of our server" }

After running apply, the IP will be printed directly in your terminal. This is essential for connecting your terminal to the new server.