Skip to content

state/remote: Generate error when force push is requested but not supported #26042

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

chrisroberts
Copy link
Member

@chrisroberts chrisroberts commented Aug 28, 2020

Currently when attempting to force push a remote state to a backend which
has not implemented the ClientForcePusher, the force option is ignored and
state verification is applied like normal. This checks if the force option
was given, and if the client does not implement the ClientForcePusher interface
it returns an error that the backend does not support the option.

Current behavior:

$ terraform state push -force ./old.tfstate
Failed to write state: cannot import state with serial 34 over newer state with serial 36

Proposed behavior:

$ terraform state push -force ./old.tfstate
Failed to write state: The configured backend does not support forced state push.

…ported

Currently when attempting to force push a remote state to a backend which
has not implemented the ClientForcePusher, the force option is ignored and
state verification is applied like normal. This checks if the force option
was given, and if the client does not implement the ClientForcePusher interface
it returns an error that the backend does not support the option.
@codecov
Copy link

codecov bot commented Aug 28, 2020

Codecov Report

Merging #26042 into master will decrease coverage by 0.00%.
The diff coverage is 75.00%.

Impacted Files Coverage Δ
backend/remote-state/inmem/client.go 95.23% <0.00%> (-4.77%) ⬇️
states/remote/state.go 67.92% <100.00%> (+0.61%) ⬆️
terraform/node_resource_plan.go 91.80% <0.00%> (-1.64%) ⬇️
dag/marshal.go 54.44% <0.00%> (+1.11%) ⬆️

@pselle
Copy link
Contributor

pselle commented Jan 26, 2021

@chrisroberts I think what you have here was related to a bug that was fixed not long after your PR: #26190

I think this means the behavior you're describing has changed? Let us know if you want to continue to pursue this PR in some fashion.

@pselle pselle added the waiting-response An issue/pull request is waiting for a response from the community label Jan 26, 2021
Base automatically changed from master to main February 24, 2021 18:01
@hashicorp-cla
Copy link

hashicorp-cla commented Mar 12, 2022

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-response An issue/pull request is waiting for a response from the community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants