Giter VIP home page Giter VIP logo

Comments (6)

Tomasz-Kluczkowski avatar Tomasz-Kluczkowski commented on June 7, 2024

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

Project Module path Cost change New monthly cost
management ../../../tmp/base/management/terraform -£224 £0
management management/terraform +£224 £224
playground ../../../tmp/base/playground/terraform -£30 £0
playground playground/terraform +£30 £30

from infracost.

Tomasz-Kluczkowski avatar Tomasz-Kluczkowski commented on June 7, 2024

So in conclusion, am I doing something wrong?

from infracost.

aliscott avatar aliscott commented on June 7, 2024

@Tomasz-Kluczkowski what is your CONFIG_FILE variable set to? Also does it work if you copy the config file into /tmp/base before running infracost breakdown, e.g.:

    - |
      cp infracost.yml /tmp/base
      cd /tmp/base
      infracost breakdown --config-file=${CONFIG_FILE} \
                          --format=json \
                          --out-file=infracost-base.json

from infracost.

Tomasz-Kluczkowski avatar Tomasz-Kluczkowski commented on June 7, 2024

Hi,
I am running in gitlab. In my repo the .infracost.yml is in the root of the project.

CONFIG_FILE: ${CI_PROJECT_DIR}/.infracost.yml

from infracost.

Tomasz-Kluczkowski avatar Tomasz-Kluczkowski commented on June 7, 2024

I will try running with your instructions and report back.

from infracost.

Tomasz-Kluczkowski avatar Tomasz-Kluczkowski commented on June 7, 2024

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 change

This comment will be updated when code changes.

And also when resources were changed:

💰 Monthly cost will increase by £9 📈

Project Cost change New monthly cost
playground +£9 (+31%) £40

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?

from infracost.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.