Skip to content
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_orchestrated_virtual_machine_scale_set support for additional_unattend_content #24282

Closed
1 task done
gibbcode opened this issue Dec 19, 2023 · 4 comments · Fixed by #24292
Closed
1 task done
Labels
enhancement service/vmss Virtual Machine Scale Sets
Milestone

Comments

@gibbcode
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

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

Both azurerm_windows_virtual_machine and azurerm_windows_virtual_machine_scale_set offer the option to specify additional_unattend_content.

This option is available in ARM for flexible VMSS azurerm_orchestrated_virtual_machine_scale_set, but is not available in Terraform.

This prevents consumers from executing custom_data after a VM build.

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

azurerm_orchestrated_virtual_machine_scale_set

Potential Terraform Configuration

resource "azurerm_orchestrated_virtual_machine_scale_set" "vmss" {
  resource_group_name         = azurerm_resource_group.rg.name
  name                        = var.name
  location                    = var.location
  instances                   = var.vmss_instances
  tags                        = local.tags

  os_profile {
    custom_data = base64encode(module.rds-init.rendered)
    windows_configuration {
      admin_username           = "azureuser"
      admin_password           = sensitive(data.azurerm_key_vault_secret.admin-password.value)
      computer_name_prefix     = substr(var.name,0,9)
      additional_unattend_content {
         content = var.content
         setting = var.setting
      }
    }
  }

References

Param available in azurerm_windows_virtual_machine and azurerm_windows_virtual_machine_scale_set

But not in azurerm_orchestrated_virtual_machine_scale_set

@rcskosir rcskosir added service/vmss Virtual Machine Scale Sets enhancement labels Dec 19, 2023
harshavmb added a commit to AmadeusITGroup/terraform-provider-azurerm that referenced this issue Dec 20, 2023
@rcskosir
Copy link
Contributor

Thank you for taking the time to open this issue. Please subscribe to PR #24292 created by @harshavmb for this issue.

harshavmb added a commit to AmadeusITGroup/terraform-provider-azurerm that referenced this issue Jan 24, 2024
@harshavmb
Copy link
Contributor

Hi @gibbcode ,

Unfortunately, I couldn't get this working! I am having problems with Autounattend.xml. I tried with several contents, all I get is below error which doesn't tell much. I doubt it's even supported by azure API as I see several comments here. I have had similar experience with flex orchestration APIs not having all feature support like uniform mode.

In case if you have a working xml, please share with me. Have you tested with by other means like az-cli/restapi? I couldn't test this via portal as no option was offered.

Error: waiting for creation of Orchestrated Virtual Machine Scale Set (Subscription: "b500a058-6396-45db-a15d-3f31913e84a5"
│ Resource Group Name: "factory-01"
│ Virtual Machine Scale Set Name: "acctestOVMSS-01"): Code="OSProvisioningInternalError" Message="OS Provisioning failed for VM 'acctestOVMSS-01_9cec32de' due to an internal error." Target="acctestOVMSS-01_9cec32de"

harshavmb added a commit to AmadeusITGroup/terraform-provider-azurerm that referenced this issue Feb 13, 2024
@harshavmb
Copy link
Contributor

No problem, I got it working with below configuration..

additional_unattend_content {        
        setting = "FirstLogonCommands"
        content = "<FirstLogonCommands><SynchronousCommand><CommandLine>shutdown /r /t 0 /c \"initial reboot\"</CommandLine><Description>reboot</Description><Order>1</Order></SynchronousCommand></FirstLogonCommands>"        
}

harshavmb added a commit to AmadeusITGroup/terraform-provider-azurerm that referenced this issue Feb 13, 2024
katbyte pushed a commit that referenced this issue Feb 15, 2024
#24292)

* #24282: Support additional_unattend_content part of azurerm_orchestrated_virtual_machine_scale_set

* #24282: Changes as per review

* #24282: Fix errors and tests

* #24282: terrafmt
@github-actions github-actions bot added this to the v3.92.0 milestone Feb 15, 2024
rizkybiz pushed a commit to rizkybiz/terraform-provider-azurerm that referenced this issue Feb 21, 2024
…orchestra… (hashicorp#24292)

* hashicorp#24282: Support additional_unattend_content part of azurerm_orchestrated_virtual_machine_scale_set

* hashicorp#24282: Changes as per review

* hashicorp#24282: Fix errors and tests

* hashicorp#24282: terrafmt
rizkybiz pushed a commit to rizkybiz/terraform-provider-azurerm that referenced this issue Feb 29, 2024
…orchestra… (hashicorp#24292)

* hashicorp#24282: Support additional_unattend_content part of azurerm_orchestrated_virtual_machine_scale_set

* hashicorp#24282: Changes as per review

* hashicorp#24282: Fix errors and tests

* hashicorp#24282: terrafmt
Copy link

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement service/vmss Virtual Machine Scale Sets
Projects
None yet
3 participants