Skip to content
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

SR-IOV physical_function "Automatic-" prefix not recognized #2307

Open
1 of 4 tasks
RocketLR opened this issue Dec 10, 2024 · 1 comment
Open
1 of 4 tasks

SR-IOV physical_function "Automatic-" prefix not recognized #2307

RocketLR opened this issue Dec 10, 2024 · 1 comment
Labels
bug Type: Bug needs-triage Status: Issue Needs Triage

Comments

@RocketLR
Copy link

Community Guidelines

  • I have read and agree to the HashiCorp Community Guidelines .
  • Vote on this issue by adding a 👍 reaction to the original issue initial description to help the maintainers prioritize.
  • Do not leave "+1" or other comments that do not add relevant information or questions.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Terraform

2.10.0

Terraform Provider

hashicorp/vsphere

VMware vSphere

7.0.3

Description

Description

When configuring SR-IOV network interfaces in Terraform, there's a discrepancy between how vSphere and the Terraform provider handle automatically assigned physical functions. In vSphere, when SR-IOV networks are configured, the system automatically assigns physical functions with the prefix "Automatic-" followed by the PCI address (e.g., "Automatic-0000:19:00.3"). However, the Terraform provider doesn't recognize this format and throws an error.

Current Behavior

When specifying the exact format shown in vSphere:

network_interface {
    adapter_type = "sriov"
    network_id = "dvportgroup-3015"
    physical_function = "Automatic-0000:19:00.3"
}

Error: unable to find SR-IOV physical adapter Automatic-0000:19:00.3 on host esxi-host-01.domain.com

Additional Context

This appears to be a disconnect between how vSphere represents automatically assigned SR-IOV physical functions and how the Terraform provider validates them. The "Automatic-" prefix is a valid vSphere construct that should be recognized by the provider.

Affected Resources or Data Sources

resource/vsphere_virtual_machine

Terraform Configuration

resource "vsphere_virtual_machine" "ISP-server01" {
  name             = "ISP-Server01"
  resource_pool_id = data.vsphere_compute_cluster.cluster.resource_pool_id
  datastore_id     = data.vsphere_datastore.datastore.id
  
  memory          = 16384
  memory_hot_add_enabled = true
  memory_reservation = 16384
  memory_reservation_locked_to_max = true

  num_cpus        = 4
  enable_logging  = true
  scsi_type       = "lsilogic"
  
  sata_controller_count = 1
  cdrom {
    client_device = false
  }

  network_interface {
    network_id = "dvportgroup-3014"
  }
  network_interface {
    adapter_type   = "sriov"
    network_id = "dvportgroup-3015"
    physical_function = "Automatic-0000:19:00.3"
  }
}

Debug Output

https://gist.github.com/RocketLR/ad446bb6b149c0b4f5b1aa281ad872b9

Panic Output

No response

Expected Behavior

The provider should recognize and accept the "Automatic-" prefix format as it is the valid format shown in vSphere UI and API responses.

Actual Behavior

Tries to set a manual physical_function with the "Automatic-" included as the value.

Steps to Reproduce

Steps to Reproduce

  1. Initial Environment Setup:

    • Have an existing vSphere cluster with VMs configured with SR-IOV networks via vCenter GUI
    • SR-IOV is properly configured on ESXi hosts and working
    • VMs are running with SR-IOV network interfaces that show as "Automatic-[PCI_ADDRESS]" in vCenter
  2. Import Existing Infrastructure to Terraform:

    # First, create basic Terraform configuration with provider
    terraform init
    
    # Import existing VM
    terraform import vsphere_virtual_machine.ISP-server01 'datastore/vm/ISP-server01'
    
    # run plan to compare my main.tf resource config with vspheres actual state. 
    terraform plan
    

Environment Details

No response

Screenshots

No response

References

No response

@RocketLR RocketLR added bug Type: Bug needs-triage Status: Issue Needs Triage labels Dec 10, 2024
Copy link

Hello, RocketLR! 🖐

Thank you for submitting an issue for this provider. The issue will now enter into the issue lifecycle.

If you want to contribute to this project, please review the contributing guidelines and information on submitting pull requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Type: Bug needs-triage Status: Issue Needs Triage
Projects
None yet
Development

No branches or pull requests

1 participant