# Virtual Machines BS Series B2s EU West 736.9334 0.0000 736.9334 0.0449 $33,11
# Virtual Network IP Addresses Standard IPv4 Static Public IP 2,217.0000 0.0000 2,217.0000 0.0047 $10,38

provider "azurerm" {
features {}
}

resource "azurerm_resource_group" "example" {
name     = "example-resources"
location = "East US"
}

resource "azurerm_virtual_network" "example" {
name                = "example-network"
address_space       = ["10.0.0.0/16"]
location            = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
}

resource "azurerm_subnet" "example" {
name                 = "example-subnet"
resource_group_name  = azurerm_resource_group.example.name
virtual_network_name = azurerm_virtual_network.example.name
address_prefixes     = ["10.0.1.0/24"]
}

resource "azurerm_network_interface" "example" {
name                = "example-nic"
location            = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name

ip_configuration {
name                          = "internal"
subnet_id                     = azurerm_subnet.example.id
private_ip_address_allocation = "Dynamic"
}
}

resource "azurerm_linux_virtual_machine" "example" {
name                = "example-vm"
location            = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
network_interface_ids = [
azurerm_network_interface.example.id,
]

size                 = "Standard_DS2_v2"
admin_username       = "adminuser"
admin_password       = "Password1234!"
disable_password_authentication = false
computer_name        = "hostname"

os_disk {
caching              = "ReadWrite"
storage_account_type = "Premium_LRS"
}

source_image_reference {
publisher = "Canonical"
offer     = "UbuntuServer"
sku       = "18.04-LTS"
version   = "latest"
}
}
