Terraform Output Values¶
Step-01: Introduction¶
- Understand about Output Values and implement them
- Query outputs using
terraform output - Understand about redacting secure attributes in output values
- Generate machine-readable output
Step-02: Basics of Output Values¶
- Reference Sub folder: terraform-manifests
- Understand Output Values
- You can export both Argument & Attribute References
- Terraform AWS EC2 Instance
# Initialize Terraform terraform init # Validate Terraform configuration files terraform validate # Format Terraform configuration files terraform fmt # Review the terraform plan terraform plan # Create Resources terraform apply -auto-approve # Access Application http://<Public-IP> http://<Public-DNS>
Step-03: Query Terraform Outputs¶
- Terraform will load the project state in state file, so that using
terraform outputcommand we can query the state file.
Step-04: Output Values - Suppressing Sensitive Values in Output¶
- We can redact the sensitive outputs using
sensitve = truein output block - This will only redact the cli output for terraform plan and apply
- When you query using
terraform output, you will be able to fetch exact values fromterraform.tfstatefiles - Add
sensitve = truefor outputec2_publicdns - Test the flow
Step-05: Generate machine-readable output¶
Step-06: Destroy Resources¶
# Destroy Resources
terraform destroy -auto-approve
# Clean-Up
rm -rf .terraform*
rm -rf terraform.tfstate*
References¶
🎉 New Course
Ultimate DevOps Real-World Project Implementation on AWS
$15.99
$84.99
81% OFF
MARCH2026
Enroll Now on Udemy →
🎉 Offer