Problem
VCS-driven Terraform Enterprise (TFE) or Terraform Cloud (TFC) workspaces, whose code is using submodules within the VCS repository, may error failing to retrieve configuration when runs are triggered.
The error message logs reported in the TFE or TFC workspace may also include the following excerpt.
Fatal: Authentication failed for 'https://github.com/$companyname/$path/'
Fatal: clone of 'https://github.com/$companyname/$path/' into submodule path '/local/slug-ingressXXXX/clone/$module-name' failed
failed to clone '$submodule-name', Retry Scheduled
Cause
- The .gitmodules file contains the incorrect URL or protocol
[submodule "modules"]
path = modules
url = https://github.com/$companyname/$path (Wrong protocol)
- As displayed in the error message the URL is using https instead of ssh
- ssh is the expected protocol for submodule authentication connection
Solutions:
- Change the url setting in the .gitmodules file to use ssh for connection, for example
[submodule "modules"]
path = modules
url = git@github.com/$companyname/$path
-
After the correct URL has been modified, retry the workspace run
Additional Information
https://developer.hashicorp.com/terraform/enterprise/vcs/troubleshooting