Skip to content

hypercore_nic import generates empty vm_uuid and causes perpetual drift #111

Description

@ighrairi

Provider: scalecomputing/hypercore
Terraform version: 1.15.9
Provider version: 1.4.0

Summary:

When importing existing NICs using the hypercore_nic resource:

  1. terraform plan -generate-config-out generates an empty vm_uuid.

  2. Subsequent plans always show a change for vm_uuid, even immediately after a successful apply.

This causes perpetual drift and prevents imported NIC resources from reaching a stable state.

Reproduction:

Example VM

WinSRV2025_Template
UUID: cf43258f-65a3-1ed8-9d37-agf422987a24

The VM has a single VirtIO NIC with VLAN-ALL (blank VLAN).

Import Block

import {
  to = hypercore_nic.WinSRV2025_Template_nic1
  id = "${hypercore_vm.WinSRV2025_Template.id}:VIRTIO:0"

  #or  id = format("%s:%s:%d", hypercore_vm.WinSRV2025_Template.id, "VIRTIO", 0)
}

Generate Configuration

terraform plan -generate-config-out=nic.tf

Terraform will perform the following actions:

....
  # hypercore_nic.WinSRV2025_Template_nic1 will be imported

    resource "hypercore_nic" "WinSRV2025_Template_nic1" {
        id          = "cf43258f-65a3-1ed8-9d37-agf422987a24"
        mac_address = "7C:4C:58:93:1F:CE"
        type        = "VIRTIO"
        vlan        = 0
        vm_uuid     = null
    }

Plan: 1 to import, 0 to add, 0 to change, 0 to destroy.

Generated resource

resource "hypercore_nic" "WinSRV2025_Template_nic1" {
  mac_address = "7C:4C:58:93:1F:CE"
  type        = "VIRTIO"
  vlan        = 0
  vm_uuid     = ""
}

Expected Behavior

The generated configuration should contain the parent VM UUID:

resource "hypercore_nic" "WinSRV2025_Template_nic1" {
  mac_address = "7C:4C:58:93:1F:CE"
  type        = "VIRTIO"
  vlan        = 0
  vm_uuid     = hypercore_vm.WinSRV2025_Template.id
}

After manually replacing the value vm_uuid = "" with:

vm_uuid = hypercore_vm.WinSRV2025_Template.id

and running:

terraform apply --auto-approve

the next terraform plan still reports:

# hypercore_nic.WinSRV2025_Template_nic1 will be updated in-place

+ vm_uuid = "cf43258f-65a3-1ed8-9d37-agf422987a24"

The behavior was not observed on a single VM only. I reproduced the same results with multiple imported hypercore_nic resources attached to different VMs:

terraform plan -generate-config-out generates an empty vm_uuid.
terraform apply completes successfully.
The next terraform plan still reports a change for vm_uuid.

The behavior is consistent across all imported NICs tested and as a workaround, and I am currently using the following lifecycle block in the hypercore_nic resource: :

lifecycle {
        ignore_changes = [
        vm_uuid
        ]
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions