-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.tf
49 lines (41 loc) · 1.38 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
locals {
resource_group_name = "${var.application}-${var.environment}"
vnet_name = "${var.application}-${var.environment}-vnet"
subnet_name = "${var.application}-${var.environment}-subnet"
saname = "${var.application}${var.environment}"
}
resource "azurerm_resource_group" "lab2" {
name = local.resource_group_name
location = var.location
tags = merge(var.default_tags, map("type", "resource"))
}
module "vnet" {
source = "./modules/vnet"
location = var.location
resource_group_name = local.resource_group_name
vnet_name = local.vnet_name
address_space = var.address_space
tags = merge(var.default_tags, map("type", "network"))
}
module "subnets" {
source = "./modules/subnet"
location = var.location
resource_group_name = local.resource_group_name
vnet_name = module.vnet.vnet_name
subnets = [
{
name = local.subnet_name
prefix = var.subnet
}
]
tags = merge(var.default_tags, map("type", "network"))
}
module "vmss" {
source = "./modules/vmss"
location = var.location
capacity = var.capacity
saname = local.saname
subnet_id = module.subnets.vnet_subnets
resource_group_name = local.resource_group_name
tags = merge(var.default_tags, map("type", "vmss"))
}