Update init reconfigure error message

If you move from the remote backend to the cloud block you will see this
error message.
This commit is contained in:
Barrett Clark 2021-10-21 15:54:41 -05:00 committed by Chris Arcand
parent 85f0bc6198
commit cc6de251d8
1 changed files with 12 additions and 1 deletions

View File

@ -663,7 +663,11 @@ func (m *Meta) backendFromConfig(opts *BackendOpts) (backend.Backend, tfdiags.Di
} }
if !m.migrateState { if !m.migrateState {
if c.Type == "cloud" {
diags = diags.Append(migrateOrReconfigDiagCloud)
} else {
diags = diags.Append(migrateOrReconfigDiag) diags = diags.Append(migrateOrReconfigDiag)
}
return nil, diags return nil, diags
} }
@ -1384,3 +1388,10 @@ var migrateOrReconfigDiag = tfdiags.Sourceless(
"A change in the backend configuration has been detected, which may require migrating existing state.\n\n"+ "A change in the backend configuration has been detected, which may require migrating existing state.\n\n"+
"If you wish to attempt automatic migration of the state, use \"terraform init -migrate-state\".\n"+ "If you wish to attempt automatic migration of the state, use \"terraform init -migrate-state\".\n"+
`If you wish to store the current configuration with no changes to the state, use "terraform init -reconfigure".`) `If you wish to store the current configuration with no changes to the state, use "terraform init -reconfigure".`)
var migrateOrReconfigDiagCloud = tfdiags.Sourceless(
tfdiags.Error,
"Terraform Cloud configuration changed",
"A change in the Terraform Cloud configuration has been detected, which may require migrating existing state.\n\n"+
"If you wish to attempt automatic migration of the state, use \"terraform init -migrate-state\".\n"+
`If you wish to store the current configuration with no changes to the state, use "terraform init -reconfigure".`)