-
Notifications
You must be signed in to change notification settings - Fork 0
/
r-network.tf
38 lines (30 loc) · 1.12 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
locals {
network_interface_ids = concat(
azurerm_network_interface.this[*].id,
(var.network_interface_ids != null ? var.network_interface_ids : [])
)
}
resource "azurerm_network_interface" "this" {
count = var.create_network_interface ? 1 : 0
name = "nic-${trimprefix(var.name, "vm-")}"
location = var.location
resource_group_name = var.resource_group_name
tags = var.tags
ip_configuration {
name = "ipconfig1"
private_ip_address = var.private_ip_address
private_ip_address_allocation = var.private_ip_address == null ? "Dynamic" : "Static"
public_ip_address_id = one(azurerm_public_ip.this[*].id)
subnet_id = var.subnet_id
}
}
resource "azurerm_public_ip" "this" {
count = var.create_public_ip_address ? 1 : 0
name = "nic-${trimprefix(var.name, "vm-")}"
location = var.location
resource_group_name = var.resource_group_name
tags = var.tags
allocation_method = "Static"
sku = "Standard"
sku_tier = "Regional"
}