Displaying output in Terraform

After executing “terraform apply” normally it will show “the resource has been created” with some little information’s. If you like to see more attributes about resources or some specific values after resource creation you have to include output section in your tf source code file.

For this example we will consider the scenario for creating EIP and S3 bucket in aws. You can refer the below outattributes.tf files. Note: Provider section included in another tf file in the same directory.

#terrform apply

In the above images you can see after apply complete section there is “output section”. It contains all the attributes and values of that resources.

Now if you like to see only some specific attribute values , you can update the source code tf file like below and apply again.

You can check with some other attribute for the resource , Instead of public_ip we can use piblic_dns for EIP resource.

If you like to get multiple specific outputs ,its possible . You can update the code like below . Note: This is simple method, there are multiple options available.


Leave a Reply