Add rationale behind how Pulumi executes statements and builds state
File: docs/troubleshooting/faq.md
Here is a great explanation of how Pulumi works internally.
Unlike Terraform which builds the state first and then executes the required API calls to the providers, Pulumi is executing a statement as soon as it's met in the code (The language host continues to execute your program concurrently with the engine processing this request.) and does the cleanup in the end for the resources that were present in the previous state file but are not in the code anymore.
This approach may seem a bit counterintuitive at first - wouldn't that be easier and more robust to execute the whole code, build the new state in memory and only then execute the API calls based on the diff between the two states?
Probably this has to do with the advanced features not possible with the Terraform approach (like Gate Deployments where the second deployment is rolled out only after the first one is created and is checked to be healthy. That would be hard to achieve if the whole state is first calculated in memory), but maybe there's another reason for that?
I think it's an important difference from the way Terraform is doing things, and as Terraform is the biggest competitor out there, the rationale for this quite different modus operandi should be better explained in the docs.
Thanks for the suggestion!