azure - 有没有办法使用 Terraform 创建 Azure 数据科学 VM?

标签 azure terraform azure-dsvm

我正在使用 Terraform 创建 Azure VM,但由于这些虚拟机没有安装太多功能,因此我正在研究其他 Azure 资源。我发现 Azure Data Science VM 可以满足我的大部分需求,因此我想知道是否有一种方法可以使用 Terraform 创建这些 VM。我在文档中看不到它,但也许有解决方法。

任何关于这方面的方向都会很棒!

最佳答案

假设

Azure 资源模型。

步骤

此过程将分为几个步骤。您首先需要检索平台镜像。

data "azurerm_platform_image" "test" {
   location  = "West Europe"
   publisher = "Microsoft"
   offer     = "xx"
   sku       = "xx"
}

但是,在完全填充此内容之前,您需要检索 SKUOffer。令人烦恼的是,这在互联网上并不容易获得,并且需要 API 调用或 Powershell 乐趣。

This链接将帮助您实现这一目标。

填充上述 terraform 后,您就可以利用它来创建虚拟机。

resource "azurerm_virtual_machine" "test" {
    name                  = "acctvm"
    location              = "West US 2"
    resource_group_name   = "${azurerm_resource_group.test.name}"
    network_interface_ids = ["${azurerm_network_interface.test.id}"]
    vm_size               = "Standard_DS1_v2"

storage_image_reference {
    id = "${data.azurerm_platform_image.test.id}"
}

storage_os_disk {
    name              = "myosdisk1"
    caching           = "ReadWrite"
    create_option     = "FromImage"
    managed_disk_type = "Standard_LRS"
}

# Optional data disks
storage_data_disk {
    name              = "datadisk_new"
    managed_disk_type = "Standard_LRS"
    create_option     = "Empty"
    lun               = 0
    disk_size_gb      = "1023"
}

storage_data_disk {
    name            = "${azurerm_managed_disk.test.name}"
    managed_disk_id = "${azurerm_managed_disk.test.id}"
    create_option   = "Attach"
    lun             = 1
    disk_size_gb    = "${azurerm_managed_disk.test.disk_size_gb}"
}

os_profile {
    computer_name  = "hostname"
    admin_username = "testadmin"
    admin_password = "Password1234!"
}

os_profile_linux_config {
    disable_password_authentication = false
}

tags {
    environment = "staging"
}
}

关于azure - 有没有办法使用 Terraform 创建 Azure 数据科学 VM?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46795361/

相关文章:

azure - Azure 中的服务计划和应用程序服务计划有什么区别?

azure - Azure Key Vault 是否可以与函数一起使用来存储队列触发器的连接字符串?

azure - TERRAFORM 如何在子网上设置 count.index 以检索 network_security_group_id

azure - 在 Azure DSVM 上创建和使用自定义 Anaconda 环境

azure - 无法访问 Azure 上的 Jupyter

Azure 数据工厂

powershell - WinRM 访问被拒绝(Visual Studio Team Services 的生成定义中的 Azure 文件复制任务)

amazon-ec2 - 使用 private_key 时,Terraform 配置程序抛出未找到 key 错误

amazon-web-services - 如何在使用 Terraform 创建网络负载均衡器时附加弹性 IP?