Is there any way to write an expression to console before or after a specific resource is apply or planned?

I am looking for a way to evaluate an expression and write it to a debug console.

It traditional programming languages such as Python, we can easily print something to console. But I am not sure how to do it in HCL.

The standard way would be to include it as an output.

You could also run a shell script with echo commands.

Hi Stuart-c,

Thank you for help.

To my understanding, the output variables won’t show until the end of the execution.

The shell script option is really interesting.

Is there any sample shows how to evaluate a terraform expression and show it using a shell script? That really helps.

Thank you,

It sounds like you’re looking for the local-provisioner hook.

1 Like