Skip to content

Commit 9f7dcbe

Browse files
unattend bug fix (#187)
1 parent 39dfaed commit 9f7dcbe

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

examples/windows_w_run_command/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,12 @@ module "testvm" {
292292
generate_admin_password_or_ssh_key = false
293293
}
294294
}
295+
additional_unattend_contents = [
296+
{
297+
setting = "FirstLogonCommands"
298+
content = "<FirstLogonCommands><SynchronousCommand><CommandLine>%windir%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -NoProfile -ExecutionPolicy Bypass -file C:\\test.ps1</CommandLine><Description>script</Description><Order>2</Order></SynchronousCommand></FirstLogonCommands>"
299+
}
300+
]
295301
enable_telemetry = var.enable_telemetry
296302
encryption_at_host_enabled = true
297303
managed_identities = {

examples/windows_w_run_command/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,12 @@ module "testvm" {
273273
generate_admin_password_or_ssh_key = false
274274
}
275275
}
276+
additional_unattend_contents = [
277+
{
278+
setting = "FirstLogonCommands"
279+
content = "<FirstLogonCommands><SynchronousCommand><CommandLine>%windir%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -NoProfile -ExecutionPolicy Bypass -file C:\\test.ps1</CommandLine><Description>script</Description><Order>2</Order></SynchronousCommand></FirstLogonCommands>"
280+
}
281+
]
276282
enable_telemetry = var.enable_telemetry
277283
encryption_at_host_enabled = true
278284
managed_identities = {

main.windows_vm.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ resource "azurerm_windows_virtual_machine" "this" {
7474
}
7575
dynamic "additional_unattend_content" {
7676
for_each = {
77-
for content in var.additional_unattend_contents : sha256(content) => content
77+
for content in var.additional_unattend_contents : sha256(content.content) => content
7878
}
7979

8080
content {

0 commit comments

Comments
 (0)