Skip to content

Commit a7c54d1

Browse files
Inline PowerShell script using EncodedCommand in VMSS
Updated the VMSS extension to use the PowerShell -EncodedCommand parameter with base64-encoded init.ps1 content, removing the need for fileUris and script fields. This change embeds the script directly and avoids external dependencies.
1 parent 4a22372 commit a7c54d1

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

gh-runners/vmss.tf

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,7 @@ resource "azurerm_virtual_machine_scale_set_extension" "vmss" {
102102

103103
# Embed init.ps1 script inline to avoid external dependencies
104104
protected_settings = jsonencode({
105-
commandToExecute = "powershell -ExecutionPolicy Unrestricted -File init.ps1"
106-
fileUris = []
107-
script = base64encode(file("${path.module}/init.ps1"))
105+
commandToExecute = "powershell -ExecutionPolicy Unrestricted -EncodedCommand ${textencodebase64(file("${path.module}/init.ps1"), "UTF-16LE")}"
108106
})
109107
}
110108

0 commit comments

Comments
 (0)