-
Notifications
You must be signed in to change notification settings - Fork 112
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
Terraform crashed while creating VM in Nutanix #205
Comments
Hi @sachin433, This error is caused by this block:
Would it be possible to pass the project uuid instead of the name? For example:
We will also check from our side how we can optimise the error handling. |
why the resource schema is so redundant? if the section is called project_reference, what is the point to embed kind field inside? why not to use any kind of a abstract section name (e.g. 'reference') or omit kind field entirely? |
@kruftik, we are following the Nutanix API schema's as close as possible. However, we are constantly looking at improvements and we will also consider omitting the kind field (easy workaround would be to put "project" as default value). |
@yannickstruyf3 thanks for spotting the error. I kind of missed it. |
Terraform Version
0.13.5
Affected Resource(s)
nutanix_virtual_machine
Terraform Configuration Files
data "nutanix_clusters" "clusters" {}
resource "nutanix_virtual_machine" "MyTestVM_TF" {
name = "MyTestVM-TF"
description = "Created with Terraform"
provider = nutanix
cluster_uuid = data.nutanix_clusters.clusters.entities.0.metadata.uuid
num_vcpus_per_socket = 1
num_sockets = 1
memory_size_mib = 2048
project_reference = {
kind = "project"
name = "Performance"
}
disk_list {
data_source_reference = {
kind = "image"
uuid = "921a719f-845e-4399-83f9-00bd7c5df1be"
}
}
disk_list {
# defining an additional entry in the disk_list array will create another.
#disk_size_mib and disk_size_bytes must be set together.
disk_size_mib = 100000
disk_size_bytes = 104857600000
}
}
Expected Behavior
[comviva@Openshift_Master terraform-project]$ terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.
data.nutanix_clusters.clusters: Refreshing state... [id=terraform-202011281732]
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
Terraform will perform the following actions:
nutanix_virtual_machine.MyTestVM_TF will be created
api_version = (known after apply)
availability_zone_reference = (known after apply)
boot_device_disk_address = (known after apply)
boot_device_mac_address = (known after apply)
boot_device_order_list = (known after apply)
cluster_name = (known after apply)
cluster_uuid = "0005b231-aec3-c536-4589-3868d9f168"
description = "Created with Terraform"
enable_script_exec = (known after apply)
guest_customization_cloud_init_custom_key_values = (known after apply)
guest_customization_cloud_init_meta_data = (known after apply)
guest_customization_cloud_init_user_data = (known after apply)
guest_customization_is_overridable = (known after apply)
guest_customization_sysprep = (known after apply)
guest_customization_sysprep_custom_key_values = (known after apply)
guest_os_id = (known after apply)
hardware_clock_timezone = (known after apply)
host_reference = (known after apply)
hypervisor_type = (known after apply)
id = (known after apply)
memory_size_mib = 2048
metadata = (known after apply)
name = "MyTestVM-TF"
ngt_credentials = (known after apply)
ngt_enabled_capability_list = (known after apply)
nic_list_status = (known after apply)
num_sockets = 1
num_vcpus_per_socket = 1
num_vnuma_nodes = (known after apply)
nutanix_guest_tools = (known after apply)
owner_reference = (known after apply)
parent_reference = (known after apply)
power_state = (known after apply)
power_state_mechanism = (known after apply)
project_reference = {
}
should_fail_on_script_failure = (known after apply)
state = (known after apply)
use_hot_add = true
vga_console_enabled = (known after apply)
categories {
}
disk_list {
data_source_reference = {
}
disk_size_bytes = (known after apply)
disk_size_mib = (known after apply)
uuid = (known after apply)
volume_group_reference = (known after apply)
device_properties {
}
storage_config {
flash_mode = (known after apply)
storage_container_reference {
}
}
}
disk_list {
data_source_reference = (known after apply)
disk_size_bytes = 104857600000
disk_size_mib = 100000
uuid = (known after apply)
volume_group_reference = (known after apply)
device_properties {
}
storage_config {
flash_mode = (known after apply)
storage_container_reference {
}
}
}
gpu_list {
}
nic_list {
is_connected = (known after apply)
mac_address = (known after apply)
model = (known after apply)
network_function_chain_reference = (known after apply)
network_function_nic_type = (known after apply)
nic_type = (known after apply)
subnet_name = (known after apply)
subnet_uuid = (known after apply)
uuid = (known after apply)
ip_endpoint_list {
}
}
}
Plan: 1 to add, 0 to change, 0 to destroy.
Actual Behavior
[comviva@Openshift_Master terraform-project]$ terraform apply -auto-approve
data.nutanix_clusters.clusters: Refreshing state... [id=terraform-2020112817378]
nutanix_virtual_machine.MyTestVM_TF: Creating...
panic: interface conversion: interface {} is nil, not string
2020-11-28T23:50:58.859+0530 [DEBUG] plugin.terraform-provider-nutanix_v1.1.0_x4:
2020-11-28T23:50:58.859+0530 [DEBUG] plugin.terraform-provider-nutanix_v1.1.0_x4: goroutine 27 [running]:
2020-11-28T23:50:58.859+0530 [DEBUG] plugin.terraform-provider-nutanix_v1.1.0_x4: github.com/terraform-providers/terraform-provider-nutanix/nutanix.getMetadataAttributes(0xc00065cbd0, 0xc00031efc0, 0x114e193, 0x2, 0xc00028ead0, 0x203001)
2020-11-28T23:50:58.859+0530 [DEBUG] plugin.terraform-provider-nutanix_v1.1.0_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-nutanix/nutanix/helpers.go:27 +0x79d
2020-11-28T23:50:58.859+0530 [DEBUG] plugin.terraform-provider-nutanix_v1.1.0_x4: github.com/terraform-providers/terraform-provider-nutanix/nutanix.resourceNutanixVirtualMachineCreate(0xc00065cbd0, 0xf4bb20, 0xc000318b80, 0x2, 0x1c21660)
2020-11-28T23:50:58.859+0530 [DEBUG] plugin.terraform-provider-nutanix_v1.1.0_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-nutanix/nutanix/resource_nutanix_virtual_machine.go:834 +0x255
2020-11-28T23:50:58.859+0530 [DEBUG] plugin.terraform-provider-nutanix_v1.1.0_x4: github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc0005fde00, 0xc000215310, 0xc00072bd60, 0xf4bb20, 0xc000318b80, 0xfea601, 0xc0003ea1b8, 0xc0001fa630)
2020-11-28T23:50:58.859+0530 [DEBUG] plugin.terraform-provider-nutanix_v1.1.0_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-nutanix/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:305 +0x365
2020-11-28T23:50:58.859+0530 [DEBUG] plugin.terraform-provider-nutanix_v1.1.0_x4: github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc0006bc400, 0xc0002f9a00, 0xc000215310, 0xc00072bd60, 0xc0001e7ee8, 0xc00020cad0, 0xfec5a0)
2020-11-28T23:50:58.859+0530 [DEBUG] plugin.terraform-provider-nutanix_v1.1.0_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-nutanix/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:289 +0x99
2020-11-28T23:50:58.859+0530 [DEBUG] plugin.terraform-provider-nutanix_v1.1.0_x4: github.com/hashicorp/terraform/helper/plugin.(*GRPCProviderServer).ApplyResourceChange(0xc00020c858, 0x1441f60, 0xc0005a9140, 0xc000317440, 0xc00020c858, 0xc0005a9140, 0xc000304b78)
2020-11-28T23:50:58.859+0530 [DEBUG] plugin.terraform-provider-nutanix_v1.1.0_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-nutanix/vendor/github.com/hashicorp/terraform/helper/plugin/grpc_provider.go:885 +0x8c4
2020-11-28T23:50:58.859+0530 [DEBUG] plugin.terraform-provider-nutanix_v1.1.0_x4: github.com/hashicorp/terraform/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0x1110f60, 0xc00020c858, 0x1441f60, 0xc0005a9140, 0xc000317380, 0x0, 0x1441f60, 0xc0005a9140, 0xc0001bac00, 0xade)
2020-11-28T23:50:58.859+0530 [DEBUG] plugin.terraform-provider-nutanix_v1.1.0_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-nutanix/vendor/github.com/hashicorp/terraform/internal/tfplugin5/tfplugin5.pb.go:3189 +0x217
2020-11-28T23:50:58.859+0530 [DEBUG] plugin.terraform-provider-nutanix_v1.1.0_x4: google.golang.org/grpc.(*Server).processUnaryRPC(0xc000082780, 0x144d280, 0xc000083500, 0xc000650f00, 0xc0006544e0, 0x1be6f40, 0x0, 0x0, 0x0)
2020-11-28T23:50:58.859+0530 [DEBUG] plugin.terraform-provider-nutanix_v1.1.0_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-nutanix/vendor/google.golang.org/grpc/server.go:1024 +0x501
2020-11-28T23:50:58.859+0530 [DEBUG] plugin.terraform-provider-nutanix_v1.1.0_x4: google.golang.org/grpc.(*Server).handleStream(0xc000082780, 0x144d280, 0xc000083500, 0xc000650f00, 0x0)
2020-11-28T23:50:58.859+0530 [DEBUG] plugin.terraform-provider-nutanix_v1.1.0_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-nutanix/vendor/google.golang.org/grpc/server.go:1313 +0xd3d
2020-11-28T23:50:58.859+0530 [DEBUG] plugin.terraform-provider-nutanix_v1.1.0_x4: google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc0000a41c0, 0xc000082780, 0x144d280, 0xc000083500, 0xc000650f00)
2020-11-28T23:50:58.859+0530 [DEBUG] plugin.terraform-provider-nutanix_v1.1.0_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-nutanix/vendor/google.golang.org/grpc/server.go:722 +0xa1
2020-11-28T23:50:58.859+0530 [DEBUG] plugin.terraform-provider-nutanix_v1.1.0_x4: created by google.golang.org/grpc.(*Server).serveStreams.func1
2020-11-28T23:50:58.859+0530 [DEBUG] plugin.terraform-provider-nutanix_v1.1.0_x4: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-nutanix/vendor/google.golang.org/grpc/server.go:720 +0xa1
2020-11-28T23:50:58.860+0530 [DEBUG] plugin: plugin process exited: path=.terraform/plugins/registry.terraform.io/terraform-providers/nutanix/1.1.0/linux_amd64/terraform-provider-nutanix_v1.1.0_x4 pid=27451 error="exit status 2"
2020/11/28 23:50:58 [DEBUG] nutanix_virtual_machine.MyTestVM_TF: apply errored, but we're indicating that via the Error pointer rather than returning it: rpc error: code = Unavailable desc = transport is closing
2020/11/28 23:50:58 [TRACE] eval: *terraform.EvalMaybeTainted
2020/11/28 23:50:58 [TRACE] EvalMaybeTainted: nutanix_virtual_machine.MyTestVM_TF encountered an error during creation, so it is now marked as tainted
2020/11/28 23:50:58 [TRACE] eval: *terraform.EvalWriteState
2020/11/28 23:50:58 [TRACE] EvalWriteState: removing state object for nutanix_virtual_machine.MyTestVM_TF
2020/11/28 23:50:58 [TRACE] eval: *terraform.EvalApplyProvisioners
2020/11/28 23:50:58 [TRACE] EvalApplyProvisioners: nutanix_virtual_machine.MyTestVM_TF has no state, so skipping provisioners
2020/11/28 23:50:58 [TRACE] eval: *terraform.EvalMaybeTainted
2020/11/28 23:50:58 [TRACE] EvalMaybeTainted: nutanix_virtual_machine.MyTestVM_TF encountered an error during creation, so it is now marked as tainted
2020/11/28 23:50:58 [TRACE] eval: *terraform.EvalWriteState
2020/11/28 23:50:58 [TRACE] EvalWriteState: removing state object for nutanix_virtual_machine.MyTestVM_TF
2020/11/28 23:50:58 [TRACE] eval: *terraform.EvalIf
2020/11/28 23:50:58 [TRACE] eval: *terraform.EvalIf
2020/11/28 23:50:58 [TRACE] eval: *terraform.EvalWriteDiff
2020/11/28 23:50:58 [TRACE] eval: *terraform.EvalApplyPost
2020-11-28T23:50:58.860+0530 [WARN] plugin.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
2020/11/28 23:50:58 [ERROR] eval: *terraform.EvalApplyPost, err: rpc error: code = Unavailable desc = transport is closing
2020/11/28 23:50:58 [ERROR] eval: *terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing
2020/11/28 23:50:58 [TRACE] [walkApply] Exiting eval tree: nutanix_virtual_machine.MyTestVM_TF
2020/11/28 23:50:58 [TRACE] vertex "nutanix_virtual_machine.MyTestVM_TF": visit complete
2020/11/28 23:50:58 [TRACE] dag/walk: upstream of "provider["registry.terraform.io/terraform-providers/nutanix"] (close)" errored, so skipping
2020/11/28 23:50:58 [TRACE] dag/walk: upstream of "meta.count-boundary (EachMode fixup)" errored, so skipping
2020/11/28 23:50:58 [TRACE] dag/walk: upstream of "root" errored, so skipping
2020/11/28 23:50:58 [TRACE] statemgr.Filesystem: creating backup snapshot at terraform.tfstate.backup
2020/11/28 23:50:58 [TRACE] statemgr.Filesystem: state has changed since last snapshot, so incrementing serial to 12
2020/11/28 23:50:58 [TRACE] statemgr.Filesystem: writing snapshot at terraform.tfstate
2020/11/28 23:50:58 [TRACE] statemgr.Filesystem: removing lock metadata file .terraform.tfstate.lock.info
2020/11/28 23:50:58 [TRACE] statemgr.Filesystem: unlocking terraform.tfstate using fcntl flock
2020-11-28T23:50:58.870+0530 [DEBUG] plugin: plugin exited
!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!
Error: rpc error: code = Unavailable desc = transport is closing
Steps to Reproduce
terraform apply -auto-approve
The text was updated successfully, but these errors were encountered: