vmware / terraform-provider-vra7

Terraform VMware vRealize Automation 7 provider - VMware has ended the active development of this Terraform Provider, so this repository will no longer be updated.
https://registry.terraform.io/providers/vmware/vra7/latest
Mozilla Public License 2.0
38 stars 33 forks source link

panic when tfstate file exists but doesn't have much in it #52

Open karolsochk opened 4 years ago

karolsochk commented 4 years ago

vRA 7.x version 7.6 Terraform version 0.12.19 terraform-provider-vra7 plugin version 0.5.0

Describe the bug I got a panic on apply when I had a semi-empty tfstate file that contained this:

{
  "version": 4,
  "terraform_version": "0.12.20",
  "serial": 1,
  "lineage": "8019ce29-5d1c-a372-1533-b4bd24a7e1c0",
  "outputs": {},
  "resources": []
}

here's the error I got:

vra7_deployment.nazwa_resource: Creating...
vra7_deployment.nazwa_resource: Still creating... [10s elapsed]
vra7_deployment.nazwa_resource: Still creating... [20s elapsed]
vra7_deployment.nazwa_resource: Still creating... [30s elapsed]
vra7_deployment.nazwa_resource: Still creating... [40s elapsed]
vra7_deployment.nazwa_resource: Still creating... [50s elapsed]
vra7_deployment.nazwa_resource: Still creating... [1m0s elapsed]
vra7_deployment.nazwa_resource: Still creating... [1m10s elapsed]
vra7_deployment.nazwa_resource: Still creating... [1m20s elapsed]
vra7_deployment.nazwa_resource: Still creating... [1m30s elapsed]
vra7_deployment.nazwa_resource: Still creating... [1m40s elapsed]
vra7_deployment.nazwa_resource: Still creating... [1m50s elapsed]
vra7_deployment.nazwa_resource: Still creating... [2m0s elapsed]
vra7_deployment.nazwa_resource: Still creating... [2m10s elapsed]
vra7_deployment.nazwa_resource: Still creating... [2m20s elapsed]
vra7_deployment.nazwa_resource: Still creating... [2m30s elapsed]
vra7_deployment.nazwa_resource: Still creating... [2m40s elapsed]
vra7_deployment.nazwa_resource: Still creating... [2m50s elapsed]
vra7_deployment.nazwa_resource: Still creating... [3m0s elapsed]
vra7_deployment.nazwa_resource: Still creating... [3m10s elapsed]
vra7_deployment.nazwa_resource: Still creating... [3m20s elapsed]
vra7_deployment.nazwa_resource: Still creating... [3m30s elapsed]
vra7_deployment.nazwa_resource: Still creating... [3m40s elapsed]
vra7_deployment.nazwa_resource: Still creating... [3m50s elapsed]
vra7_deployment.nazwa_resource: Still creating... [4m0s elapsed]
vra7_deployment.nazwa_resource: Still creating... [4m10s elapsed]
vra7_deployment.nazwa_resource: Still creating... [4m20s elapsed]
vra7_deployment.nazwa_resource: Still creating... [4m30s elapsed]
vra7_deployment.nazwa_resource: Still creating... [4m40s elapsed]
vra7_deployment.nazwa_resource: Still creating... [4m50s elapsed]

Error: rpc error: code = Unavailable desc = transport is closing

