Git Product home page Git Product logo

Comments (8)

alikhajeh1 avatar alikhajeh1 commented on August 23, 2024

@dcarbone puzzling indeed! Here are some questions/pointers:

  1. Are you generating a TF plan JSON file using terraform show -json, e.g. shown in this example? Notice how that example shows the TF plan JSON file is generated from the TF plan binary file.

  2. Can you please add --log-level debug to that diff command, then see if the GH Action logs provide any clues?

  3. What exact CLI version is being installed? That's shown in the Setup action logs, e.g. this.

from actions.

dcarbone avatar dcarbone commented on August 23, 2024

@alikhajeh1: At this point I have tried using both base -> diff and plan -> show -> diff procedures, both produce the same empty comment output.

I will execute again with --debug and report back :)

from actions.

dcarbone avatar dcarbone commented on August 23, 2024

Hmm, so looks like I get quite a few errors and stacktraces.

Below is the first one, I can provide others if need be.

Error:

time="2022-06-23T19:09:17Z" level=debug parser=terraform_hcl msg="could not evaluate value for attr: for_each err: value is not a collection

Trace:

runtime/debug.Stack()
	/opt/hostedtoolcache/go/1.18.3/x64/src/runtime/debug/stack.go:24 +0x65
github.com/infracost/infracost/internal/hcl.(*Attribute).value.func1()
	/home/runner/work/infracost/infracost/internal/hcl/attribute.go:71 +0x79
panic({0x1c4a6a0, 0x26b9350})
	/opt/hostedtoolcache/go/1.18.3/x64/src/runtime/panic.go:838 +0x207
github.com/zclconf/go-cty/cty.Value.LengthInt({{{0x26d60c0?, 0xc0001f21cd?}}, {0x1c4a6a0?, 0xc00060c860?}})
	/home/runner/go/pkg/mod/github.com/zclconf/[email protected]/cty/value_ops.go:1087 +0x20d
github.com/zclconf/go-cty/cty.Value.AsValueMap({{{0x26d60c0?, 0xc0001f21cd?}}, {0x1c4a6a0?, 0xc00060c860?}})
	/home/runner/go/pkg/mod/github.com/zclconf/[email protected]/cty/value_ops.go:1318 +0x71
github.com/infracost/infracost/internal/hcl.buildObject({0xc0005ca1e0, 0x3, 0x3}, 0x40d687?, {{{0x26d60c0?, 0xc0001f21cd?}}, {0x1c4a6a0?, 0xc00060cb30?}}, 0x1)
	/home/runner/work/infracost/infracost/internal/hcl/attribute.go:242 +0xdaf
github.com/infracost/infracost/internal/hcl.buildObject({0xc0005ca1e0, 0x3, 0x3}, 0xc0005ca030?, {{{0x26d60c0?, 0xc0001f21cd?}}, {0x1c4a6a0?, 0xc00060cb30?}}, 0x0)
	/home/runner/work/infracost/infracost/internal/hcl/attribute.go:267 +0x5d7
github.com/infracost/infracost/internal/hcl.traverseVarAndSetCtx(0xc00060f3c0?, {0xc0005ca1e0, 0x3, 0x3}, {{{0x26d60c0?, 0xc0001f21cd?}}, {0x1c4a6a0?, 0xc00060cb30?}})
	/home/runner/work/infracost/infracost/internal/hcl/attribute.go:175 +0x27a
github.com/infracost/infracost/internal/hcl.(*Attribute).value(0xc00060f3c0, 0x2)
	/home/runner/work/infracost/infracost/internal/hcl/attribute.go:102 +0x6f1
github.com/infracost/infracost/internal/hcl.(*Attribute).value(0xc00060f3c0, 0x1)
	/home/runner/work/infracost/infracost/internal/hcl/attribute.go:124 +0x9f1
github.com/infracost/infracost/internal/hcl.(*Attribute).value(0xc00060f3c0, 0x0)
	/home/runner/work/infracost/infracost/internal/hcl/attribute.go:124 +0x9f1
