Cloud, backend/remote: forward -minimal-refresh to HCPT and TFE - #39310
Merged
Merged
Conversation
v1.112.0 adds the minimal-refresh run attribute (MinimalRefresh on RunCreateOptions and Run).
Send the minimal-refresh run attribute only when -minimal-refresh is requested, so ordinary runs never include it. Replace the temporary "not supported" diagnostics with a check that the server's TFP-API-Version is at least MinimalRefreshMinAPIVersion, returning an error before any run is created otherwise. MinimalRefreshMinAPIVersion is provisional and must be updated to the API version that ships minimal refresh support.
Send the minimal-refresh run attribute only when -minimal-refresh is requested, and replace the temporary "not supported" diagnostics with the same API version check used by the cloud integration.
-minimal-refresh to HCPT and TFE
austinvalle
reviewed
Sep 30, 2026
austinvalle
left a comment
Member
There was a problem hiding this comment.
I know this is still in draft but I took a look early 👀, hopefully not too much noise if any of the stuff I commented on was in-progress
The existing entry that introduced -minimal-refresh already covers this change.
shwetamurali
marked this pull request as ready for review
October 1, 2026 14:04
austinvalle
reviewed
Oct 1, 2026
austinvalle
left a comment
Member
There was a problem hiding this comment.
This PR looks good! I think we can wait for the version to be fully decided before we merge this PR so I'll hold off on approval until that's updated 👍🏻
austinvalle
approved these changes
Oct 2, 2026
Merged
2 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Forwards the
-minimal-refreshplanning option to HCP Terraform / Terraform Enterprise through thecloudblock and the legacyremotebackend.Core already supports
-minimal-refreshlocally, but remote operations reject it with a temporary "Minimal refresh mode is currently not supported" error, because HCP Terraform and go-tfe didn't support it yet. HCP Terraform's Runs API now accepts aminimal-refreshrun attribute, and go-tfe v1.112.0 exposes it (hashicorp/go-tfe#1502).Changes Made
github.com/hashicorp/go-tfefrom v1.110.0 to v1.112.0cloudandremote): setsMinimalRefresh = trueon the run create options only when-minimal-refreshis requested. It stays nil otherwise, so ordinary runs never send the attribute and older servers see no change.TFP-API-Version, following the existing-target/-replace/-refresh-onlypattern in theremotebackend. If the version is belowMinimalRefreshMinAPIVersion(2.7) or can't be parsed, Terraform returns an error before any run is created:Older servers silently drop unknown run attributes, so without this check a run on an older server would quietly do a full refresh.
Tests
Manual testing
Terraform built from this branch against a local HCP Terraform stack
API 2.6:
plan -minimal-refreshandapply -minimal-refreshare rejected by Core before any run is created:-minimal-refreshwith-refresh=falseor-refresh-onlyis still rejected by argument parsing and a plainplanworks as before.API 2.7:
minimal-refreshplan-onlyplan -minimal-refreshtruetrueplanned_and_finishedapply -minimal-refreshtruefalseappliedplanfalsetrueplanned_and_finishedAll runs had
refresh: true,refresh-only: false. Atlas validation errors still reach the user.Specs
New tests in
internal/cloud/backend_minimal_refresh_test.goandinternal/backend/remote/backend_minimal_refresh_test.go, using the mock client:-minimal-refresh→MinimalRefresh == true; without it → nil (not false)The mock runs client now records
MinimalRefreshfrom the create options.Manual testing against a local HCP Terraform stack: see below / to be added.
Follow-ups (not in this PR)
Target Release
1.17.x
Rollback Plan
Changes to Security Controls
Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.
CHANGELOG entry