Skip to content

Instantly share code, notes, and snippets.

@larryclaman
Created July 12, 2019 15:12
Show Gist options
  • Save larryclaman/4f6d2304c7cd8844db17313560a1a4d7 to your computer and use it in GitHub Desktop.
Save larryclaman/4f6d2304c7cd8844db17313560a1a4d7 to your computer and use it in GitHub Desktop.
Terraform example
locals {
"winscript" = "powershell iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) ;powershell choco install --ignore-checksums -y microsoftazurestorageexplorer ;powershell choco install -y IIS-WebServer --source windowsfeatures ;powershell choco install webdeploy -y; choco install azure-cli -y; powershell exit 0"
}
resource "azurerm_virtual_machine_extension" "bootstrapwin" {
count = "${length(local.winvmlist)}"
name = "Xbootstrapwin${count.index}"
location = "${var.Location}"
resource_group_name = "${azurerm_resource_group.vmdemorg.name}"
virtual_machine_name = "winvm${count.index}"
publisher = "Microsoft.Compute"
type = "CustomScriptExtension"
type_handler_version = "1.9"
//depends_on = ["winvm${count.index}"]
depends_on = ["azurerm_virtual_machine.winvm" ]
protected_settings = <<PSETTINGS
{
"commandToExecute": "${local.winscript}"
}
PSETTINGS
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment