Outputs & resource references
Publish a useful output contract
Lesson 3 of 20 · 12 min · Module 1: Declare a configuration contract
An output gives downstream work a named value instead of an assumption.
Start this lesson →Free. No installation: you write and run the code in your browser, and it is checked automatically.
By the end, you’ll be able to…
- Give the next responsibility a stable name
- Reference the actual resource value
The idea
Terraform accepts .tf.json as an alternative configuration representation. Here, built-in terraform_data values make state and plan concepts inspectable without provisioning a cloud resource.
01Give the next responsibility a stable name
An output can expose a value a caller needs without requiring them to understand every internal configuration detail.
02Reference the actual resource value
The output expression connects to terraform_data.app.output.endpoint. Copying an unrelated literal could drift away from what the resource describes.
03Avoid treating a value as a reachability test
A URL string can be correctly configured while the service is unavailable. Deployment and HTTP verification remain separate responsibilities.
Your turn
What the checks look for
- Uses the resource reference
- Resolves the endpoint output
Take this with you
Keep configuration contracts separate from operational evidence.
Go a little further
Add a second named output for a nonsecret service label.