Turn Your Vehicle Into a Smart Earning Asset

While youโ€™re not driving your car or bike, it can still be working for you. MOTOSHARE helps you earn passive income by connecting your vehicle with trusted renters in your city.

๐Ÿš— You set the rental price
๐Ÿ” Secure bookings with verified renters
๐Ÿ“ Track your vehicle with GPS integration
๐Ÿ’ฐ Start earning within 48 hours

Join as a Partner Today

Itโ€™s simple, safe, and rewarding. Your vehicle. Your rules. Your earnings.

Terraform Output Variable Tutorials with Example

Terraform will store hundreds or even thousands of attribute values for all the defined resources in our infrastructure in state file.

An outputed attributes can not only be used for the user reference but it can also act as an input to other resources being created via Terraform.

Output variables provide a convenient way to get useful information about your infrastructure. Terraform output values allow you to export structured data about your resources. You can use this data to configure other parts of your infrastructure with automation tools, or as a data source for another Terraform workspace. Outputs are also necessary to share data from a child module to your root module.

Resource instances managed by Terraform each export attributes whose values can be used elsewhere in configuration. Output values are a way to expose some of that information to the user of your module.

We can use output variables to organize data to be easily queried and shown back to the Terraform user.

While Terraform stores hundreds or thousands of attribute values for all our resources, we are more likely to be interested in a few values of importance, such as a load balancer IP, VPN address, etc.

Output values are like the return values of a Terraform module, and have several uses:

  • A child module can use outputs to expose a subset of its resource attributes to a parent module.
  • A root module can use outputs to print certain values in the CLI output after running terraform apply.
  • When using remote state, root module outputs can be accessed by other configurations via a terraform_remote_state data source.

Terraform example code for output value of string type

String Type – Terraform example code for output value of aws_instance public_dns


output "instance_public_dns" {
  value = aws_instance.example.public_dns
}Code language: JavaScript (javascript)

Map Type – Terraform example code for output value of aws_instance root_block_device


output "instance_root_block_device" {
  value = aws_instance.example.root_block_device[0].volume_id
}Code language: JavaScript (javascript)

List Type – Terraform example code for output value of aws_instance security group


output "instance_security_group" {
  value = aws_instance.example.security_groups[0]
}Code language: JavaScript (javascript)

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.