Merge pull request #27545 from hashicorp/alisdair/remote-backend-version-check-state-migration
cli: Fix state migration remote version check
This commit is contained in:
commit
a7d50d3264
|
@ -70,6 +70,19 @@ func (m *Meta) backendMigrateState(opts *backendMigrateOpts) error {
|
||||||
opts.twoEnv = backend.DefaultStateName
|
opts.twoEnv = backend.DefaultStateName
|
||||||
opts.force = m.forceInitCopy
|
opts.force = m.forceInitCopy
|
||||||
|
|
||||||
|
// Disregard remote Terraform version for the state source backend. If it's a
|
||||||
|
// Terraform Cloud remote backend, we don't care about the remote version,
|
||||||
|
// as we are migrating away and will not break a remote workspace.
|
||||||
|
m.ignoreRemoteBackendVersionConflict(opts.One)
|
||||||
|
|
||||||
|
// Check the remote Terraform version for the state destination backend. If
|
||||||
|
// it's a Terraform Cloud remote backend, we want to ensure that we don't
|
||||||
|
// break the workspace by uploading an incompatible state file.
|
||||||
|
diags := m.remoteBackendVersionCheck(opts.Two, opts.twoEnv)
|
||||||
|
if diags.HasErrors() {
|
||||||
|
return diags.Err()
|
||||||
|
}
|
||||||
|
|
||||||
// Determine migration behavior based on whether the source/destination
|
// Determine migration behavior based on whether the source/destination
|
||||||
// supports multi-state.
|
// supports multi-state.
|
||||||
switch {
|
switch {
|
||||||
|
|
Loading…
Reference in New Issue