patrickchugh / terravision

Terravision creates Professional Cloud Architecture Diagrams from your Terraform code automatically. Supports AWS, Google and Azure.
Mozilla Public License 2.0
821 stars 78 forks source link

ERROR: Unable to call Git to clone repository #118

Open soldera opened 6 months ago

soldera commented 6 months ago

Hi! I am having an issue with the drawing process.

Steps to reproduce:

mkdir test
cd test
touch main.tf

main.tf:

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.0"
    }
  }

  required_version = ">= 1.7.2"
}

provider "aws" {
  region = "us-east-1"
}

module "eks_prometheus" {
  # Locked to v2.2.3
  source = "github.com/terraform-aws-modules/terraform-aws-managed-service-prometheus?ref=ce8c537c5ecae79a693ed819c1e958e24a4b3083"

  workspace_alias = "alias-dev"
}

terravision draw --source test/ --debug

Preflight check..
  dot command detected: /opt/homebrew/bin/dot
  gvpr command detected: /opt/homebrew/bin/gvpr
  git command detected: /usr/bin/git
  terraform command detected: /usr/local/bin/terraform

Checking Terraform Version...

Terraform v1.7.2

Initializing the backend...
Initializing modules...
Downloading git::https://github.com/terraform-aws-modules/terraform-aws-managed-service-prometheus.git?ref=ce8c537c5ecae79a693ed819c1e958e24a4b3083 for eks_prometheus...
- eks_prometheus in /var/folders/q7/z4xm9hbx44x81mm5jw5hr7rw0000gn/T/tmpr88u4c34/modules/eks_prometheus

Initializing provider plugins...
- Finding hashicorp/aws versions matching ">= 4.35.0, ~> 5.0"...
- Installing hashicorp/aws v5.47.0...
- Installed hashicorp/aws v5.47.0 (signed by HashiCorp)

Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.

Initalising workspace: default

Generating Terraform Plan..

Terraform used the selected providers to generate the following execution plan. Resource actions are
indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # module.eks_prometheus.aws_prometheus_alert_manager_definition.this[0] will be created
  + resource "aws_prometheus_alert_manager_definition" "this" {
      + definition   = <<-EOT
            alertmanager_config: |
              route:
                receiver: 'default'
              receivers:
                - name: 'default'
        EOT
      + id           = (known after apply)
      + workspace_id = (known after apply)
    }

  # module.eks_prometheus.aws_prometheus_workspace.this[0] will be created
  + resource "aws_prometheus_workspace" "this" {
      + alias               = "alias-dev"
      + arn                 = (known after apply)
      + id                  = (known after apply)
      + prometheus_endpoint = (known after apply)
      + tags_all            = (known after apply)
    }

Plan: 2 to add, 0 to change, 0 to destroy.

─────────────────────────────────────────────────────────────────────────────────────────────────────────

Saved the plan to: /var/folders/q7/z4xm9hbx44x81mm5jw5hr7rw0000gn/T/tfplan.bin

To perform exactly these actions, run the following command to apply:
    terraform apply "/var/folders/q7/z4xm9hbx44x81mm5jw5hr7rw0000gn/T/tfplan.bin"

Analysing plan..

Unprocessed terraform graph dictionary:

{
    "aws_prometheus_alert_manager_definition.this~1": [],
    "aws_prometheus_workspace.this~1": [
        "aws_prometheus_alert_manager_definition.this~1"
    ]
}

Parsing Terraform Source Files..
  Added Source Location: test/
  Parsing test/prometheus.tf
    Found 1 module stanza(s)

Loading Sources..
  Processing External Module: github.com/terraform-aws-modules/terraform-aws-managed-service-prometheus?ref=ce8c537c5ecae79a693ed819c1e958e24a4b3083
    Assuming code from Terraform registry source: https://github.com/terraform-aws-modules/terraform-aws-managed-service-prometheus
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 https://github.com/terraform-aws-modules/terraform-aws-managed-service-prometheus is reachable via CLI.
patrickchugh commented 6 months ago

Can you try if it works without pointing to a particular ?ref= in the terraform?

f0rkth1s commented 5 months ago

We have this same issue cloning a repo from Azure devops where the git URL is incorrect with a / where a : should be

martivo commented 3 months ago

Can you try if it works without pointing to a particular ?ref= in the terraform?

I have same issue, module is hosted in public github and using https protocol. Removeing the "?ref=" produces same error.

TF code:

module "main" {
  source                 = "git::https://github.com/entigolabs/entigo-infralib-release.git//modules/aws/vpc?ref=v0.13.1"
  ...
}

With ref:

Loading Sources..
  Processing External Module: git::https://github.com/entigolabs/entigo-infralib-release.git//modules/aws/vpc?ref=v0.13.1
    Assuming code from Terraform registry source: https://github.com/entigolabs/entigo-infralib-release.git//modules/aws/vpc
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 repo https://github.com/entigolabs/entigo-infralib-release.git//modules/aws/vpc is reachable via the git CLI.

Without ref:

...
Loading Sources..
  Processing External Module: git::https://github.com/entigolabs/entigo-infralib-release.git//modules/aws/vpc
    Assuming code from Terraform registry source: https://github.com/entigolabs/entigo-infralib-release.git//modules/aws/vpc
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 repo https://github.com/entigolabs/entigo-infralib-release.git//modules/aws/vpc is reachable via the git CLI.

Using git to clone the same repo in the same environment works:

# git clone https://github.com/entigolabs/entigo-infralib-release.git
Cloning into 'entigo-infralib-release'...
remote: Enumerating objects: 2083, done.
remote: Counting objects: 100% (391/391), done.
remote: Compressing objects: 100% (270/270), done.
remote: Total 2083 (delta 213), reused 268 (delta 114), pack-reused 1692
Receiving objects: 100% (2083/2083), 1.64 MiB | 2.65 MiB/s, done.
Resolving deltas: 100% (1092/1092), done.