Using output values
Note
The code for this section is under chap03/output
in the GitHub repo of this book.
We used output values briefly but have not yet discussed them in detail. Output values expose information from Terraform. So far, we have used them to output IP addresses or other pertinent information on the command line. However, output values do more, as we see in the following chapters.
By convention, all output values are placed in a file called outputs.tf
. An output block requires a label
argument and an argument named value
that outputs the value of an expression. The description
argument is optional and is used to describe a short description of the output.
Now is also an excellent opportunity to introduce the splat expression (https://www.terraform.io/language/expressions/splat). A splat expression is a short form of a for
expression and is best explained by the following example. The two highlighted code segments are equivalent. Splat expressions are useful...