Problem
When attempting to create a new workspace in Terraform Enterprise (TFE) connected to a GitHub repository, the operation fails with the following error message in the UI:
Error creating Workspace repository doesn’t exist or isn’t accessible
The Terraform Enterprise application logs show a corresponding error message.
2023-02-15 06:58:14 [ERROR] [1784f4ae-cb02-4c35-8018-956aeb70efc8] msg=There was an error creating the workspace invalid_object=#<Vcs::Repo:0x00007fef5c0b8008> error=The specified repository "Org-name/tesstrepo" doesn't exist or isn't accessible.
This issue can occur even if the VCS provider connection was created successfully.
Prerequisites
- The GitHub user account used for the TFE VCS connection must have administrative access to the target repository.
Cause
The primary cause of this error is IP address filtering configured at the GitHub organization level. If your GitHub organization restricts access to a specific list of allowed IP addresses, it will block connection attempts from the Terraform Enterprise instance's IP address, preventing TFE from accessing the repository.
This can be difficult to diagnose because other repositories on the same TFE instance that belong to different GitHub organizations (without IP filtering) may continue to work correctly.
Solution
Add the TFE IP Address to the GitHub Organization's Allowlist
To resolve this issue, a GitHub organization administrator must add the public IP address of your Terraform Enterprise instance to the organization's IP allowlist.
- Identify the public-facing IP address or range for your Terraform Enterprise instance from which it makes outbound requests.
- Provide this IP address to your GitHub organization administrator.
- The administrator must add the IP address to the organization's security settings under the IP allowlist feature.
After the IP address is allowlisted, attempt to create the workspace in Terraform Enterprise again.
Additional Information
- For detailed instructions, refer to GitHub's documentation on managing allowed IP addresses for your organization.
- For general guidance on VCS issues, see Troubleshooting VCS webhooks in Terraform Enterprise.