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

Update r/(linux|windows)_virtual_machine_scale_set - Add health_probe_id back to Update #5430

Merged

Conversation

ArcturusZhang
Copy link
Contributor

@ArcturusZhang ArcturusZhang commented Jan 17, 2020

Since the PR has already add support for passing a health probe in update request of vmss, we could re-enable this in the update method to prevent the errors from the service when upgrade_policy is set to Automatic or Rolling.

Currently, if the upgrade_policy is set to Rolling or Automatic, when updating the VMSS in place, the service will complain about missing a health probe or health extension when updating:

{
  "error": {
    "code": "BadRequest",
    "message": "Rolling Upgrade mode is not supported for this Virtual Machine Scale Set because a health probe or health extension was not provided."
  }
}

@ghost ghost added the size/XS label Jan 17, 2020
@tombuildsstuff tombuildsstuff added this to the v2.0.0 milestone Jan 17, 2020
@tombuildsstuff tombuildsstuff added enhancement service/vmss Virtual Machine Scale Sets labels Jan 30, 2020
@tombuildsstuff tombuildsstuff self-assigned this Jan 30, 2020
Copy link
Contributor

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

hey @ArcturusZhang

Thanks for this PR - apologies for the delayed review here!

Taking a look through this looks good to me - however to be able to run the acceptance tests in situ this is going to need rebasing on top of master; as such I hope you don't mind but I'm going to push a rebase so that we can run the full test suite here 👍

Thanks!

@tombuildsstuff
Copy link
Contributor

hi @ArcturusZhang

After running the tests it appears there's some more (conditional) logic required to be able to enable this functionality than just setting the property unfortunately:

Test Failed

------- Stdout: -------
=== RUN   TestAccAzureRMLinuxVirtualMachineScaleSet_imagesAutomaticUpdate
=== PAUSE TestAccAzureRMLinuxVirtualMachineScaleSet_imagesAutomaticUpdate
=== CONT  TestAccAzureRMLinuxVirtualMachineScaleSet_imagesAutomaticUpdate
--- FAIL: TestAccAzureRMLinuxVirtualMachineScaleSet_imagesAutomaticUpdate (572.09s)
    testing.go:640: Step 2 error: errors during apply:
        
        Error: Error updating Linux Virtual Machine Scale Set "acctestvmss-200203151104692851" (Resource Group "acctestRG-200203151104692851"): compute.VirtualMachineScaleSetsClient#Update: Failure sending request: StatusCode=400 -- Original Error: Code="BadRequest" Message="Virtual Machine Scale Sets with Automatic OS Upgrade enabled must have all VM instances upgraded to same Platform Image. Upgrade all VM instances to latest Virtual Machine Scale Set model while property 'upgradePolicy.automaticOSUpgradePolicy.enableAutomaticOSUpgrade' is false and then update property 'upgradePolicy.automaticOSUpgradePolicy.enableAutomaticOSUpgrade' to true"
Test Failed

------- Stdout: -------
=== RUN   TestAccAzureRMLinuxVirtualMachineScaleSet_imagesRollingUpdate
=== PAUSE TestAccAzureRMLinuxVirtualMachineScaleSet_imagesRollingUpdate
=== CONT  TestAccAzureRMLinuxVirtualMachineScaleSet_imagesRollingUpdate
--- FAIL: TestAccAzureRMLinuxVirtualMachineScaleSet_imagesRollingUpdate (772.16s)
    testing.go:640: Step 2 error: errors during apply:
        
        Error: Error updating Instance "1" (Linux VM Scale Set "acctestvmss-200203151104692943" / Resource Group "acctestRG-200203151104692943") to the Latest Configuration: compute.VirtualMachineScaleSetsClient#UpdateInstances: Failure sending request: StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status=<nil> Code="OperationNotAllowed" Message="Operation 'manualUpgrade' is only allowed on Virtual Machine Scale Set 'acctestvmss-200203151104692943' with 'Manual' UpgradeMode."

For the moment we're going to ship the Beta of the azurerm_linux_virtual_machine_scale_set and azurerm_windows_virtual_machine_scale_set resources without this functionality (there's a known issue in the documentation for this beta resource) - but we'll take another look & fix this up once that's out.

Thanks!

@ArcturusZhang
Copy link
Contributor Author

hi @ArcturusZhang

After running the tests it appears there's some more (conditional) logic required to be able to enable this functionality than just setting the property unfortunately:

Test Failed

------- Stdout: -------
=== RUN   TestAccAzureRMLinuxVirtualMachineScaleSet_imagesAutomaticUpdate
=== PAUSE TestAccAzureRMLinuxVirtualMachineScaleSet_imagesAutomaticUpdate
=== CONT  TestAccAzureRMLinuxVirtualMachineScaleSet_imagesAutomaticUpdate
--- FAIL: TestAccAzureRMLinuxVirtualMachineScaleSet_imagesAutomaticUpdate (572.09s)
    testing.go:640: Step 2 error: errors during apply:
        
        Error: Error updating Linux Virtual Machine Scale Set "acctestvmss-200203151104692851" (Resource Group "acctestRG-200203151104692851"): compute.VirtualMachineScaleSetsClient#Update: Failure sending request: StatusCode=400 -- Original Error: Code="BadRequest" Message="Virtual Machine Scale Sets with Automatic OS Upgrade enabled must have all VM instances upgraded to same Platform Image. Upgrade all VM instances to latest Virtual Machine Scale Set model while property 'upgradePolicy.automaticOSUpgradePolicy.enableAutomaticOSUpgrade' is false and then update property 'upgradePolicy.automaticOSUpgradePolicy.enableAutomaticOSUpgrade' to true"
Test Failed

------- Stdout: -------
=== RUN   TestAccAzureRMLinuxVirtualMachineScaleSet_imagesRollingUpdate
=== PAUSE TestAccAzureRMLinuxVirtualMachineScaleSet_imagesRollingUpdate
=== CONT  TestAccAzureRMLinuxVirtualMachineScaleSet_imagesRollingUpdate
--- FAIL: TestAccAzureRMLinuxVirtualMachineScaleSet_imagesRollingUpdate (772.16s)
    testing.go:640: Step 2 error: errors during apply:
        
        Error: Error updating Instance "1" (Linux VM Scale Set "acctestvmss-200203151104692943" / Resource Group "acctestRG-200203151104692943") to the Latest Configuration: compute.VirtualMachineScaleSetsClient#UpdateInstances: Failure sending request: StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status=<nil> Code="OperationNotAllowed" Message="Operation 'manualUpgrade' is only allowed on Virtual Machine Scale Set 'acctestvmss-200203151104692943' with 'Manual' UpgradeMode."

For the moment we're going to ship the Beta of the azurerm_linux_virtual_machine_scale_set and azurerm_windows_virtual_machine_scale_set resources without this functionality (there's a known issue in the documentation for this beta resource) - but we'll take another look & fix this up once that's out.

Thanks!

Thanks a lot. But currently updating vmss with upgrade_policy of Rolling or Automatic will throw errors, is there any work around about this?

@tombuildsstuff
Copy link
Contributor

Tests pass:

$ TF_ACC=1 envchain azurerm go test -v ./azurerm/internal/services/compute/tests/ -run="(TestAccAzureRMLinuxVirtualMachineScaleSet_imagesRollingUpdate|TestAccAzureRMLinuxVirtualMachineScaleSet_imagesAutomaticUpdate)" -timeout=60m
=== RUN   TestAccAzureRMLinuxVirtualMachineScaleSet_imagesAutomaticUpdate
=== PAUSE TestAccAzureRMLinuxVirtualMachineScaleSet_imagesAutomaticUpdate
=== RUN   TestAccAzureRMLinuxVirtualMachineScaleSet_imagesRollingUpdate
=== PAUSE TestAccAzureRMLinuxVirtualMachineScaleSet_imagesRollingUpdate
=== CONT  TestAccAzureRMLinuxVirtualMachineScaleSet_imagesAutomaticUpdate
=== CONT  TestAccAzureRMLinuxVirtualMachineScaleSet_imagesRollingUpdate
--- PASS: TestAccAzureRMLinuxVirtualMachineScaleSet_imagesRollingUpdate (935.69s)
--- PASS: TestAccAzureRMLinuxVirtualMachineScaleSet_imagesAutomaticUpdate (937.28s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/compute/tests	937.327s
$ TF_ACC=1 envchain azurerm go test -v ./azurerm/internal/services/compute/tests/ -run="(TestAccAzureRMWindowsVirtualMachineScaleSet_imagesRollingUpdate|TestAccAzureRMWindowsVirtualMachineScaleSet_imagesAutomaticUpdate)" -timeout=60m
=== RUN   TestAccAzureRMWindowsVirtualMachineScaleSet_imagesAutomaticUpdate
=== PAUSE TestAccAzureRMWindowsVirtualMachineScaleSet_imagesAutomaticUpdate
=== RUN   TestAccAzureRMWindowsVirtualMachineScaleSet_imagesRollingUpdate
=== PAUSE TestAccAzureRMWindowsVirtualMachineScaleSet_imagesRollingUpdate
=== CONT  TestAccAzureRMWindowsVirtualMachineScaleSet_imagesAutomaticUpdate
=== CONT  TestAccAzureRMWindowsVirtualMachineScaleSet_imagesRollingUpdate
--- PASS: TestAccAzureRMWindowsVirtualMachineScaleSet_imagesRollingUpdate (505.82s)
--- PASS: TestAccAzureRMWindowsVirtualMachineScaleSet_imagesAutomaticUpdate (1130.70s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/compute/tests	1130.762s

Copy link
Member

@jackofallops jackofallops left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@tombuildsstuff
Copy link
Contributor

tombuildsstuff commented Feb 11, 2020

Ignoring some expected & transitory test failures (due to issues in Azure) the tests are fine:

Screenshot 2020-02-11 at 10 31 01

@tombuildsstuff tombuildsstuff merged commit 4f69a18 into hashicorp:master Feb 11, 2020
@tombuildsstuff tombuildsstuff modified the milestones: v2.0.0, v1.44.0 Feb 11, 2020
tombuildsstuff added a commit that referenced this pull request Feb 11, 2020
also splitting the 2.0 changes out into their own block since they're not officially available just yet
@ArcturusZhang ArcturusZhang deleted the Add-Health-Probe-Back-In-VMSS branch February 11, 2020 09:47
@ghost
Copy link

ghost commented Feb 12, 2020

This has been released in version 1.44.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 1.44.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Mar 28, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 28, 2020
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.

3 participants