Skip to content

Terraform 1.6.0 - Host Key Verification Failed when using git ssh regression #34543

@marvelous-melanie

Description

@marvelous-melanie

Terraform Version

Terraform v1.6.0

Terraform Configuration Files

module "XXXXXXXXXX" {
  source = "git@example.com:site/module.git"
  name   = "XXXXXXXXXX"
}

Debug Output

on linux_amd64
Initializing plugins and modules...

Initializing Terraform Cloud...
Initializing modules...
Downloading git::ssh://git@github.com/company/repo-name.git for module-name...
╷
│ Error: Failed to download module
│ 
│   on module_name.tf line 25:
│   25: module "module_name" {
│ 
│ Could not download module "module_name" (module_name.tf:25)
│ source code from
│ "git::ssh://git@github.com/company/repo-name.git": error
│ downloading 'ssh://git@github.com/company/repo-name.git':
│ /usr/bin/git exited with 128: Cloning into
│ '.terraform/modules/module_name'...
│ Host key verification failed.
│ fatal: Could not read from remote repository.
│ 
│ Please make sure you have the correct access rights
│ and the repository exists.
│

Expected Behavior

This module should successfully download. We have multiple other workspaces running with the same exact configuration (same SSH key, specified in the same way, accessing the same remote module using the exact same module source line) but lower versions of Terraform.

Those all work perfectly, and this workspace also worked perfectly until starting to fail yesterday, again with no configuration change on our end. Reverting this workspace to 1.5.7 caused the module to begin downloading properly again.

Actual Behavior

The module fails to download.

Steps to Reproduce

  1. Using a v1.6.0 remote Terraform Cloud workspace, configure Terraform Cloud to use a GitHub SSH key
  2. Create a module with a remote git source
  3. terraform init
  4. terraform plan

Additional Context

No response

References

I believe this bug was previously opened and closed in this issue, but given that we started experiencing it again a few days ago, I suspect it has been reintroduced.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugnewnew issue not yet triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions