[GH-ISSUE #49] Unable to clone module as git+ssh #24

Closed
opened 2026-05-06 12:36:17 +02:00 by BreizhHardware · 15 comments

Originally created by @strowi on GitHub (Aug 21, 2023).
Original GitHub issue: https://github.com/patrickchugh/terravision/issues/49

Hi,

as mentioned here on reddit, i seem to be having a problem with private submodules:

module "eks_blueprints" {
  # source = "../../terraform-modules/terraform-aws-eks-blueprints/"
  source = "git::ssh://git@gitlab.com/xyz/terraform-modules/terraform-aws-eks-blueprints?ref=v4.42.1-2"

  cluster_name    = local.cluster_name
  cluster_version = "1.27"
...
}

While terraform init & co all work fine, terravision seems to be having an issue with this:

Found 3 module stanza(s)
Loading Sources..
Downloading External Module: git::ssh://git@gitlab.com/xyz/terraform-modules/terraform-aws-eks-blueprints?ref=v4.42.1-2
Cloning from Terraform registry source: [git@gitlab.com](mailto:git@gitlab.com)/xyz/terraform-modules/terraform-aws-eks-blueprints?ref=v4.42.1-2
0it [00:00, ?it/s]
ERROR: Unable to call Git to clone repository! Check git and SSH fingerprints and keys are correct and ensure the URL [git@gitlab.com](mailto:git@gitlab.com)/xyz/terraform-modules/terraform-aws-eks-blueprints?ref=v4.42.1-2 is reachable via CLI.
Originally created by @strowi on GitHub (Aug 21, 2023). Original GitHub issue: https://github.com/patrickchugh/terravision/issues/49 Hi, as mentioned [here](https://www.reddit.com/r/kubernetes/comments/15vq66q/comment/jwzst81) on reddit, i seem to be having a problem with private submodules: ```tf module "eks_blueprints" { # source = "../../terraform-modules/terraform-aws-eks-blueprints/" source = "git::ssh://git@gitlab.com/xyz/terraform-modules/terraform-aws-eks-blueprints?ref=v4.42.1-2" cluster_name = local.cluster_name cluster_version = "1.27" ... } ``` While terraform init & co all work fine, terravision seems to be having an issue with this: ```bash Found 3 module stanza(s) Loading Sources.. Downloading External Module: git::ssh://git@gitlab.com/xyz/terraform-modules/terraform-aws-eks-blueprints?ref=v4.42.1-2 Cloning from Terraform registry source: [git@gitlab.com](mailto:git@gitlab.com)/xyz/terraform-modules/terraform-aws-eks-blueprints?ref=v4.42.1-2 0it [00:00, ?it/s] ERROR: Unable to call Git to clone repository! Check git and SSH fingerprints and keys are correct and ensure the URL [git@gitlab.com](mailto:git@gitlab.com)/xyz/terraform-modules/terraform-aws-eks-blueprints?ref=v4.42.1-2 is reachable via CLI. ```
Author
Owner

@jayor96 commented on GitHub (Aug 21, 2023):

if you replace all "github" with "gitlab" in file modules/gitlibs.py and then change module source definition from "git@gitlab...." to "git::ssh://git@gitlab......" in your terraform code, it should work. Also keep in mind that if you use modules from branch via ?ref=... it will not work and you should comment out ?ref part and change default branch in your repo to one which you want to pull. Those are just my findings so far.

<!-- gh-comment-id:1686939084 --> @jayor96 commented on GitHub (Aug 21, 2023): if you replace all "github" with "gitlab" in file modules/gitlibs.py and then change module source definition from "git@gitlab...." to "git::ssh://git@gitlab......" in your terraform code, it should work. Also keep in mind that if you use modules from branch via ?ref=... it will not work and you should comment out ?ref part and change default branch in your repo to one which you want to pull. Those are just my findings so far.
Author
Owner

@patrickchugh commented on GitHub (Aug 21, 2023):

Thanks for spotting this @strowi - will work on a fix soon.

<!-- gh-comment-id:1687089274 --> @patrickchugh commented on GitHub (Aug 21, 2023): Thanks for spotting this @strowi - will work on a fix soon.
Author
Owner

@strowi commented on GitHub (Aug 24, 2023):

@jayor96 thx for the hints, but i guess i'll wait on a fix, since this seems to be a lot. Esp. if i want to do it in CI ;)

<!-- gh-comment-id:1692370076 --> @strowi commented on GitHub (Aug 24, 2023): @jayor96 thx for the hints, but i guess i'll wait on a fix, since this seems to be a lot. Esp. if i want to do it in CI ;)
Author
Owner

@patrickchugh commented on GitHub (Aug 26, 2023):

@strowi Can you do a git pull and try again with the latest fixed code?

<!-- gh-comment-id:1694311794 --> @patrickchugh commented on GitHub (Aug 26, 2023): @strowi Can you do a git pull and try again with the latest fixed code?
Author
Owner

@ashraf133 commented on GitHub (Aug 27, 2023):

hello ,
i have same problem even after pulling latest code,
the auto generated url is false
ERROR: Unable to call Git to clone repository! Check git and SSH fingerprints and keys are correct and ensure the URL git@gitlab.YYY.com/XXX.git is reachable via CLI.

terravision's wrong url : git@gitlab.YYY.com/XXX.git

expected correct url : git@gitlab.YYY.com:XXX.git

the difference is ":" after .com and not "/"

<!-- gh-comment-id:1694601177 --> @ashraf133 commented on GitHub (Aug 27, 2023): hello , i have same problem even after pulling latest code, the auto generated url is false ERROR: Unable to call Git to clone repository! Check git and SSH fingerprints and keys are correct and ensure the URL git@gitlab.YYY.com/XXX.git is reachable via CLI. terravision's wrong url : git@gitlab.YYY.com/XXX.git expected correct url : git@gitlab.YYY.com:XXX.git the difference is ":" after .com and not "/"
Author
Owner

@patrickchugh commented on GitHub (Aug 27, 2023):

@ashraf133 well spotted let me fix that

<!-- gh-comment-id:1694608007 --> @patrickchugh commented on GitHub (Aug 27, 2023): @ashraf133 well spotted let me fix that
Author
Owner

@strowi commented on GitHub (Aug 28, 2023):

@patrickchugh : sorry for the delay, was aways for a few days. The cloning-problems seems to be fixed now. Thx!
Now it seems stuck at Processing variables... for about 10m at 100%, but that might be because of the size.. I am basically trying to run this on https://github.com/aws-ia/terraform-aws-eks-blueprints . Will wait a bit longer if it finishes.. :)

<!-- gh-comment-id:1695417454 --> @strowi commented on GitHub (Aug 28, 2023): @patrickchugh : sorry for the delay, was aways for a few days. The cloning-problems seems to be fixed now. Thx! Now it seems stuck at `Processing variables...` for about 10m at 100%, but that might be because of the size.. I am basically trying to run this on https://github.com/aws-ia/terraform-aws-eks-blueprints . Will wait a bit longer if it finishes.. :)
Author
Owner

@patrickchugh commented on GitHub (Aug 28, 2023):

@strowi I made some changes to the code now to show more verbose debug messages you can paste the relevant lines from the output if necessary. Let me know if it works?

<!-- gh-comment-id:1695515198 --> @patrickchugh commented on GitHub (Aug 28, 2023): @strowi I made some changes to the code now to show more verbose debug messages you can paste the relevant lines from the output if necessary. Let me know if it works?
Author
Owner

@ashraf133 commented on GitHub (Aug 28, 2023):

@patrickchugh , i have re pulled the last main branch but still have same problem with same cause

<!-- gh-comment-id:1695635177 --> @ashraf133 commented on GitHub (Aug 28, 2023): @patrickchugh , i have re pulled the last main branch but still have same problem with same cause
Author
Owner

@strowi commented on GitHub (Aug 31, 2023):

@patrickchugh with commit a301f5fb55 i am getting not much more debug output...

~>  ~/tmp/terravision/terravision draw --debug
...
Preflight check..
  dot command detected: /usr/bin/dot
  gvpr command detected: /usr/bin/gvpr
  git command detected: /usr/bin/git
  Added Source Location: .
  Parsing ./terraform_secrets.auto.tfvars
  Parsing ./variables.tf
    Found 11 variable stanza(s)
  Parsing ./main.tf
    Found 5 resource stanza(s)
    Found 1 data stanza(s)
  Parsing ./providers.tf
  Parsing ./eks_blueprint.tf
    Found 3 module stanza(s)
  Added Source Location: /home/rvg/src/a/terraform-modules/terraform-aws-eks-blueprints
  Added Source Location: /home/rvg/src/a/terraform-modules/terraform-aws-eks-blueprints/modules/kubernetes-addons
Loading Sources..
  Downloading External Module: terraform-aws-modules/vpc/aws
    Cloning from Terraform registry source: https://github.com/terraform-aws-modules/terraform-aws-vpc
  Skipping download of module terraform-aws-modules/vpc/aws, found existing folder in module cache
  Added Source Location: /tmp/tmpr7fph4kg/;vpc;terraform-aws-modules/vpc/aws/
    Found 2 locals stanza(s)
    Found 1 resource stanza(s)
    Found 2 data stanza(s)
  Parsing /home/rvg/src/a/terraform-modules/terraform-aws-eks-blueprints/eks-worker.tf
    Found 3 module stanza(s)
  Added Source Location: /home/rvg/src/a/terraform-modules/terraform-aws-eks-blueprints/modules/aws-eks-managed-node-groups
  Added Source Location: /home/rvg/src/a/terraform-modules/terraform-aws-eks-blueprints/modules/aws-eks-self-managed-node-groups
  Added Source Location: /home/rvg/src/a/terraform-modules/terraform-aws-eks-blueprints/modules/aws-eks-fargate-profiles
  Parsing /home/rvg/src/a/terraform-modules/terraform-aws-eks-blueprints/aws-auth-configmap.tf
    Found 1 resource stanza(s)
  Parsing /home/rvg/src/a/terraform-modules/terraform-aws-eks-blueprints/locals.tf
    Found 1 locals stanza(s)
  Parsing /home/rvg/src/a/terraform-modules/terraform-aws-eks-blueprints/variables.tf
    Found 64 variable stanza(s)
  Parsing /home/rvg/src/a/terraform-modules/terraform-aws-eks-blueprints/main.tf
    Found 4 module stanza(s)
  Added Source Location: /home/rvg/src/a/terraform-modules/terraform-aws-eks-blueprints/modules/aws-kms
Loading Sources..
  Downloading External Module: terraform-aws-modules/eks/aws
    Cloning from Terraform registry source: https://github.com/terraform-aws-modules/terraform-aws-eks
  Skipping download of module terraform-aws-modules/eks/aws, found existing folder in module cache
....

  Parsing /home/rvg/src/infra/terraform-modules/terraform-aws-eks-blueprints/modules/irsa/outputs.tf
    Found 4 output stanza(s)
  Parsing /home/rvg/src/infra/terraform-modules/terraform-aws-eks-blueprints/modules/irsa/versions.tf
Processing Variables..
    var.aws
    var.aws_region
    var.cluster_name
    var.cluster_description
    var.hetzner_dns_api_token
    var.rancher_hostname
    var.rancher_labels
...
    helm_release.addon

And that's it.

BTW is there support for multiple --varfile ? It is quite common to have an extra tfvars for encrypted secrets.

<!-- gh-comment-id:1700481928 --> @strowi commented on GitHub (Aug 31, 2023): @patrickchugh with commit a301f5fb5509132b84379d479741ee5e5cf662ad i am getting not much more debug output... ```bash ~> ~/tmp/terravision/terravision draw --debug ... Preflight check.. dot command detected: /usr/bin/dot gvpr command detected: /usr/bin/gvpr git command detected: /usr/bin/git Added Source Location: . Parsing ./terraform_secrets.auto.tfvars Parsing ./variables.tf Found 11 variable stanza(s) Parsing ./main.tf Found 5 resource stanza(s) Found 1 data stanza(s) Parsing ./providers.tf Parsing ./eks_blueprint.tf Found 3 module stanza(s) Added Source Location: /home/rvg/src/a/terraform-modules/terraform-aws-eks-blueprints Added Source Location: /home/rvg/src/a/terraform-modules/terraform-aws-eks-blueprints/modules/kubernetes-addons Loading Sources.. Downloading External Module: terraform-aws-modules/vpc/aws Cloning from Terraform registry source: https://github.com/terraform-aws-modules/terraform-aws-vpc Skipping download of module terraform-aws-modules/vpc/aws, found existing folder in module cache Added Source Location: /tmp/tmpr7fph4kg/;vpc;terraform-aws-modules/vpc/aws/ Found 2 locals stanza(s) Found 1 resource stanza(s) Found 2 data stanza(s) Parsing /home/rvg/src/a/terraform-modules/terraform-aws-eks-blueprints/eks-worker.tf Found 3 module stanza(s) Added Source Location: /home/rvg/src/a/terraform-modules/terraform-aws-eks-blueprints/modules/aws-eks-managed-node-groups Added Source Location: /home/rvg/src/a/terraform-modules/terraform-aws-eks-blueprints/modules/aws-eks-self-managed-node-groups Added Source Location: /home/rvg/src/a/terraform-modules/terraform-aws-eks-blueprints/modules/aws-eks-fargate-profiles Parsing /home/rvg/src/a/terraform-modules/terraform-aws-eks-blueprints/aws-auth-configmap.tf Found 1 resource stanza(s) Parsing /home/rvg/src/a/terraform-modules/terraform-aws-eks-blueprints/locals.tf Found 1 locals stanza(s) Parsing /home/rvg/src/a/terraform-modules/terraform-aws-eks-blueprints/variables.tf Found 64 variable stanza(s) Parsing /home/rvg/src/a/terraform-modules/terraform-aws-eks-blueprints/main.tf Found 4 module stanza(s) Added Source Location: /home/rvg/src/a/terraform-modules/terraform-aws-eks-blueprints/modules/aws-kms Loading Sources.. Downloading External Module: terraform-aws-modules/eks/aws Cloning from Terraform registry source: https://github.com/terraform-aws-modules/terraform-aws-eks Skipping download of module terraform-aws-modules/eks/aws, found existing folder in module cache .... Parsing /home/rvg/src/infra/terraform-modules/terraform-aws-eks-blueprints/modules/irsa/outputs.tf Found 4 output stanza(s) Parsing /home/rvg/src/infra/terraform-modules/terraform-aws-eks-blueprints/modules/irsa/versions.tf Processing Variables.. var.aws var.aws_region var.cluster_name var.cluster_description var.hetzner_dns_api_token var.rancher_hostname var.rancher_labels ... helm_release.addon ``` And that's it. BTW is there support for multiple `--varfile` ? It is quite common to have an extra tfvars for encrypted secrets.
Author
Owner

@patrickchugh commented on GitHub (Oct 3, 2023):

I will be releasing a significant update that uses the Terraform binary - please test again with that once released.

<!-- gh-comment-id:1744724397 --> @patrickchugh commented on GitHub (Oct 3, 2023): I will be releasing a significant update that uses the Terraform binary - please test again with that once released.
Author
Owner

@jayor96 commented on GitHub (Oct 9, 2023):

@patrickchugh when do you plan to release it please ?

<!-- gh-comment-id:1753411492 --> @jayor96 commented on GitHub (Oct 9, 2023): @patrickchugh when do you plan to release it please ?
Author
Owner

@patrickchugh commented on GitHub (Nov 21, 2023):

@jayor96 @strowi @ashraf133 Hello, thank you for your feedback and thanks for testing out Terravision and helping to make this a better product. I have recently completed a major revamp to the code which uses the terraform binary to download source files and generate initial relationships, before augmenting it with source code parsing as before. This is a significant departure from the previous approach and whilst slower, ensures a more accurate output and will handle all terraform in built functions now when encountered in the source. Please do a git pull and re-test again with the latest source code. If your problem is resolved, please close the thread in github issues and mark it as completed. If not, please give as much detail as you can about the errors and include any source files if possible so I can reproduce your issue. Once again, thanks for helping and look forward to hearing from you soon.

P.

<!-- gh-comment-id:1820024341 --> @patrickchugh commented on GitHub (Nov 21, 2023): @jayor96 @strowi @ashraf133 Hello, thank you for your feedback and thanks for testing out Terravision and helping to make this a better product. I have recently completed a major revamp to the code which uses the terraform binary to download source files and generate initial relationships, before augmenting it with source code parsing as before. This is a significant departure from the previous approach and whilst slower, ensures a more accurate output and will handle all terraform in built functions now when encountered in the source. Please do a git pull and re-test again with the latest source code. If your problem is resolved, please close the thread in github issues and mark it as completed. If not, please give as much detail as you can about the errors and include any source files if possible so I can reproduce your issue. Once again, thanks for helping and look forward to hearing from you soon. P.
Author
Owner

@patrickchugh commented on GitHub (Dec 28, 2023):

Closing since no feedback

<!-- gh-comment-id:1871520438 --> @patrickchugh commented on GitHub (Dec 28, 2023): Closing since no feedback
Author
Owner

@f0rkth1s commented on GitHub (May 31, 2024):

Can I bump this issue, we are seeing the same issue with the : missing when cloning repos from azure devops.

<!-- gh-comment-id:2142002320 --> @f0rkth1s commented on GitHub (May 31, 2024): Can I bump this issue, we are seeing the same issue with the : missing when cloning repos from azure devops.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/terravision#24
No description provided.