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

VM is recreated after changing non-destructive resources #2267

Closed
4 tasks done
svg-mn opened this issue Sep 26, 2024 · 3 comments
Closed
4 tasks done

VM is recreated after changing non-destructive resources #2267

svg-mn opened this issue Sep 26, 2024 · 3 comments
Assignees
Labels
bug Type: Bug not-reproduced Status: Not Reproduced

Comments

@svg-mn
Copy link

svg-mn commented Sep 26, 2024

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

1.9.6

Terraform Provider

2.9.2

VMware vSphere

8.0.2

Description

When using the vSphere Terraform provider, certain resource changes that should not require the destruction and recreation of the virtual machine (such as changing the VM name or adjusting CPU count) are causing the provider to unnecessarily destroy and recreate the VM. This behavior leads to service disruption and increased downtime, which is not expected for these types of changes.

Affected Resources or Data Sources

resource/vm

Terraform Configuration

resource "vsphere_virtual_machine" "example" {
name = "example-vm"
num_cpus = 2
memory = 4096
resource_pool_id = "resgroup-123"
datastore_id = "datastore-123"

network_interface {
network_id = "network-123"
adapter_type = "vmxnet3"
}

disk {
label = "disk0"
size = 50
}
}

Debug Output

I can't link the debug GitHub log since it's not connected to the internet

Panic Output

No response

Expected Behavior

Changes to non-destructive fields (like the VM name, CPU count) should be applied in place without triggering a VM destruction and recreation.

Actual Behavior

When modifying resources like the VM name or CPU count Terraform plans to destroy the existing VM and recreate a new one. These changes should instead be updated without needing to delete and recreate the virtual machine.

Steps to Reproduce

  1. Deploy a VM using the vsphere_virtual_machine resource.

  2. Change the name, CPU, or memory allocation in the Terraform configuration.

  3. Run terraform plan and observe that it plans to destroy and recreate the VM instead of updating the resources in place.

Environment Details

No response

Screenshots

No response

References

No response

@svg-mn svg-mn added bug Type: Bug needs-triage Status: Issue Needs Triage labels Sep 26, 2024
Copy link

Hello, svg-mn! 🖐

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.

@burnsjared0415
Copy link
Collaborator

i am not able to re-produce this, i have tested each setting one by one and get change for each, please provide info of output.

  # vsphere_virtual_machine.vm will be updated in-place
  ~ resource "vsphere_virtual_machine" "vm" {
      - enable_disk_uuid                        = true -> null
        id                                      = "4228e427-62e8-ccc2-3fb6-015d66766146"
      ~ memory                                  = 2048 -> 4098
        name                                    = "foo-win-1"
        tags                                    = []
        # (67 unchanged attributes hidden)

        # (2 unchanged blocks hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.
      - enable_disk_uuid                        = true -> null
        id                                      = "4228e427-62e8-ccc2-3fb6-015d66766146"
        name                                    = "foo-win-1"
      ~ num_cpus                                = 2 -> 4
        tags                                    = []
        # (67 unchanged attributes hidden)

        # (2 unchanged blocks hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.
  ~ resource "vsphere_virtual_machine" "vm" {
      - enable_disk_uuid                        = true -> null
        id                                      = "4228e427-62e8-ccc2-3fb6-015d66766146"
      ~ name                                    = "foo-win-1" -> "foo-win-2"
        tags                                    = []
        # (68 unchanged attributes hidden)

        # (2 unchanged blocks hidden)
    }

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

@burnsjared0415 burnsjared0415 added waiting-response Status: Waiting on a Response not-reproduced Status: Not Reproduced labels Oct 9, 2024
@burnsjared0415 burnsjared0415 self-assigned this Oct 9, 2024
@tenthirtyam tenthirtyam removed the needs-triage Status: Issue Needs Triage label Oct 9, 2024
@tenthirtyam tenthirtyam added this to the On Deck milestone Oct 9, 2024
@tenthirtyam
Copy link
Collaborator

Marking as closed. Please open a new issue and reference #2267 is the problem persists.

@tenthirtyam tenthirtyam closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2024
@github-actions github-actions bot removed the waiting-response Status: Waiting on a Response label Oct 16, 2024
@tenthirtyam tenthirtyam removed this from the On Deck milestone Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Type: Bug not-reproduced Status: Not Reproduced
Projects
None yet
Development

No branches or pull requests

3 participants