Home > Back-end >  Terraform Public Registry - Host key verification failed
Terraform Public Registry - Host key verification failed

Time:01-30

I'm trying to use a module from a public repo, but doing

module "eka_iam_role_ca" {
  source = "[email protected]:ahmad-hamade/terraform-eks-config.git//eks-iam-role?ref=TAG"

  cluster_name     = local.cluster_name
  role_name        = "cluster-autoscaler"
  service_accounts = ["kube-system/cluster-autoscaler"]
  policies         = [data.aws_iam_policy_document.cluster_autoscaler.json]

  tags = {
    Terraform = "true"
    Environment = "dev"
  }
}

Throws:

│ Error: Failed to download module
│ 
│ Could not download module "eka_iam_role_ca" (role.tf:1) source code from "git::ssh://[email protected]/ahmad-hamade/terraform-eks-config.git?ref=TAG": error
│ downloading 'ssh://[email protected]/ahmad-hamade/terraform-eks-config.git?ref=TAG': /usr/bin/git exited with 128: Cloning into
│ '.terraform/modules/eka_iam_role_ca'...
│ load pubkey "/home/root1/.ssh/id_rsa": invalid format
│ [email protected]: Permission denied (publickey).
│ fatal: Could not read from remote repository.
│ 
│ Please make sure you have the correct access rights
│ and the repository exists.

I had no problems using git so far, I can still use my own repos without a problem, but I'm not sure why this one refuses to work.

CodePudding user response:

I had no problems using git so far, I can still use my own repos without a problem

Yes, but that was with your account.

The module is using /home/root1/.ssh/id_rsa, meaning it is not executed with your account, and do not have access to the same keys (or any key at all).

You need to make sure the process is executed with the right account (one with the expected keys).

  •  Tags:  
  • Related