panic: runtime error: invalid memory address or nil pointer dereference
2020-03-10T15:08:25.361+0100 [DEBUG] plugin.terraform-provider-vra7_v0.5.0_x4: [signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x19fb33e]
2020-03-10T15:08:25.361+0100 [DEBUG] plugin.terraform-provider-vra7_v0.5.0_x4:
2020-03-10T15:08:25.361+0100 [DEBUG] plugin.terraform-provider-vra7_v0.5.0_x4: goroutine 55 [running]:
2020-03-10T15:08:25.361+0100 [DEBUG] plugin.terraform-provider-vra7_v0.5.0_x4: github.com/terraform-providers/terraform-provider-vra7/vra7.waitForRequestCompletion(0xc0002ada40, 0x1c24e40, 0xc00039c300, 0xc00016c120, 0x24, 0x1, 0x1, 0x1, 0xc00055f080)
2020-03-10T15:08:25.361+0100 [DEBUG] plugin.terraform-provider-vra7_v0.5.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-vra7/vra7/resource_vra7_deployment.go:588 +0x1be
2020-03-10T15:08:25.361+0100 [DEBUG] plugin.terraform-provider-vra7_v0.5.0_x4: github.com/terraform-providers/terraform-provider-vra7/vra7.resourceVra7DeploymentCreate(0xc0002ada40, 0x1c24e40, 0xc00039c300, 0x2, 0x27bdc60)
2020-03-10T15:08:25.361+0100 [DEBUG] plugin.terraform-provider-vra7_v0.5.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-vra7/vra7/resource_vra7_deployment.go:198 +0xdda
2020-03-10T15:08:25.361+0100 [DEBUG] plugin.terraform-provider-vra7_v0.5.0_x4: github.com/terraform-providers/terraform-provider-vra7/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc00046e000, 0xc00012e460, 0xc00000cd00, 0x1c24e40, 0xc00039c300, 0xc000387301, 0xc000396240, 0x1af2200)
2020-03-10T15:08:25.361+0100 [DEBUG] plugin.terraform-provider-vra7_v0.5.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-vra7/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:287 +0x3b4
2020-03-10T15:08:25.361+0100 [DEBUG] plugin.terraform-provider-vra7_v0.5.0_x4: github.com/terraform-providers/terraform-provider-vra7/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc00046e080, 0xc0005bda58, 0xc00012e460, 0xc00000cd00, 0xc0002b0e08, 0xc0000ae620, 0x1af4120)
2020-03-10T15:08:25.361+0100 [DEBUG] plugin.terraform-provider-vra7_v0.5.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-vra7/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:285 +0x18f
2020-03-10T15:08:25.361+0100 [DEBUG] plugin.terraform-provider-vra7_v0.5.0_x4: github.com/terraform-providers/terraform-provider-vra7/vendor/github.com/hashicorp/terraform/helper/plugin.(*GRPCProviderServer).ApplyResourceChange(0xc0000ae040, 0x1ebfa20, 0xc0003865a0, 0xc00039d980, 0xc0000ae040, 0xc0003865a0, 0xc00022dbd0)
2020-03-10T15:08:25.361+0100 [DEBUG] plugin.terraform-provider-vra7_v0.5.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-vra7/vendor/github.com/hashicorp/terraform/helper/plugin/grpc_provider.go:885 +0x894
2020-03-10T15:08:25.361+0100 [DEBUG] plugin.terraform-provider-vra7_v0.5.0_x4: github.com/terraform-providers/terraform-provider-vra7/vendor/github.com/hashicorp/terraform/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0x1c1cee0, 0xc0000ae040, 0x1ebfa20, 0xc0003865a0, 0xc0000c7db0, 0x0, 0x1ebfa20, 0xc0003865a0, 0xc0000e6900, 0x448)
2020-03-10T15:08:25.361+0100 [DEBUG] plugin.terraform-provider-vra7_v0.5.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-vra7/vendor/github.com/hashicorp/terraform/internal/tfplugin5/tfplugin5.pb.go:3217 +0x23e
2020-03-10T15:08:25.362+0100 [DEBUG] plugin.terraform-provider-vra7_v0.5.0_x4: github.com/terraform-providers/terraform-provider-vra7/vendor/google.golang.org/grpc.(*Server).processUnaryRPC(0xc00055e300, 0x1eca9e0, 0xc00054cc00, 0xc0003a0000, 0xc000391f80, 0x2792d40, 0x0, 0x0, 0x0)
2020-03-10T15:08:25.362+0100 [DEBUG] plugin.terraform-provider-vra7_v0.5.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-vra7/vendor/google.golang.org/grpc/server.go:966 +0x470
2020-03-10T15:08:25.362+0100 [DEBUG] plugin.terraform-provider-vra7_v0.5.0_x4: github.com/terraform-providers/terraform-provider-vra7/vendor/google.golang.org/grpc.(*Server).handleStream(0xc00055e300, 0x1eca9e0, 0xc00054cc00, 0xc0003a0000, 0x0)
2020-03-10T15:08:25.362+0100 [DEBUG] plugin.terraform-provider-vra7_v0.5.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-vra7/vendor/google.golang.org/grpc/server.go:1245 +0xd25
2020-03-10T15:08:25.362+0100 [DEBUG] plugin.terraform-provider-vra7_v0.5.0_x4: github.com/terraform-providers/terraform-provider-vra7/vendor/google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc00003a0a0, 0xc00055e300, 0x1eca9e0, 0xc00054cc00, 0xc0003a0000)
2020-03-10T15:08:25.362+0100 [DEBUG] plugin.terraform-provider-vra7_v0.5.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-vra7/vendor/google.golang.org/grpc/server.go:685 +0x9f
2020-03-10T15:08:25.362+0100 [DEBUG] plugin.terraform-provider-vra7_v0.5.0_x4: created by github.com/terraform-providers/terraform-provider-vra7/vendor/google.golang.org/grpc.(*Server).serveStreams.func1
2020-03-10T15:08:25.362+0100 [DEBUG] plugin.terraform-provider-vra7_v0.5.0_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-vra7/vendor/google.golang.org/grpc/server.go:683 +0xa1
2020/03/10 15:08:25 [DEBUG] vra7_deployment.nazwa_resource: apply errored, but we're indicating that via the Error pointer rather than returning it: rpc error: code = Unavailable desc = transport is closing
2020/03/10 15:08:25 [TRACE] <root>: eval: *terraform.EvalMaybeTainted
2020/03/10 15:08:25 [TRACE] EvalMaybeTainted: vra7_deployment.nazwa_resource encountered an error during creation, so it is now marked as tainted
2020/03/10 15:08:25 [TRACE] <root>: eval: *terraform.EvalWriteState
2020/03/10 15:08:25 [TRACE] EvalWriteState: removing state object for vra7_deployment.nazwa_resource
2020/03/10 15:08:25 [TRACE] <root>: eval: *terraform.EvalApplyProvisioners
2020/03/10 15:08:25 [TRACE] EvalApplyProvisioners: vra7_deployment.nazwa_resource has no state, so skipping provisioners
2020/03/10 15:08:25 [TRACE] <root>: eval: *terraform.EvalMaybeTainted
2020/03/10 15:08:25 [TRACE] EvalMaybeTainted: vra7_deployment.nazwa_resource encountered an error during creation, so it is now marked as tainted
2020/03/10 15:08:25 [TRACE] <root>: eval: *terraform.EvalWriteState
2020/03/10 15:08:25 [TRACE] EvalWriteState: removing state object for vra7_deployment.nazwa_resource
2020/03/10 15:08:25 [TRACE] <root>: eval: *terraform.EvalIf
2020/03/10 15:08:25 [TRACE] <root>: eval: *terraform.EvalIf
2020/03/10 15:08:25 [TRACE] <root>: eval: *terraform.EvalWriteDiff
2020/03/10 15:08:25 [TRACE] <root>: eval: *terraform.EvalApplyPost
2020/03/10 15:08:25 [ERROR] <root>: eval: *terraform.EvalApplyPost, err: rpc error: code = Unavailable desc = transport is closing
2020/03/10 15:08:25 [ERROR] <root>: eval: *terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing
2020/03/10 15:08:25 [TRACE] [walkApply] Exiting eval tree: vra7_deployment.nazwa_resource
2020/03/10 15:08:25 [TRACE] vertex "vra7_deployment.nazwa_resource": visit complete
2020/03/10 15:08:25 [TRACE] dag/walk: upstream of "provider.vra7 (close)" errored, so skipping
2020/03/10 15:08:25 [TRACE] dag/walk: upstream of "meta.count-boundary (EachMode fixup)" errored, so skipping
2020/03/10 15:08:25 [TRACE] dag/walk: upstream of "root" errored, so skipping
2020-03-10T15:08:25.364+0100 [DEBUG] plugin: plugin process exited: path=/Users/karolsokolowski/GIT/ochk-terraform-vra7-tests/examples/create_centOS/.terraform/plugins/darwin_amd64/terraform-provider-vra7_v0.5.0_x4 pid=15270 error="exit status 2"
2020/03/10 15:08:25 [TRACE] statemgr.Filesystem: not making a backup, because the new snapshot is identical to the old
2020/03/10 15:08:25 [TRACE] statemgr.Filesystem: no state changes since last snapshot
2020/03/10 15:08:25 [TRACE] statemgr.Filesystem: writing snapshot at terraform.tfstate
2020/03/10 15:08:25 [TRACE] statemgr.Filesystem: removing lock metadata file .terraform.tfstate.lock.info
2020/03/10 15:08:25 [TRACE] statemgr.Filesystem: unlocking terraform.tfstate using fcntl flock
2020-03-10T15:08:25.376+0100 [DEBUG] plugin: plugin exited

!!!!!!!!!!!!!!!!!!!!!!!!!!! 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.

SECURITY WARNING: the "crash.log" file that was created may contain
sensitive information that must be redacted before it is safe to share
on the issue tracker.

[1]: https://github.com/hashicorp/terraform/issues

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

To Reproduce Steps to reproduce the behavior: I'm just trying to create a vra7 machine using terraform apply.

Expected behavior No panic, tfstate file written with new machine details

Prativa20 commented 4 years ago

@karolsochk Hi, can you please share the vra_terraform.log file and the also the main.tf file?