Lesson 4 of 4 · Terraform Core Concepts
Outputs and state
Outputs expose useful values after Terraform applies a configuration. State is Terraform’s record of which real resources it manages. Treat state as sensitive operational data: use a secure remote backend for team or production work and do not casually edit it.
Example
output "vpc_id" {
value = aws_vpc.main.id
description = "ID of the training network"
}
terraform {
backend "s3" {}
}Step by step
- Output values that another module or person needs.
- Mark secret outputs as sensitive.
- Use a remote backend for shared work.
- Review state changes with the same care as infrastructure changes.
Common mistakes to avoid
- Treating an output as a secret store.
- Deleting state to fix an infrastructure problem without understanding the impact.