hashicorp / terraform

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
https://www.terraform.io/
Other
42.35k stars 9.49k forks source link

panic: AttributeTypes on non-object Type #27285

Closed MindAwake closed 3 years ago

MindAwake commented 3 years ago

Hi there,

We receive terraform crash after terraform apply on one of our module.

Terraform v0.13.5
+ provider registry.terraform.io/hashicorp/archive v2.0.0
+ provider registry.terraform.io/hashicorp/aws v3.21.0
+ provider registry.terraform.io/hashicorp/dns v3.0.0
+ provider registry.terraform.io/hashicorp/external v2.0.0
+ provider registry.terraform.io/hashicorp/local v1.4.0
+ provider registry.terraform.io/hashicorp/null v3.0.0
+ provider registry.terraform.io/hashicorp/random v3.0.0
+ provider registry.terraform.io/hashicorp/template v2.2.0
+ provider registry.terraform.io/terraform-providers/postgresql v1.7.2

tracelog looks like this:


goroutine 12846 [running]:
github.com/zclconf/go-cty/cty.Type.AttributeTypes(...)
        /home/circleci/project/project/vendor/github.com/zclconf/go-cty/cty/object_type.go:134
github.com/zclconf/go-cty/cty/convert.unifyObjectTypesToMap(0xc004fef428, 0x2, 0x2, 0xc005327501, 0x0, 0x411ecb0, 0xc004df9980, 0x5, 0x5)
        /home/circleci/project/project/vendor/github.com/zclconf/go-cty/cty/convert/unify.go:224 +0x59b
github.com/zclconf/go-cty/cty/convert.unifyTupleTypesToList(0xc004fef428, 0x2, 0x2, 0x1, 0x40, 0x2c3534a, 0x0, 0xc004fef108, 0x40a3a2)
        /home/circleci/project/project/vendor/github.com/zclconf/go-cty/cty/convert/unify.go:343 +0x334
github.com/zclconf/go-cty/cty/convert.unifyTupleTypes(0xc004fef428, 0x2, 0x2, 0xc004de0001, 0x2, 0x2, 0x2cef420, 0xc005307160, 0x21d08c0)
        /home/circleci/project/project/vendor/github.com/zclconf/go-cty/cty/convert/unify.go:274 +0x6ab
github.com/zclconf/go-cty/cty/convert.unify(0xc004fef428, 0x2, 0x2, 0xc005307101, 0x2cef2e0, 0x411ecb0, 0x0, 0x0, 0x0)
        /home/circleci/project/project/vendor/github.com/zclconf/go-cty/cty/convert/unify.go:55 +0x509
github.com/zclconf/go-cty/cty/convert.UnifyUnsafe(...)
        /home/circleci/project/project/vendor/github.com/zclconf/go-cty/cty/convert/public.go:82
github.com/hashicorp/hcl/v2/hclsyntax.(*ConditionalExpr).Value(0xc000baaf50, 0xc004dcfe20, 0x0, 0xc004fef700, 0x1, 0x1, 0x0, 0x0, 0x0)
        /home/circleci/project/project/vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression.go:546 +0x1d57
github.com/hashicorp/terraform/lang.(*Scope).EvalExpr(0xc0046e7d10, 0x2cee0e0, 0xc000baaf50, 0x2cef2e0, 0x411ecb0, 0x0, 0x0, 0xc0065c58d0, 0x1, 0x1, ...)
        /home/circleci/project/project/lang/eval.go:93 +0x1b3
github.com/hashicorp/terraform/terraform.(*BuiltinEvalContext).EvaluateExpr(0xc001ac3e10, 0x2cee0e0, 0xc000baaf50, 0x2cef2e0, 0x411ecb0, 0x0, 0x0, 0x0, 0x2, 0xc0034ba000, ...)
        /home/circleci/project/project/terraform/eval_context_builtin.go:286 +0x1ef
github.com/hashicorp/terraform/terraform.(*EvalLocal).Eval(0xc0021c4b00, 0x2d31320, 0xc001ac3e10, 0x1, 0x1, 0xc00273bc00, 0x200000000000000)
        /home/circleci/project/project/terraform/eval_local.go:43 +0x6d7
github.com/hashicorp/terraform/terraform.EvalRaw(0x2c86f40, 0xc0021c4b00, 0x2d31320, 0xc001ac3e10, 0x22ba9a0, 0x3fae442, 0x221a960, 0xc0033747f0)
        /home/circleci/project/project/terraform/eval.go:49 +0xc7
github.com/hashicorp/terraform/terraform.Eval(0x2c86f40, 0xc0021c4b00, 0x2d31320, 0xc001ac3e10, 0xc0021c4b00, 0x2c86f40, 0xc0021c4b00, 0x0)
        /home/circleci/project/project/terraform/eval.go:35 +0x4d
github.com/hashicorp/terraform/terraform.(*Graph).walk.func1(0x24d8700, 0xc003376180, 0x0, 0x0, 0x0)
        /home/circleci/project/project/terraform/graph.go:73 +0xc77
github.com/hashicorp/terraform/dag.(*Walker).walkVertex(0xc000fa4fc0, 0x24d8700, 0xc003376180, 0xc005eed0c0)
        /home/circleci/project/project/dag/walk.go:387 +0x357
created by github.com/hashicorp/terraform/dag.(*Walker).Update
        /home/circleci/project/project/dag/walk.go:309 +0x11d7

Here is my full crash.log:

crash.zip

alisdair commented 3 years ago

Hi @MindAwake, thanks for reporting this.

Unfortunately it's difficult for us to fix this crash without being able to reproduce it. Can you provide a minimal but complete Terraform configuration which exhibits the same behaviour?

paboum commented 3 years ago

Unfortunately it's difficult for us to fix this crash without being able to reproduce it. Can you provide a minimal but complete Terraform configuration which exhibits the same behaviour?

Have you tried expanding crash.log so that it contains mininmum but complete information for debugging fatal errors?

alisdair commented 3 years ago

The crash log does not contain complete information for debugging fatal errors. In order to understand how the panic happened, we need to be able to reproduce the problem. For this reason, we ask for a small Terraform configuration which allows us to investigate and fix the bug.

mildwonkey commented 3 years ago

We have addressed a large number of similar-sounding panics in the last several releases, so I'm cautiously optimistic the same configuration will result in a useful error message in the future. If you still do get this panic, we will need a full reproduction case.

I'm going to close this, since there hasn't been a response, but if you are still experiencing a problem please open a new issue or ask in the community forums. Thanks!

github-actions[bot] commented 3 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.