Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic: HasAttribute on non-object Type #75

Open
awilkins opened this issue May 28, 2020 · 0 comments · May be fixed by #76
Open

panic: HasAttribute on non-object Type #75

awilkins opened this issue May 28, 2020 · 0 comments · May be fixed by #76

Comments

@awilkins
Copy link
Contributor

I think this occurred while I was editing a map index e.g.

locals {
  subnets_by_az = {
    for subnet in var.vpc_config.subnets.private-data :
    subnet.availability_zone_id => subnet
  }
}
resource "aws_instance" "demo" {
  ami           = data.aws_ami.demo.id
  instance_type = "t2.micro"
  subnet_id     = local.subnets_by_az["euw1..."].id  # crash occurred editing this line where dots are

}

Stack trace

panic: HasAttribute on non-object Type

goroutine 1114 [running]:
github.com/zclconf/go-cty/cty.Type.HasAttribute(0x15c7d80, 0x1e522d0, 0x1d983e9, 0x1, 0x203000)
	/home/awilkins/gocode/pkg/mod/github.com/zclconf/go-cty@v1.2.1/cty/object_type.go:104 +0xbc
github.com/juliosueiras/terraform-lsp/helper.parseVariables(0xc00034ed30, 0x1, 0x1, 0xc0009f7988, 0x0, 0x0, 0x0, 0xffaaaabfeaaaa, 0x34, 0x20)
	/home/awilkins/thinkmoney/terraform-lsp/helper/file.go:144 +0x67d
github.com/juliosueiras/terraform-lsp/helper.parseVariables(0xc00034ed20, 0x2, 0x2, 0xc0009f7988, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/home/awilkins/thinkmoney/terraform-lsp/helper/file.go:150 +0x55f
github.com/juliosueiras/terraform-lsp/helper.ParseOtherAttr(...)
	/home/awilkins/thinkmoney/terraform-lsp/helper/file.go:157
github.com/juliosueiras/terraform-lsp/tfstructs.GetVarAttributeCompletion(0xc00034ed00, 0x4, 0x4, 0x0, 0x0, 0x0, 0xc000762800, 0x15c6d00, 0xc0007f94a0, 0xc0005182d7, ...)
	/home/awilkins/thinkmoney/terraform-lsp/tfstructs/vars.go:115 +0x195c
github.com/juliosueiras/terraform-lsp/langserver.TextDocumentComplete(0x15c66c0, 0xc0008da3f0, 0xc000518280, 0x47, 0x28, 0x33, 0x1, 0x0, 0x0, 0x0, ...)
	/home/awilkins/thinkmoney/terraform-lsp/langserver/complete.go:323 +0x18fe
reflect.Value.call(0x11241a0, 0x130d1f8, 0x13, 0x12b6e4b, 0x4, 0xc0008da6c0, 0x2, 0x2, 0x18, 0xc000a94060, ...)
	/snap/go/5759/src/reflect/value.go:460 +0x8ab
reflect.Value.Call(0x11241a0, 0x130d1f8, 0x13, 0xc0008da6c0, 0x2, 0x2, 0x2, 0xc0008da6c0, 0x1)
	/snap/go/5759/src/reflect/value.go:321 +0xb4
github.com/creachadair/jrpc2/handler.newHandler.func7(0x15c66c0, 0xc0008da3f0, 0xc0004c4480, 0x12186e0, 0xc0008da3f0, 0x113b4a0, 0x1e522d0)
	/home/awilkins/gocode/pkg/mod/github.com/creachadair/jrpc2@v0.4.2/handler/handler.go:222 +0x20a
github.com/creachadair/jrpc2/handler.Func.Handle(0xc000516ac0, 0x15c66c0, 0xc0008da3f0, 0xc0004c4480, 0x0, 0x0, 0x15c66c0, 0xc0008da3f0)
	/home/awilkins/gocode/pkg/mod/github.com/creachadair/jrpc2@v0.4.2/handler/handler.go:23 +0x44
github.com/creachadair/jrpc2.(*Server).invoke(0xc000580000, 0x15c6600, 0xc0004c44c0, 0x15a9980, 0xc000516ac0, 0xc0004c4480, 0x0, 0x0, 0x0, 0x0, ...)
	/home/awilkins/gocode/pkg/mod/github.com/creachadair/jrpc2@v0.4.2/server.go:288 +0x168
github.com/creachadair/jrpc2.(*Server).dispatch.func1(0xc000a263a0, 0xc000580000, 0xc000749680)
	/home/awilkins/gocode/pkg/mod/github.com/creachadair/jrpc2@v0.4.2/server.go:185 +0x91
created by github.com/creachadair/jrpc2.(*Server).dispatch
	/home/awilkins/gocode/pkg/mod/github.com/creachadair/jrpc2@v0.4.2/server.go:183 +0x137
[Info  - 11:18:06] Connection to server got closed. Server will restart.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant