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

azurerm_linux_virtual_machine azurerm_windows_virtual_machine - support bypass_platform_safety_checks_on_user_schedule_enabled and reboot_setting #22349

Merged
merged 3 commits into from Jul 27, 2023

Conversation

myc2h6o
Copy link
Contributor

@myc2h6o myc2h6o commented Jul 3, 2023

…upport `bypass_platform_safety_checks_on_user_schedule_enabled` and `reboot_setting`
@myc2h6o
Copy link
Contributor Author

myc2h6o commented Jul 3, 2023

Test result
image
image

Copy link
Member

@stephybun stephybun left a comment

Choose a reason for hiding this comment

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

Left 2 minor comments on the linux resource, could you port those two changes over to the windows resource as well. I'll run the tests then this should be good to go.

Comment on lines 899 to 900
if v := patchSettings.AutomaticByPlatformSettings.BypassPlatformSafetyChecksOnUserSchedule; v != nil {
bypassPlatformSafetyChecksOnUserScheduleEnabled = pointer.From(v)
Copy link
Member

Choose a reason for hiding this comment

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

pointer.From contains nil checking so this can be condensed down to

Suggested change
if v := patchSettings.AutomaticByPlatformSettings.BypassPlatformSafetyChecksOnUserSchedule; v != nil {
bypassPlatformSafetyChecksOnUserScheduleEnabled = pointer.From(v)
bypassPlatformSafetyChecksOnUserScheduleEnabled = pointer.From(v)

Comment on lines 902 to 904
if v := patchSettings.AutomaticByPlatformSettings.RebootSetting; v != "" {
rebootSetting = string(v)
}
Copy link
Member

Choose a reason for hiding this comment

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

Can condense this as well

Suggested change
if v := patchSettings.AutomaticByPlatformSettings.RebootSetting; v != "" {
rebootSetting = string(v)
}
rebootSetting = string(v)

@@ -126,6 +126,10 @@ The following arguments are supported:

* `boot_diagnostics` - (Optional) A `boot_diagnostics` block as defined below.

* `bypass_platform_safety_checks_on_user_schedule_enabled` - (Optional) Specifies whether to skip platform scheduled patch when user schedule is associated to the VM. Defaults to `false`.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* `bypass_platform_safety_checks_on_user_schedule_enabled` - (Optional) Specifies whether to skip platform scheduled patch when user schedule is associated to the VM. Defaults to `false`.
* `bypass_platform_safety_checks_on_user_schedule_enabled` - (Optional) Specifies whether to skip platform scheduled patching when a user schedule is associated with the VM. Defaults to `false`.

@@ -182,6 +186,10 @@ The following arguments are supported:

* `proximity_placement_group_id` - (Optional) The ID of the Proximity Placement Group which the Virtual Machine should be assigned to.

* `reboot_setting` - (Optional) Specifies the reboot setting for platform scheduled patch. Possible values are `Always`, `IfRequired` and `Never`.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* `reboot_setting` - (Optional) Specifies the reboot setting for platform scheduled patch. Possible values are `Always`, `IfRequired` and `Never`.
* `reboot_setting` - (Optional) Specifies the reboot setting for platform scheduled patching. Possible values are `Always`, `IfRequired` and `Never`.

@@ -119,6 +119,10 @@ The following arguments are supported:

* `boot_diagnostics` - (Optional) A `boot_diagnostics` block as defined below.

* `bypass_platform_safety_checks_on_user_schedule_enabled` - (Optional) Specifies whether to skip platform scheduled patch when user schedule is associated to the VM. Defaults to `false`.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* `bypass_platform_safety_checks_on_user_schedule_enabled` - (Optional) Specifies whether to skip platform scheduled patch when user schedule is associated to the VM. Defaults to `false`.
* `bypass_platform_safety_checks_on_user_schedule_enabled` - (Optional) Specifies whether to skip platform scheduled patching when a user schedule is associated with the VM. Defaults to `false`.

@@ -177,6 +181,10 @@ The following arguments are supported:

* `proximity_placement_group_id` - (Optional) The ID of the Proximity Placement Group which the Virtual Machine should be assigned to.

* `reboot_setting` - (Optional) Specifies the reboot setting for platform scheduled patch. Possible values are `Always`, `IfRequired` and `Never`.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* `reboot_setting` - (Optional) Specifies the reboot setting for platform scheduled patch. Possible values are `Always`, `IfRequired` and `Never`.
* `reboot_setting` - (Optional) Specifies the reboot setting for platform scheduled patching. Possible values are `Always`, `IfRequired` and `Never`.

@myc2h6o
Copy link
Contributor Author

myc2h6o commented Jul 27, 2023

@stephybun thanks for reviewing the change! I've updated the code and the doc according to your comments, please take a look.

Copy link
Member

@stephybun stephybun 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 🤖

@stephybun stephybun merged commit 59bf06b into hashicorp:main Jul 27, 2023
23 checks passed
@github-actions github-actions bot added this to the v3.67.0 milestone Jul 27, 2023
stephybun added a commit that referenced this pull request Jul 27, 2023
@myc2h6o myc2h6o deleted the vm_auto_patch branch July 27, 2023 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for PatchSettings automaticByPlatformSettings
3 participants