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

terraform apply -refresh-only flags disks in r/vsphere_virtual_machine as orphaned_disk #2070

Open
4 tasks done
furstblumier opened this issue Nov 22, 2023 · 1 comment
Open
4 tasks done
Labels
bug Type: Bug needs-triage Status: Issue Needs Triage
Milestone

Comments

@furstblumier
Copy link

furstblumier commented Nov 22, 2023

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

v1.5.7

Terraform Provider

v2.5.1

VMware vSphere

v7.0.3

Description

After recreating a VM outside of terraform (eg after a backup restore), and running a terraform plan -refresh-only the disks are attached as orphaned_diskX at the VM. I would expect a sync from the remote state to the tfstate would attach the disks with label diskX instead of orphaned. The current behaviour breaks subsequent runs of terraform, since it tries to remove the orphaned disks.

Affected Resources or Data Sources

resource/vsphere_virtual_machine and its disk subresource

Terraform Configuration

https://gist.github.com/rexatlanti/4cb41f24e340e5f760aa3a502e055919

Debug Output

https://gist.github.com/rexatlanti/be5cba40f192315fc7d4a4cfa04271a3

Panic Output

No response

Expected Behavior

terraform apply -refresh-only adds remote disks as diskX instead of orphaned_diskX

Actual Behavior

Disks are being written into the state as orphaned_diskX

Steps to Reproduce

  1. Create a VM via terraform, vsphere provider.
  2. delete the VM.
  3. recreate the VM from a backup, which gives the disks a new uuid.
  4. run terraform plan/apply -restore-only
  5. See that the disks that are attached at the VM are marked as orphaned

Environment Details

No response

Screenshots

No response

References

No response

@furstblumier furstblumier added bug Type: Bug needs-triage Status: Issue Needs Triage labels Nov 22, 2023
@furstblumier furstblumier changed the title terraform apply -fresh-only flags disks in r/vsphere_virtual_machine as orphaned_disk terraform apply -refresh-only flags disks in r/vsphere_virtual_machine as orphaned_disk Nov 22, 2023
Copy link

Hello, rexatlanti! 🖐

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.

@tenthirtyam tenthirtyam added this to the Backlog milestone Jun 12, 2024
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

2 participants