OpenTofu Version
OpenTofu v1.7.1
on darwin_amd64
Use Cases
Fixing plan (or rather, refresh) performance on large enough (in resource count) states.
Attempted Solutions
- Increasing parallelism only takes you so far until the providers rate-limit you.
- Disabling refresh works but comes with all sorts of consistency risks.
- Splitting one big state into multiple smaller states comes with all sorts of problems associated with it.
Proposal
Add a tofu plan -light flag such that only resources modified in code are targeted for planning.
This would reduce the scope of the pre-plan refresh down to the set of resources we know changed, which reduces overall plan times without the consistency risk of -refresh=false.
In order for OpenTofu to know what resources were modified in code, it would store a copy of the code in state every time it successfully applies. This would allow diff'ing "last-applied code" vs. "new code", the result of which is the scope of the next "light" plan.
Basically, -light tells OpenTofu to autogenerate the -target list from code changes.
More details: https://www.bejarano.io/terraform-plan-light/
References
No response
OpenTofu Version
Use Cases
Fixing plan (or rather, refresh) performance on large enough (in resource count) states.
Attempted Solutions
Proposal
Add a
tofu plan -lightflag such that only resources modified in code are targeted for planning.This would reduce the scope of the pre-plan refresh down to the set of resources we know changed, which reduces overall plan times without the consistency risk of
-refresh=false.In order for OpenTofu to know what resources were modified in code, it would store a copy of the code in state every time it successfully applies. This would allow diff'ing "last-applied code" vs. "new code", the result of which is the scope of the next "light" plan.
Basically,
-lighttells OpenTofu to autogenerate the-targetlist from code changes.More details: https://www.bejarano.io/terraform-plan-light/
References
No response
Hi all,
This issue has ended up representing both the general problem that refreshing can make planning slow and a few specific proposed solutions to that problem with their own advantages and disadvantages.
Since there are lots of different possible ways to improve on this problem, where each one has quite a different set of constraints and tradeoffs, we've created #4372 to act as an umbrella issue for the problem itself, separate from any specific solution to it.
If you're following this issue because you've found that refreshing already-tracked resource instance objects is significantly slowing down the planning phase for your configuration, please add a 👍 upvote to that other issue too.