Introduction
Terraform Cloud VCS-driven workspaces with Terraform version 1.6.0 with correctly set SSH key are prompting the below error:
Error
Downloading git::ssh://git@github.com/... ╷ │ Error: Failed to download module │ ... │ Could not download module "..." source code from │ "git::ssh://git@github.com/...: │ error downloading │ 'ssh://git@github.com/... exited with 128: Cloning into │ '.terraform/modules/...
│ Host key verification failed. │ fatal: Could not read from remote repository. │ │ Please make sure you have the correct access rights │ and the repository exists.
Root Cause
This is a known bug with Terraform version 1.6.0 in Terraform Cloud workspaces.
This issue has been resolved with the next Terraform version - 1.6.1.
Solution
To resolve the issue for a workspace throwing this error please follow the below steps:
- Workspace settings -> General -> Terraform version drop-down menu -> Choose any version higher or lower than 1.6.0-> Click "Save settings"
- Perform another run