Skip to content

Latest commit

 

History

History
19 lines (13 loc) · 549 Bytes

03_output.adoc

File metadata and controls

19 lines (13 loc) · 549 Bytes

Terraform output

You can use every part of a resource as an output. This is useful to get the value of a resource and use it in another resource.

Task: Create an output

  • Create a new file outputs.tf and add the following content:

output "private_ip" {
  value = aws_instance.example.private_ip
}
  • Run terraform apply and terraform output to see the value of the output

It is also possible to get only the value of the output by running terraform output private_ip

Next step: Data sources