TransWikia.com

Include verbose output in terraform/terragrunt

DevOps Asked by JohnLBevan on November 26, 2020

Is there any way to include verbose / debugging output in Terraform / Terragrunt?

I’m new to the language, and often struggle with knowing exactly what’s going on. It would be helpful for me to be able to inspect certain values; e.g. to confirm that locals & variables have the values I expect, to get the ids of created components, etc.

I can include such info by creating outputs and assigning values there; but if I’m debugging a module I then have to include the output in the module’s output, and again in the calling code’s output for it to be visible; then have to delete those entries before delivering the solution.

I’d like a solution more like C#’s Debug.WriteLine(/*...*/) or PowerShell’s Write-Verbose #... i.e. somewhere I can say what value I’d like to inspect, but have that output only show in the terminal when run with verbose output enabled, so these statements can be toggled on when needed, rather than impacting the delivered solution.

Does anything like this exist in the language? So far I’ve found nothing documented or by Googling.

Note: The TF_LOG environment variable documented here is helpful for providing more info on what’s going on under the covers; but only allows you to see predefined output; not to push your own content to the output stream.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP