无法在 terraform 中部署 CIS 映像 - 无法从 Marketplace 映像部署

can't deploy CIS images in terraform - Unable to deploy from the Marketplace image

我正在尝试使用 Terraform 在 Azure 中部署 CIS Ubuntu 映像,但出现以下错误:

│ Error: Code="VMMarketplaceInvalidInput" Message="Unable to deploy from the Marketplace image or a custom image sourced from Marketplace image. The part number in the purchase information for VM '/xxx' is not as expected. Beware that the Plan object's properties are case-sensitive. "

我的 terraform 资源看起来像这样(为简洁起见更改了名称):

resource "azurerm_virtual_machine" "vm" {
  name                              = "name"
  location                          = "East US"
  resource_group_name               = "name"
  network_interface_ids             = [azurerm_network_interface.nic.id]
  vm_size                           = "Standard_D8_v3"
  delete_os_disk_on_termination     = true

  storage_image_reference {
    offer     = "cis-ubuntu-linux-2004-l1"     
    publisher = "center-for-internet-security-inc" 
    sku       = "cis-ubuntu2004-l1povw-jan-2022"       
    version   = "1.1.9"
  }

  plan { 
    name      = "cis-ubuntu2004-l1"
    publisher = "center-for-internet-security-inc"
    product   = "cis-ubuntu-linux-2004-l1"
  }

  storage_os_disk {
    name              = "name"
    caching           = "ReadWrite"
    create_option     = "FromImage"
    managed_disk_type = "Standard_LRS"
  }

  os_profile {
    computer_name  = "name"
    admin_username = "username"
    admin_password = "password"
  }

  os_profile_linux_config {
    disable_password_authentication = false
  }
}

我已经通过 CLI 接受了条款并在查询时得到以下信息:

$ az vm image terms show --offer "cis-ubuntu-linux-2004-l1" --plan "cis-ubuntu2004-l1" --publisher "center-for-internet-security-inc"
{
  "accepted": true,
  ...

不确定我哪里出错了?

Thakn 您确认问题已通过更改正确的 sku 得到解决 name.Please 找到我在我的环境中测试过的相同内容。

您可以检查 Azure Marketplace 中提供的基于发布者列出 VM 映像。

 az vm image list --output table --all --publisher center-for-internet-security-inc.

上图中对于1.1.9版本skucis-ubuntu2004-l1povw不是cis-ubuntu2004-l1povw-jan-2022.

参考 url :https://docs.microsoft.com/en-us/cli/azure/vm/image/terms?view=azure-cli-latest