-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaz_wrkld.tf
92 lines (80 loc) · 2.37 KB
/
az_wrkld.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
resource "azurerm_linux_virtual_machine" "prx" {
name = "${var.prefix}-az-proxy"
resource_group_name = var.az_rg_name
location = azurerm_resource_group.sse.location
size = "Standard_F2"
admin_username = "adminuser"
network_interface_ids = [
azurerm_network_interface.prx.id,
]
admin_ssh_key {
username = "adminuser"
public_key = file("~/.ssh/id_rsa.pub")
}
os_disk {
caching = "ReadWrite"
storage_account_type = "Standard_LRS"
}
source_image_reference {
publisher = "Canonical"
offer = "UbuntuServer"
sku = "22.04-LTS"
version = "latest"
}
}
*/
resource "azurerm_network_interface" "win" {
name = "${var.prefix}-nic-win"
location = var.az_region
resource_group_name = var.az_rg_name
ip_configuration {
name = "ipconfig1"
subnet_id = azurerm_subnet.wrkld.id
private_ip_address_allocation = "Static"
private_ip_address = "10.100.100.100"
}
}
resource "azurerm_network_security_group" "rdp" {
name = "${var.prefix}-nsg-rdp"
location = var.az_region
resource_group_name = var.az_rg_name
security_rule {
name = "allow-rdp"
protocol = "Tcp"
source_address_prefix = "*"
source_port_range = "*"
destination_address_prefix = "VirtualNetwork"
destination_port_ranges = [
3389
]
access = "Allow"
priority = 100
direction = "Inbound"
}
}
resource "azurerm_network_interface_security_group_association" "rdp" {
network_interface_id = azurerm_network_interface.win.id
network_security_group_id = azurerm_network_security_group.rdp.id
}
resource "azurerm_windows_virtual_machine" "win" {
name = "${var.prefix}-win"
resource_group_name = var.az_rg_name
location = var.az_region
size = "Standard_B2ms"
admin_username = "sse"
admin_password = random_string.pwd.result
network_interface_ids = [
azurerm_network_interface.win.id,
]
os_disk {
caching = "ReadWrite"
storage_account_type = "Standard_LRS"
}
source_image_reference {
publisher = "MicrosoftWindowsDesktop"
offer = "windows-11"
sku = "win11-22h2-pro"
version = "latest"
}
}