Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: diff between creation and import state #2127

Merged
merged 1 commit into from
Feb 12, 2024

Conversation

vasilsatanasov
Copy link
Contributor

Description

There are differences between the state in the r/vsphere_virtual_machine when it is imported and when it is created/cloned. Fixed several of them which maked sense for me.

  • datastore_cluster_id - adding the property to the state when the VM is imported in order to keep the pervious behaviour.

  • disk.label / disk.keep_on_remove - the logic was to assign a computed label in format "disk" instead of the actual label added by the system and in such cases the disk was marked as keep_on_remove. Changed this to set the actual label and not setting the keep_on_remove property (defaulting to folse). If the label is not present - keeping the old logic.

  • Not sure how to proceed with sata_controller_count - looks like this should be a computed property, but this is a breaking change which I would avoid introducing.

Fixes #1706

Acceptance tests

  • Have you added an acceptance test for the functionality being added?
  • Have you run the acceptance tests on this branch?

Output from acceptance testing:

API server listening at: 127.0.0.1:62880
=== RUN   TestAccResourceVSphereVirtualMachine_basic
--- PASS: TestAccResourceVSphereVirtualMachine_basic (117.01s)
PASS

Debugger finished with the exit code 0

API server listening at: 127.0.0.1:63049
=== RUN   TestAccResourceVSphereVirtualMachine_cloneImport
--- PASS: TestAccResourceVSphereVirtualMachine_cloneImport (229.53s)
PASS

Debugger finished with the exit code 0

TestAccResourceVSphereVirtualMachine_multipleDisksAtDifferentSCSISlotsImport failing with the same error as in nightly acc tests

Release Note

Release note for CHANGELOG:

Unifies disk.keep_on_remove with default and disk.label with the correct one assigned to the VM disk during import
If a VM datastore is part of a datastore cluster the datastore_cluster_id attribute is filled during import.

References

#1706

There are differences between the state in the r/vsphere_virtual_machine
when it is imported and when it is created/cloned. Fixed several of
them which maked sense for me.

- datastore_cluster_id - adding the property to the state when the VM is
  imported in order to keep the pervious behaviour.
- disk.label / disk.keep_on_remove - the logic was to assign a computed
  label in format "disk<number of the diks>" instead of the actual label
  added by the system and in such cases the disk was marked as
keep_on_remove. Changed this to set the actual label and not setting the
keep_on_remove property (defaulting to folse). If the label is not
present - keeping the old logic.

- Not sure how to procede with sata_controller_count - looks like this
  should be a computed proprty, but this is a breaking change which I
  would avoid introducung.

added sata_controller_count attribute  to ignore state attributes since
e2e tests are failing localy

Fixes hashicorp#1706

Signed-off-by: Vasil Atanasov <vasila@vmware.com>
@vasilsatanasov vasilsatanasov requested a review from a team as a code owner January 31, 2024 08:11
@tenthirtyam tenthirtyam added the bug Type: Bug label Jan 31, 2024
@tenthirtyam tenthirtyam added this to the v2.7.0 milestone Jan 31, 2024
@tenthirtyam tenthirtyam self-requested a review January 31, 2024 11:41
@tenthirtyam tenthirtyam changed the title fix: Differences between creation and import state fix: diff between creation and import state Feb 8, 2024
Copy link
Collaborator

@tenthirtyam tenthirtyam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@tenthirtyam tenthirtyam merged commit 609d0ae into hashicorp:main Feb 12, 2024
4 checks passed
Copy link

github-actions bot commented Mar 6, 2024

This functionality has been released in v2.7.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

Copy link

github-actions bot commented Apr 6, 2024

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 6, 2024
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
bug Type: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Imported Attributes' Values Not Match Creation Default Values/Creation Module Defined
3 participants