Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save divgo/4168c7bed33bdab28a87a40f9c771db3 to your computer and use it in GitHub Desktop.
Save divgo/4168c7bed33bdab28a87a40f9c771db3 to your computer and use it in GitHub Desktop.
variable "dsc_key" {
default = "dsc_registration_key_from_portal"
}
variable "dsc_endpoint" {
default = "dsc_registration_url_from_portal"
}
variable dsc_config {
default = "node_configuration_you_want_applied__can_leave_blank"
}
resource "azurerm_virtual_machine_extension" "dsc_for_linux" {
name = "dsc_for_linux"
location = "${var.location}"
resource_group_name = "${var.resource_group_name}"
virtual_machine_name = "${var.vm_name}"
publisher = "Microsoft.OSTCExtensions"
type = "CustomScriptForLinux"
type_handler_version = "1.5"
depends_on = ["module.linux_vm"]
settings = <<SETTINGS
{
"fileUris": ["https://your_storage_account_name.blob.core.windows.net/scripts/onboard_linux_to_AzureAutomationDSC.sh"]
}
SETTINGS
protected_settings = <<PROTECTED_SETTINGS
{
"commandToExecute": "./onboard_linux_to_dsc.sh ${var.dsc_key} ${var.dsc_endpoint} ${var.dsc_config}",
"storageAccountName": "your_storage_account_name",
"storageAccountKey": "${var.storage_account_key}"
}
PROTECTED_SETTINGS
tags {
environment = "Production"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment