From cc6de251d8275ce00fb49205f4750dcbc0f830a2 Mon Sep 17 00:00:00 2001 From: Barrett Clark Date: Thu, 21 Oct 2021 15:54:41 -0500 Subject: [PATCH] Update init reconfigure error message If you move from the remote backend to the cloud block you will see this error message. --- internal/command/meta_backend.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/internal/command/meta_backend.go b/internal/command/meta_backend.go index d72a56c1d..552ee6300 100644 --- a/internal/command/meta_backend.go +++ b/internal/command/meta_backend.go @@ -663,7 +663,11 @@ func (m *Meta) backendFromConfig(opts *BackendOpts) (backend.Backend, tfdiags.Di } if !m.migrateState { - diags = diags.Append(migrateOrReconfigDiag) + if c.Type == "cloud" { + diags = diags.Append(migrateOrReconfigDiagCloud) + } else { + diags = diags.Append(migrateOrReconfigDiag) + } 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"+ "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".`) + +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".`)