-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathoption-10-customScriptExtension.tf
31 lines (24 loc) · 1.11 KB
/
option-10-customScriptExtension.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
Example:
custom_data = ${file("serverconfig/jumpbox-init.ps1"
*/
variable "custom_data" {
description = "Specifies custom data to supply to the machine. On Linux-based systems, this can be used as a cloud-init script. On other systems, this will be copied as a file on disk. Internally, Terraform will base64 encode this value before sending it to the API. The maximum length of the binary array is 65535 bytes."
default = null
}
resource "azurerm_virtual_machine_extension" "CustomScriptExtension" {
count = var.custom_data == null ? 0 : 1
name = "CustomScriptExtension"
location = var.location
resource_group_name = var.resource_group_name
virtual_machine_name = azurerm_virtual_machine.VM.name
publisher = "Microsoft.Compute"
type = "CustomScriptExtension"
type_handler_version = "1.9"
settings = <<SETTINGS
{
"commandToExecute": "powershell -command copy-item \"c:\\AzureData\\CustomData.bin\" \"c:\\AzureData\\CustomData.ps1\";\"c:\\AzureData\\CustomData.ps1\""
}
SETTINGS
tags = var.tags
}