Terraform

What are output variables? Why do we need them?

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

Output variable allow you to display/print certain piece of data as part of Terraform execution.

The most common use case for it is probably to print the IP address of an instance. Imagine you provision an instance and you would like to know what the IP address to connect to it. Instead of looking for it for the console/OS, you can use the output variable and print that piece of information to the screen