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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a disk on a exists vm will recreate this VM #2233

Open
4 tasks done
johng521888 opened this issue Jul 4, 2024 · 2 comments
Open
4 tasks done

add a disk on a exists vm will recreate this VM #2233

johng521888 opened this issue Jul 4, 2024 · 2 comments
Assignees
Labels
acknowledged Status: Issue or Pull Request Acknowledged area/vm Area: Virtual Machines bug Type: Bug needs-triage Status: Issue Needs Triage waiting-response Status: Waiting on a Response
Milestone

Comments

@johng521888
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

1.7.1

Terraform Provider

2.6.1

VMware vSphere

7.0.3

Description

I modified main.tf and tried to add a disk to an existing VM. Terraform apply will recreate my VM, which will cause data loss. Is there any way to avoid the re-creation?

Affected Resources or Data Sources

resource/vsphere_virtual_machine

Terraform Configuration

1銆乧reate vsphere vm from template with only one disk first
2銆乤dd another disk to the vsphere_virtual_machine resource

Debug Output

vsphere_virtual_machine.vm锛欴estroying... [id=422de896-1dbe-6669-d019-fa8e69afd15f]

Panic Output

No response

Expected Behavior

when I add a new disk to an existing VM, I want to avoid recreating the VM after executing terraform apply.

Actual Behavior

add new disk will recreate VM

Steps to Reproduce

1銆乽se terraform create an VM with only one disk instance
2銆乽se terraform create an disk
3銆丮odify the main.tf file of the virtual machine and bind the disk created in the second step to the virtual machine
4銆乤pply this VM will destroy and recreate this VM

Environment Details

No response

Screenshots

No response

References

#434

@johng521888 johng521888 added bug Type: Bug needs-triage Status: Issue Needs Triage labels Jul 4, 2024
Copy link

github-actions bot commented Jul 4, 2024

Hello, johng521888! 馃枑

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.

@spacegospod
Copy link
Collaborator

Hey @johng521888 I tried this myself, I added both a simple disk block and one with a path to an existing vmdk.
Neither of these destroy the VM, they just reconfigure it.
I ran this experiment on a basic VM and on one that I created from a template.

Can you try updating your provider to the latest version?
If you continue to encounter this problem please share your configuration and the output from terraform plan so that we can see the diff

@spacegospod spacegospod added acknowledged Status: Issue or Pull Request Acknowledged area/vm Area: Virtual Machines labels Jul 8, 2024
@tenthirtyam tenthirtyam added the waiting-response Status: Waiting on a Response label Jul 8, 2024
@tenthirtyam tenthirtyam added this to the Backlog milestone Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acknowledged Status: Issue or Pull Request Acknowledged area/vm Area: Virtual Machines bug Type: Bug needs-triage Status: Issue Needs Triage waiting-response Status: Waiting on a Response
Projects
None yet
Development

No branches or pull requests

3 participants