{"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/c9def3e214014c1188faabfc4a5bde5095139765/internal/cloud/test.go#L311-L347","documentation":"During service discovery, services.Discover(hostname) failed with a disco.ErrServiceDiscoveryNetworkRequest: Terraform could not reach the host's .well-known/terraform.json discovery endpoint. It is surfaced when setting up cloud-backed terraform test.","triggerScenarios":"terraform test against HCP/TFE when the hostname is unreachable: DNS failure, no network, proxy/firewall blocking the discovery request, or a wrong hostname.","commonSituations":"Offline or air-gapped machine without connectivity, a mistyped hostname in the module source, a corporate proxy blocking discovery, or a transient DNS outage.","solutions":["Verify connectivity: curl https://<host>/.well-known/terraform.json.","Correct the hostname and organization in the module source address.","Configure HTTP(S) proxy environment variables if behind a proxy.","Retry after confirming DNS resolves."],"exampleFix":"# before: wrong host / no egress -> a network issue prevented cloud configuration\n# after: fix hostname and confirm discovery endpoint reachable\ncurl -I https://app.terraform.io/.well-known/terraform.json\nterraform test","handlingStrategy":"validation","validationCode":"// Pre-flight: confirm the discovery endpoint is reachable\nresp, err := http.Get(\"https://\" + hostname + \"/.well-known/terraform.json\")\nif err != nil {\n    return fmt.Errorf(\"cannot reach discovery endpoint for %s: %w\", hostname, err)\n}\ndefer resp.Body.Close()","typeGuard":"func isServiceDiscoveryNetworkError(err error) bool {\n    var discoErr *disco.ErrServiceDiscoveryNetworkRequest\n    return errors.As(err, &discoErr)\n}","tryCatchPattern":"_, err := discoverTfeURL(hostname, services)\nif err != nil {\n    var discoErr *disco.ErrServiceDiscoveryNetworkRequest\n    if errors.As(err, &discoErr) {\n        // fix connectivity/proxy/hostname, then retry\n    }\n}","preventionTips":["Verify egress/proxy allows the HCP/TFE hostname","Double-check the hostname in the module source","Confirm DNS resolves before running"],"tags":["network","service-discovery","connectivity","test-runner"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T20:17:04.800Z"}