-
Notifications
You must be signed in to change notification settings - Fork 523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using config file produces misleading comment with module paths from clone of main branch and the real module paths #2740
Comments
Additionally I just tested this setup for a multi terraform project repo, and the result is similar to when using only one project - the reports are shown for base modules for main branch and for real modules. 💰 Monthly cost will not change
|
So in conclusion, am I doing something wrong? |
@Tomasz-Kluczkowski what is your
|
Hi, CONFIG_FILE: ${CI_PROJECT_DIR}/.infracost.yml |
I will try running with your instructions and report back. |
ok I changed the code to be: cp .infracost.yml /tmp/base
cd /tmp/base
infracost breakdown --config-file=.infracost.yml \
--format=json \
--out-file=infracost-base.json
- |
cd -
infracost diff --config-file=.infracost.yml \
--compare-to=/tmp/base/infracost-base.json \
--format=json \
--out-file=infracost.json Which produced expected results for no changes to resources: Infracost report💰 Monthly cost will not changeThis comment will be updated when code changes. And also when resources were changed: 💰 Monthly cost will increase by £9 📈
So I think your solution is correct @aliscott . Should then infracost's documentation here: https://gitlab.com/infracost/infracost-gitlab-ci/-/tree/master/examples/multi-project-config-file be updated? |
Since config file can accept anything between 1 and infinite amount of projects it should work fine for just 1 project too.
This is not the case.
I am testing infracost for a variety of projects (terraform and terragrunt) and building a common ci-job template in gitlab.
For this issue we are considering a simple terraform project, with 1 folder
terraform
where the code is , with no multiple environments.Consider this config file:
and running using this code (as per instructions here: https://gitlab.com/infracost/infracost-gitlab-ci/-/tree/master/examples/multi-project-config-file):
Produces the following comment:
Infracost report
💰 Monthly cost will not change
Where I would expect, that similarly to if I use
--path=./terraform
without config file, it will figure out there is only 1 project and provide result just for it.We can see that it correctly states:
Monthly cost will not change
, but it does it for 2 projects:../../../../tmp/base/terraform
which is the path for the cloned code from the main branchterraform
which is the path of the current branch.Am I doing something wrong or using config file for 1 project was never considered but should?
The text was updated successfully, but these errors were encountered: