Skip to content

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

Description

@ricardbejarano

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

Pinned by apparentlymart

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfrozenneeds-community-inputpending-decisionThis issue has not been accepted for implementation nor rejected. It's still open to discussion.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions