-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
azurerm_windows_virtual_machine fails to create when referencing a "specialised" shared gallery image. #7772
Comments
The documentation is not clear on exactly what value I also note resource explorer does not show any
|
To try and rule out any stupidity on my part, I've used the DATA source: |
At the behest of Terraform support, I created a cut-down version of the code which still gave the same error.
After rereading some of the MS docs, I am rather confused about the different methods to create images. On one hand, there is the "Managed Image", created by sysprep'ing (Generalise) + OOBE, created by clicking Please could someone from Hashicorp / MS confirm if my findings are accurate, in that Specialised VM's are not supported/do not work? If the latter, is this something that can be fixed and if not, can we have a note added to the documentation, please? I'll leave this open to allow Hashicorp to respond, but essentially, I seem to have resolved the issue. |
Hi @woter1832 thanks for this issue! Despite that now azurerm provider supports creating specialized image, it does not support provision VMs or VMSSes by using the specialized images. It is implementing in PR #7524 but it is currently blocked by some inconsistency in the compute API of azure. Please stay tuned. Thanks! |
(upvoted this) |
I'm also stuck with this issue but for azurerm_linux_virtual_machine instead. |
Same problem here. Do I understand that terraform is unable to deploy "specialized" image at all? |
@kinwolfqc it appears so, I have exactly the same issue with the latest Azure provider. There doesn't seem to be a solution at this moment other than creating a generalized version of the image. |
I can confirm that using a generalized image with |
I managed to create a (Windows) VM based on a specialised image (version) from a shared image gallery with terraform by relying on the (deprecated) |
This comment has been minimized.
This comment has been minimized.
This comment was marked as off-topic.
This comment was marked as off-topic.
I am having this same issue as well with Linux VM. Even though this was marked as off topic, wanted to add another data point. With the old resource of |
this issue seems last more than 2 years, no final solution until now, is there any workaround , thanks in advance |
My "workaround" was to generalize the image... Heh, that's all I got. |
Hi,
|
I guess there are no updates.... It's been 3 years now :( |
FWIW, I was able to get a specialised image working with the To prove this out, it is possible to force deployment of a Windows 11 Gen 2 Standard Security VM as a base image using the Azure CLI on which we can customise and specialise, for example:
Then, I modify and capture a specialised image in the Azure Compute Gallery. I can then use something like this Terraform to deploy a working VM from this specialised image:
If we do the same process but instead deploy a Windows 11 Gen 2 VM with Trusted Launch security, then customise and capture the specialised image to the Azure Compute Gallery, subsequent VMs fail to deploy from the image. Essentially, the only thing that changes in the Terraform snippet above is the reference to the
I do not believe the It seems you cannot change the VM security type once it has been deployed, so instead, you would need to start from scratch using this method. Capturing an image of a VM retains the security type. Of course (and as pointed out), the When generalising a Gen 2 VM that uses the Trusted Launch security type, I can use some Terraform similar to:
This uses the newer However, when switching to use a specialised image in the same Terraform snippet, we get another failure:
This is, of course, what @woter1832 initially reported above. When deploying a VM from a specialised image in the portal, the Admin username and password fields are greyed out. However, we can't remove the Whatever, this is super frustrating as Gen 2 VMs using the Trusted Launch security type can be deployed from specialised images via the Azure portal and all other Azure command line options. |
This is a HUGE problem !!! The Simple Use Case is: I need to create a VM machine (or VMSS ) using a Specialised image using Trusted launch upon Spot priority.
Due to the above problems, we are incurring loss because the automation cannot be implemented properly. We use Terraform for all the clouds and only Azure provider has such limitations. We need to create it manually everytime (via console or CLI). I have been following this thread for a long time now and still no progress, its Super Frustrating to see such stupid limitations when Terraform providers for AWS and GCP is highly matured. PLEASEE fix this ASAP. |
While this IMHO is a must have, I use the following workaround:
The main 'problem' with this approach is that the subscription must be set correctly with 'az account set subscription' to where the resource should be created but this command could be added. |
Creating a generalized image isn't possible for all virtual machine image definitions. There should be marked support of the |
I second this. I need to recreate three virtual machines for an important workload and want to use a specialized image with the windows/linux resource and this is driving me insane. |
Hi. Any news regarding this issue? Thanks |
Guys, this issue has been open since 2020.... It bothered me a ton when I ran into it 2 years ago and it's bothering me that I'm running into it again.... This basically blocks the deployment of any VM from an image if you want it to have secure boot. |
Community Note
Terraform (and AzureRM Provider) Version
Affected Resource(s)
azurerm_windows_virtual_machine
Terraform Configuration Files
Debug Output
Panic Output
Expected Behavior
Deploy two Windows VMs from "Shared Gallery Image"
Actual Behavior
A spurious error that does not relate to the issue.
Repeats for VM2.
(Line 82 is the begining of the resource:
resource "azurerm_windows_virtual_mahine" "pool" {
)If this isn't a bug, please consider updating the document that would resolve my mistake. Perhaps an example of using
source_image_id
.Steps to Reproduce
terraform apply
Important Factoids
This may be related to #5998 although the error is different.
Plan succeeds.
I did a test by creating the old
os_profile{}
block, addingadmin_username
andadmin_password
which made the plan fail.If this is the same regression as mentioned in #5998, can you check
azurerm_linux_virtual_machine
too, please?If I comment out
source_image_id
and usesource_image_reference
instead,apply
works and the VMs deploy.T. I. A.
References
There is an unanswered related question on your discuss site: https://discuss.hashicorp.com/t/unable-to-create-azure-windows-vm/6672
The text was updated successfully, but these errors were encountered: