Skip to content

Commit 51329a3

Browse files
committed
Make reporting errors from reattach.IsProviderReattached more consistent
1 parent 0169b7e commit 51329a3

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

internal/command/meta_backend.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,8 +1704,7 @@ func (m *Meta) stateStore_C_s(c *configs.StateStore, stateStoreHash int, backend
17041704
} else {
17051705
isReattached, err := reattach.IsProviderReattached(c.ProviderAddr, os.Getenv("TF_REATTACH_PROVIDERS"))
17061706
if err != nil {
1707-
diags = diags.Append(fmt.Errorf("Error determining if the state storage provider is reattached or not. This is a bug in Terraform and should be reported: %w",
1708-
err))
1707+
diags = diags.Append(fmt.Errorf("Unable to determine if state storage provider is reattached while initializing state store for the first time. This is a bug in Terraform and should be reported: %w", err))
17091708
return nil, diags
17101709
}
17111710
if isReattached {
@@ -1820,7 +1819,7 @@ func getStateStorageProviderVersion(c *configs.StateStore, locks *depsfile.Locks
18201819
isBuiltin := c.ProviderAddr.Hostname == addrs.BuiltInProviderHost
18211820
isReattached, err := reattach.IsProviderReattached(c.ProviderAddr, os.Getenv("TF_REATTACH_PROVIDERS"))
18221821
if err != nil {
1823-
diags = diags.Append(err)
1822+
diags = diags.Append(fmt.Errorf("Unable to determine if state storage provider is reattached while determining the version in use. This is a bug in Terraform and should be reported: %w", err))
18241823
return nil, diags
18251824
}
18261825
if isBuiltin || isReattached {

internal/command/workdir/statestore_config_state.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func (s *StateStoreConfigState) Validate() error {
6363
// Version information is required if the provider isn't builtin or unmanaged by Terraform
6464
isReattached, err := reattach.IsProviderReattached(*s.Provider.Source, os.Getenv("TF_REATTACH_PROVIDERS"))
6565
if err != nil {
66-
return fmt.Errorf("error determining if state storage provider is reattached: %w", err)
66+
return fmt.Errorf("Unable to determine if state storage provider is reattached while validating backend state file contents. This is a bug in Terraform and should be reported: %w", err)
6767
}
6868
if (s.Provider.Source.Hostname != tfaddr.BuiltInProviderHost) &&
6969
!isReattached {

0 commit comments

Comments
 (0)