{"record":{"id":"60151db421ca36cb","repo":"hashicorp/terraform","slug":"a-network-issue-prevented-cloud-configuration-w-60151d","errorCode":null,"errorMessage":"a network issue prevented cloud configuration; %w","messagePattern":"a network issue prevented cloud configuration; %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cloud/test.go","lineNumber":329,"sourceCode":"\t\treturn moduletest.Pass, diags\n\tcase tfe.TestPending:\n\t\treturn moduletest.Pending, diags\n\tcase tfe.TestSkip:\n\t\treturn moduletest.Skip, diags\n\tdefault:\n\t\tpanic(\"found unrecognized test status: \" + run.TestStatus)\n\t}\n}\n\n// discover the TFC/E API service URL\nfunc discoverTfeURL(hostname svchost.Hostname, services *disco.Disco) (*url.URL, error) {\n\thost, err := services.Discover(hostname)\n\tif err != nil {\n\t\tvar serviceDiscoErr *disco.ErrServiceDiscoveryNetworkRequest\n\n\t\tswitch {\n\t\tcase errors.As(err, &serviceDiscoErr):\n\t\t\terr = fmt.Errorf(\"a network issue prevented cloud configuration; %w\", err)\n\t\t\treturn nil, err\n\t\tdefault:\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn host.ServiceURL(tfeServiceID)\n}\n\nfunc (runner *TestSuiteRunner) client(addr tfaddr.Module, id tfe.RegistryModuleID) (*tfe.Client, *tfe.RegistryModule, tfdiags.Diagnostics) {\n\tvar diags tfdiags.Diagnostics\n\n\tvar client *tfe.Client\n\tif runner.clientOverride != nil {\n\t\tclient = runner.clientOverride\n\t} else {\n\t\tservice, err := discoverTfeURL(addr.Package.Host, runner.Services)\n\t\tif err != nil {","sourceCodeStart":311,"sourceCodeEnd":347,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/cloud/test.go#L311-L347","documentation":"Thrown during HCP Terraform / Terraform Enterprise service discovery inside discoverTfeURL when the HTTP request to resolve the API service URL fails at the network layer. Terraform wraps the underlying *disco.ErrServiceDiscoveryNetworkRequest with a user-facing message indicating a network problem prevented cloud configuration. This occurs when the test runner resolves the hostname for cloud-backed terraform test execution.","triggerScenarios":"services.Discover(hostname) returns an error assignable to *disco.ErrServiceDiscoveryNetworkRequest. This happens when DNS resolution fails for the TFC/E hostname, the host is unreachable, a proxy blocks the HTTPS request to /.well-known/terraform.json, TLS negotiation fails, or the connection times out.","commonSituations":"Corporate firewall or proxy blocking outbound HTTPS to app.terraform.io; incorrect or unreachable hostname in a self-hosted TFE installation; DNS misconfiguration; transient network outage; missing HTTP_PROXY/HTTPS_PROXY env vars in proxy environments.","solutions":["Verify connectivity to the hostname: curl -v https://<hostname>/.well-known/terraform.json","Set or correct HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables for proxy environments","Confirm the hostname in your cloud configuration block or TF_CLOUD_HOSTNAME is correct and DNS-resolvable","Retry the command if the failure was transient (intermittent network issues)"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Pre-flight connectivity check before running cloud tests\nfunc checkTfeReachable(hostname string) error {\n    url := fmt.Sprintf(\"https://%s/.well-known/terraform.json\", hostname)\n    client := &http.Client{Timeout: 10 * time.Second}\n    resp, err := client.Get(url)\n    if err != nil {\n        return fmt.Errorf(\"cannot reach TFC/E host %s: %w\", hostname, err)\n    }\n    defer resp.Body.Close()\n    if resp.StatusCode != http.StatusOK {\n        return fmt.Errorf(\"unexpected status %d from %s\", resp.StatusCode, url)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify the TFC/E hostname is DNS-resolvable and reachable before running terraform test","Configure HTTP_PROXY, HTTPS_PROXY, and NO_PROXY in corporate network environments","Use TF_CLOUD_HOSTNAME only when pointing to a known reachable TFE instance","Add retry logic in CI for transient network failures during cloud operations"],"tags":["network","terraform-cloud","service-discovery","tfe","dns"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}