我正在使用Terraform部署Azure VM。我想探索在云中创建虚拟机后,在虚拟机上预安装一系列工具(如Azure cli)的选项。有人能帮我举一个如何实现这一点的示例吗?我当前的Terraform脚本如下所示:
resource "azurerm_linux_virtual_machine" "main" {
name = "trainingVM-1"
resource_group_name = data.azurerm_resource_group.current.name
location = data.azurerm_resource_group.current.location
size = "Standard_B2s"
admin_username = "vmsysuser2"
admin_password = "Training123!"
disable_password_authentication = false
network_interface_ids = [
azurerm_network_interface.linux.id,
]
os_disk {
caching = "ReadWrite"
storage_account_type = "Standard_LRS"
}
source_image_reference {
publisher = "Canonical"
offer = "UbuntuServer"
sku = "16.04-LTS"
version = "latest"
}
identity {
type = "SystemAssigned, UserAssigned"
identity_ids = [azurerm_user_assigned_identity.uai.id]
}
}
1条答案
按热度按时间euoag5mw1#
1/您需要将此添加到您的***azure VM***资源块:
2/然后创建文件“azure_cli.tpl”,其中包含安装Azure CLI的Linux说明: