-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy path4-dc1.tf
More file actions
69 lines (59 loc) · 2.14 KB
/
4-dc1.tf
File metadata and controls
69 lines (59 loc) · 2.14 KB
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
####################################
####### DC 1 #######################
####################################
# Creating a NIC for internal network on DC1
resource "azurerm_network_interface" "dc1_internalnic" {
name = "dc1_intnic"
location = var.location
resource_group_name = var.rg
ip_configuration {
name = "dc1_internal"
subnet_id = azurerm_subnet.subnet.id
private_ip_address_allocation = "Static"
private_ip_address = var.int_dns_address
}
}
# Creating a NIC for external network on DC1
resource "azurerm_network_interface" "dc1_externalnic" {
name = "dc1_extnic"
location = var.location
resource_group_name = var.rg
#network_security_group_id = azurerm_network_security_group.secgroup.id
ip_configuration {
primary = true
name = "dc1_externalnic"
subnet_id = azurerm_subnet.subnet
5444
.id
private_ip_address_allocation = "Dynamic"
public_ip_address_id = azurerm_public_ip.dc1publicip.id
}
}
#Creating DC1 VM
resource "azurerm_virtual_machine" "dc1primary" {
name = "dc1primary"
resource_group_name = var.rg
location = var.location
network_interface_ids = [azurerm_network_interface.dc1_externalnic.id, azurerm_network_interface.dc1_internalnic.id]
vm_size = "Standard_D1_v2"
primary_network_interface_id = azurerm_network_interface.dc1_externalnic.id
delete_os_disk_on_termination = true
delete_data_disks_on_termination = true
storage_image_reference {
publisher = "MicrosoftWindowsServer"
offer = "WindowsServer"
sku = "2012-R2-Datacenter"
version = "latest"
}
storage_os_disk {
name = "dc1disk"
caching = "ReadWrite"
create_option = "FromImage"
}
os_profile {
computer_name = "DC1"
admin_username = var.username
admin_password = var.password
}
os_profile_windows_config {
provision_vm_agent = true
}
}