From 1375b9c537dc86b8979318e90b1618b2333ede4e Mon Sep 17 00:00:00 2001 From: Radek Simko Date: Wed, 6 Apr 2022 09:55:23 +0100 Subject: [PATCH] internal/getproviders: Add URL to error message for clarity Occasionally `terraform init` on some providers may return the following error message: Error while installing citrix/citrixadc v1.13.0: could not query provider registry for registry.terraform.io/citrix/citrixadc: failed to retrieve authentication checksums for provider: 403 Forbidden The 403 is most often returned from GitHub (rather than Registry API) and this change makes it more obvious. --- internal/getproviders/registry_client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/getproviders/registry_client.go b/internal/getproviders/registry_client.go index a31405ec01c8..482b6b6494df 100644 --- a/internal/getproviders/registry_client.go +++ b/internal/getproviders/registry_client.go @@ -437,7 +437,7 @@ func (c *registryClient) getFile(url *url.URL) ([]byte, error) { defer resp.Body.Close() if resp.StatusCode != http.StatusOK { - return nil, fmt.Errorf("%s", resp.Status) + return nil, fmt.Errorf("%s returned from %s", resp.Status, resp.Request.URL) } data, err := ioutil.ReadAll(resp.Body)