Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

terraform init: add link to documentation when a checksum is missing from the lock file #31408

Merged
merged 9 commits into from Jul 20, 2022
3 changes: 2 additions & 1 deletion internal/getproviders/errors.go
Expand Up @@ -5,6 +5,7 @@ import (
"net/url"

svchost "github.com/hashicorp/terraform-svchost"

"github.com/hashicorp/terraform/internal/addrs"
)

Expand Down Expand Up @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions internal/providercache/installer_test.go
Expand Up @@ -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"
Expand Down Expand Up @@ -1311,7 +1312,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: {
Expand Down Expand Up @@ -1357,7 +1358,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`,
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions internal/providercache/package_install.go
Expand Up @@ -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,
)
}
Expand Down Expand Up @@ -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,
)
}
Expand Down