Comments (8)
@dcarbone puzzling indeed! Here are some questions/pointers:
-
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. -
Can you please add
--log-level debug
to that diff command, then see if the GH Action logs provide any clues? -
What exact CLI version is being installed? That's shown in the Setup action logs, e.g. this.
from actions.
@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.
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.
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.
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.
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.
@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.
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)
- NodeJS12 actions are deprecated HOT 5
- No valid Terraform files found at the given path, try a different directory | Github action HOT 2
- github action infracost/actions/setup@v2 failing because node12 is blocked by github HOT 5
- Infracost
- Trouble with infracost diff HOT 2
- Error: No INFRACOST_API_KEY environment variable is set. HOT 10
- Running infracost action using `working-directory` HOT 6
- Infracost estimate: monthly cost will increase by $0.00 - When base branch is empty HOT 5
- feature: support multi api-key HOT 2
- Increment to Node 20 HOT 2
- Action not working with Terraform Cloud HOT 12
- Infracost comment github --tag HOT 5
- GITHUB_TOKEN permissions used by this action
- Not able to download modules from private hosting HOT 25
- Usage of PR_NUMBER while using reusable workflow . HOT 3
- post_condition seems to have disapeared from new GH Action HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from actions.