-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathmain.tf
More file actions
131 lines (112 loc) · 4 KB
/
Copy pathmain.tf
File metadata and controls
131 lines (112 loc) · 4 KB
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# We strongly recommend using the required_providers block to set the
# Azure Provider source and version being used
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "=3.26.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
}
}
provider "azurerm" {
features {}
}
resource "random_pet" "name" {
prefix = var.resource_group_name_prefix
length = 1
}
resource "random_password" "password" {
length = 16
special = true
override_special = "!#$%&*()-_=+[]{}<>:?"
}
######################################
# Create Resource Group.
######################################
resource "azurerm_resource_group" "rg" {
location = var.resource_group_location
name = "${random_pet.name.id}.rg"
}
######################################
# Create networks
######################################
module "networks" {
source = "./modules/networks"
name = random_pet.name.id
resource_group_location = var.resource_group_location
resource_group_name = azurerm_resource_group.rg.name
remote_vnet = module.bastion-host.bastion-vnet
remote_vnet_name = module.bastion-host.bastion-vnet-name
}
######################################
# Create Bastion Host
######################################
module "bastion-host" {
source = "./modules/management_tools"
name = random_pet.name.id
resource_group_location = var.resource_group_location
resource_group_name = azurerm_resource_group.rg.name
}
######################################
# Create app_gateway
######################################
module "app-gateway" {
source = "./modules/app_gateway"
name = random_pet.name.id
resource_group_location = var.resource_group_location
resource_group_name = azurerm_resource_group.rg.name
app_gtw_sub = module.networks.subnet1
app_gtw_ip = module.networks.app-gtw-ip
}
######################################
# Create private load_balancer
######################################
module "load_balancer" {
source = "./modules/load_balancer"
name = random_pet.name.id
resource_group_location = var.resource_group_location
resource_group_name = azurerm_resource_group.rg.name
lb_sub = module.networks.subnet3
}
######################################
# Create web scale set
######################################
module "web_scale_sets" {
source = "./modules/web_scale_set"
name = random_pet.name.id
resource_group_location = var.resource_group_location
resource_group_name = azurerm_resource_group.rg.name
scale_set_sub = module.networks.subnet3
app_gty_backend_pool_ids = module.app-gateway.app_gateway.backend_address_pool[*].id
admin_user = var.admin_user
admin_password = random_password.password.bcrypt_hash
}
######################################
# Create biz scale set
######################################
module "biz_scale_sets" {
source = "./modules/biz_scale_set"
name = random_pet.name.id
resource_group_location = var.resource_group_location
resource_group_name = azurerm_resource_group.rg.name
scale_set_sub = module.networks.subnet4
lb_backend_pool_ids = module.load_balancer.lb_pool_ids
admin_user = var.admin_user
admin_password = random_password.password.bcrypt_hash
}
######################################
# Create Database.
######################################
module "db_MySQL" {
source = "./modules/My_Database"
name = random_pet.name.id
resource_group_location = var.resource_group_location
resource_group_name = azurerm_resource_group.rg.name
throughput = 400
data_tier_sub_id = module.networks.subnet5
ip_range_filter = "0.0.0.0"
}