Skip to content
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

Test case for changing backend hash during aborted state migration #26260

Closed
wants to merge 1 commit into from

Conversation

lsierant
Copy link
Contributor

@lsierant lsierant commented Sep 16, 2020

Failing test case for issue #26259

Also, I tried to come up with a solution, but there are multiple cases when dealing with state migrations and that defeated me unfortunately.

Simple fix by removing this early state update in 'backend_C_r_S_unchanged ' will not work as it brakes init_test.go:TestInit_backendReinitConfigToExtra.

func (m *Meta) backend_C_r_S_unchanged
[...]
	// it's possible for a backend to be unchanged, and the config itself to
	// have changed by moving a parameter from the config to `-backend-config`
	// In this case we only need to update the Hash.
	if c != nil && s.Backend.Hash != uint64(cHash) {
		s.Backend.Hash = uint64(cHash)
		if err := sMgr.WriteState(s); err != nil {
			diags = diags.Append(err)
			return nil, diags
		}
	}
[...]

What I have found so far is that m.backend_C_r_S_changed casually calls m.backend_C_r_S_unchanged which updates hash only:

func (m *Meta) backend_C_r_S_changed(c *configs.Backend, cHash int, sMgr *clistate.LocalState, output bool) (backend.Backend, tfdiags.Diagnostics) {
// [...]
        // Grab the existing backend
	oldB, oldBDiags := m.backend_C_r_S_unchanged(c, cHash, sMgr)
// [...]

Base automatically changed from master to main February 24, 2021 18:01
chrisarcand pushed a commit that referenced this pull request Nov 2, 2021
Th3will pushed a commit to Th3will/terraform that referenced this pull request Nov 6, 2021
@github-actions
Copy link

github-actions bot commented Dec 3, 2021

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant