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
41.68k stars 9.41k forks source link

When i'm trying to run terraform init . I get the below error. #19458

Closed kranthivodnala closed 5 years ago

kranthivodnala commented 5 years ago

When i'm trying to run terraform init . I get the below error.

2018/11/24 21:39:45 [INFO] Terraform version: 0.12.0 alpha1 
2018/11/24 21:39:45 [INFO] Go runtime version: go1.11.1
2018/11/24 21:39:45 [INFO] CLI args: []string{"C:\\ProgramData\\chocolatey\\lib\\terraform\\tools\\terraform.exe", "plan"}
2018/11/24 21:39:45 [DEBUG] Attempting to open CLI config file: C:\Users\User\AppData\Roaming\terraform.rc
2018/11/24 21:39:45 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2018/11/24 21:39:45 [INFO] CLI command args: []string{"plan"}
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x20 pc=0x7fb807]

goroutine 1 [running]:
github.com/hashicorp/hcl2/hcl/hclsyntax.(*Body).PartialContent(0x0, 0x5dc3ac0, 0x0, 0x0, 0x30001, 0x0, 0x0, 0x0)
    /opt/gopath/src/github.com/hashicorp/terraform/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/structure.go:135 +0x87
github.com/hashicorp/terraform/configs.decodeResourceBlock(0xc00026fa00, 0x8, 0x34d9bef, 0x8, 0x0)
    /opt/gopath/src/github.com/hashicorp/terraform/configs/resource.go:88 +0x188
github.com/hashicorp/terraform/configs.(*Parser).loadConfigFile(0xc00043aa60, 0xc000468040, 0x9, 0x0, 0x0, 0x3824100, 0x9, 0x2)
    /opt/gopath/src/github.com/hashicorp/terraform/configs/parser_config.go:115 +0xe2e
github.com/hashicorp/terraform/configs.(*Parser).LoadConfigFile(0xc00043aa60, 0xc000468040, 0x9, 0x0, 0x0, 0x1, 0xc000468000)
    /opt/gopath/src/github.com/hashicorp/terraform/configs/parser_config.go:22 +0x4b
github.com/hashicorp/terraform/configs.(*Parser).loadFiles(0xc00043aa60, 0xc00040e790, 0x1, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, ...)
    /opt/gopath/src/github.com/hashicorp/terraform/configs/parser_config_dir.go:76 +0x347
github.com/hashicorp/terraform/configs.(*Parser).LoadConfigDir(0xc00043aa60, 0x34d2955, 0x1, 0x0, 0x1, 0xc000411f20, 0x1)
    /opt/gopath/src/github.com/hashicorp/terraform/configs/parser_config_dir.go:36 +0x12b
github.com/hashicorp/terraform/command.(*Meta).loadSingleModule(0xc00044c000, 0x34d2955, 0x1, 0x383dec0, 0xc00040d960, 0x0, 0x0)
    /opt/gopath/src/github.com/hashicorp/terraform/command/meta_config.go:85 +0x15f
github.com/hashicorp/terraform/command.(*Meta).loadBackendConfig(0xc00044c000, 0xc0003d24e0, 0xe, 0x0, 0x0, 0x0, 0x0)
    /opt/gopath/src/github.com/hashicorp/terraform/command/meta_config.go:122 +0x46
github.com/hashicorp/terraform/command.(*PlanCommand).Run(0xc00044c000, 0xc0000723f0, 0x0, 0x0, 0xc00040e240)
    /opt/gopath/src/github.com/hashicorp/terraform/command/plan.go:76 +0x7e2
github.com/mitchellh/cli.(*CLI).Run(0xc000412500, 0xc000412500, 0xc0003b9d20, 0x1)
    /opt/gopath/src/github.com/hashicorp/terraform/vendor/github.com/mitchellh/cli/cli.go:255 +0x20e
main.wrappedMain(0x0)
    /opt/gopath/src/github.com/hashicorp/terraform/main.go:222 +0xad3
main.realMain(0x0)
    /opt/gopath/src/github.com/hashicorp/terraform/main.go:99 +0xbe
main.main()
    /opt/gopath/src/github.com/hashicorp/terraform/main.go:35 +0x35
kranthivodnala commented 5 years ago
panic: can't use ElementIterator on null value
2018-11-24T22:20:52.250-0600 [DEBUG] plugin.terraform-provider-aws_v1.40.0-5-g4f24bc8b7_x4.exe:
2018-11-24T22:20:52.250-0600 [DEBUG] plugin.terraform-provider-aws_v1.40.0-5-g4f24bc8b7_x4.exe: goroutine 49 [running]:
2018-11-24T22:20:52.250-0600 [DEBUG] plugin.terraform-provider-aws_v1.40.0-5-g4f24bc8b7_x4.exe: github.com/zclconf/go-cty/cty.Value.ElementIterator(0x3585e40, 0xc00011c750, 0x0, 0x0, 0x32a2630, 0x14)
2018-11-24T22:20:52.250-0600 [DEBUG] plugin.terraform-provider-aws_v1.40.0-5-g4f24bc8b7_x4.exe:     /opt/gopath/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/zclconf/go-cty/cty/value_ops.go:858 +0xda
2018-11-24T22:20:52.251-0600 [DEBUG] plugin.terraform-provider-aws_v1.40.0-5-g4f24bc8b7_x4.exe: github.com/hashicorp/terraform/terraform.newResourceConfigShimmedComputedKeys(0x3585ec0, 0xc000094878, 0x2b861c0, 0xc00070ef90, 0xc00084c190, 0x0, 0x0, 0xbf6f46, 0x2b83ca0, 0xc00070f0b0)
2018-11-24T22:20:52.251-0600 [DEBUG] plugin.terraform-provider-aws_v1.40.0-5-g4f24bc8b7_x4.exe:     /opt/gopath/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/terraform/resource.go:298 +0xa40
2018-11-24T22:20:52.251-0600 [DEBUG] plugin.terraform-provider-aws_v1.40.0-5-g4f24bc8b7_x4.exe: github.com/hashicorp/terraform/terraform.NewResourceConfigShimmed(0x3585ec0, 0xc000094878, 0x2b861c0, 0xc00070ef90, 0xc00084c190, 0xc0001424b0)
2018-11-24T22:20:52.251-0600 [DEBUG] plugin.terraform-provider-aws_v1.40.0-5-g4f24bc8b7_x4.exe:     /opt/gopath/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/terraform/resource.go:239 +0x113
2018-11-24T22:20:52.251-0600 [DEBUG] plugin.terraform-provider-aws_v1.40.0-5-g4f24bc8b7_x4.exe: github.com/hashicorp/terraform/helper/schema.diffFromValues(0x3585ec0, 0xc0000947f0, 0x0, 0x0, 0x3585ec0, 0xc000094878, 0x2b861c0, 0xc00070ef90, 0xc00042ab00, 0x0, ...)
2018-11-24T22:20:52.252-0600 [DEBUG] plugin.terraform-provider-aws_v1.40.0-5-g4f24bc8b7_x4.exe:     /opt/gopath/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/shims.go:30 +0xc5
2018-11-24T22:20:52.252-0600 [DEBUG] plugin.terraform-provider-aws_v1.40.0-5-g4f24bc8b7_x4.exe: github.com/hashicorp/terraform/helper/schema.DiffFromValues(0x3585ec0, 0xc0000947f0, 0x0, 0x0, 0x3585ec0, 0xc000094878, 0x2b861c0, 0xc00070ef90, 0xc00042ab00, 0x0, ...)
2018-11-24T22:20:52.252-0600 [DEBUG] plugin.terraform-provider-aws_v1.40.0-5-g4f24bc8b7_x4.exe:     /opt/gopath/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/shims.go:18 +0xa7
2018-11-24T22:20:52.252-0600 [DEBUG] plugin.terraform-provider-aws_v1.40.0-5-g4f24bc8b7_x4.exe: github.com/hashicorp/terraform/helper/plugin.(*GRPCProviderServer).ApplyResourceChange(0xc0000947b8, 0x3584dc0, 0xc0002b2180, 0xc000056420, 0xc0000947b8, 0xc000606270, 0x2c5ba00)
2018-11-24T22:20:52.252-0600 [DEBUG] plugin.terraform-provider-aws_v1.40.0-5-g4f24bc8b7_x4.exe:     /opt/gopath/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/plugin/grpc_provider.go:584 +0x4ca
2018-11-24T22:20:52.253-0600 [DEBUG] plugin.terraform-provider-aws_v1.40.0-5-g4f24bc8b7_x4.exe: github.com/hashicorp/terraform/plugin/proto._Provider_ApplyResourceChange_Handler(0x31a9b00, 0xc0000947b8, 0x3584dc0, 0xc0002b2180, 0xc000200000, 0x0, 0x0, 0x0, 0x2, 0x222c2270616d225b)
2018-11-24T22:20:52.253-0600 [DEBUG] plugin.terraform-provider-aws_v1.40.0-5-g4f24bc8b7_x4.exe:     /opt/gopath/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/plugin/proto/plugin.pb.go:2974 +0x245
2018-11-24T22:20:52.253-0600 [DEBUG] plugin.terraform-provider-aws_v1.40.0-5-g4f24bc8b7_x4.exe: google.golang.org/grpc.(*Server).processUnaryRPC(0xc00005c480, 0x358dca0, 0xc00005cd80, 0xc00011e500, 0xc000209b00, 0x5880700, 0x0, 0x0, 0x0)
2018-11-24T22:20:52.253-0600 [DEBUG] plugin.terraform-provider-aws_v1.40.0-5-g4f24bc8b7_x4.exe:     /opt/gopath/src/github.com/terraform-providers/terraform-provider-aws/vendor/google.golang.org/grpc/server.go:982 +0x4d4
2018-11-24T22:20:52.253-0600 [DEBUG] plugin.terraform-provider-aws_v1.40.0-5-g4f24bc8b7_x4.exe: google.golang.org/grpc.(*Server).handleStream(0xc00005c480, 0x358dca0, 0xc00005cd80, 0xc00011e500, 0x0)
2018-11-24T22:20:52.253-0600 [DEBUG] plugin.terraform-provider-aws_v1.40.0-5-g4f24bc8b7_x4.exe:     /opt/gopath/src/github.com/terraform-providers/terraform-provider-aws/vendor/google.golang.org/grpc/server.go:1208 +0x130f
2018-11-24T22:20:52.254-0600 [DEBUG] plugin.terraform-provider-aws_v1.40.0-5-g4f24bc8b7_x4.exe: google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc00006ccc0, 0xc00005c480, 0x358dca0, 0xc00005cd80, 0xc00011e500)
2018-11-24T22:20:52.254-0600 [DEBUG] plugin.terraform-provider-aws_v1.40.0-5-g4f24bc8b7_x4.exe:     /opt/gopath/src/github.com/terraform-providers/terraform-provider-aws/vendor/google.golang.org/grpc/server.go:686 +0xa6
2018-11-24T22:20:52.254-0600 [DEBUG] plugin.terraform-provider-aws_v1.40.0-5-g4f24bc8b7_x4.exe: created by google.golang.org/grpc.(*Server).serveStreams.func1
2018-11-24T22:20:52.254-0600 [DEBUG] plugin.terraform-provider-aws_v1.40.0-5-g4f24bc8b7_x4.exe:     /opt/gopath/src/github.com/terraform-providers/terraform-provider-aws/vendor/google.golang.org/grpc/server.go:684 +0xa8
2018/11/24 22:20:52 [DEBUG] aws_instance.my-instance: apply errored, but we're indicating that via the Error pointer rather than returning it: rpc error: code = Unavailable desc = transport is closing
2018/11/24 22:20:52 [TRACE] <root>: eval: *terraform.EvalMaybeTainted
2018/11/24 22:20:52 [TRACE] EvalMaybeTainted: aws_instance.my-instance encountered an error during creation, so it is now marked as tainted
2018/11/24 22:20:52 [TRACE] <root>: eval: *terraform.EvalWriteState
2018/11/24 22:20:52 [TRACE] EvalWriteState: removing state object for aws_instance.my-instance
2018/11/24 22:20:52 [TRACE] <root>: eval: *terraform.EvalApplyProvisioners
2018/11/24 22:20:52 [TRACE] EvalApplyProvisioners: aws_instance.my-instance has no state, so skipping provisioners
2018/11/24 22:20:52 [TRACE] <root>: eval: *terraform.EvalMaybeTainted
2018/11/24 22:20:52 [TRACE] EvalMaybeTainted: aws_instance.my-instance encountered an error during creation, so it is now marked as tainted
2018/11/24 22:20:52 [TRACE] <root>: eval: *terraform.EvalWriteState
2018/11/24 22:20:52 [TRACE] EvalWriteState: removing state object for aws_instance.my-instance
2018/11/24 22:20:52 [TRACE] <root>: eval: *terraform.EvalIf
2018/11/24 22:20:52 [TRACE] <root>: eval: *terraform.EvalIf
2018/11/24 22:20:52 [TRACE] <root>: eval: *terraform.EvalWriteDiff
2018/11/24 22:20:52 [TRACE] <root>: eval: *terraform.EvalApplyPost
2018/11/24 22:20:52 [ERROR] <root>: eval: *terraform.EvalApplyPost, err: rpc error: code = Unavailable desc = transport is closing
2018/11/24 22:20:52 [ERROR] <root>: eval: *terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing
2018/11/24 22:20:52 [TRACE] [walkApply] Exiting eval tree: aws_instance.my-instance
2018/11/24 22:20:52 [TRACE] vertex "aws_instance.my-instance": visit complete
2018/11/24 22:20:52 [TRACE] dag/walk: upstream of "meta.count-boundary (EachMode fixup)" errored, so skipping
2018/11/24 22:20:52 [TRACE] dag/walk: upstream of "provider.aws (close)" errored, so skipping
2018/11/24 22:20:52 [TRACE] dag/walk: upstream of "root" errored, so skipping
2018-11-24T22:20:52.272-0600 [DEBUG] plugin: plugin process exited: path=C:\ProgramData\chocolatey\lib\terraform\tools\terraform-provider-aws_v1.40.0-5-g4f24bc8b7_x4.exe pid=16132 error="exit status 2"

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Terraform crashed! This is always indicative of a bug within Terraform.
A crash log has been placed at "crash.log" relative to your current
working directory. It would be immensely helpful if you could please
report the crash with Terraform[1] so that we can fix this.

When reporting bugs, please include your terraform version. That
information is available on the first line of crash.log. You can also
get it by running 'terraform --version' on the command line.

[1]: https://github.com/hashicorp/terraform/issues
kranthivodnala commented 5 years ago

Re-installed terrraform . Fixed the 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.