-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure_controller.tf
68 lines (57 loc) · 2.12 KB
/
azure_controller.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
resource "azurerm_network_interface" "controller_vnic" {
name = "${var.project_name}_controller"
location = "${var.azure_region}"
resource_group_name = "${var.resource_group}"
network_security_group_id = "${azurerm_network_security_group.nsg_controller.id}"
ip_configuration {
name = "${var.project_name}_controller"
subnet_id = "${element(azurerm_subnet.subnet.*.id, 1)}"
private_ip_address_allocation = "dynamic"
public_ip_address_id = "${azurerm_public_ip.controller_public_ip.id}"
}
}
data "template_file" "userdata" {
template = "${file("files/userdata.json")}"
vars {
password = "${var.admin_password}"
}
}
resource "azurerm_virtual_machine" "controller" {
name = "${var.project_name}_controller"
location = "${var.azure_region}"
resource_group_name = "${var.resource_group}"
network_interface_ids = ["${azurerm_network_interface.controller_vnic.id}"]
vm_size = "${var.controller_instance_size}"
delete_os_disk_on_termination = "true"
delete_data_disks_on_termination = "true"
storage_image_reference {
publisher = "avi-networks"
offer = "avi-vantage-adc"
sku = "avi-vantage-adc-byol"
version = "${var.controller_version}"
}
plan {
name = "avi-vantage-adc-byol"
publisher = "avi-networks"
product = "avi-vantage-adc"
}
storage_os_disk {
name = "${var.project_name}_controller"
caching = "ReadWrite"
create_option = "FromImage"
managed_disk_type = "Premium_LRS"
}
os_profile {
computer_name = "${var.project_name}-web-${count.index}"
admin_username = "${var.avi_username}"
admin_password = "${var.admin_password}"
custom_data = "${data.template_file.userdata.rendered}"
}
os_profile_linux_config {
disable_password_authentication = false
ssh_keys {
path = "/home/${var.avi_username}/.ssh/authorized_keys"
key_data = "${file("keys/${var.project_name}.pub")}"
}
}
}