Problem
TFE runs were failing while referencing modules from other private repository on Github
"git::ssh://git@github.com/<username>/<repo-name>.git" with
ERROR: Repository not found. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
Cause
- Authentication method for downloading the module was incorrectly configured.
Solutions
-
Generate key-pair using following command "ssh-keygen -t rsa -m PEM -f "/Users/<NAME>/.ssh/service_terraform" -C "service_terraform_enterprise"
-
Add private key to your TFE instance.
- Add public key to the repository in Github which is being sourced.
- Go to your repo -> Settings -> Deploy Keys -> Add Deploy Keys -> Enter your public key -> Click on Allow Write access -> Add key.
Outcome
Once the keys are configured in the correct repository, the modules will be sourced.