Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save buzztroll/7b91efdc70194ea5bdd8fdf6ce270097 to your computer and use it in GitHub Desktop.
Save buzztroll/7b91efdc70194ea5bdd8fdf6ce270097 to your computer and use it in GitHub Desktop.
resource "azurerm_resource_group" "test" {
name = "acctestlbrg-33"
location = "West US"
}
resource "azurerm_public_ip" "test" {
name = "simplelbip"
location = "West US"
resource_group_name = "${azurerm_resource_group.test.name}"
public_ip_address_allocation = "static"
}
resource "azurerm_simple_lb" "test" {
name = "acctestlb33"
location = "West US"
type = "Microsoft.Network/loadBalancers"
resource_group_name = "${azurerm_resource_group.test.name}"
frontend_allocation_method = "Dynamic"
frontend_public_ip_address = "${azurerm_public_ip.test.id}"
probe {
name = "sshProbe"
protocol = "Tcp"
port = 22
interval = 5
number_of_probes = 16
}
probe {
name = "httpProbe"
protocol = "Http"
port = 80
interval = 5
number_of_probes = 16
request_path = "/"
}
rule {
protocol = "Tcp"
load_distribution = "Default"
frontend_port = 80
backend_port = 80
name = "httprule"
probe_name = "httpProbe"
}
rule {
protocol = "Tcp"
load_distribution = "Default"
frontend_port = 22
backend_port = 22
name = "sshrule"
probe_name = "sshProbe"
}
}
resource "azurerm_network_interface" "test" {
count = 2
name = "simplelbnic${count.index}"
location = "West US"
resource_group_name = "${azurerm_resource_group.test.name}"
ip_configuration {
name = "simplelbconfiguration1${count.index}"
subnet_id = "${azurerm_subnet.test.id}"
private_ip_address_allocation = "Dynamic"
load_balancer_backend_address_pools_ids = ["${azurerm_simple_lb.test.backend_pool_id}"]
}
}
resource "azurerm_virtual_machine" "test" {
count = 2
name = "simplelbvm${count.index}"
location = "West US"
resource_group_name = "${azurerm_resource_group.test.name}"
network_interface_ids = ["${element(azurerm_network_interface.test.*.id, count.index)}"]
vm_size = "Standard_A0"
availability_set_id = "${azurerm_availability_set.test.id}"
storage_image_reference {
publisher = "Canonical"
offer = "UbuntuServer"
sku = "14.04.2-LTS"
version = "latest"
}
storage_os_disk {
name = "myosdisk${count.index}"
vhd_uri = "${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}/myosdisk${count.index}.vhd"
caching = "ReadWrite"
create_option = "FromImage"
}
os_profile {
computer_name = "buzzvm${count.index}"
admin_username = "testadmin"
admin_password = "CHANGEME"
}
os_profile_linux_config {
disable_password_authentication = false
}
}
resource "azurerm_storage_container" "test" {
name = "simplelbvhds11"
resource_group_name = "${azurerm_resource_group.test.name}"
storage_account_name = "${azurerm_storage_account.test.name}"
container_access_type = "private"
}
resource "azurerm_storage_account" "test" {
name = "simplelbsa11"
resource_group_name = "${azurerm_resource_group.test.name}"
location = "westus"
account_type = "Standard_LRS"
}
resource "azurerm_availability_set" "test" {
name = "AVALLCAPS"
location = "West US"
resource_group_name = "${azurerm_resource_group.test.name}"
}
resource "azurerm_subnet" "test" {
name = "simplelbsubnet"
resource_group_name = "${azurerm_resource_group.test.name}"
virtual_network_name = "${azurerm_virtual_network.test.name}"
address_prefix = "192.168.2.0/24"
}
resource "azurerm_virtual_network" "test" {
name = "simplelbvnet"
address_space = ["192.168.0.0/16"]
location = "West US"
resource_group_name = "${azurerm_resource_group.test.name}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment