0

If I run ansible with profile_tasks I get a nice table at the end that shows me how long each task took.

How can I get a similar summary at the end of running terraform apply?

4
  • 1
    profile tasks is an ansible callback plugin. You'd need to extend terraform's cli with a similar plugin. to my knowledge none exists. Commented Mar 4, 2021 at 14:17
  • That's surprising! A lot of people work with both tools. You'd think by now someone would have wanted to do it! Anyway, a answer with how to extend the cli is probably out of scope. Maybe the answer has to be something with grep, sort, awk etc
    – opticyclic
    Commented Mar 4, 2021 at 14:25
  • Perhaps you could hook in something using the terraform CDK. Just a guess, but a language might provide you with the hooks you need to profile the resource actions (modify/destroy/create) Commented Mar 4, 2021 at 14:27
  • I wonder if it could be as simple as capturing and parsing the text output from an apply as it usually includes timing information in the output. For example grep'ed on "complete" on a captured output, should be able easy to parse further; "aws_security_group.bastions: Modifications complete after 1s [x]" Commented May 21, 2021 at 9:22

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.