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
2 changes: 1 addition & 1 deletion internal/getproviders/errors.go
Expand Up @@ -210,7 +210,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
4 changes: 2 additions & 2 deletions internal/providercache/installer_test.go
Expand Up @@ -1311,7 +1311,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 +1357,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",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The nittiest possible grammar nit: this seems like a semicolon-appropriate situation rather than a comma-appropriate situation, because this new addition reads to me as an independent clause.

(and same feedback for the other example below)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

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