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

Support additional_unattend_content part of azurerm_orchestrated_virtual_machine_scale_set resource #24292

Merged
merged 4 commits into from
Feb 15, 2024

Conversation

harshavmb
Copy link
Contributor

Support additional_unattend_content part of azurerm_orchestrated_virtual_machine_scale_set resource.

Fixes #24282

Copy link
Member

@stephybun stephybun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this @harshavmb.

Could you please take a look at the comments left in-line? Once that's done we can take another look through.

@harshavmb
Copy link
Contributor Author

Hi @stephybun ,

I made changes as asked in the review. Could you please have another look on this?

Copy link
Member

@stephybun stephybun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately we have several test failures @harshavmb

Test ended in panic.
------- Stdout: -------
=== RUN   TestAccOrchestratedVirtualMachineScaleSet_AutomaticVMGuestPatchingHotpatchingEnabledWindows
=== PAUSE TestAccOrchestratedVirtualMachineScaleSet_AutomaticVMGuestPatchingHotpatchingEnabledWindows
=== CONT  TestAccOrchestratedVirtualMachineScaleSet_AutomaticVMGuestPatchingHotpatchingEnabledWindows
------- Stderr: -------
panic: Invalid address to set: []string{"additional_unattend_content"}
goroutine 550 [running]:
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).Set(0xc002de7600, {0x9628719, 0x1b}, {0x82f9040, 0xc005e6e900})
  /opt/teamcity-agent/work/3337027aeff310bf/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/resource_data.go:233 +0x2b5
github.com/hashicorp/terraform-provider-azurerm/internal/services/compute.resourceOrchestratedVirtualMachineScaleSetRead(0xc002de7600, {0x8667da0?, 0xc00393e000?})
  /opt/teamcity-agent/work/3337027aeff310bf/internal/services/compute/orchestrated_virtual_machine_scale_set_resource.go:1319 +0x1aad
github.com/hashicorp/terraform-provider-azurerm/internal/services/compute.resourceOrchestratedVirtualMachineScaleSetCreate(0xc002de7600, {0x8667da0?, 0xc00393e000?})
  /opt/teamcity-agent/work/3337027aeff310bf/internal/services/compute/orchestrated_virtual_machine_scale_set_resource.go:695 +0x32c5
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xa0220f0?, {0xa0220f0?, 0xc001bc8c60?}, 0xd?, {0x8667da0?, 0xc00393e000?})
  /opt/teamcity-agent/work/3337027aeff310bf/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/resource.go:766 +0x163
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc00461d0a0, {0xa0220f0, 0xc001bc8c60}, 0xc001fa88f0, 0xc002de6580, {0x8667da0, 0xc00393e000})
  /opt/teamcity-agent/work/3337027aeff310bf/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/resource.go:909 +0xa7e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc003ffbe48, {0xa0220f0?, 0xc001bc8bd0?}, 0xc001dbe000)
  /opt/teamcity-agent/work/3337027aeff310bf/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/grpc_provider.go:1060 +0xdbc
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc005ca1720, {0xa0220f0?, 0xc001b48d80?}, 0xc003a521c0)
  /opt/teamcity-agent/work/3337027aeff310bf/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server/server.go:859 +0x56a
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x9204680?, 0xc005ca1720}, {0xa0220f0, 0xc001b48d80}, 0xc003a52150, 0x0)
  /opt/teamcity-agent/work/3337027aeff310bf/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:467 +0x169
google.golang.org/grpc.(*Server).processUnaryRPC(0xc002a40000, {0xa047940, 0xc003c8c1a0}, 0xc00372c120, 0xc0032d8660, 0xffaee78, 0x0)
  /opt/teamcity-agent/work/3337027aeff310bf/vendor/google.golang.org/grpc/server.go:1374 +0xde7
google.golang.org/grpc.(*Server).handleStream(0xc002a40000, {0xa047940, 0xc003c8c1a0}, 0xc00372c120, 0x0)
  /opt/teamcity-agent/work/3337027aeff310bf/vendor/google.golang.org/grpc/server.go:1751 +0x9e7
google.golang.org/grpc.(*Server).serveStreams.func1.1()
  /opt/teamcity-agent/work/3337027aeff310bf/vendor/google.golang.org/grpc/server.go:986 +0xbb
created by google.golang.org/grpc.(*Server).serveStreams.func1 in goroutine 334
  /opt/teamcity-agent/work/3337027aeff310bf/vendor/google.golang.org/grpc/server.go:997 +0x145

@harshavmb
Copy link
Contributor Author

Hi @stephybun,

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.

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"

@github-actions github-actions bot added size/L and removed size/S labels Feb 13, 2024
@harshavmb
Copy link
Contributor Author

In the meantime, 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 harshavmb requested a review from stephybun February 13, 2024 09:15
@harshavmb
Copy link
Contributor Author

Unfortunately we have several test failures @harshavmb

Test ended in panic.
------- Stdout: -------
=== RUN   TestAccOrchestratedVirtualMachineScaleSet_AutomaticVMGuestPatchingHotpatchingEnabledWindows
=== PAUSE TestAccOrchestratedVirtualMachineScaleSet_AutomaticVMGuestPatchingHotpatchingEnabledWindows
=== CONT  TestAccOrchestratedVirtualMachineScaleSet_AutomaticVMGuestPatchingHotpatchingEnabledWindows
------- Stderr: -------
panic: Invalid address to set: []string{"additional_unattend_content"}
goroutine 550 [running]:
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).Set(0xc002de7600, {0x9628719, 0x1b}, {0x82f9040, 0xc005e6e900})
  /opt/teamcity-agent/work/3337027aeff310bf/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/resource_data.go:233 +0x2b5
github.com/hashicorp/terraform-provider-azurerm/internal/services/compute.resourceOrchestratedVirtualMachineScaleSetRead(0xc002de7600, {0x8667da0?, 0xc00393e000?})
  /opt/teamcity-agent/work/3337027aeff310bf/internal/services/compute/orchestrated_virtual_machine_scale_set_resource.go:1319 +0x1aad
github.com/hashicorp/terraform-provider-azurerm/internal/services/compute.resourceOrchestratedVirtualMachineScaleSetCreate(0xc002de7600, {0x8667da0?, 0xc00393e000?})
  /opt/teamcity-agent/work/3337027aeff310bf/internal/services/compute/orchestrated_virtual_machine_scale_set_resource.go:695 +0x32c5
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xa0220f0?, {0xa0220f0?, 0xc001bc8c60?}, 0xd?, {0x8667da0?, 0xc00393e000?})
  /opt/teamcity-agent/work/3337027aeff310bf/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/resource.go:766 +0x163
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc00461d0a0, {0xa0220f0, 0xc001bc8c60}, 0xc001fa88f0, 0xc002de6580, {0x8667da0, 0xc00393e000})
  /opt/teamcity-agent/work/3337027aeff310bf/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/resource.go:909 +0xa7e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc003ffbe48, {0xa0220f0?, 0xc001bc8bd0?}, 0xc001dbe000)
  /opt/teamcity-agent/work/3337027aeff310bf/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/grpc_provider.go:1060 +0xdbc
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc005ca1720, {0xa0220f0?, 0xc001b48d80?}, 0xc003a521c0)
  /opt/teamcity-agent/work/3337027aeff310bf/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server/server.go:859 +0x56a
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x9204680?, 0xc005ca1720}, {0xa0220f0, 0xc001b48d80}, 0xc003a52150, 0x0)
  /opt/teamcity-agent/work/3337027aeff310bf/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:467 +0x169
google.golang.org/grpc.(*Server).processUnaryRPC(0xc002a40000, {0xa047940, 0xc003c8c1a0}, 0xc00372c120, 0xc0032d8660, 0xffaee78, 0x0)
  /opt/teamcity-agent/work/3337027aeff310bf/vendor/google.golang.org/grpc/server.go:1374 +0xde7
google.golang.org/grpc.(*Server).handleStream(0xc002a40000, {0xa047940, 0xc003c8c1a0}, 0xc00372c120, 0x0)
  /opt/teamcity-agent/work/3337027aeff310bf/vendor/google.golang.org/grpc/server.go:1751 +0x9e7
google.golang.org/grpc.(*Server).serveStreams.func1.1()
  /opt/teamcity-agent/work/3337027aeff310bf/vendor/google.golang.org/grpc/server.go:986 +0xbb
