forked from magenx/Magento-2-aws-cluster-terraform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
variables.tf
250 lines (230 loc) · 7.14 KB
/
variables.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
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
locals {
# Create global project name to be assigned to all resources
project = lower("${var.app["brand"]}-${random_string.this["project"].result}")
}
variable "password" {
description = "Generate password"
default = [
"rds",
"rabbitmq",
"app",
"blowfish"
]
}
variable "string" {
description = "Generate random string"
default = [
"admin_path",
"mysql_path",
"profiler",
"session_persistent",
"cache_prefix",
"health_check",
"project"
]
}
variable "ec2" {
description = "EC2 instances names and types included in AutoScaling groups"
default = {
varnish = "m6g.large"
frontend = "c6g.xlarge"
admin = "c6g.xlarge"
}
}
variable "app" {
description = "Map application params | Magento 2"
default = {
source_repo = "magenx/Magento-2"
app_version = "2"
cidr_block = "172.30.0.0/16"
brand = "magenx"
domain = "magenx.org"
admin_email = "admin@magenx.org"
admin_login = "admin"
admin_firstname = "Hereis"
admin_lastname = "Myname"
source = "https://github.com/magenx/Magento-2.git"
language = "en_US"
currency = "EUR"
timezone = "UTC"
php_version = "8.1"
php_packages = "cli fpm common mysql zip gd mbstring curl xml bcmath intl soap oauth lz4 apcu"
linux_packages = "nfs-common unzip git patch python3-pip acl attr imagemagick snmp"
exclude_linux_packages = "apache2* *apcu-bc"
volume_size = "50"
composer_user = "8c681734f22763b50ea0c29dff9e7af2"
composer_pass = "02dfee497e669b5db1fe1c8d481d6974"
}
}
variable "elk" {
description = "Map ElasticSearch configuration values"
default = {
elasticsearch_version = "7.9"
instance_type = "m6g.large.elasticsearch"
instance_count = "1"
ebs_enabled = true
volume_type = "gp2"
volume_size = "20"
log_type = "ES_APPLICATION_LOGS"
}
}
variable "rds" {
description = "Map RDS configuration values"
default = {
db_name = "m2_magenx_live"
allocated_storage = "50"
max_allocated_storage = "100"
storage_type = "gp2"
storage_encrypted = true
engine = "mariadb"
engine_version = "10.5.12"
family = "mariadb10.5"
instance_class = "db.m6g.large"
skip_final_snapshot = true
multi_az = false
enabled_cloudwatch_logs_exports = "error"
performance_insights_enabled = true
copy_tags_to_snapshot = true
backup_retention_period = "0"
delete_automated_backups = true
deletion_protection = false
}
}
variable "max_connection_count" {
description = "Map 6g. class RDS max connection count"
default = {
"db.m6g.large" = "683"
"db.m6g.xlarge" = "1365"
"db.r6g.large" = "1365"
"db.m6g.2xlarge" = "2731"
"db.r6g.xlarge" = "2731"
"db.m6g.4xlarge" = "5461"
"db.r6g.2xlarge" = "5461"
"db.m6g.8xlarge" = "10923"
"db.r6g.4xlarge" = "10923"
"db.m6g.12xlarge" = "16384"
"db.m6g.16xlarge" = "21845"
"db.r6g.8xlarge" = "21845"
"db.r6g.12xlarge" = "32768"
"db.r6g.16xlarge" = "43691"
}
}
variable "rds_memory" {
description = "Map 6g. class RDS memory gb"
default = {
"db.m6g.large" = "8"
"db.r6g.large" = "16"
"db.m6g.xlarge" = "16"
"db.r6g.xlarge" = "32"
"db.m6g.2xlarge" = "32"
"db.r6g.2xlarge" = "64"
"db.m6g.4xlarge" = "64"
"db.m6g.8xlarge" = "128"
"db.r6g.4xlarge" = "128"
"db.m6g.12xlarge" = "192"
"db.m6g.16xlarge" = "256"
"db.r6g.8xlarge" = "256"
"db.r6g.12xlarge" = "384"
"db.r6g.16xlarge" = "512"
}
}
variable "rabbitmq" {
description = "Map RabbitMQ configuration values"
default = {
engine_version = "3.8.11"
deployment_mode = "CLUSTER_MULTI_AZ"
host_instance_type = "mq.t3.micro"
}
}
variable "redis" {
description = "Map ElastiCache Redis configuration values"
default = {
num_cache_clusters = "1"
node_type = "cache.m6g.large"
name = ["session", "cache"]
engine_version = "6.x"
port = "6379"
at_rest_encryption_enabled = true
}
}
variable "asg" {
description = "Map Autoscaling Group configuration values"
default = {
volume_size = "50"
monitoring = false
warm_pool = "disabled"
desired_capacity = "1"
min_size = "1"
max_size = "5"
health_check_type = "EC2"
health_check_grace_period = "300"
}
}
variable "asp" {
description = "Map Autoscaling Policy configuration values"
default = {
evaluation_periods_in = "2"
evaluation_periods_out = "1"
period = "300"
out_threshold = "80"
in_threshold = "25"
}
}
variable "s3" {
description = "S3 bucket names"
type = set(string)
default = ["media", "system", "backup", "state"]
}
variable "alb" {
description = "Application Load Balancer configuration values"
default = {
type = ["inner","outer"]
rps_threshold = "5000"
error_threshold = "25"
}
}
variable "ec2_instance_profile_policy" {
description = "Policy attach to EC2 Instance Profile"
type = set(string)
default = [
"arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy",
"arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore",
"arn:aws:iam::aws:policy/service-role/AmazonEC2RoleforAWSCodeDeploy"
]
}
variable "eventbridge_policy" {
description = "Policy attach to EventBridge role"
type = set(string)
default = [
"arn:aws:iam::aws:policy/service-role/CloudWatchEventsBuiltInTargetExecutionAccess",
"arn:aws:iam::aws:policy/service-role/CloudWatchEventsInvocationAccess",
"arn:aws:iam::aws:policy/service-role/AmazonSSMAutomationRole"
]
}
variable "aws_config_rule" {
description = "Use AWS Config to evaluate critical configuration settings for your AWS resources."
default = {
ROOT_ACCOUNT_MFA_ENABLED = ""
MFA_ENABLED_FOR_IAM_CONSOLE_ACCESS = ""
EC2_STOPPED_INSTANCE = ""
INCOMING_SSH_DISABLED = "AWS::EC2::SecurityGroup"
DB_INSTANCE_BACKUP_ENABLED = "AWS::RDS::DBInstance"
RDS_SNAPSHOTS_PUBLIC_PROHIBITED = "AWS::RDS::DBSnapshot"
RDS_INSTANCE_DELETION_PROTECTION_ENABLED = "AWS::RDS::DBInstance"
EC2_IMDSV2_CHECK = "AWS::EC2::Instance"
EC2_VOLUME_INUSE_CHECK = "AWS::EC2::Volume"
ELB_DELETION_PROTECTION_ENABLED = "AWS::ElasticLoadBalancingV2::LoadBalancer"
}
}
variable "az_number" {
description = "Assign a number to each AZ letter used in secondary cidr/subnets configuration"
default = {
a = 0
b = 1
c = 2
d = 3
e = 4
f = 5
g = 6
}
}