Pre-apply, post-apply terraform hooks for logging

First of all, Hi,

I’d like to log in an api when someone applies terraform changes, best case a post request to the api before terraform applies and after its done, including successful or failed cases.

What I don’t want is to send requests in the planning phase, which the http provider from terraform does, nor do I want a bash/shell script wrapper around terraforms commands.

If you have ideas or already done something similar, please let me know.

1 Like

@fcbear welcome!

Have you looked at Terraform Cloud? I realize you’re not asking for a GUI, but for small teams it’s entirely free and may offer the kind of auditing you want, out of the box.

Additionally practitioners that interact with Terraform on the CLI can continue to do so as long as Terraform is configured for remote runs.

Just what I was going to recommend. Terraform Cloud sounds like it would work great for what you’re asking as you can see all previous runs that were performed along with successes and failures.

thanks for your replies, unfortunately Terraform Cloud is not an option due to company stuff.

Maybe I can provide a little bit more information. I already have an api for the logging which is used by different systems, and it shall be the main source of information to see possible impacts in configuration changes or releases.
To do so, I was wondering if those hooks or something similar exists and how I can use them to get towards my goal.
If you have other suggestions besides the Terraform Cloud, feel free to let me know.