Hi, I’m trying to troubleshoot an issue that is sh...
# help
m
Hi, I’m trying to troubleshoot an issue that is showing up the cost showing up as below picture (basically previous cost is $0). This is definitely wrong since all I did is making the rds instance size larger so should be much lower cost. I did run locally using infracost breakdown, then infracost diff. It shows the correct number. This is my setup in atlantis:
Copy code
- run: terragrunt show -json "$$PLANFILE" > "$$SHOWFILE"
      - run: |
            infracost breakdown --path="$$SHOWFILE" \
                                --format=json \
                                --log-level=info \
                                --out-file="$$INFRACOST_OUTPUT" \
                                --project-name="$$REPO_REL_DIR"
      - run: |
                    infracost comment github --repo xxx \
                                   --pull-request $$PULL_NUM \
                                   --path $$INFRACOST_OUTPUT \
                                   --github-token $$ATLANTIS_GH_TOKEN \
                                   --tag $$INFRACOST_COMMENT_TAG \
                                   --behavior new
I guess I’m trying to understand generally why we don’t need infracost diff inside cicd set up. I’m using terragrunt with atlantis as my set up. Any help would be appreciated, many thanks
picture here:
c
Hi Mengying, the diff isn’t needed because you’re passing a terraform plan json (the
$SHOWFILE
) to
infracost breakdown
and those contain both the current and planned states. Likewise the output of
breakdown
contains the cost breakdown for pervious and new states, which the comment command uses to calculate the diff.
So could there be a problem with the $SHOWFILE not containing the current state for some reason?
w
Given that you’re using GitHub, you can also use the GH App (which we made free today): https://www.infracost.io/docs/integrations/github_app/ that’s much simpler to setup
m
Yep for sure I can look into setting up github app some time.
great point for the showfile since that could be the reason for getting this inaccurate result
hi @crooked-daybreak-55253 jumping back to this thread. I’m still having trouble with the same resource. I can give you the showfile if needed. I validated the showfile contains the plan and looks good to me
however when I was doing the infracost output file, it doesn’t seem to recognize the resources in the pastBreakdown
c
yeah why don’t you DM me the showfile
do you see that the
prior_state
key has the expected resources in the showfile?