Problem
When you attempt to use BitBucket Server as a VCS provider, HCP Terraform or Terraform Enterprise returns a connection reset by peer error. The error message includes the IP address and port number of the Bitbucket server.
Prerequisites
- Bitbucket Server or Data Center integration.
Cause
This error may be caused by incorrectly configured settings or a transient networking issue between your HCP Terraform or Terraform Enterprise instance and your Bitbucket instance.
Solutions
Solution 1: Reset the VCS Connection
If you encounter this error when attempting to complete a run, try editing the VCS settings to change the repository to a different one, and then change it back to the desired repository. This can sometimes resolve transient connection issues.
Solution 2: Verify Network Configuration
Ensure that your network configuration allows traffic between HCP Terraform or Terraform Enterprise and your Bitbucket instance.
- Review the networking requirements for Bitbucket Data Center integration.
- Confirm your Bitbucket instance's currently configured ports. According to the Bitbucket documentation, the default ports are
7999for SSH and7990for HTTP. Verify that your firewall and network routing rules align with your configuration.
Solution 3: Engage Your Networking Team
Discuss the error with your networking team. Provide them with the full error message and timestamps to help them investigate potential network-level issues, such as firewall blocks or routing problems.
Outcome
After you identify and resolve the connection issues, runs should progress as expected.