Skip to content

Version 1.6.0 - Host Key Verification Failed when using git ssh #33986

@1BuBuBu1

Description

@1BuBuBu1

Terraform Version

Terraform v1.6.0

Terraform Configuration Files

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

Debug Output

Initializing modules...
2023-10-05T07:42:44.101Z [TRACE] ModuleInstaller: installing child modules for . into .terraform/modules
2023-10-05T07:42:44.115Z [DEBUG] Module installer: begin XXXXXXXXXX
2023-10-05T07:42:44.115Z [TRACE] ModuleInstaller: XXXXXXXXXX is not yet installed
2023-10-05T07:42:44.115Z [TRACE] ModuleInstaller: cleaning directory .terraform/modules/XXXXXXXXXX prior to install of XXXXXXXXXX
2023-10-05T07:42:44.115Z [TRACE] ModuleInstaller: XXXXXXXXXX address "git::ssh://git@example.com/site/module.git" will be handled by go-getter
Downloading git::ssh://git@example.com/site/module.git for XXXXXXXXXX...
2023-10-05T07:42:44.115Z [TRACE] getmodules: fetching "git::ssh://git@example.com/site/module.git" to ".terraform/modules/XXXXXXXXXX"
2023-10-05T07:42:44.178Z [DEBUG] Module installer: begin XXXXXXXXXX
2023-10-05T07:42:44.178Z [TRACE] ModuleInstaller: XXXXXXXXXX is not yet installed
2023-10-05T07:42:44.178Z [TRACE] ModuleInstaller: cleaning directory .terraform/modules/XXXXXXXXXX prior to install of XXXXXXXXXX
2023-10-05T07:42:44.178Z [TRACE] ModuleInstaller: XXXXXXXXXX address "git::ssh://git@example.com/site/module.git" will be handled by go-getter
Downloading git::ssh://git@example.com/site/module.git for XXXXXXXXXX...
2023-10-05T07:42:44.179Z [TRACE] getmodules: fetching "git::ssh://git@example.com/site/module.git" to ".terraform/modules/XXXXXXXXXX"

Expected Behavior

Terraform Init should execute successfully and download the necessary modules from the private repository through git ssh.

Actual Behavior

SSH Keys were not modified and still active, but terraform init returned with "could not read from remote repository"

│ Error: Failed to download module
│ 
│   on XXXXX.tf line XX:
│   XX: module "XXXXXXX" {
│ 
│ Could not download module "XXXXXXX"
│ (XXXXXXX.tf:XX) source code from
│ "git::ssh://git@example.com/site/module.git":
│ error downloading
│ 'ssh://git@example.com/site/module.git':
│ /usr/bin/git exited with 128: Cloning into
│ '.terraform/modules/XXXXXXX'...
│ Host key verification failed.
│ fatal: Could not read from remote repository.
│ 
│ Please make sure you have the correct access rights
│ and the repository exists.

Steps to Reproduce

  1. terraform init

Additional Context

Rollbacked version to terraform v1.5.7 with all config staying intact, no changes introduced to all config files. the terraform init command can be executed successfully and modules have been installed as expected. Using v1.6.0 will result in the above mentioned issue.

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugnewnew issue not yet triagedwaiting-responseAn issue/pull request is waiting for a response from the community

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions