https://infracost.io logo
#general
Title
# general
b

bulky-jackal-21121

06/13/2022, 10:26 AM
Hey guys. I’m to get the newer version of infracost reading my HCL but I get the following error (in 🧵 ). Does anyone know what’s wrong?
Copy code
Detected Terraform project at /Users/vutoff/Projects_Git/RBank/aws-terraform/dr/monolith
  ✔ Downloading Terraform modules
  ✔ Evaluating Terraform directory

Error: An unexpected error occurred

not a number
goroutine 27 [running]:
runtime/debug.Stack()
	runtime/debug/stack.go:24 +0x65
main.(*parallelRunner).run.func1.1()
	<http://github.com/infracost/infracost/cmd/infracost/run.go:298|github.com/infracost/infracost/cmd/infracost/run.go:298> +0x46
panic({0x270c6c0, 0x311fd50})
	runtime/panic.go:838 +0x207
<http://github.com/zclconf/go-cty/cty.Value.AsBigFloat(|github.com/zclconf/go-cty/cty.Value.AsBigFloat(>{{{0x313a1e8?, 0xc0001a7ada?}}, {0x270c6c0?, 0xc0034c4e30?}})
	<http://github.com/zclconf/go-cty@v1.10.0/cty/value_ops.go:1276|github.com/zclconf/go-cty@v1.10.0/cty/value_ops.go:1276> +0x145
<http://github.com/infracost/infracost/internal/providers/terraform.countReferences(0xc00131a360?)|github.com/infracost/infracost/internal/providers/terraform.countReferences(0xc00131a360?)>
	<http://github.com/infracost/infracost/internal/providers/terraform/hcl_provider.go:471|github.com/infracost/infracost/internal/providers/terraform/hcl_provider.go:471> +0x112
<http://github.com/infracost/infracost/internal/providers/terraform.(*HCLProvider).getResourceOutput(_|github.com/infracost/infracost/internal/providers/terraform.(*HCLProvider).getResourceOutput(_>, _)
	<http://github.com/infracost/infracost/internal/providers/terraform/hcl_provider.go:400|github.com/infracost/infracost/internal/providers/terraform/hcl_provider.go:400> +0x77a
<http://github.com/infracost/infracost/internal/providers/terraform.(*HCLProvider).marshalModule|github.com/infracost/infracost/internal/providers/terraform.(*HCLProvider).marshalModule>(0xc00076ed20, 0xc001c817d8)
	<http://github.com/infracost/infracost/internal/providers/terraform/hcl_provider.go:311|github.com/infracost/infracost/internal/providers/terraform/hcl_provider.go:311> +0x265
<http://github.com/infracost/infracost/internal/providers/terraform.(*HCLProvider).marshalModule(0xc00076ed20|github.com/infracost/infracost/internal/providers/terraform.(*HCLProvider).marshalModule(0xc00076ed20>, 0xc0006ac038)
	<http://github.com/infracost/infracost/internal/providers/terraform/hcl_provider.go:329|github.com/infracost/infracost/internal/providers/terraform/hcl_provider.go:329> +0x77b
<http://github.com/infracost/infracost/internal/providers/terraform.(*HCLProvider).modulesToPlanJSON(0xc00076ed20|github.com/infracost/infracost/internal/providers/terraform.(*HCLProvider).modulesToPlanJSON(0xc00076ed20>, 0xc0005d1aa0?)
	<http://github.com/infracost/infracost/internal/providers/terraform/hcl_provider.go:282|github.com/infracost/infracost/internal/providers/terraform/hcl_provider.go:282> +0x166
<http://github.com/infracost/infracost/internal/providers/terraform.(*HCLProvider).LoadPlanJSONs(0xc00076ed20)|github.com/infracost/infracost/internal/providers/terraform.(*HCLProvider).LoadPlanJSONs(0xc00076ed20)>
	<http://github.com/infracost/infracost/internal/providers/terraform/hcl_provider.go:205|github.com/infracost/infracost/internal/providers/terraform/hcl_provider.go:205> +0xa5
<http://github.com/infracost/infracost/internal/providers/terraform.(*HCLProvider).LoadResources(0xc00020ee40|github.com/infracost/infracost/internal/providers/terraform.(*HCLProvider).LoadResources(0xc00020ee40>?, 0xc0001a0010?)
	<http://github.com/infracost/infracost/internal/providers/terraform/hcl_provider.go:154|github.com/infracost/infracost/internal/providers/terraform/hcl_provider.go:154> +0x35
main.(*parallelRunner).runProjectConfig(0xc0003de9c0, 0xc00060c000)
	<http://github.com/infracost/infracost/cmd/infracost/run.go:461|github.com/infracost/infracost/cmd/infracost/run.go:461> +0x1109
main.(*parallelRunner).run.func1()
	<http://github.com/infracost/infracost/cmd/infracost/run.go:304|github.com/infracost/infracost/cmd/infracost/run.go:304> +0x1c5
<http://golang.org/x/sync/errgroup.(*Group).Go.func1()|golang.org/x/sync/errgroup.(*Group).Go.func1()>
	<http://golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c/errgroup/errgroup.go:57|golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c/errgroup/errgroup.go:57> +0x67
created by <http://golang.org/x/sync/errgroup.(*Group).Go|golang.org/x/sync/errgroup.(*Group).Go>
	<http://golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c/errgroup/errgroup.go:54|golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c/errgroup/errgroup.go:54> +0x8d

Environment:
Infracost v0.10.3

An unexpected error occurred. We've been notified of it and will investigate it soon. If you would like to follow-up, please copy the above output and create an issue at: <https://github.com/infracost/infracost/issues/new>
m

mysterious-teacher-68276

06/13/2022, 10:28 AM
Hey @bulky-jackal-21121 👋
This looks like Infracost is struggling to evaluate the
count
attributes in your project. I think this could be two problems: 1. you’re using an expression in HCL which is evaluated as
nil
because Infracost can’t resolve it for some reason. We’ll need some more info to try and debug this. 2. You’re setting a count attribute to a string somewhere in your infrastructure and Infracost is struggling to convert this. Either way, we definitely need to not panic here and give you a better output! 🙃 Do you mind opening an issue on our repo here: https://github.com/infracost/infracost/issues so that we can track this and direct other users to it if they’re having problems. We can continue the discussion there and try and find out what the root cause is. As a workaround, until we get this fixed, you can use the
--terraform-force-cli
flag for you project. This uses the Terraform binary to get outputs from your project. You can read more about the workaround here
b

bulky-jackal-21121

06/13/2022, 11:24 AM
Thanks, Hugo. I’ll try it.
7 Views