Hi guys, I am new here, nice to meet you all. We w...
# help
s
Hi guys, I am new here, nice to meet you all. We want to implement Infracost for the new projects, where the baseline(main)/target branches are currently empty. We keep the work in the ‘development’ branches. We’re using GitHub Actions. However, I’ve got a problem with PRs. The jobs fail because it cannot find the .tf files in the baseline branch (which is correct, because the branch is empty). I would like to achieve the state when the previous cost, based on the baseline branch, is equal to ‘0’, so it can compare with the report from the development branch Thank you in advance
b
Hello! Welcome, nice to meet you too 🙂
I know the easiest way to solve this issue - switch from GitHub Actions to use our GitHub app integration 😄
Is it something you can consider?
s
hi Vadim, thanks for the fast answer 🙂 I can give it a try.
b
Cool beans, please let me know how this goes 🙂
Oh I forgot to tell you how to do this, sorry. Login to https://dashboard.infracost.io/, pick your org and follow the Get Started flow 🙂 (in case you don't have PRs yet). Or you can go to Org Settings -> Integrations.
s
• Hi @busy-agent-35515 I’ve been able to get it working but I’d prefer to not store any credentials like sshkey or tokens outside GitHub, so still would prefer to get the GitHub Action working. Also, I’ve got the same problem
No valid terraform files found given path, try a different directory
b
Huh, this is curious. Okay, sad it didn't work for you 😞
You are using
infracost diff
command, right?
If you can detect the branch in your workflow, you could skip running
infracost breakdown
command on the base branch and instead pass an empty
infracost.json
to the
infracost diff
command in
--compare-to
flag. The empty file would look something like this
{ version: '0.2', projects: [] }
Let me know if you have questions 🙂
@stocky-city-287 Did this work? 🙂
s
Hey @busy-agent-35515, I just finished the adaptation and it works fine 🙂
b
Awesome! :) We’ll look into fixing the issue with GH app too :)
s
Cool, it would be perfect to not need to put an ‘empty’ json for the new projects 🙂 Anyway, thanks for the fast support!
b
I agree, however it is not obvious when the repo is new or TF code is not detected and needs more configuration. We opt in showing an error as this is the most common use case.