<p>If I run ansible with <code>profile_tasks</code> I get a nice table at the end that shows me how long each task took.</p>
<p>How can I get a similar summary at the end of running <code>terraform apply</code>?</p>

CC BY-SA 4.0
2021-03-04T14:17:49.113Z
profile tasks is an ansible _callback_ plugin. You'd need to extend terraform's cli with a similar plugin. to my knowledge none exists.
Bruce Becker
CC BY-SA 4.0
2021-03-04T14:25:14.400Z
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
CC BY-SA 4.0
2021-03-04T14:27:27.633Z
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)
Bruce Becker
CC BY-SA 4.0
2021-05-21T09:22:46.637Z
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]"
Alastair Montgomery
<terraform>
How Do I Get A Summary of Task Times With Terraform?
opticyclic
# How Do I Get A Summary of Task Times With Terraform?

(Asked by: username_0 on 2021-03-04)

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`?

**Tags:** terraform

> **Comments:**
> **username_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.  
> **username_0**: 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  
> **username_1**: 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)  
> **username_2**: 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]"  

---

## 0 answers

