-
Notifications
You must be signed in to change notification settings - Fork 13
/
r-network.tf
69 lines (53 loc) · 2.28 KB
/
r-network.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
resource "azurerm_public_ip" "main" {
count = var.public_ip_enabled ? 1 : 0
name = local.public_ip_name
location = var.location
resource_group_name = var.resource_group_name
sku = "Standard"
allocation_method = "Static"
domain_name_label = coalesce(var.custom_dns_label, local.name)
zones = var.public_ip_zones
tags = merge(local.default_tags, var.extra_tags, var.public_ip_extra_tags)
}
moved {
from = azurerm_public_ip.public_ip
to = azurerm_public_ip.main
}
resource "azurerm_network_interface" "main" {
name = local.nic_name
location = var.location
resource_group_name = var.resource_group_name
accelerated_networking_enabled = var.nic_accelerated_networking_enabled
ip_configuration {
name = local.ip_configuration_name
subnet_id = var.subnet.id
private_ip_address_allocation = var.static_private_ip == null ? "Dynamic" : "Static"
private_ip_address = var.static_private_ip
public_ip_address_id = one(azurerm_public_ip.main[*].id)
}
tags = merge(local.default_tags, var.extra_tags, var.nic_extra_tags)
}
moved {
from = azurerm_network_interface.nic
to = azurerm_network_interface.main
}
resource "azurerm_network_interface_backend_address_pool_association" "main" {
count = var.load_balancer_attachment != null ? 1 : 0
backend_address_pool_id = var.load_balancer_attachment.id
ip_configuration_name = local.ip_configuration_name
network_interface_id = azurerm_network_interface.main.id
}
moved {
from = azurerm_network_interface_backend_address_pool_association.lb_pool_association
to = azurerm_network_interface_backend_address_pool_association.main
}
resource "azurerm_network_interface_application_gateway_backend_address_pool_association" "main" {
count = var.application_gateway_attachment != null ? 1 : 0
backend_address_pool_id = var.application_gateway_attachment.id
ip_configuration_name = local.ip_configuration_name
network_interface_id = azurerm_network_interface.main.id
}
moved {
from = azurerm_network_interface_application_gateway_backend_address_pool_association.appgw_pool_association
to = azurerm_network_interface_application_gateway_backend_address_pool_association.main
}