IssueRaiser

Option to skip refreshing resource instances whose configuration hasn't changed since the last apply

### OpenTofu Version ```shell 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_

Posted by ricardbejarano on Jun 4, 2024, 12:06 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.2,000 issues0 comments

reliability (E-commerce)

Option to skip refreshing resource instances whose configuration hasn't changed since the last apply

ricardbejaranoJun 4, 2024, 12:06 PM

### OpenTofu Version ```shell 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_

Comments (0)

No comments yet. Start the discussion.

Comment on this issue