terraform-provider-azurerm icon indicating copy to clipboard operation
terraform-provider-azurerm copied to clipboard

Support for automatic_instance_repair on the Orchestrated Virtual Machine Scale Set azure rm resource

Open githubofkrishnadhas opened this issue 1 year ago • 4 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Community Note

  • Please vote on this issue by adding a :thumbsup: reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment and review the contribution guide to help.

Description

Hi Team,

I am using azurerm_orchestrated_virtual_machine_scale_set to spin up Axure VMSS using terraform.

The reason why i am using azurerm_orchestrated_virtual_machine_scale_set is that i need to test and try out the spot mix property introduced by Microsoft which enables us to have on demand as well as spot instances in same virtual machine scaleset.

I was using azurerm_linux_virtual_machine_scale_set resource and saw that this will not support spot mix, and only support uniform orchestration mode as either completely ondemand or spot .

I was unaware of azurerm_orchestrated_virtual_machine_scale_set module and raised the below issue: https://github.com/hashicorp/terraform-provider-azurerm/issues/24184

and from this i came to know about this resouce block.

the issue is that i need to use automatic_instance_repair as we will be using docker to set up the application and in case the containers went down this is a feature that can help us to an extent.

I saw this warning in terraform azurerm documentation:

To enable the automatic_instance_repair, the Orchestrated Virtual Machine Scale Set must have a valid health_probe_id

and for this to work we need to have a upgrade_mode and health_probe_id. but i cant see where to put it as its not clear in the documentation and code.

I can see comments saying this is not supported in ovmss

  • https://github.com/hashicorp/terraform-provider-azurerm/blob/main/internal/services/compute/orchestrated_virtual_machine_scale_set_resource.go#L339-L341

This could be very helpful if you can integrate it also with OVMSS.

New or Affected Resource(s)/Data Source(s)

azurerm_orchestrated_virtual_machine_scale_set

Potential Terraform Configuration

This is how its in azurerm_linux_virtual_machine_scale_set 

resource "azurerm_linux_virtual_machine_scale_set" "vmss" {
  name                = azurerm_resource_group.vmss.name
  location            = azurerm_resource_group.vmss.location
  resource_group_name = azurerm_resource_group.vmss.name
  #tags                = azurerm_resource_group.vmss.tags
  depends_on = [
    azurerm_lb_rule.vmss
  ]
  upgrade_mode = "Manual"
  health_probe_id = "${ var.auto_repair ? azurerm_lb_probe.vmss.id : null}"
  zones = var.zones
  sku = "${var.sku}"
  instances = "${var.autoscale_default}"

// rest of terraform code
}

References

https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/orchestrated_virtual_machine_scale_set

https://github.com/hashicorp/terraform-provider-azurerm/blob/main/internal/services/compute/orchestrated_virtual_machine_scale_set_resource.go#L339-L341

https://github.com/hashicorp/terraform-provider-azurerm/issues/24184 https://learn.microsoft.com/en-us/azure/virtual-machine-scale-sets/spot-priority-mix?tabs=portal

githubofkrishnadhas avatar Dec 26 '23 13:12 githubofkrishnadhas