mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-25 16:31:10 -06:00
terraform init: add link to documentation when a checksum is missing from the lock file (#31408)
* terraform init: add suggested fix for when a checksum is missing from the lock file * improve error message * add link to the documentation * cleanup leftovers from previous attempt * fix tests * s/,/; * fix imports
This commit is contained in:
parent
83e84e5477
commit
9f0d1d0630
@ -5,6 +5,7 @@ import (
|
||||
"net/url"
|
||||
|
||||
svchost "github.com/hashicorp/terraform-svchost"
|
||||
|
||||
"github.com/hashicorp/terraform/internal/addrs"
|
||||
)
|
||||
|
||||
@ -210,7 +211,7 @@ func (err ErrQueryFailed) Unwrap() error {
|
||||
return err.Wrapped
|
||||
}
|
||||
|
||||
// ErrRequestCancelled is an error type used to indicate that an operation
|
||||
// ErrRequestCanceled is an error type used to indicate that an operation
|
||||
// failed due to being cancelled via the given context.Context object.
|
||||
//
|
||||
// This error type doesn't include information about what was cancelled,
|
||||
|
@ -16,6 +16,7 @@ import (
|
||||
"github.com/google/go-cmp/cmp"
|
||||
svchost "github.com/hashicorp/terraform-svchost"
|
||||
"github.com/hashicorp/terraform-svchost/disco"
|
||||
|
||||
"github.com/hashicorp/terraform/internal/addrs"
|
||||
"github.com/hashicorp/terraform/internal/depsfile"
|
||||
"github.com/hashicorp/terraform/internal/getproviders"
|
||||
@ -1401,7 +1402,7 @@ func TestEnsureProviderVersions(t *testing.T) {
|
||||
beepProvider: getproviders.MustParseVersionConstraints(">= 1.0.0"),
|
||||
},
|
||||
WantErr: `some providers could not be installed:
|
||||
- example.com/foo/beep: the local package for example.com/foo/beep 1.0.0 doesn't match any of the checksums previously recorded in the dependency lock file (this might be because the available checksums are for packages targeting different platforms)`,
|
||||
- example.com/foo/beep: the local package for example.com/foo/beep 1.0.0 doesn't match any of the checksums previously recorded in the dependency lock file (this might be because the available checksums are for packages targeting different platforms); for more information: https://www.terraform.io/language/provider-checksum-verification`,
|
||||
WantEvents: func(inst *Installer, dir *Dir) map[addrs.Provider][]*testInstallerEventLogItem {
|
||||
return map[addrs.Provider][]*testInstallerEventLogItem{
|
||||
noProvider: {
|
||||
@ -1447,7 +1448,7 @@ func TestEnsureProviderVersions(t *testing.T) {
|
||||
Error string
|
||||
}{
|
||||
"1.0.0",
|
||||
`the local package for example.com/foo/beep 1.0.0 doesn't match any of the checksums previously recorded in the dependency lock file (this might be because the available checksums are for packages targeting different platforms)`,
|
||||
`the local package for example.com/foo/beep 1.0.0 doesn't match any of the checksums previously recorded in the dependency lock file (this might be because the available checksums are for packages targeting different platforms); for more information: https://www.terraform.io/language/provider-checksum-verification`,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -117,7 +117,7 @@ func installFromLocalArchive(ctx context.Context, meta getproviders.PackageMeta,
|
||||
)
|
||||
} else if !matches {
|
||||
return authResult, fmt.Errorf(
|
||||
"the current package for %s %s doesn't match any of the checksums previously recorded in the dependency lock file",
|
||||
"the current package for %s %s doesn't match any of the checksums previously recorded in the dependency lock file; for more information: https://www.terraform.io/language/provider-checksum-verification",
|
||||
meta.Provider, meta.Version,
|
||||
)
|
||||
}
|
||||
@ -199,7 +199,7 @@ func installFromLocalDir(ctx context.Context, meta getproviders.PackageMeta, tar
|
||||
)
|
||||
} else if !matches {
|
||||
return authResult, fmt.Errorf(
|
||||
"the local package for %s %s doesn't match any of the checksums previously recorded in the dependency lock file (this might be because the available checksums are for packages targeting different platforms)",
|
||||
"the local package for %s %s doesn't match any of the checksums previously recorded in the dependency lock file (this might be because the available checksums are for packages targeting different platforms); for more information: https://www.terraform.io/language/provider-checksum-verification",
|
||||
meta.Provider, meta.Version,
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user