Terraform-provider-azurerm: source_image_id parse error

Created on 4 Feb 2020  ·  6Comments  ·  Source: terraform-providers/terraform-provider-azurerm

Community Note

  • Please vote on this issue by adding a 👍 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

Terraform (and AzureRM Provider) Version

````
Terraform v0.12.20

  • provider.azurerm v1.43.0
  • provider.null v2.1.2
    ````

Terraform Configuration Files

data "azurerm_shared_image" "hpc-sig-image" {
  name                = "ompi"
  gallery_name        = "hpcimages"
  resource_group_name = "packer-hpc-rg"
}
...
resource "azurerm_linux_virtual_machine" "vm" {
  count                 = var.instance_count
  name                  = "hpc-${lower(var.app_name)}-vm${count.index + 1}"
  location              = azurerm_resource_group.RG.location
  availability_set_id   = azurerm_availability_set.avset.id
  resource_group_name   = azurerm_resource_group.RG.name
  network_interface_ids = [element(azurerm_network_interface.vnic.*.id, count.index)]
  size                  = var.instance_size

  source_image_id       = data.azurerm_shared_image.hpc-sig-image.id

  os_disk {
    name              = "osdisk${count.index + 1}"
    caching           = "ReadWrite"
    storage_account_type = "StandardSSD_LRS"
    disk_size_gb      = "64"
  }
  computer_name  = "hpc-${lower(var.app_name)}-vm${count.index + 1}"
  admin_username = "ubuntu"

  admin_ssh_key {
    username     = "ubuntu"
    public_key = file("~/ubuntu.key.pub")
  }
}

Description / Feedback

terraform throws an error after upgrading to using new provider. This is a shared image previously working on tf 1.x

````
greg @ tennis ~/hpc-fvcom/azure (azurerm-tf-v2)
└─ ▶ tf plan
var.instance_count
Defines the number of VMs to be provisioned.

Enter a value: 1

Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

data.azurerm_resource_group.network-rg: Refreshing state...
data.azurerm_shared_image.hpc-sig-image: Refreshing state...
data.azurerm_virtual_network.vnet: Refreshing state...
data.azurerm_subnet.subnet: Refreshing state...


Error: Can not parse "source_image_id" as a resource id: ID contained more segments than required: "/subscriptions/guid-123-456-678-901/resourceGroups/packer-hpc-rg/providers/Microsoft.Compute/galleries/hpcimages/images/ompi"

on cluster-azure.tf line 103, in resource "azurerm_linux_virtual_machine" "vm":
103: resource "azurerm_linux_virtual_machine" "vm" {
````

bug preview servicvirtual-machine

Most helpful comment

looks like this was missed in the newly released v2 ?

All 6 comments

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

looks like this was missed in the newly released v2 ?

Hi @mb139h
If you have found a regression could you open a new issue with an example and some output you're seeing? The 2.0 release is based on the 1.x line, so this should have been brought in.
Thanks
Ste

I've had no issues using source_image_id in the v2 release.

I should have been more specific. The new linux vm scale set does not have this functionality implemented. I opened a bug https://github.com/terraform-providers/terraform-provider-azurerm/issues/5998

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!

Was this page helpful?
0 / 5 - 0 ratings