https://infracost.io logo
#help
Title
# help
a

aloof-memory-96366

03/09/2023, 12:09 PM
Hey - we’re just getting started with Infrascost today, and have a question about the previous cost. Is there a way to dry-run the terraform code, so the tool knows what we have deployed already with terraform?
m

mysterious-teacher-68276

03/09/2023, 12:13 PM
Hey @aloof-memory-96366, there’s a number of ways to achieve this, can I ask what your setup is: 1. How are you using Infracost? 2. How do you normally deploy your Terraform code? Does your main branch represent what is deployed 3. What is your VCS system
a

aloof-memory-96366

03/09/2023, 12:14 PM
Using the cloud version, with github. The main branch does have what is deployed (split out into projects per environment)
m

mysterious-teacher-68276

03/09/2023, 12:14 PM
so are you using the github app?
a

aloof-memory-96366

03/09/2023, 12:14 PM
yeah
m

mysterious-teacher-68276

03/09/2023, 12:16 PM
ok so a follow up question: have you opened a PR yet with the GH app enabled, or have you just run on the main branch?
a

aloof-memory-96366

03/09/2023, 12:17 PM
yeah, I have done a PR (to add a new instance group to a GRP project)
m

mysterious-teacher-68276

03/09/2023, 12:20 PM
ok great, so going back to your original question. I think I might be a bit confused. What would you like to achieve. As if i understand correctly - your main branch has the current deployed infrastructure, so opening a PR to it will show the previous cost of the “deployed” infrastructure. Am I missing something?
a

aloof-memory-96366

03/09/2023, 12:20 PM
The previous cost of that project is about $150,000 a month
m

mysterious-teacher-68276

03/09/2023, 12:20 PM
right - so this suggests that you have some configuration issues
most likely Infracost is assuming an incorrect project structure
a

aloof-memory-96366

03/09/2023, 12:21 PM
ok
m

mysterious-teacher-68276

03/09/2023, 12:21 PM
have you added a config file yet?
a

aloof-memory-96366

03/09/2023, 12:21 PM
yeah (although it’s in the PR same PR, not on the main branch yet)
Copy code
version: 0.1
projects:
  - path: projects/dev-us
    terraform_workspace: infra-air-google-dev-us

  - path: projects/alpha-us
    terraform_workspace: infra-air-google-alpha-us

  - path: projects/uat-lcl-a
    terraform_workspace: infra-air-google-uat-lcl-a

  - path: projects/sandbox-uk
    terraform_workspace: infra-air-google-sandbox-uk

  - path: projects/production-uk
    terraform_workspace: infra-air-google-production-uk

  - path: projects/production-us
    terraform_workspace: infra-air-google-production-u2

  - path: projects/production-us2
    terraform_workspace: infra-air-google-production-us2

  - path: projects/production-au
    terraform_workspace: infra-air-google-production-au
m

mysterious-teacher-68276

03/09/2023, 12:22 PM
ok cool - are you free to jump on a call, I might be able to help you out easier
a

aloof-memory-96366

03/09/2023, 12:22 PM
Yes please, although I might need my colleague too (who maintains the TF repo). He’s around tomorrow if you’re free?
m

mysterious-teacher-68276

03/09/2023, 12:23 PM
Ok sure if you DM me your email i’ll ping you an invite
a

aloof-memory-96366

03/09/2023, 12:23 PM
thanks!
m

mysterious-teacher-68276

03/09/2023, 12:23 PM
can you send me your organization_id as well as I might be able to look into something in the meantime
2 Views