created by google.golang.org/grpc.(*Server).serveStreams.func1 in goroutine 334
  /opt/teamcity-agent/work/3337027aeff310bf/vendor/google.golang.org/grpc/server.go:997 +0x145

I fixed the test case & tests ran fine at my end. Could you please re-review?

Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🌋

@katbyte katbyte merged commit 38a7350 into hashicorp:main Feb 15, 2024
33 checks passed
@katbyte katbyte changed the title #24282: Support additional_unattend_content part of azurerm_orchestra… Support additional_unattend_content part of azurerm_orchestrated_virtual_machine_scale_set resource Feb 15, 2024
@github-actions github-actions bot added this to the v3.92.0 milestone Feb 15, 2024
katbyte added a commit that referenced this pull request Feb 15, 2024
dduportal added a commit to jenkins-infra/azure that referenced this pull request Feb 19, 2024
<Actions>
<action
id="f410411e63aff4bb73a81c2aec1d373cf8a903e63b30dee2006b0030d8a94cc8">
        <h3>Bump Terraform `azurerm` provider version</h3>
<details
id="1d9343c012f5434ac9fe8a98135bae3667b399259be16d9b14302ea3bd424a24">
            <summary>Update Terraform lock file</summary>
<p>changes detected:&#xA;&#x9;&#34;hashicorp/azurerm&#34; updated from
&#34;3.91.0&#34; to &#34;3.92.0&#34; in file
&#34;.terraform.lock.hcl&#34;</p>
            <details>
                <summary>3.92.0</summary>
<pre>Changelog retrieved
from:&#xA;&#x9;https://github.com/hashicorp/terraform-provider-azurerm/releases/tag/v3.92.0&#xA;FEATURES:&#xA;&#xA;*
**New Data Source**: `azurerm_virtual_desktop_application_group`
([#24771](https://github.com/hashicorp/terraform-provider-azurerm/issues/24771))&#xA;&#xA;ENHANCEMENTS:&#xA;&#xA;*
provider: support for the feature flag
`postgresql_flexible_server.restart_server_on_configuration_value_change
property`
([#23811](hashicorp/terraform-provider-azurerm#23811
dependencies: updating to v0.20240214.1142753 of
`github.com/hashicorp/go-azure-sdk`
([#24889](hashicorp/terraform-provider-azurerm#24889
`automation`: updating to use the transport layer from
`hashicorp/go-azure-sdk` rather than `Azure/go-autorest`
([#24858](hashicorp/terraform-provider-azurerm#24858
`maintenance`: updating to use the transport layer from
`hashicorp/go-azure-sdk` rather than `Azure/go-autorest`
([#24819](hashicorp/terraform-provider-azurerm#24819
`containerapps`: updating to use the transport layer from
`hashicorp/go-azure-sdk` rather than `Azure/go-autorest`
([#24862](hashicorp/terraform-provider-azurerm#24862
`containerservices`: updating to use the transport layer from
`hashicorp/go-azure-sdk` rather than `Azure/go-autorest`
([#24872](hashicorp/terraform-provider-azurerm#24872
`timeseriesinsights`: updating to use the transport layer from
`hashicorp/go-azure-sdk` rather than `Azure/go-autorest`
([#24889](hashicorp/terraform-provider-azurerm#24889
`azurerm_container_app_environment`: support for the
`infrastructure_resource_group_name` property
([#24361](hashicorp/terraform-provider-azurerm#24361
`azurerm_cost_anomaly_alert` - support for the `subscription_id`
property
([#24258](hashicorp/terraform-provider-azurerm#24258
`azurerm_cosmosdb_account` - add default values for the
`consistency_policy` code block
([#24830](hashicorp/terraform-provider-azurerm#24830
`azurerm_dashboard_grafana` - support for the `smtp` block
([#24717](hashicorp/terraform-provider-azurerm#24717
`azurerm_key_vault_certificates` - support for the `tags` property
([#24857](hashicorp/terraform-provider-azurerm#24857
`azurerm_key_vault_secrets` - support for the `tags` property
([#24857](hashicorp/terraform-provider-azurerm#24857
`azurerm_orchestrated_virtual_machine_scale_set` - support for the
`additional_unattend_content` block
([#24292](hashicorp/terraform-provider-azurerm#24292
`azurerm_virtual_desktop_host_pool` - support for the `vm_template`
property
([#24369](https://github.com/hashicorp/terraform-provider-azurerm/issues/24369))&#xA;&#xA;BUG
FIXES:&#xA;&#xA;* `azurerm_container_app_environment`: avoid unwanted
changes when updating and using `log_analytics_workspace_id`
([#24303](hashicorp/terraform-provider-azurerm#24303
`azurerm_cosmosdb_account` - fixed regression in the `backup` code block
([#24830](hashicorp/terraform-provider-azurerm#24830
`azurerm_data_factory` - allow the `git_url` property to be blank/empty
([#24879](hashicorp/terraform-provider-azurerm#24879
`azurerm_linux_web_app_slot` - the `worker_count` property now works
correctly in the `site_config` block
([#24515](hashicorp/terraform-provider-azurerm#24515
`azurerm_linux_web_app` - support `off` for the `file_system_level`
property
([#24877](hashicorp/terraform-provider-azurerm#24877
`azurerm_linux_web_app_slot` - support `off` for the `file_system_level`
property
([#24877](hashicorp/terraform-provider-azurerm#24877
`azurerm_private_endpoint` - fixing an issue where updating the Private
Endpoint would remove any Application Security Group Association
([#24846](hashicorp/terraform-provider-azurerm#24846
`azurerm_search_service` - fixed the update function to adjust for
changed API behaviour
([#24837](hashicorp/terraform-provider-azurerm#24837
`azurerm_search_service` - fixed the update function to adjust for
changed API behaviour
([#24903](hashicorp/terraform-provider-azurerm#24903
`azurerm_windows_web_app` - support `off` for the `file_system_level`
property
([#24877](hashicorp/terraform-provider-azurerm#24877
`azurerm_windows_web_app_slot` - support `off` for the
`file_system_level` property
([#24877](https://github.com/hashicorp/terraform-provider-azurerm/issues/24877))&#xA;&#xA;&#xA;</pre>
            </details>
        </details>
<a
href="https://infra.ci.jenkins.io/job/updatecli/job/azure/job/main/3/">Jenkins
pipeline link</a>
    </action>
</Actions>

---

<table>
  <tr>
    <td width="77">
<img src="https://www.updatecli.io/images/updatecli.png" alt="Updatecli
logo" width="50" height="50">
    </td>
    <td>
      <p>
Created automatically by <a
href="https://www.updatecli.io/">Updatecli</a>
      </p>
      <details><summary>Options:</summary>
        <br />
<p>Most of Updatecli configuration is done via <a
href="https://www.updatecli.io/docs/prologue/quick-start/">its
manifest(s)</a>.</p>
        <ul>
<li>If you close this pull request, Updatecli will automatically reopen
it, the next time it runs.</li>
<li>If you close this pull request and delete the base branch, Updatecli
will automatically recreate it, erasing all previous commits made.</li>
        </ul>
        <p>
Feel free to report any issues at <a
href="https://github.com/updatecli/updatecli/issues">github.com/updatecli/updatecli</a>.<br
/>
If you find this tool useful, do not hesitate to star <a
href="https://github.com/updatecli/updatecli/stargazers">our GitHub
repository</a> as a sign of appreciation, and/or to tell us directly on
our <a
href="https://matrix.to/#/#Updatecli_community:gitter.im">chat</a>!
        </p>
      </details>
    </td>
  </tr>
</table>

Co-authored-by: Jenkins Infra Bot (updatecli) <[email protected]>
Co-authored-by: Damien Duportal <[email protected]>
@harshavmb harshavmb deleted the github-24282 branch February 20, 2024 13:44
rizkybiz pushed a commit to rizkybiz/terraform-provider-azurerm that referenced this pull request 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 pull request Feb 21, 2024
rizkybiz pushed a commit to rizkybiz/terraform-provider-azurerm that referenced this pull request 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
rizkybiz pushed a commit to rizkybiz/terraform-provider-azurerm that referenced this pull request Feb 29, 2024
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, 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 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

azurerm_orchestrated_virtual_machine_scale_set support for additional_unattend_content
4 participants