witty-beard-49162
05/14/2025, 9:24 AMError loading Terraform modules: could not load modules for path . failed to parse file .infracost/terraform_modules/4be729b152ff5fe757b510249ccab486/main.tf diag: .infracost/terraform_modules/4be729b152ff5fe757b510249ccab486/main.tf:3,56-57: Missing argument separator; A comma is required to separate each function argument from the next.
My CI/CD job looks like this :
infracost:merge-request-checks:
tags:
- docker-M
stage: infracost:merge-request-checks
image:
# Always use the latest 0.10.x version to pick up bug fixes and new resources.
# See <https://www.infracost.io/docs/integrations/cicd/#docker-images> for other options
name: infracost/infracost:ci-0.10
entrypoint: [""]
script:
# If you use private modules, add an environment variable or secret
# called GIT_SSH_KEY with your private key, so Infracost can access
# private repositories (similar to how Terraform/Terragrunt does).
- mkdir -p ~/.ssh
`- eval `ssh-agent -s``
- echo "$GIT_SSH_KEY" | tr -d '\r' | ssh-add -
# Update this to <http://github.com|github.com>, <http://gitlab.com|gitlab.com>, <http://bitbucket.org|bitbucket.org>, <http://ssh.dev.azure.com|ssh.dev.azure.com> or your source control server's domain
- ssh-keyscan <http://gitlab.kazan.myworldline.com|gitlab.kazan.myworldline.com> >> ~/.ssh/known_hosts
# Clone the base branch of the pull request (e.g. main/master) into a temp directory.
- git clone $CI_REPOSITORY_URL --branch=$CI_MERGE_REQUEST_TARGET_BRANCH_NAME --single-branch /tmp/base
# Generate an Infracost cost snapshot from the comparison branch, so that Infracost can compare the cost difference.
- infracost breakdown --path=/tmp/base/${TF_ROOT} --format=json --out-file=infracost-base.json
# Generate an Infracost diff and save it to a JSON file.
- infracost diff --path=${TF_ROOT} --compare-to=infracost-base.json --format=json --out-file=infracost.json
- infracost comment gitlab --path=infracost.json --repo=$CI_PROJECT_PATH --merge-request=$CI_MERGE_REQUEST_IID --gitlab-server-url=$CI_SERVER_URL --gitlab-token=$GITLAB_TOKEN --behavior=update
variables:
INFRACOST_API_KEY: $INFRACOST_API_KEY
`GITLAB_TOKEN: $GITLAB_TOKEN # With api
scope and Maintainer role to post merge request comments`
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
artifacts:
paths:
- infracost.json
- infracost-base.json
expire_in: 1 days
My repository tree is simple as every tf file are in root (.)
Modules they used are in our private gitlab host (which is why i also tried with the ssh commands activated, exact same result)
Also the infracost commands are working perfectly locally
Let me know if more infos are needed for analysis =)witty-beard-49162
05/14/2025, 12:57 PMnot detected as registry module error="Registry module source is not in the correct format" project_name= project_path=. provider=terraform_dir
for every module !witty-beard-49162
05/14/2025, 1:38 PMsource = "git::<https://gitlab.kazan.myworldline.com/>...
i removed ssh script lines and added - echo "<https://git>:{password}@gitlab.kazan.myworldline.com" >> ~/.git-credentials
is it enough ? because it does not change the result =/
Also, my config for private module may not be complete : DEBUG module [MASKED]_mysql_master.client_cert.iam needs loading: not in cache project_name= project_path=. provider=terraform_dir
able-exabyte-30192
05/16/2025, 3:56 PM<http://main.tf:3,56-57|main.tf:3,56-57>: Missing argument separator; A comma is required to separate each function argument from the next.
- So this doesn't look like a module access issue (I think that's unrelated). I'd recommend focusing on the module it did download. It's saying that inside that module, there's a syntax error in main.tf, which is causing the issue. So probably want to look there and resolve that first.witty-beard-49162
05/19/2025, 6:03 AMreplicas = merge({ (var.region) = var.kms_key_id }, var.replicas)
should it be : replicas = merge({(var.region)=var.kms_key_id}, var.replicas)
?witty-beard-49162
05/19/2025, 6:10 AM