-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscaleset.tf
77 lines (64 loc) · 2.19 KB
/
scaleset.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
resource "azurerm_virtual_machine_scale_set" "demo" {
name = "mytestscaleset-1"
location = var.location
resource_group_name = azurerm_resource_group.demo.name
# automatic rolling upgrade
automatic_os_upgrade = true
upgrade_policy_mode = "Rolling"
rolling_upgrade_policy {
max_batch_instance_percent = 20
max_unhealthy_instance_percent = 20
max_unhealthy_upgraded_instance_percent = 5
pause_time_between_batches = "PT0S"
}
# required when using rolling upgrade policy
health_probe_id = azurerm_lb_probe.demo.id
zones = var.zones
sku {
name = "Standard_A1_v2"
tier = "Standard"
capacity = 2
}
storage_profile_image_reference {
publisher = "Canonical"
offer = "UbuntuServer"
sku = "18.04-LTS"
version = "latest"
}
storage_profile_os_disk {
name = ""
caching = "ReadWrite"
create_option = "FromImage"
managed_disk_type = "Standard_LRS"
}
storage_profile_data_disk {
lun = 0
caching = "ReadWrite"
create_option = "Empty"
disk_size_gb = 10
}
os_profile {
computer_name_prefix = "demo"
admin_username = "demo"
custom_data = "#!/bin/bash\n\napt-get update && apt-get install -y nginx && systemctl enable nginx && systemctl start nginx"
}
os_profile_linux_config {
disable_password_authentication = true
ssh_keys {
key_data = file("mykey.pub")
path = "/home/demo/.ssh/authorized_keys"
}
}
network_profile {
name = "networkprofile"
primary = true
network_security_group_id = azurerm_network_security_group.demo-instance.id
ip_configuration {
name = "IPConfiguration"
primary = true
subnet_id = azurerm_subnet.demo-subnet-1.id
load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.bpepool.id]
load_balancer_inbound_nat_rules_ids = [azurerm_lb_nat_pool.lbnatpool.id]
}
}
}