hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.58k stars 4.62k forks source link

azurerm_linux_virtual_machine - license_type support for UBUNTU_PRO #27520

Open jasonrepos opened 2 weeks ago

jasonrepos commented 2 weeks ago

Is there an existing issue for this?

Community Note

Description

It would be good to have support for the UBUNTU_PRO license within azurerm_linux_virtual_machine license_type

│ Error: expected license_type to be one of ["RHEL_BYOS" "SLES_BYOS"], got UBUNTU_PRO │ │ with azurerm_linux_virtual_machine., │ on terraform.tf line 3987, in resource "azurerm_linux_virtual_machine" "": │ 3987: license_type = "UBUNTU_PRO"

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

azurerm_linux_virtual_machine

Potential Terraform Configuration

resource "azurerm_linux_virtual_machine" "xxx" {
  name                       = "xxx"
  location                   = azurerm_resource_group.yyy.location
  resource_group_name        = azurerm_resource_group.yyy.name
  license_type = "UBUNTU_PRO"

References

No response

harshavmb commented 2 weeks ago

Hi @jasonrepos ,

Could you please share links to documentation where it says UBUNTU_PRO is supported? Here I see only SLES & RHEL appear to be supported.

jasonrepos commented 2 weeks ago

Hi @harshavmb

Here is the Azure doc on Ubuntu Pro - https://learn.microsoft.com/en-us/azure/virtual-machines/workloads/canonical/ubuntu-pro-in-place-upgrade

In my case I have manually upgraded our Ubuntu VMs using the following command

az vm update -g myResourceGroup -n myVmName --license-type UBUNTU_PRO

Following this, I am now having to set a lifecycle ignore so terraform does not revert the change.

lifecycle { ignore_changes = [ license_type ]

Chambras commented 2 weeks ago

@jasonrepos Just curious what offer and sku are you using?

jasonrepos commented 2 weeks ago

source_image_reference { publisher = "Canonical" offer = "0001-com-ubuntu-server-focal" sku = "20_04-lts-gen2" version = "latest" }