Skip to content

Instantly share code, notes, and snippets.

@geekzter
Last active May 4, 2021 12:25
Show Gist options
  • Save geekzter/738883b417f219edd7b0e036105b3a47 to your computer and use it in GitHub Desktop.
Save geekzter/738883b417f219edd7b0e036105b3a47 to your computer and use it in GitHub Desktop.
Azure Pipeline Agent Cloud Config (Terraform merge)
data cloudinit_config user_data {
gzip = false
base64_encode = false
part {
content = templatefile("${path.root}/../cloudinit/cloud-config-userdata.yaml",
{
# Propagate virtual network information, so cloudinit can set up environment variables
subnet_id = azurerm_subnet.agent_subnet.id
virtual_network_id = azurerm_virtual_network.pipeline_network.id
})
content_type = "text/cloud-config"
}
merge_type = "list(append)+dict(recurse_array)+str()"
}
# Show relevant attributes only
resource azurerm_linux_virtual_machine_scale_set linux_agents {
# ...
custom_data = base64encode(data.cloudinit_config.user_data.rendered)
# ...
lifecycle {
# Let Azure DevOps manage the number of instances
ignore_changes = [instances]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment