infracost / infracost

Cloud cost estimates for Terraform in pull requests💰📉 Shift FinOps Left!

Home Page:https://infracost.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New `terraform test` support for variables in run block causes module evaluation to fail

brettcurtis opened this issue · comments

I've been messing around with the new native terraform test, and I think it manifests an issue with infracost in how you can add variables to the test files.

Check out this repo: https://github.com/osinfra-io/terraform-google-vpc/tree/main/tests

We can set variables in the test files instead of passing them in tfvars. That's probably why I see what I do in the Infracost UI.

unnamed

Thanks for raising this @brettcurtis. That's an interesting use case. How do you see Infracost interacting with these "tests" considering they are not actually real Infrastructure? What would be your ideal solution?

I'd want to see the cost of the modules in the fixtures directory in. The linked repo isn't the best example but if you look at this one: https://github.com/osinfra-io/terraform-google-project/tree/main/tests/fixtures it would be nice to know the cost of the "default" and "logging" module mostly so the developer writing the module understood code change cost impact but also for the consumer or the module to get an idea of how much it might cost to use it via the badges.