Back
You can try with the below code, and this will help for the spot instances:
resource "azurerm_linux_virtual_machine_scale_set" "example" { name = "example-vmss" resource_group_name = azurerm_resource_group.example.name location = azurerm_resource_group.example.location sku = "Standard_F2" instances = 1 admin_username = "adminuser" priority = "Spot" eviction_policy = "Deallocate" admin_ssh_key { username = "adminuser" public_key = file("~/.ssh/id_rsa.pub") } source_image_reference { publisher = "Canonical" offer = "UbuntuServer" sku = "16.04-LTS" version = "latest" } os_disk { storage_account_type = "Standard_LRS" caching = "ReadWrite" } network_interface { name = "example" primary = true ip_configuration { name = "internal" primary = true subnet_id = azurerm_subnet.internal.id } }}
resource "azurerm_linux_virtual_machine_scale_set" "example" {
name = "example-vmss"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
sku = "Standard_F2"
instances = 1
admin_username = "adminuser"
priority = "Spot"
eviction_policy = "Deallocate"
admin_ssh_key {
username = "adminuser"
public_key = file("~/.ssh/id_rsa.pub")
}
source_image_reference {
publisher = "Canonical"
offer = "UbuntuServer"
sku = "16.04-LTS"
version = "latest"
os_disk {
storage_account_type = "Standard_LRS"
caching = "ReadWrite"
network_interface {
name = "example"
primary = true
ip_configuration {
name = "internal"
subnet_id = azurerm_subnet.internal.id
I hope this will help.
Want to become an Azure expert? join Azure Training now!!
31k questions
32.8k answers
501 comments
693 users