Skip to content

issue when trying to clone disk #73

@locus313

Description

@locus313

I am doing some testing of the provider and when using some of the code from the demo example for cloning a disk

resource "hypercore_virtual_disk" "ubuntu-2204" {
  name       = "ubuntu-2204-server-cloudimg-amd64.img"
  source_url = "https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img"
}

resource "hypercore_vm" "test-vm" {
  tags       = ["test"]
  name        = "test-vm"
  description = "test VM"
  vcpu        = 4
  memory      = 4096  # MiB
  clone = {
    source_vm_uuid = data.hypercore_vms.template-vm.vms.0.uuid
    meta_data = templatefile("assets/meta-data.ubuntu-22.04.yml.tftpl", {
      name = "test-vm",
    })
    user_data = templatefile("assets/user-data.ubuntu-22.04.yml.tftpl", {
      name                = "test-vm",
      ssh_authorized_keys = "",
      ssh_import_id       = "",
    })
  }

  # snapshot_schedule_uuid = hypercore_vm_snapshot_schedule.demo1.id
  # TODO update, "" -> null

  # Pin VM to the first node in cluster
  # If preferred_node fails, run VM on any other node.
  affinity_strategy = {
    strict_affinity = true
    preferred_node_uuid = data.hypercore_nodes.node_1.nodes.0.uuid
    backup_node_uuid = ""
    # backup_node_uuid = data.hypercore_nodes.node_2.id
  }
}


resource "hypercore_disk" "os" {
  vm_uuid                = hypercore_vm.test-vm.id
  type                   = "VIRTIO_DISK"
  size                   = 20.5  # GB
  source_virtual_disk_id = hypercore_virtual_disk.ubuntu-2204.id
}

I am getting the following error:

Error: Unexpected error
│
│   with hypercore_disk.os,
│   on main.tf line 45, in resource "hypercore_disk" "os":
│   45: resource "hypercore_disk" "os" {
│
│ terraform provider got an unexpected error during execution: runtime error: invalid memory address or nil pointer      
│ dereference

Here is the information from the debug log output:

2025-07-27T13:34:20.248-0700 [INFO]  Starting apply for hypercore_disk.os
2025-07-27T13:34:20.249-0700 [DEBUG] hypercore_disk.os: applying the planned Create change
2025-07-27T13:34:20.249-0700 [INFO]  provider.terraform-provider-hypercore_v1.1.0.exe: TTRT HypercoreDiskResource CONFIGURE: @caller=github.com/hashicorp/terraform-provider-hypercore/internal/provider/hypercore_disk_resource.go:106 @module=hypercore tf_provider_addr=registry.terraform.io/hashicorp/hypercore tf_req_id=5f5f5417-dc77-b160-759e-5d2fc9d76006 tf_resource_type=hypercore_disk tf_rpc=ApplyResourceChange timestamp=2025-07-27T13:34:20.249-0700
2025-07-27T13:34:20.249-0700 [INFO]  provider.terraform-provider-hypercore_v1.1.0.exe: TTRT HypercoreDiskResource CREATE: @caller=github.com/hashicorp/terraform-provider-hypercore/internal/provider/hypercore_disk_resource.go:129 @module=hypercore tf_req_id=5f5f5417-dc77-b160-759e-5d2fc9d76006 tf_resource_type=hypercore_disk tf_rpc=ApplyResourceChange tf_provider_addr=registry.terraform.io/hashicorp/hypercore timestamp=2025-07-27T13:34:20.249-0700
2025-07-27T13:34:20.249-0700 [INFO]  provider.terraform-provider-hypercore_v1.1.0.exe: TTRT Create: vm_uuid=24f5dbf2-c349-49f1-928f-71a2d296f188, type=VIRTIO_DISK, slot=0, size=0: tf_req_id=5f5f5417-dc77-b160-759e-5d2fc9d76006 tf_resource_type=hypercore_disk tf_rpc=ApplyResourceChange @module=hypercore tf_provider_addr=registry.terraform.io/hashicorp/hypercore @caller=github.com/hashicorp/terraform-provider-hypercore/internal/provider/hypercore_disk_resource.go:150 timestamp=2025-07-27T13:34:20.249-0700
2025-07-27T13:34:20.255-0700 [DEBUG] provider.terraform-provider-hypercore_v1.1.0.exe: TTRT No task tag for this task    
: @caller=github.com/hashicorp/terraform-provider-hypercore/internal/utils/task_tag.go:37 @module=hypercore tf_req_id=5f5f5417-dc77-b160-759e-5d2fc9d76006 tf_resource_type=hypercore_disk tf_provider_addr=registry.terraform.io/hashicorp/hypercore tf_rpc=ApplyResourceChange timestamp=2025-07-27T13:34:20.254-0700
2025-07-27T13:34:20.255-0700 [ERROR] provider.terraform-provider-hypercore_v1.1.0.exe: Response contains error diagnostic: @module=sdk.proto diagnostic_summary="Unexpected error" tf_proto_version=6.9 tf_req_id=5f5f5417-dc77-b160-759e-5d2fc9d76006 tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/terraform-plugin-go@v0.28.0/tfprotov6/internal/diag/diagnostics.go:58 diagnostic_detail="terraform provider got an unexpected error during execution: runtime error: invalid memory address or nil pointer dereference" diagnostic_severity=ERROR tf_provider_addr=registry.terraform.io/hashicorp/hypercore tf_resource_type=hypercore_disk timestamp=2025-07-27T13:34:20.255-0700
f_resource_type=hypercore_disk timestamp=2025-07-27T13:34:20.255-0700
2025-07-27T13:34:20.257-0700 [DEBUG] State storage *statemgr.Filesystem declined to persist a state snapshot
f_resource_type=hypercore_disk timestamp=2025-07-27T13:34:20.255-0700
2025-07-27T13:34:20.257-0700 [DEBUG] State storage *statemgr.Filesystem declined to persist a state snapshot
f_resource_type=hypercore_disk timestamp=2025-07-27T13:34:20.255-0700
f_resource_type=hypercore_disk timestamp=2025-07-27T13:34:20.255-0700
2025-07-27T13:34:20.257-0700 [DEBUG] State storage *statemgr.Filesystem declined to persist a state snapshot
2025-07-27T13:34:20.257-0700 [ERROR] vertex "hypercore_disk.os" error: Unexpected error
╷
│ Error: Unexpected error
│
│   with hypercore_disk.os,
│   on main.tf line 45, in resource "hypercore_disk" "os":
│   45: resource "hypercore_disk" "os" {
│
│ terraform provider got an unexpected error during execution: runtime error: invalid memory address or nil pointer      
│ dereference
╵
2025-07-27T13:34:20.260-0700 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2025-07-27T13:34:20.263-0700 [INFO]  provider: plugin process exited: plugin=.terraform/providers/registry.terraform.io/scalecomputing/hypercore/1.1.0/windows_amd64/terraform-provider-hypercore_v1.1.0.exe id=36796
2025-07-27T13:34:20.263-0700 [DEBUG] provider: plugin exited

Is this a bug? or is there something different I should try?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions