output
What is output?
output: A value a module exposes to its caller (or prints after apply) — an IP address, a bucket name, a connection string. An output in Terraform exposes a value from a configuration or module, such as a server's IP address, a bucket name or a database endpoint. After terraform apply, outputs are printed, and terraform output shows them later.
Frequently asked questions about output
How is output used in practice?
Modules use outputs to pass values to the configuration that calls them. A network module outputs subnet IDs, which a server module then uses.
What should you keep in mind with output?
Outputs are also a handy way to feed values into other tools, for example terraform output -json in a deploy script. Mark outputs that contain secrets with sensitive = true, so they are hidden in the console output. They are still stored in plain text in the state file, which is one more reason to keep state in a secured backend rather than on a laptop or in Git.
What does an example of output look like?
output "bucket_arn" { value = aws_s3_bucket.logs.arn } At a glance
| Category | Terraform |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |