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.76k stars 9.56k forks source link

terraform fmt crash #7055

Closed j0sh3rs closed 8 years ago

j0sh3rs commented 8 years ago

Version = 0.6.16

Attempting to run terraform fmt on my repo (which has worked before) crashed out:

2016/06/07 15:29:28 [INFO] Terraform version: 0.6.16
2016/06/07 15:29:28 [DEBUG] Detected home directory from env var: /Users/jsimmonds
2016/06/07 15:29:28 [DEBUG] Discovered plugin: atlas = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-atlas
2016/06/07 15:29:28 [DEBUG] Discovered plugin: aws = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-aws
2016/06/07 15:29:28 [DEBUG] Discovered plugin: azure = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-azure
2016/06/07 15:29:28 [DEBUG] Discovered plugin: azurerm = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-azurerm
2016/06/07 15:29:28 [DEBUG] Discovered plugin: chef = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-chef
2016/06/07 15:29:28 [DEBUG] Discovered plugin: clc = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-clc
2016/06/07 15:29:28 [DEBUG] Discovered plugin: cloudflare = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-cloudflare
2016/06/07 15:29:28 [DEBUG] Discovered plugin: cloudstack = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-cloudstack
2016/06/07 15:29:28 [DEBUG] Discovered plugin: cobbler = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-cobbler
2016/06/07 15:29:28 [DEBUG] Discovered plugin: consul = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-consul
2016/06/07 15:29:28 [DEBUG] Discovered plugin: datadog = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-datadog
2016/06/07 15:29:28 [DEBUG] Discovered plugin: digitalocean = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-digitalocean
2016/06/07 15:29:28 [DEBUG] Discovered plugin: dme = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-dme
2016/06/07 15:29:28 [DEBUG] Discovered plugin: dnsimple = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-dnsimple
2016/06/07 15:29:28 [DEBUG] Discovered plugin: docker = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-docker
2016/06/07 15:29:28 [DEBUG] Discovered plugin: dyn = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-dyn
2016/06/07 15:29:28 [DEBUG] Discovered plugin: fastly = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-fastly
2016/06/07 15:29:28 [DEBUG] Discovered plugin: github = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-github
2016/06/07 15:29:28 [DEBUG] Discovered plugin: google = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-google
2016/06/07 15:29:28 [DEBUG] Discovered plugin: heroku = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-heroku
2016/06/07 15:29:28 [DEBUG] Discovered plugin: influxdb = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-influxdb
2016/06/07 15:29:28 [DEBUG] Discovered plugin: librato = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-librato
2016/06/07 15:29:28 [DEBUG] Discovered plugin: mailgun = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-mailgun
2016/06/07 15:29:28 [DEBUG] Discovered plugin: mysql = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-mysql
2016/06/07 15:29:28 [DEBUG] Discovered plugin: null = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-null
2016/06/07 15:29:28 [DEBUG] Discovered plugin: openstack = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-openstack
2016/06/07 15:29:28 [DEBUG] Discovered plugin: packet = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-packet
2016/06/07 15:29:28 [DEBUG] Discovered plugin: postgresql = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-postgresql
2016/06/07 15:29:28 [DEBUG] Discovered plugin: powerdns = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-powerdns
2016/06/07 15:29:28 [DEBUG] Discovered plugin: rundeck = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-rundeck
2016/06/07 15:29:28 [DEBUG] Discovered plugin: softlayer = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-softlayer
2016/06/07 15:29:28 [DEBUG] Discovered plugin: statuscake = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-statuscake
2016/06/07 15:29:28 [DEBUG] Discovered plugin: template = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-template
2016/06/07 15:29:28 [DEBUG] Discovered plugin: terraform = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-terraform
2016/06/07 15:29:28 [DEBUG] Discovered plugin: tls = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-tls
2016/06/07 15:29:28 [DEBUG] Discovered plugin: triton = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-triton
2016/06/07 15:29:28 [DEBUG] Discovered plugin: ultradns = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-ultradns
2016/06/07 15:29:28 [DEBUG] Discovered plugin: vcd = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-vcd
2016/06/07 15:29:28 [DEBUG] Discovered plugin: vsphere = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provider-vsphere
2016/06/07 15:29:28 [DEBUG] Discovered plugin: chef = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provisioner-chef
2016/06/07 15:29:28 [DEBUG] Discovered plugin: file = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provisioner-file
2016/06/07 15:29:28 [DEBUG] Discovered plugin: local-exec = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provisioner-local-exec
2016/06/07 15:29:28 [DEBUG] Discovered plugin: remote-exec = /usr/local/Cellar/terraform/0.6.16/bin/terraform-provisioner-remote-exec
2016/06/07 15:29:28 [DEBUG] Detected home directory from env var: /Users/jsimmonds
2016/06/07 15:29:28 [DEBUG] Attempting to open CLI config file: /Users/jsimmonds/.terraformrc
2016/06/07 15:29:28 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2016/06/07 15:29:28 [DEBUG] Detected home directory from env var: /Users/jsimmonds
2016/06/07 15:29:28 [DEBUG] waiting for all plugin processes to complete...
panic: runtime error: index out of range

goroutine 1 [running]:
panic(0xaa11c0, 0xc820012180)
    /usr/local/Cellar/go/1.6.2/libexec/src/runtime/panic.go:481 +0x3e6
github.com/hashicorp/terraform/vendor/github.com/hashicorp/hcl/hcl/printer.(*printer).objectType(0xc8202fdf80, 0xc8202f2ea0, 0x0, 0x0, 0x0)
    /private/tmp/terraform-20160518-48719-13lf0ll/terraform-0.6.16/src/github.com/hashicorp/terraform/vendor/github.com/hashicorp/hcl/hcl/printer/nodes.go:297 +0x1762
github.com/hashicorp/terraform/vendor/github.com/hashicorp/hcl/hcl/printer.(*printer).output(0xc8202fdf80, 0xaacb40, 0xc8202f2ea0, 0x0, 0x0, 0x0)
    /private/tmp/terraform-20160518-48719-13lf0ll/terraform-0.6.16/src/github.com/hashicorp/terraform/vendor/github.com/hashicorp/hcl/hcl/printer/nodes.go:158 +0xd1c
github.com/hashicorp/terraform/vendor/github.com/hashicorp/hcl/hcl/printer.(*printer).objectItem(0xc8202fdf80, 0xc8202f2e40, 0x0, 0x0, 0x0)
    /private/tmp/terraform-20160518-48719-13lf0ll/terraform-0.6.16/src/github.com/hashicorp/terraform/vendor/github.com/hashicorp/hcl/hcl/printer/nodes.go:206 +0x43f
github.com/hashicorp/terraform/vendor/github.com/hashicorp/hcl/hcl/printer.(*printer).output(0xc8202fdf80, 0xaaca60, 0xc8202f2e40, 0x0, 0x0, 0x0)
    /private/tmp/terraform-20160518-48719-13lf0ll/terraform-0.6.16/src/github.com/hashicorp/terraform/vendor/github.com/hashicorp/hcl/hcl/printer/nodes.go:152 +0x204
github.com/hashicorp/terraform/vendor/github.com/hashicorp/hcl/hcl/printer.(*printer).output(0xc8202fdf80, 0xb4d980, 0xc8202e3c00, 0x0, 0x0, 0x0)
    /private/tmp/terraform-20160518-48719-13lf0ll/terraform-0.6.16/src/github.com/hashicorp/terraform/vendor/github.com/hashicorp/hcl/hcl/printer/nodes.go:142 +0xb2f
github.com/hashicorp/terraform/vendor/github.com/hashicorp/hcl/hcl/printer.(*printer).output(0xc8202fdf80, 0xaac8a0, 0xc8202cef90, 0x0, 0x0, 0x0)
    /private/tmp/terraform-20160518-48719-13lf0ll/terraform-0.6.16/src/github.com/hashicorp/terraform/vendor/github.com/hashicorp/hcl/hcl/printer/nodes.go:107 +0x39f
github.com/hashicorp/terraform/vendor/github.com/hashicorp/hcl/hcl/printer.(*Config).Fprint(0x123c270, 0x14fb628, 0xc8202fdf10, 0x14fb650, 0xc8202cef90, 0x0, 0x0)
    /private/tmp/terraform-20160518-48719-13lf0ll/terraform-0.6.16/src/github.com/hashicorp/terraform/vendor/github.com/hashicorp/hcl/hcl/printer/printer.go:32 +0x1dc
github.com/hashicorp/terraform/vendor/github.com/hashicorp/hcl/hcl/printer.Format(0xc820306000, 0x5c3, 0xe00, 0x0, 0x0, 0x0, 0x0, 0x0)
    /private/tmp/terraform-20160518-48719-13lf0ll/terraform-0.6.16/src/github.com/hashicorp/terraform/vendor/github.com/hashicorp/hcl/hcl/printer/printer.go:59 +0x16c
github.com/hashicorp/terraform/vendor/github.com/hashicorp/hcl/hcl/fmtcmd.processFile(0xc8202e3b80, 0x18, 0x14f32b8, 0xc8201afcb0, 0x14f3380, 0xc8201ab950, 0x10100, 0x0, 0x0)
    /private/tmp/terraform-20160518-48719-13lf0ll/terraform-0.6.16/src/github.com/hashicorp/terraform/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/fmtcmd.go:59 +0x1a6
github.com/hashicorp/terraform/vendor/github.com/hashicorp/hcl/hcl/fmtcmd.walkDir.func1(0xc8202e3b80, 0x18, 0x14f30f8, 0xc8202fe0d0, 0x0, 0x0, 0x0, 0x0)
    /private/tmp/terraform-20160518-48719-13lf0ll/terraform-0.6.16/src/github.com/hashicorp/terraform/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/fmtcmd.go:95 +0x119
path/filepath.walk(0xc8202e3b80, 0x18, 0x14f30f8, 0xc8202fe0d0, 0xc8201eee00, 0x0, 0x0)
    /usr/local/Cellar/go/1.6.2/libexec/src/path/filepath/path.go:349 +0x80
path/filepath.walk(0xc8202e6fd0, 0xb, 0x14f30f8, 0xc8202a3c70, 0xc8201eee00, 0x0, 0x0)
    /usr/local/Cellar/go/1.6.2/libexec/src/path/filepath/path.go:374 +0x4fc
path/filepath.walk(0xc3ab68, 0x1, 0x14f30f8, 0xc8201b96c0, 0xc8201eee00, 0x0, 0x0)
    /usr/local/Cellar/go/1.6.2/libexec/src/path/filepath/path.go:374 +0x4fc
path/filepath.Walk(0xc3ab68, 0x1, 0xc8201eee00, 0x0, 0x0)
    /usr/local/Cellar/go/1.6.2/libexec/src/path/filepath/path.go:396 +0xe1
github.com/hashicorp/terraform/vendor/github.com/hashicorp/hcl/hcl/fmtcmd.walkDir(0xc3ab68, 0x1, 0xc8201ab960, 0x1, 0x1, 0x14f3380, 0xc8201ab950, 0x1000101, 0x0, 0x0)
    /private/tmp/terraform-20160518-48719-13lf0ll/terraform-0.6.16/src/github.com/hashicorp/terraform/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/fmtcmd.go:100 +0xc5
github.com/hashicorp/terraform/vendor/github.com/hashicorp/hcl/hcl/fmtcmd.Run(0xc8204f3998, 0x1, 0x1, 0xc8201ab960, 0x1, 0x1, 0x14f32b8, 0xc820030008, 0x14f3380, 0xc8201ab950, ...)
    /private/tmp/terraform-20160518-48719-13lf0ll/terraform-0.6.16/src/github.com/hashicorp/terraform/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/fmtcmd.go:124 +0x28e
github.com/hashicorp/terraform/command.(*FmtCommand).Run(0xc8201cca20, 0xc82000a430, 0x0, 0x0, 0xc8201aab30)
    /private/tmp/terraform-20160518-48719-13lf0ll/terraform-0.6.16/src/github.com/hashicorp/terraform/command/fmt.go:62 +0x602
github.com/hashicorp/terraform/vendor/github.com/mitchellh/cli.(*CLI).Run(0xc8201c6180, 0xc8201a9a70, 0x0, 0x0)
    /private/tmp/terraform-20160518-48719-13lf0ll/terraform-0.6.16/src/github.com/hashicorp/terraform/vendor/github.com/mitchellh/cli/cli.go:153 +0x5ee
main.wrappedMain(0x0)
    /private/tmp/terraform-20160518-48719-13lf0ll/terraform-0.6.16/src/github.com/hashicorp/terraform/main.go:142 +0xb05
main.realMain(0x0)
    /private/tmp/terraform-20160518-48719-13lf0ll/terraform-0.6.16/src/github.com/hashicorp/terraform/main.go:78 +0xa10
main.main()
    /private/tmp/terraform-20160518-48719-13lf0ll/terraform-0.6.16/src/github.com/hashicorp/terraform/main.go:21 +0x18
phinze commented 8 years ago

Hi @j0sh3rs - sorry for the crash!

Is there any chance you can narrow down the file / config snippet that causes the crash and share it? It's going to be tough to pin down the bug without a reproducing config.

mitchellh commented 8 years ago

Been awhile since a response here. Going to close. If you can repro this please open a new issue!

ghost commented 4 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.