-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
64 lines (53 loc) · 1.77 KB
/
main.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
# Azure Provider source and version
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "=3.0.0"
}
azapi = {
source = "azure/azapi"
version = "=1.11.0"
}
}
}
# Configure the Microsoft Azure Provider
provider "azurerm" {
features {}
}
# Create a new resource group
resource "azurerm_resource_group" "dev_resource_group" {
name = "${var.prefix}_rg_1"
location = var.location
}
# Create a new virtual network
resource "azurerm_virtual_network" "dev_virtual_network_1" {
resource_group_name = azurerm_resource_group.dev_resource_group.name
name = "${var.prefix}_vn_1"
address_space = ["10.0.0.0/16"]
location = var.location
}
# Create 3 new NIC for private VM
resource "azurerm_network_interface" "dev_nics_1" {
count = var.backend_pool_node_count
name = "${var.prefix}_dev_nic_${count.index}"
location = var.location
resource_group_name = azurerm_resource_group.dev_resource_group.name
ip_configuration {
name = "host_nic_config"
subnet_id = azurerm_subnet.dev_subnet_1.id
private_ip_address_allocation = "Dynamic"
}
}
# NIC for public control node
resource "azurerm_network_interface" "dev_nics_control_node_1" {
name = "${var.prefix}_dev_nic_control_node_1"
location = var.location
resource_group_name = azurerm_resource_group.dev_resource_group.name
ip_configuration {
name = "control_nic_config"
subnet_id = azurerm_subnet.dev_subnet_1.id
private_ip_address_allocation = "Dynamic"
public_ip_address_id = azurerm_public_ip.dev_public_ip_control_node.id
}
}