https://infracost.io logo
#help
Title
# help
s

stale-needle-387

03/07/2024, 11:34 AM
Anyone facing issues when running in a Terragrunt repo where the command just seems to freeze, with no useful logs indicating what went wrong (even with DEBUG logging)? Happy to share the entire log in PM.
Oh, after spamming "Enter" a few times, it's asking for a GitHub password, which is strange as everything should be accessible from my SSH key. Need to try and figure out what module it can't access
Hmmmm... It seems to be requiring access to a repo that is no longer used by us. Likely fetching it from Git history or something, or disregarding our version selection
For context, we used to pay for access to a collection of Terraform modules. We no longer have access to the original modules so cloned them to our own organization, re-pointing the module sources to that org. Infracost is looking to fetch data from the original location.
c

crooked-daybreak-55253

03/07/2024, 12:16 PM
Hi Robert, let me check with a team to see if anyone knows a way to prevent it from asking for the password
s

stale-needle-387

03/07/2024, 12:16 PM
I don't think the password is the issue any more. The issue is Infracost is looking for the incorrect module source - a location where I no longer have access. Even though the Terragrunt is pointing to a version of the modules that use the correct locations. Unless Infracost always tries to fetch all modules from Git history and download them? 1. We used to use private modules from github.com:gruntwork-io 2. We cloned all repos to our own org 3. We replaced all occurrences of "github.com:gruntwork-io" with "github.com:our-org", creating a new tag for each repo 4. We lost access to github.com:gruntwork-io 5. We can still run Terragrunt plan/apply locally on these modules 6. Infracost is looking for github.com:gruntwork-io still
c

crooked-daybreak-55253

03/07/2024, 12:25 PM
hmm we don’t try to get all the modules from the history. Maybe something is cached. Try deleting any .infracost directories and re running.
s

stale-needle-387

03/07/2024, 12:26 PM
This is my first time using infracost, so I doubt that would be an issue We performed the switch to our own org 6 months ago, and I've done a clean re-install of my OS since
c

crooked-daybreak-55253

03/07/2024, 12:27 PM
Ok then let’s try disabling the password prompt by setting
GIT_TERMINAL_PROMPT=0
as an env variable. Then hopefully we can see what it’s trying to download.
s

stale-needle-387

03/07/2024, 12:28 PM
The command completed, but it seems like it wasn't successful
Copy code
2024-03-07T12:27:56Z DBG failed to get transformed ssh url <https://github.com/gruntwork-io/terraform-aws-security.git>, retrying with ssh error="/usr/bin/git exited with 128: Cloning into 'testing/.infracost/terraform_modules/ed7ccc95ba11f56c329dad330e0f3382'...\nfatal: could not read Username for '<https://github.com>': terminal prompts disabled\n"
2024-03-07T12:28:02Z WRN Terragrunt config path /var/home/admin/Repos/immocapital/immo-infrastructure/feature/implement-infracost-in-pipelines/testing/eu-west-1/mgmt/networking/vpc/terragrunt.hcl returned module testing/.infracost/.terragrunt-cache/wwPmQNMUHP2vXjvGW_Mb5cNk80s-gJdH5n0Pv3q3EXcJ9msyFdwhlDU/modules/networking/vpc-mgmt with error: Error loading Terraform modules: could not load modules for path testing/.infracost/.terragrunt-cache/wwPmQNMUHP2vXjvGW_Mb5cNk80s-gJdH5n0Pv3q3EXcJ9msyFdwhlDU/modules/networking/vpc-mgmt could not load modules for path testing/.infracost/terraform_modules/6cb1aa003099313c9069418ec6b56df8/modules/networking/vpc-mgmt could not load modules for path testing/.infracost/terraform_modules/30f6f884192cb2add15736c5dc3cae1c/modules/vpc-flow-logs Failed to download remote module "vpc.vpc_flow_logs.s3_bucket" - could not download module git::git@github.com:gruntwork-io/terraform-aws-security.git?ref=v0.67.9 to cache error downloading '<ssh://git@github.com/gruntwork-io/terraform-aws-security.git?ref=v0.67.9>': /usr/bin/git exited with 128: Cloning into 'testing/.infracost/terraform_modules/ed7ccc95ba11f56c329dad330e0f3382'...
ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
 project_name= project_path=./testing/eu-west-1/mgmt/networking/vpc provider=terragrunt_dir
2024-03-07T12:28:02Z DBG Found terragrunt HCL working dir: testing/.infracost/.terragrunt-cache/wwPmQNMUHP2vXjvGW_Mb5cNk80s-gJdH5n0Pv3q3EXcJ9msyFdwhlDU/modules/networking/vpc-mgmt project_name= project_path=./testing/eu-west-1/mgmt/networking/vpc provider=terragrunt_dir
2024-03-07T12:28:02Z DBG IsCloudEnabled inferred from Config.EnabledDashboard is_cloud_enabled=false
2024-03-07T12:28:02Z DBG IsCloudEnabled inferred from Config.EnabledDashboard is_cloud_enabled=false
2024-03-07T12:28:02Z INF Starting: Retrieving cloud prices to calculate costs
2024-03-07T12:28:02Z DBG IsCloudEnabled inferred from Config.EnabledDashboard is_cloud_enabled=false
2024-03-07T12:28:02Z DBG Skipping sending project results since Infracost Cloud upload is not enabled.
2024-03-07T12:28:02Z DBG 'POST' request to '/event' using trace_id: 'e0def1b4-43df-497e-b957-fedc0a0f8f50'
2024-03-07T12:28:02Z DBG performing request method POST url <https://pricing.api.infracost.io/event> library=retryablehttp

Project: testing/eu-west-1/mgmt/networking/vpc

 Name  Monthly Qty  Unit  Monthly Cost 
                                       
 OVERALL TOTAL                   $0.00 
──────────────────────────────────
No cloud resources were detected

┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┓
┃ Project                                            ┃ Monthly cost ┃
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━┫
┃ testing/eu-west-1/mgmt/networking/vpc              ┃ $0.00        ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━┛
Reran after clearing
./testing/.infracost
, and the same issue is happening
Hmmm... Another module that's been through an identical migration is successful There's something strange going on.
c

crooked-daybreak-55253

03/07/2024, 12:35 PM
does that
<https://github.com/gruntwork-io/terraform-aws-security.git>
look familiar at all?
s

stale-needle-387

03/07/2024, 12:36 PM
Yes, that was a module we used to subscribe to, but no longer do. It has since moved to
immo-gruntwork/terraform-aws-security.git
(private repo)
c

crooked-daybreak-55253

03/07/2024, 12:45 PM
So it looks like
./testing/eu-west-1/mgmt/networking/vpc
sources a module called
modules/networking/vpc-mgmt
which sources
/modules/vpc-flow-logs
which sources
vpc.vpc_flow_logs.s3_bucket
. Maybe one of those modules in the chain is locked to an older version that still tries to load
gruntwork-io/terraform-aws-security.git
s

stale-needle-387

03/07/2024, 12:46 PM
Wouldn't that cause
terragrunt plan/apply
to fail too?
I think I have been making some mistakes during my testing, but not 100% sure where yet. There's definitely some strange behaviour with Infracost and the
.infracost
directory. Will spend a bit of time on my own again looking into it and report back
c

crooked-daybreak-55253

03/07/2024, 12:50 PM
plan/apply calls the terraform cli, we do our our
.tf
parsing in the infracost cli so there could be a bug in our parsing that causes us to hit this