Skip to content

terraform plan -light #35290

@ricardbejarano

Description

@ricardbejarano

Terraform Version

Terraform v1.8.4
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 terraform 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 Terraform 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 Terraform to autogenerate the -target list from code changes.

More details: https://www.bejarano.io/terraform-plan-light/

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions