Outputting Resource Properties
Learn more about Terraform output and output resource properties.
We'll cover the following...
The first example is pretty basic and, in the real world, probably not very useful. Outputs are much more useful when used to output the values of resources that have been created as part of a Terraform run.
Terraform output project example
Let’s create another Terraform project and output the values of resources as a part of a Terraform run:
Press + to interact
provider "aws" {region = "us-east-2"}resource "aws_s3_bucket" "first_bucket" {bucket = "kevholditch-bucket-outputs"}output "bucket_name" {value = aws_s3_bucket.first_bucket.id}output "bucket_arn" {value = aws_s3_bucket.first_bucket.arn}output "bucket_information" {value = "bucket name: ${aws_s3_bucket.first_bucket.id}, bucket arn: ${aws_s3_bucket.first_bucket.arn}"}
Let’s walk through the above code.
-
The
provider
andresource
should be familiar to you. We are simply ...