vmware / terraform-provider-vcf

Terraform Provider for VMware Cloud Foundation
https://registry.terraform.io/providers/vmware/vcf/
Mozilla Public License 2.0
22 stars 9 forks source link

Provider crashes when host commission is tried #127

Closed pradeep17j closed 7 months ago

pradeep17j commented 7 months ago

Code of Conduct

Terraform

1.7.3

Terraform Provider

1.7.3

VMware Cloud Foundation

0.8.1

Description

Host comm operation crashes the provider

Following is the variable file used


bash-4.2$ cat variables.tf

-----------------------------------------------

SDDC Manager Authentication Variables

-----------------------------------------------

variable "sddc_manager_host" { description = "SDDC Manager FQDN." type = string default = "sddc-manager.vrack.vsphere.local" } variable "sddc_manager_username" { description = "UI username for the SDDC Manager appliance." type = string default = "vcf" } variable "sddc_manager_password" { description = "Password for the admin username" type = string default = "VMware123!" }

-----------------------------------------------

Host Configuration Variables

-----------------------------------------------

variable "wld_hosts" { description = "Hosts to be commissioned into SDDC Manager." type = map(list(string)) default = {

"host_fqdn" = [ "Network Pool UUID", "password", "storage_type", "vmnic0", "vmnic1" ]

"esxi-5.vrack.vsphere.local" = [ "f19b1e0e-3135-497f-9f9b-470482645d0d", "EvoSddc!2016", "VSAN", "vmnic0", "vmnic1" ]

} }

Plan was successful


Terraform will perform the following actions:

vcf_host.host["esxi-5.vrack.vsphere.local"] will be created

Plan: 1 to add, 0 to change, 0 to destroy. 2024-02-20T14:05:51.152-0800 [DEBUG] command: asking for input: "\nDo you want to perform these actions?"

Do you want to perform these actions? Terraform will perform the actions described above. Only 'yes' will be accepted to approve.

Enter a value: yes

Apply crashes the provider

2024-02-20T14:05:53.329-0800 [INFO] Starting apply for vcf_host.host["esxi-5.vrack.vsphere.local"] 2024-02-20T14:05:53.329-0800 [TRACE] terraform.contextPlugins: Schema for provider "registry.terraform.io/vmware/vcf" is in the global cache 2024-02-20T14:05:53.329-0800 [DEBUG] vcf_host.host["esxi-5.vrack.vsphere.local"]: applying the planned Create change 2024-02-20T14:05:53.329-0800 [TRACE] GRPCProvider: ApplyResourceChange 2024-02-20T14:05:53.329-0800 [TRACE] GRPCProvider: GetProviderSchema 2024-02-20T14:05:53.329-0800 [TRACE] GRPCProvider: returning cached schema: EXTRA_VALUE_AT_END=registry.terraform.io/vmware/vcf 2024-02-20T14:05:53.330-0800 [TRACE] provider.terraform-provider-vcf_v0.8.1: Received request: @module=sdk.proto tf_provider_addr=provider tf_req_id=010d9fe5-725b-d4c9-f4e4-f4c0d3fae952 tf_rpc=App lyResourceChange tf_proto_version=5.4 tf_resource_type=vcf_host @caller=github.com/hashicorp/terraform-plugin-go@v0.21.0/tfprotov5/tf5server/server.go:832 timestamp=2024-02-20T14:05:53.329-0800 2024-02-20T14:05:53.330-0800 [TRACE] provider.terraform-provider-vcf_v0.8.1: Sending request downstream: tf_provider_addr=provider tf_req_id=010d9fe5-725b-d4c9-f4e4-f4c0d3fae952 @caller=github.com /hashicorp/terraform-plugin-go@v0.21.0/tfprotov5/internal/tf5serverlogging/downstream_request.go:20 tf_proto_version=5.4 tf_resource_type=vcf_host tf_rpc=ApplyResourceChange @module=sdk.proto time stamp=2024-02-20T14:05:53.329-0800 2024-02-20T14:05:53.330-0800 [TRACE] provider.terraform-provider-vcf_v0.8.1: Calling downstream: @module=sdk.helper_schema @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.32.0/helper/schem a/resource.go:908 tf_provider_addr=provider tf_req_id=010d9fe5-725b-d4c9-f4e4-f4c0d3fae952 tf_resource_type=vcf_host tf_rpc=ApplyResourceChange timestamp=2024-02-20T14:05:53.329-0800 2024-02-20T14:05:53.330-0800 [TRACE] provider.terraform-provider-vcf_v0.8.1: Served request: @caller=runtime/panic.go:914 tf_proto_version=5.4 tf_req_id=010d9fe5-725b-d4c9-f4e4-f4c0d3fae952 tf_rpc =ApplyResourceChange @module=sdk.proto tf_provider_addr=provider tf_resource_type=vcf_host timestamp=2024-02-20T14:05:53.329-0800 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: panic: interface conversion: interface {} is api_client.CloudBuilderClient, not api_client.SddcManagerClient 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: goroutine 20 [running]: 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: github.com/vmware/terraform-provider-vcf/internal/provider.resourceHostCreate({0x12ee8e0?, 0xc0004db730?}, 0x0?, {0xfba b60?, 0xc00049e680?}) 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: github.com/vmware/terraform-provider-vcf/internal/provider/resource_host.go:73 +0x7b8 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).create(0xc000159ea0, {0x12ee838, 0xc0004c1ef0}, 0xd?, {0xfbab60, 0xc00049e680}) 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: github.com/hashicorp/terraform-plugin-sdk/v2@v2.32.0/helper/schema/resource.go:778 +0x11b 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).Apply(0xc000159ea0, {0x12ee838, 0xc0004c1ef0}, 0 xc000319790, 0xc0004b7c80, {0xfbab60, 0xc00049e680}) 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: github.com/hashicorp/terraform-plugin-sdk/v2@v2.32.0/helper/schema/resource.go:909 +0xa89 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(GRPCProviderServer).ApplyResourceChange(0xc0001b7d10, {0x1 2ee838?, 0xc0004c1e00?}, 0xc0003b1d10) 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: github.com/hashicorp/terraform-plugin-sdk/v2@v2.32.0/helper/schema/grpc_provider.go:1077 +0xdbc 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(server).ApplyResourceChange(0xc0000ef180, {0x12ee838?, 0 xc0004c1410?}, 0xc0004daf50) 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: github.com/hashicorp/terraform-plugin-go@v0.21.0/tfprotov5/tf5server/server.go:845 +0x3d0 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x1135f40? , 0xc0000ef180}, {0x12ee838, 0xc0004c1410}, 0xc0004b7400, 0x0) 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: github.com/hashicorp/terraform-plugin-go@v0.21.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:518 +0x169 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: google.golang.org/grpc.(Server).processUnaryRPC(0xc00061c800, {0x12ee838, 0xc0004c1380}, {0x12f2fd8, 0xc0002421a0}, 0x c0002c97a0, 0xc000252d80, 0x1be03b8, 0x0) 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: google.golang.org/grpc@v1.61.0/server.go:1385 +0xe03 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: google.golang.org/grpc.(Server).handleStream(0xc00061c800, {0x12f2fd8, 0xc0002421a0}, 0xc0002c97a0) 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: google.golang.org/grpc@v1.61.0/server.go:1796 +0xfec 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: google.golang.org/grpc.(Server).serveStreams.func2.1() 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: google.golang.org/grpc@v1.61.0/server.go:1029 +0x8b 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: created by google.golang.org/grpc.(Server).serveStreams.func2 in goroutine 10 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: google.golang.org/grpc@v1.61.0/server.go:1040 +0x135 2024-02-20T14:05:53.333-0800 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/vmware/vcf/0.8.1/linux_amd64/terraform-provider-vcf_v0.8.1 pid=10573 error="ex it status 2" 2024-02-20T14:05:53.333-0800 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF" 2024-02-20T14:05:53.334-0800 [ERROR] plugin.(GRPCProvider).ApplyResourceChange: error="rpc error: code = Canceled desc = context canceled" 2024-02-20T14:05:53.334-0800 [TRACE] maybeTainted: vcf_host.host["esxi-5.vrack.vsphere.local"] encountered an error during creation, so it is now marked as tainted 2024-02-20T14:05:53.334-0800 [TRACE] terraform.contextPlugins: Schema for provider "registry.terraform.io/vmware/vcf" is in the global cache 2024-02-20T14:05:53.334-0800 [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState to workingState for vcf_host.host["esxi-5.vrack.vsphere.local"] 2024-02-20T14:05:53.334-0800 [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState: removing state object for vcf_host.host["esxi-5.vrack.vsphere.local"] 2024-02-20T14:05:53.334-0800 [TRACE] evalApplyProvisioners: vcf_host.host["esxi-5.vrack.vsphere.local"] is tainted, so skipping provisioning 2024-02-20T14:05:53.334-0800 [TRACE] maybeTainted: vcf_host.host["esxi-5.vrack.vsphere.local"] was already tainted, so nothing to do 2024-02-20T14:05:53.334-0800 [TRACE] terraform.contextPlugins: Schema for provider "registry.terraform.io/vmware/vcf" is in the global cache 2024-02-20T14:05:53.334-0800 [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState to workingState for vcf_host.host["esxi-5.vrack.vsphere.local"] 2024-02-20T14:05:53.334-0800 [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState: removing state object for vcf_host.host["esxi-5.vrack.vsphere.local"] 2024-02-20T14:05:53.334-0800 [TRACE] statemgr.Filesystem: not making a backup, because the new snapshot is identical to the old 2024-02-20T14:05:53.335-0800 [TRACE] statemgr.Filesystem: no state changes since last snapshot 2024-02-20T14:05:53.335-0800 [TRACE] statemgr.Filesystem: writing snapshot at terraform.tfstate 2024-02-20T14:05:53.335-0800 [DEBUG] State storage statemgr.Filesystem declined to persist a state snapshot 2024-02-20T14:05:53.335-0800 [ERROR] vertex "vcf_host.host[\"esxi-5.vrack.vsphere.local\"]" error: Request cancelled 2024-02-20T14:05:53.335-0800 [TRACE] vertex "vcf_host.host[\"esxi-5.vrack.vsphere.local\"]": visit complete, with errors 2024-02-20T14:05:53.335-0800 [TRACE] dag/walk: upstream of "provider[\"registry.terraform.io/vmware/vcf\"] (close)" errored, so skipping 2024-02-20T14:05:53.335-0800 [TRACE] dag/walk: upstream of "root" errored, so skipping 2024-02-20T14:05:53.335-0800 [TRACE] statemgr.Filesystem: not making a backup, because the new snapshot is identical to the old 2024-02-20T14:05:53.336-0800 [TRACE] statemgr.Filesystem: no state changes since last snapshot 2024-02-20T14:05:53.336-0800 [TRACE] statemgr.Filesystem: writing snapshot at terraform.tfstate ╷ │ Error: Request cancelled │ │ with vcf_host.host["esxi-5.vrack.vsphere.local"], │ on main.tf line 4, in resource "vcf_host" "host": │ 4: resource "vcf_host" "host" { │ │ The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled. ╵ 2024-02-20T14:05:53.336-0800 [TRACE] statemgr.Filesystem: removing lock metadata file .terraform.tfstate.lock.info 2024-02-20T14:05:53.336-0800 [TRACE] statemgr.Filesystem: unlocking terraform.tfstate using fcntl flock

Stack trace from the terraform-provider-vcf_v0.8.1 plugin:

panic: interface conversion: interface {} is api_client.CloudBuilderClient, not api_client.SddcManagerClient

goroutine 20 [running]: github.com/vmware/terraform-provider-vcf/internal/provider.resourceHostCreate({0x12ee8e0?, 0xc0004db730?}, 0x0?, {0xfbab60?, 0xc00049e680?}) github.com/vmware/terraform-provider-vcf/internal/provider/resource_host.go:73 +0x7b8 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).create(0xc000159ea0, {0x12ee838, 0xc0004c1ef0}, 0xd?, {0xfbab60, 0xc00049e680}) github.com/hashicorp/terraform-plugin-sdk/v2@v2.32.0/helper/schema/resource.go:778 +0x11b github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).Apply(0xc000159ea0, {0x12ee838, 0xc0004c1ef0}, 0xc000319790, 0xc0004b7c80, {0xfbab60, 0xc00049e680}) github.com/hashicorp/terraform-plugin-sdk/v2@v2.32.0/helper/schema/resource.go:909 +0xa89 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(GRPCProviderServer).ApplyResourceChange(0xc0001b7d10, {0x12ee838?, 0xc0004c1e00?}, 0xc0003b1d10) github.com/hashicorp/terraform-plugin-sdk/v2@v2.32.0/helper/schema/grpc_provider.go:1077 +0xdbc github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(server).ApplyResourceChange(0xc0000ef180, {0x12ee838?, 0xc0004c1410?}, 0xc0004daf50) github.com/hashicorp/terraform-plugin-go@v0.21.0/tfprotov5/tf5server/server.go:845 +0x3d0 github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x1135f40?, 0xc0000ef180}, {0x12ee838, 0xc0004c1410}, 0xc0004b7400, 0x0) github.com/hashicorp/terraform-plugin-go@v0.21.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:518 +0x169 google.golang.org/grpc.(*Server).processUnaryRPC(0xc00061c800, {0x12ee838, 0xc0004c1380}, {0x12f2fd8, 0xc0002421a0}, 0xc0002c97a0, 0xc000252d80, 0x1be03b8, 0x0)

Affected Resources or Data Sources

vcf_host

Terraform Configuration

main.tf is as below

-----------------------------------------------

SDDC Manager - Host Commissioning Module

-----------------------------------------------

resource "vcf_host" "host" { for_each = var.wld_hosts fqdn = each.key network_pool_id = each.value[0] username = "root" password = each.value[1] storage_type = each.value[2] }


variables.tf is as below

-----------------------------------------------

SDDC Manager Authentication Variables

-----------------------------------------------

variable "sddc_manager_host" { description = "SDDC Manager FQDN." type = string default = "sddc-manager.vrack.vsphere.local" } variable "sddc_manager_username" { description = "UI username for the SDDC Manager appliance." type = string default = "vcf" } variable "sddc_manager_password" { description = "Password for the admin username" type = string default = "VMware123!" }

-----------------------------------------------

Host Configuration Variables

-----------------------------------------------

variable "wld_hosts" { description = "Hosts to be commissioned into SDDC Manager." type = map(list(string)) default = {

"host_fqdn" = [ "Network Pool UUID", "password", "storage_type", "vmnic0", "vmnic1" ]

"esxi-5.vrack.vsphere.local" = [ "f19b1e0e-3135-497f-9f9b-470482645d0d", "EvoSddc!2016", "VSAN", "vmnic0", "vmnic1" ]

} }

Debug Output

pasted in actual behavior

Panic Output

No response

Expected Behavior

Host was suppose to get commissioned

Actual Behavior

2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1 [136/3605] 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: goroutine 20 [running]: 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: github.com/vmware/terraform-provider-vcf/internal/provider.resourceHostCreate({0x12ee8e0?, 0xc0004db730?}, 0x0?, {0xfba b60?, 0xc00049e680?}) 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: github.com/vmware/terraform-provider-vcf/internal/provider/resource_host.go:73 +0x7b8 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).create(0xc000159ea0, {0x12ee838, 0xc0004c1ef0}, 0xd?, {0xfbab60, 0xc00049e680}) 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: github.com/hashicorp/terraform-plugin-sdk/v2@v2.32.0/helper/schema/resource.go:778 +0x11b 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).Apply(0xc000159ea0, {0x12ee838, 0xc0004c1ef0}, 0 xc000319790, 0xc0004b7c80, {0xfbab60, 0xc00049e680}) 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: github.com/hashicorp/terraform-plugin-sdk/v2@v2.32.0/helper/schema/resource.go:909 +0xa89 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(GRPCProviderServer).ApplyResourceChange(0xc0001b7d10, {0x1 2ee838?, 0xc0004c1e00?}, 0xc0003b1d10) 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: github.com/hashicorp/terraform-plugin-sdk/v2@v2.32.0/helper/schema/grpc_provider.go:1077 +0xdbc 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(server).ApplyResourceChange(0xc0000ef180, {0x12ee838?, 0 xc0004c1410?}, 0xc0004daf50) 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: github.com/hashicorp/terraform-plugin-go@v0.21.0/tfprotov5/tf5server/server.go:845 +0x3d0 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x1135f40? , 0xc0000ef180}, {0x12ee838, 0xc0004c1410}, 0xc0004b7400, 0x0) 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: github.com/hashicorp/terraform-plugin-go@v0.21.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:518 +0x169 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: google.golang.org/grpc.(Server).processUnaryRPC(0xc00061c800, {0x12ee838, 0xc0004c1380}, {0x12f2fd8, 0xc0002421a0}, 0x c0002c97a0, 0xc000252d80, 0x1be03b8, 0x0) 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: google.golang.org/grpc@v1.61.0/server.go:1385 +0xe03 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: google.golang.org/grpc.(Server).handleStream(0xc00061c800, {0x12f2fd8, 0xc0002421a0}, 0xc0002c97a0) 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: google.golang.org/grpc@v1.61.0/server.go:1796 +0xfec 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: google.golang.org/grpc.(Server).serveStreams.func2.1() 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: google.golang.org/grpc@v1.61.0/server.go:1029 +0x8b 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: created by google.golang.org/grpc.(Server).serveStreams.func2 in goroutine 10 2024-02-20T14:05:53.332-0800 [DEBUG] provider.terraform-provider-vcf_v0.8.1: google.golang.org/grpc@v1.61.0/server.go:1040 +0x135 2024-02-20T14:05:53.333-0800 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/vmware/vcf/0.8.1/linux_amd64/terraform-provider-vcf_v0.8.1 pid=10573 error="ex it status 2" 2024-02-20T14:05:53.333-0800 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF" 2024-02-20T14:05:53.334-0800 [ERROR] plugin.(GRPCProvider).ApplyResourceChange: error="rpc error: code = Canceled desc = context canceled" 2024-02-20T14:05:53.334-0800 [TRACE] maybeTainted: vcf_host.host["esxi-5.vrack.vsphere.local"] encountered an error during creation, so it is now marked as tainted 2024-02-20T14:05:53.334-0800 [TRACE] terraform.contextPlugins: Schema for provider "registry.terraform.io/vmware/vcf" is in the global cache 2024-02-20T14:05:53.334-0800 [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState to workingState for vcf_host.host["esxi-5.vrack.vsphere.local"] 2024-02-20T14:05:53.334-0800 [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState: removing state object for vcf_host.host["esxi-5.vrack.vsphere.local"] 2024-02-20T14:05:53.334-0800 [TRACE] evalApplyProvisioners: vcf_host.host["esxi-5.vrack.vsphere.local"] is tainted, so skipping provisioning 2024-02-20T14:05:53.334-0800 [TRACE] maybeTainted: vcf_host.host["esxi-5.vrack.vsphere.local"] was already tainted, so nothing to do 2024-02-20T14:05:53.334-0800 [TRACE] terraform.contextPlugins: Schema for provider "registry.terraform.io/vmware/vcf" is in the global cache 2024-02-20T14:05:53.334-0800 [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState to workingState for vcf_host.host["esxi-5.vrack.vsphere.local"] 2024-02-20T14:05:53.334-0800 [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState: removing state object for vcf_host.host["esxi-5.vrack.vsphere.local"] 2024-02-20T14:05:53.334-0800 [TRACE] statemgr.Filesystem: not making a backup, because the new snapshot is identical to the old 2024-02-20T14:05:53.335-0800 [TRACE] statemgr.Filesystem: no state changes since last snapshot 2024-02-20T14:05:53.335-0800 [TRACE] statemgr.Filesystem: writing snapshot at terraform.tfstate 2024-02-20T14:05:53.335-0800 [DEBUG] State storage statemgr.Filesystem declined to persist a state snapshot 2024-02-20T14:05:53.335-0800 [ERROR] vertex "vcf_host.host[\"esxi-5.vrack.vsphere.local\"]" error: Request cancelled 2024-02-20T14:05:53.335-0800 [TRACE] vertex "vcf_host.host[\"esxi-5.vrack.vsphere.local\"]": visit complete, with errors 2024-02-20T14:05:53.335-0800 [TRACE] dag/walk: upstream of "provider[\"registry.terraform.io/vmware/vcf\"] (close)" errored, so skipping 2024-02-20T14:05:53.335-0800 [TRACE] dag/walk: upstream of "root" errored, so skipping 2024-02-20T14:05:53.335-0800 [TRACE] statemgr.Filesystem: not making a backup, because the new snapshot is identical to the old 2024-02-20T14:05:53.336-0800 [TRACE] statemgr.Filesystem: no state changes since last snapshot 2024-02-20T14:05:53.336-0800 [TRACE] statemgr.Filesystem: writing snapshot at terraform.tfstate ╷ │ Error: Request cancelled │ │ with vcf_host.host["esxi-5.vrack.vsphere.local"], │ on main.tf line 4, in resource "vcf_host" "host": │ 4: resource "vcf_host" "host" { │ │ The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled. ╵ 2024-02-20T14:05:53.336-0800 [TRACE] statemgr.Filesystem: removing lock metadata file .terraform.tfstate.lock.info 2024-02-20T14:05:53.336-0800 [TRACE] statemgr.Filesystem: unlocking terraform.tfstate using fcntl flock

Stack trace from the terraform-provider-vcf_v0.8.1 plugin:

panic: interface conversion: interface {} is api_client.CloudBuilderClient, not api_client.SddcManagerClient

goroutine 20 [running]: github.com/vmware/terraform-provider-vcf/internal/provider.resourceHostCreate({0x12ee8e0?, 0xc0004db730?}, 0x0?, {0xfbab60?, 0xc00049e680?}) github.com/vmware/terraform-provider-vcf/internal/provider/resource_host.go:73 +0x7b8 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).create(0xc000159ea0, {0x12ee838, 0xc0004c1ef0}, 0xd?, {0xfbab60, 0xc00049e680}) github.com/hashicorp/terraform-plugin-sdk/v2@v2.32.0/helper/schema/resource.go:778 +0x11b github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).Apply(0xc000159ea0, {0x12ee838, 0xc0004c1ef0}, 0xc000319790, 0xc0004b7c80, {0xfbab60, 0xc00049e680}) github.com/hashicorp/terraform-plugin-sdk/v2@v2.32.0/helper/schema/resource.go:909 +0xa89 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(GRPCProviderServer).ApplyResourceChange(0xc0001b7d10, {0x12ee838?, 0xc0004c1e00?}, 0xc0003b1d10) github.com/hashicorp/terraform-plugin-sdk/v2@v2.32.0/helper/schema/grpc_provider.go:1077 +0xdbc github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(server).ApplyResourceChange(0xc0000ef180, {0x12ee838?, 0xc0004c1410?}, 0xc0004daf50) github.com/hashicorp/terraform-plugin-go@v0.21.0/tfprotov5/tf5server/server.go:845 +0x3d0 github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x1135f40?, 0xc0000ef180}, {0x12ee838, 0xc0004c1410}, 0xc0004b7400, 0x0) github.com/hashicorp/terraform-plugin-go@v0.21.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:518 +0x169 google.golang.org/grpc.(Server).processUnaryRPC(0xc00061c800, {0x12ee838, 0xc0004c1380}, {0x12f2fd8, 0xc0002421a0}, 0xc0002c97a0, 0xc000252d80, 0x1be03b8, 0x0) google.golang.org/grpc@v1.61.0/server.go:1385 +0xe03 google.golang.org/grpc.(Server).handleStream(0xc00061c800, {0x12f2fd8, 0xc0002421a0}, 0xc0002c97a0) google.golang.org/grpc@v1.61.0/server.go:1796 +0xfec google.golang.org/grpc.(Server).serveStreams.func2.1() google.golang.org/grpc@v1.61.0/server.go:1029 +0x8b created by google.golang.org/grpc.(Server).serveStreams.func2 in goroutine 10 google.golang.org/grpc@v1.61.0/server.go:1040 +0x135

Error: The terraform-provider-vcf_v0.8.1 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely helpful if you could report the crash with the plugin's maintainers so that it can be fixed. The output above should help diagnose the issue.

2024-02-20T14:05:53.337-0800 [DEBUG] provider: plugin exited

Steps to Reproduce

terraform apply

Environment Details

No response

Screenshots

No response

References

No response

spacegospod commented 7 months ago

@pradeep17j Make sure you set the correct environment variables. The provider initializes either an sddc manager client or a cloud builder client based on the environment.

https://github.com/vmware/terraform-provider-vcf/blob/bce335684b6907d738e5a0e8c5a71038c53d33b3/internal/provider/provider.go#L103C55-L103C76

The following error indicates that you have not set up your environment properly

panic: interface conversion: interface {} is api_client.CloudBuilderClient, not api_client.SddcManagerClient

github-actions[bot] commented 6 months 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.