github.com/infracost/infracost/internal/hcl.(*Attribute).Value(...)
	/home/runner/work/infracost/infracost/internal/hcl/attribute.go:65
github.com/infracost/infracost/internal/hcl.(*Evaluator).expandBlockForEaches(0xc000365c20, {0xc00060f320, 0x3, 0x3?})
	/home/runner/work/infracost/infracost/internal/hcl/evaluator.go:288 +0x174
github.com/infracost/infracost/internal/hcl.(*Evaluator).expandBlocks(0xc00039b500?, {0xc0003d19c0?, 0x26d61a0?, 0xc00017c180?})
	/home/runner/work/infracost/infracost/internal/hcl/evaluator.go:252 +0x38
github.com/infracost/infracost/internal/hcl.(*Evaluator).loadModules(0xc000365c20)
	/home/runner/work/infracost/infracost/internal/hcl/evaluator.go:634 +0x5b
github.com/infracost/infracost/internal/hcl.(*Evaluator).Run(0xc000365c20)
	/home/runner/work/infracost/infracost/internal/hcl/evaluator.go:144 +0xd2
github.com/infracost/infracost/internal/hcl.(*Parser).ParseDirectory(0xc00056e0b0)
	/home/runner/work/infracost/infracost/internal/hcl/parser.go:329 +0x4b0
github.com/infracost/infracost/internal/providers/terraform.(*HCLProvider).Modules(0xc00056d440)
	/home/runner/work/infracost/infracost/internal/providers/terraform/hcl_provider.go:248 +0x139
github.com/infracost/infracost/internal/providers/terraform.(*HCLProvider).LoadPlanJSONs(0xc00056d440)
	/home/runner/work/infracost/infracost/internal/providers/terraform/hcl_provider.go:216 +0x4a
github.com/infracost/infracost/internal/providers/terraform.(*HCLProvider).LoadResources(0xc000184f00?, 0x4?)
	/home/runner/work/infracost/infracost/internal/providers/terraform/hcl_provider.go:171 +0x35
main.(*parallelRunner).runProjectConfig(0xc0005dd3e0, 0xc0005e4780)
	/home/runner/work/infracost/infracost/cmd/infracost/run.go:474 +0x1269
main.(*parallelRunner).run.func1()
	/home/runner/work/infracost/infracost/cmd/infracost/run.go:310 +0x1c5
golang.org/x/sync/errgroup.(*Group).Go.func1()
	/home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:57 +0x67
created by golang.org/x/sync/errgroup.(*Group).Go
	/home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:54 +0x8d

from actions.

hugorut avatar hugorut commented on August 23, 2024

Hey @dcarbone, this is interesting, it looks like the for_each has an expression that can't be evaluated for some reason. Do you have any inkling as to which Terraform block this might be for? It's normally one that has a complex expression or uses a data block? The debug log might have some further information to help track it down, but we try and omit actual block names from there, as it would get very long. If you can locate the problem block and its for_each attribute it will be super helpful for us to try and fix this for you.

from actions.

hugorut avatar hugorut commented on August 23, 2024

But I would add that using the terraform show method and providing Infracost a plan JSON shouldn't run into this issue. So you could also try and run that method again with --debug and posting the logs here. There might be something more sinister going on that we're not catching.

from actions.

dcarbone avatar dcarbone commented on August 23, 2024

Hmm yeah so using the tf plan -> show operation results in the same output, but no obvious errors in the logs.

Unfortunately I don't have much time to spare debugging this much more. V1 works just fine for us, so I will unfortunately have to just stick with V1 for now until I can get more time to dedicate towards debugging this.

from actions.

alikhajeh1 avatar alikhajeh1 commented on August 23, 2024

@dcarbone in case you'd like to screenshare in the future, I'm happy to jump on a zoom call to debug - email me at [email protected] if you'd like to arrange that.

from actions.

alikhajeh1 avatar alikhajeh1 commented on August 23, 2024

Closing this issue as we can't reproduce the issue but feel free to email me or join https://www.infracost.io/community-chat to debug

from actions.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.