-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
104 lines (94 loc) · 4.13 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
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
////////////////////////////////////////////////[ INFRASTRUCTURE DEPLOYMENT ]/////////////////////////////////////////////
# # ---------------------------------------------------------------------------------------------------------------------#
# Create VPC and base networking layout
# # ---------------------------------------------------------------------------------------------------------------------#
module "network" {
source = "./modules/network"
project = local.project
vpc_cidr = var.vpc_cidr
region = var.region
}
# # ---------------------------------------------------------------------------------------------------------------------#
# Create load balancer with domain and dns settings + ssl letsencrypt
# # ---------------------------------------------------------------------------------------------------------------------#
module "loadbalancer" {
source = "./modules/loadbalancer"
project = local.project
region = var.region
vpc_uuid = module.network.vpc_uuid
size = var.loadbalancer.size
algorithm = "round_robin"
alert_email = var.alert_email
domain = local.domain
}
# # ---------------------------------------------------------------------------------------------------------------------#
# Create manager droplet to control auto scaling and manage services droplets
# # ---------------------------------------------------------------------------------------------------------------------#
module "manager" {
source = "./modules/manager"
project = local.project
vpc_uuid = module.network.vpc_uuid
vpc_cidr = var.vpc_cidr
image = var.default_image
region = var.region
size = var.manager.size
monitoring = var.monitoring
backups = var.backups
droplet_agent = var.droplet_agent
admin_ssh_key = local.admin_ssh_key
manager_ssh_key = local.manager_ssh_key
timezone = var.timezone
domain = local.domain
alert_email = var.alert_email
services_ids = module.services.services_ids
}
# # ---------------------------------------------------------------------------------------------------------------------#
# Create services [database | redis | elasticsearch | rabbitmq]
# # ---------------------------------------------------------------------------------------------------------------------#
module "services" {
source = "./modules/services"
services = var.services
project = local.project
image = var.default_image
region = var.region
monitoring = var.monitoring
backups = var.backups
vpc_uuid = module.network.vpc_uuid
vpc_cidr = var.vpc_cidr
droplet_agent = var.droplet_agent
admin_ssh_key = local.admin_ssh_key
manager_ssh_key = local.manager_ssh_key
## app variables
domain = local.domain
brand = var.brand
elk_version = var.elk_version
mariadb_version = var.mariadb_version
rabbitmq_version = var.rabbitmq_version
timezone = var.timezone
}
# # ---------------------------------------------------------------------------------------------------------------------#
# Create frontend worker
# # ---------------------------------------------------------------------------------------------------------------------#
module "frontend" {
source = "./modules/frontend"
project = local.project
image = var.default_image
region = var.region
size = var.frontend.size
resize_disk = var.resize_disk
monitoring = var.monitoring
backups = var.backups
vpc_uuid = module.network.vpc_uuid
vpc_cidr = var.vpc_cidr
droplet_agent = var.droplet_agent
admin_ssh_key = local.admin_ssh_key
manager_ssh_key = local.manager_ssh_key
timezone = var.timezone
php_version = var.php_version
php_packages = var.php_packages
varnish_version = var.varnish_version
domain = local.domain
media_ip = module.services.media_ip
brand = var.brand
packer = var.packer
}