Introduction
When running Terraform plans and applies in HCP Terraform, users may encounter intermittent networking errors. These errors typically appear as:
HTTP response was nil; connection may have been reset
This KB provides background on the issue, potential causes, and recommended mitigations.
Recommendation
A known mitigation is to reduce the parallelism of Terraform operations. By default, Terraform executes up to 10 operations in parallel. Lowering this value reduces network load and can prevent intermittent connection resets.
To adjust parallelism in HCP Terraform workspaces:
Navigate to the affected workspace settings.
Add the following environment variables:
TF_CLI_ARGS_plan="-parallelism=5"
TF_CLI_ARGS_apply="-parallelism=5"
Save the changes.
Re-run the plan or apply
Additional Information
Setting parallelism between 3–5 has been effective in mitigating these errors.
If problems persist, enabling trace logging during failed runs and providing logs to HashiCorp Support will help with further troubleshooting.