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

r\linux_virtual_machine,r\windows_virtual_machine: Add support for diff_disk_settings.placement #14847

Merged
merged 4 commits into from
May 13, 2022

Conversation

myc2h6o
Copy link
Contributor

@myc2h6o myc2h6o commented Jan 7, 2022

Implement Ephemeral OS Disk on Temp Resource Disk
Add new property diff_disk_settings.placement. Default value is CacheDisk and can be set to ResourceDisk to enable this feature.
Also caching needs to be ReadOnly to enable diff_disk_settings. Add this restriction as well.

Test result:
image

Copy link
Collaborator

@magodo magodo left a comment

Choose a reason for hiding this comment

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

Thanks for this PR!
I have left some additional mostly minor comments that once addressed this should be good to merge 👍

@katbyte katbyte modified the milestones: v3.1.0, v3.2.0 Apr 7, 2022
@myc2h6o
Copy link
Contributor Author

myc2h6o commented Apr 11, 2022

Hi @magodo thanks for reviewing the change! I've updated to code to fix the review comments, please take a look.

@myc2h6o
Copy link
Contributor Author

myc2h6o commented Apr 12, 2022

Updated test result
image

@katbyte katbyte modified the milestones: v3.2.0, v3.3.0 Apr 14, 2022
@HSerg
Copy link

HSerg commented Apr 21, 2022

@magodo do need to improve something in this PR?

@katbyte katbyte modified the milestones: v3.3.0, v3.4.0 Apr 22, 2022
@hashicorp hashicorp deleted a comment from github-actions bot Apr 22, 2022
Copy link
Member

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

One comment but this otherwise LGTM 👍

@@ -285,7 +303,8 @@ func flattenVirtualMachineOSDisk(ctx context.Context, disksClient *compute.Disks
diffDiskSettings := make([]interface{}, 0)
if input.DiffDiskSettings != nil {
diffDiskSettings = append(diffDiskSettings, map[string]interface{}{
"option": string(input.DiffDiskSettings.Option),
"option": string(input.DiffDiskSettings.Option),
"placement": string(input.DiffDiskSettings.Placement),
Copy link
Member

Choose a reason for hiding this comment

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

this'll be nil/empty in the response for existing resources, so we'd need to default this?

Copy link
Collaborator

@magodo magodo Apr 22, 2022

Choose a reason for hiding this comment

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

The original version has it set, but I've asked not to: #14847 (comment) 😅.

My understanding is the original version is trying to check a low likely case that the API didn't return the placement, then set it to its default value. But that is not always right. Imagine users have set the placement to DiffDiskPlacementResourceDisk, then if the API didn't return it, it will still ends up with a diff as the default value is DiffDiskPlacementCacheDisk. So I prefer just set whatever API is returning.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tombuildsstuff @magodo thanks for sharing the thoughts. I took another look, this property is not introduced initially in service, and default value is CacheDisk, so when it's missing from the response, we could probably consider it as CacheDisk. If it's set to ResourceDisk, it should not be missing in the response.

@katbyte katbyte modified the milestones: v3.4.0, v3.5.0, v3.6.0 Apr 29, 2022
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Thanks @myc2h6o - LGTM 🌵

@katbyte katbyte merged commit c92ac15 into hashicorp:main May 13, 2022
katbyte added a commit that referenced this pull request May 13, 2022
@myc2h6o myc2h6o deleted the vm_diff_disk branch May 13, 2022 03:23
@github-actions
Copy link

This functionality has been released in v3.6.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!

@github-actions
Copy link

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 contributions.
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 Jun 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants