Skip to content

Commit e08a02e

Browse files
committed
Fixes Issue #29959, Apply w/o init error message
When going from a local backend to Terraform Cloud, if you skip the `terraform init` and run `terraform apply` this will give the user more clear instructions.
1 parent d72a413 commit e08a02e

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

internal/command/meta_backend.go

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ func (m *Meta) determineInitReason(previousBackendType string, currentBackendTyp
737737
diags = diags.Append(tfdiags.Sourceless(
738738
tfdiags.Error,
739739
"Terraform Cloud initialization required: please run \"terraform init\"",
740-
fmt.Sprintf(strings.TrimSpace(errBackendInitCloudMigration), initReason),
740+
fmt.Sprintf(strings.TrimSpace(errBackendInitCloud), initReason),
741741
))
742742
default:
743743
diags = diags.Append(tfdiags.Sourceless(
@@ -1510,17 +1510,6 @@ hasn't changed and try again. At this point, no changes to your existing
15101510
configuration or state have been made.
15111511
`
15121512

1513-
const errBackendInitCloudMigration = `
1514-
Reason: %s.
1515-
1516-
Migrating to Terraform Cloud requires reinitialization, to discover which Terraform Cloud workspaces belong to this configuration and to optionally migrate existing state to the corresponding Terraform Cloud workspaces.
1517-
1518-
To re-initialize, run:
1519-
terraform init
1520-
1521-
Terraform has not yet made changes to your existing configuration or state.
1522-
`
1523-
15241513
const errBackendInitCloud = `
15251514
Reason: %s.
15261515

0 commit comments

Comments
 (0)