-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.tf
465 lines (380 loc) · 19.6 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
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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
locals {
naming_suffix = "external-tableau-${var.naming_suffix}"
naming_suffix_linux = "ext-tableau-linux-${var.naming_suffix}"
}
resource "aws_instance" "ext_tableau_linux" {
count = var.environment == "prod" ? "2" : "1" # 2 in Prod (Green & Blue), 1 in NotProd (Green Only)
key_name = var.key_name
ami = data.aws_ami.ext_tableau_linux.id
instance_type = var.environment == "prod" ? "r5d.2xlarge" : "r5d.2xlarge"
iam_instance_profile = aws_iam_instance_profile.ext_tableau.id
vpc_security_group_ids = [aws_security_group.sgrp.id]
associate_public_ip_address = false
subnet_id = aws_subnet.subnet.id
private_ip = element(var.dq_external_dashboard_instance_ip, count.index)
monitoring = true
user_data = <<EOF
#!/bin/bash
set -e
#log output from this user_data script
exec > >(tee /var/log/user-data.log|logger -t user-data ) 2>&1
echo "Enforcing imdsv2 on ec2 instance"
curl http://169.254.169.254/latest/meta-data/instance-id | xargs -I {} aws ec2 modify-instance-metadata-options --instance-id {} --http-endpoint enabled --http-tokens required
# start the cloud watch agent
/opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -s -m ec2 -c file:/opt/aws/amazon-cloudwatch-agent/bin/config.json
echo "#Mount filesystem - /var/opt/tableau/"
mkfs.xfs /dev/nvme2n1
mkdir -p /var/opt/tableau/
mount /dev/nvme2n1 /var/opt/tableau
echo '/dev/nvme2n1 /var/opt/tableau xfs defaults 0 0' >> /etc/fstab
echo "#Pull values from Parameter Store and save to profile"
touch /home/tableau_srv/env_vars.sh
echo "
export TABLEAU_ENVIRONMENT=external
export TABLEAU_REPO_ENVIRONMENT=external
export S3_HAPROXY_CONFIG_BUCKET=${var.haproxy_config_bucket}
export DATA_ARCHIVE_TAB_BACKUP_URL=`aws --region eu-west-2 ssm get-parameter --name data_archive_tab_ext_backup_url --query 'Parameter.Value' --output text`
export TAB_SRV_USER=`aws --region eu-west-2 ssm get-parameter --name tableau_server_username --query 'Parameter.Value' --output text`
export TAB_SRV_PASSWORD=`aws --region eu-west-2 ssm get-parameter --name tableau_server_password --query 'Parameter.Value' --output text --with-decryption`
export TAB_ADMIN_USER=`aws --region eu-west-2 ssm get-parameter --name tableau_admin_username --query 'Parameter.Value' --output text`
export TAB_ADMIN_PASSWORD=`aws --region eu-west-2 ssm get-parameter --name tableau_admin_password --query 'Parameter.Value' --output text --with-decryption`
export TAB_TABSVR_REPO_USER=`aws --region eu-west-2 ssm get-parameter --name tableau_server_repository_username --query 'Parameter.Value' --output text`
export TAB_TABSVR_REPO_PASSWORD=`aws --region eu-west-2 ssm get-parameter --name tableau_server_repository_password --query 'Parameter.Value' --output text --with-decryption`
export TAB_PRODUCT_KEY=`aws --region eu-west-2 ssm get-parameter --name tableau_ext_product_key --query 'Parameter.Value' --output text --with-decryption`
export TAB_PRODUCT_KEY_NP=`aws --region eu-west-2 ssm get-parameter --name tableau_notprod_product_key --query 'Parameter.Value' --output text --with-decryption`
" > /home/tableau_srv/env_vars.sh
echo "#Load the env vars needed for this user_data script"
source /home/tableau_srv/env_vars.sh
echo "#Load the env vars when tableau_srv logs in"
cat >>/home/tableau_srv/.bashrc <<EOL
alias la='ls -laF'
alias atrdiag='echo "Run atrdiag as user tableau, not tableau_srv"'
alias tll='/home/tableau_srv/scripts/tableau-license-list.sh'
source /home/tableau_srv/env_vars.sh
EOL
echo "#Set password for tableau_srv"
echo $TAB_SRV_PASSWORD | passwd tableau_srv --stdin
echo "#Change ownership and permissions of tableau_srv files"
chown -R tableau_srv:tableau_srv /home/tableau_srv/
chmod 0644 /home/tableau_srv/env_vars.sh
echo "#Initialise TSM (finishes off Tableau Server install/config)"
/opt/tableau/tableau_server/packages/scripts.*/initialize-tsm --accepteula --no-activation-service -f -a tableau_srv
echo "#sourcing tableau server envs - because this script is run as root not tableau_srv"
source /etc/profile.d/tableau_server.sh
echo "#License activation - Checking environment..."
echo "#Environment == '${var.environment}'"
if [ ${var.environment} == "notprod" ]; then
echo "#TSM activate NOTPROD license as tableau_srv"
tsm licenses activate --license-key "$TAB_PRODUCT_KEY_NP" --username "$TAB_SRV_USER" --password "$TAB_SRV_PASSWORD"
elif [ ${var.environment} == "prod" ]; then
echo "#TSM activate actual licenses as tableau_srv"
tsm licenses activate --license-key "$TAB_PRODUCT_KEY" --username "$TAB_SRV_USER" --password "$TAB_SRV_PASSWORD"
else
echo "ERROR: Unexpected Environment"
fi
echo "#TSM register user details"
tsm register --file /tmp/install/tab_reg_file.json -u $TAB_SRV_USER -p $TAB_SRV_PASSWORD
echo "#TSM settings (add default)"
export CLIENT_ID=`aws --region eu-west-2 ssm get-parameter --name tableau_ext_openid_provider_client_id --query 'Parameter.Value' --output text`
export CLIENT_SECRET=`aws --region eu-west-2 ssm get-parameter --name tableau_ext_openid_client_secret --query 'Parameter.Value' --output text --with-decryption`
export CONFIG_URL=`aws --region eu-west-2 ssm get-parameter --name tableau_ext_openid_provider_config_url --query 'Parameter.Value' --output text`
export EXTERNAL_URL=`aws --region eu-west-2 ssm get-parameter --name tableau_ext_openid_tableau_server_external_url --query 'Parameter.Value' --output text`
export TAB_VERSION_NUMBER=`echo $PATH | awk -F customer '{print $2}' | cut -d \. -f2- | awk -F : '{print $1}'`
cat >/opt/tableau/tableau_server/packages/scripts.$TAB_VERSION_NUMBER/config-openid.json <<EOL
{
"configEntities": {
"openIDSettings": {
"_type": "openIDSettingsType",
"enabled": true,
"clientId": "$CLIENT_ID",
"clientSecret": "$CLIENT_SECRET",
"configURL": "$CONFIG_URL",
"externalURL": "$EXTERNAL_URL"
}
}
}
EOL
cat >/opt/tableau/tableau_server/packages/scripts.$TAB_VERSION_NUMBER/config-trusted-auth.json <<EOL
{
"configEntities": {
"trustedAuthenticationSettings": {
"_type": "trustedAuthenticationSettingsType",
"trustedHosts": [ "${var.haproxy_private_ip}","${var.haproxy_private_ip2}" ]
}
}
}
EOL
echo "#Pull values from Parameter Store and save smtp config locally"
aws --region eu-west-2 ssm get-parameter --name tableau_config_smtp --query 'Parameter.Value' --output text --with-decryption > /opt/tableau/tableau_server/packages/scripts.$TAB_VERSION_NUMBER/config-smtp.json
tsm settings import -f /opt/tableau/tableau_server/packages/scripts.*/config.json
tsm settings import -f /opt/tableau/tableau_server/packages/scripts.*/config-openid.json
tsm settings import -f /opt/tableau/tableau_server/packages/scripts.*/config-trusted-auth.json
tsm settings import -f /opt/tableau/tableau_server/packages/scripts.*/config-smtp.json
echo "#TSM increase extract timeout - to 6 hours (=21600 seconds)"
tsm configuration set -k backgrounder.querylimit -v 21600
# echo "#TSM configure alerting emails"
tsm configuration set -k storage.monitoring.email_enabled -v true
# echo "#TSM configure session.idle_limit to 30 mins"
tsm configuration set -k wgserver.session.idle_limit -v 30
echo "#TSM configure access to peering proxies"
tsm configuration set -k wgserver.systeminfo.allow_referrer_ips -v ${var.haproxy_private_ip},${var.haproxy_private_ip2}
echo "#TSM apply pending changes"
tsm pending-changes apply
echo "#TSM initialise & start server"
tsm initialize --start-server --request-timeout 1800
echo "#DQDashboard Customise"
export LOGO=DQDashboards_Image_Home_Office_new-01.png
export DASH_IMAGE="$DATA_ARCHIVE_TAB_BACKUP_URL/DQDashboards/Image/$LOGO"
export TMP_FOLDER=/tmp
aws s3 cp $DASH_IMAGE $TMP_FOLDER
tsm customize --server-name "HO External Carrier Portal" --username "$TAB_SRV_USER" --password "$TAB_SRV_PASSWORD"
tsm customize --signin-logo /$TMP_FOLDER/$LOGO
tsm customize --logo /$TMP_FOLDER/$LOGO
tsm customize --header-logo /$TMP_FOLDER/$LOGO
tsm data-access repository-access enable --repository-username $TAB_TABSVR_REPO_USER --repository-password $TAB_TABSVR_REPO_PASSWORD --ignore-prompt
echo "#TABCMD - initial user"
su -c "tabcmd initialuser --server 'localhost:80' --username $TAB_ADMIN_USER --password $TAB_ADMIN_PASSWORD" - tableau_srv
# Always restore from Blue
export BACKUP_LOCATION="$DATA_ARCHIVE_TAB_BACKUP_URL/blue/"
echo "#Get most recent Tableau backup from S3"
export LATEST_BACKUP_NAME=`aws s3 ls $BACKUP_LOCATION | tail -1 | awk '{print $4}'`
aws s3 cp $BACKUP_LOCATION$LATEST_BACKUP_NAME /var/opt/tableau/tableau_server/data/tabsvc/files/backups/$LATEST_BACKUP_NAME
echo "#Restore latest backup to Tableau Server"
tsm stop --username "$TAB_SRV_USER" --password "$TAB_SRV_PASSWORD" && tsm maintenance restore --file $LATEST_BACKUP_NAME --username "$TAB_SRV_USER" --password "$TAB_SRV_PASSWORD" && tsm start --username "$TAB_SRV_USER" --password "$TAB_SRV_PASSWORD"
echo "#Mount filesystem - /var/log/"
mkfs.xfs /dev/nvme1n1
mkdir -p /mnt/var/log/
mount /dev/nvme1n1 /mnt/var/log
rsync -a /var/log/ /mnt/var/log
semanage fcontext -a -t var_t "/mnt/var" && semanage fcontext -a -e /var/log /mnt/var/log && restorecon -R -v /mnt/var
echo '/dev/nvme1n1 /var/log xfs defaults 0 0' >> /etc/fstab
umount /mnt/var/log/
reboot
EOF
tags = {
Name = "ec2-${local.naming_suffix_linux}"
}
lifecycle {
prevent_destroy = true
ignore_changes = [
user_data,
ami,
instance_type,
]
}
}
resource "aws_instance" "ext_tableau_linux_staging" {
count = var.environment == "prod" ? "1" : "0" # 1 in Prod, 0 in NotProd
key_name = var.key_name
ami = data.aws_ami.ext_tableau_linux.id
instance_type = var.environment == "prod" ? "r5.2xlarge" : "r5.2xlarge"
iam_instance_profile = aws_iam_instance_profile.ext_tableau.id
vpc_security_group_ids = [aws_security_group.sgrp.id]
associate_public_ip_address = false
subnet_id = aws_subnet.subnet.id
private_ip = var.dq_external_staging_dashboard_instance_ip
monitoring = true
user_data = <<EOF
#!/bin/bash
set -e
#log output from this user_data script
exec > >(tee /var/log/user-data.log|logger -t user-data ) 2>&1
echo "Enforcing imdsv2 on ec2 instance"
curl http://169.254.169.254/latest/meta-data/instance-id | xargs -I {} aws ec2 modify-instance-metadata-options --instance-id {} --http-endpoint enabled --http-tokens required
echo "#Mount filesystem - /var/opt/tableau/"
mkfs.xfs /dev/nvme2n1
mkdir -p /var/opt/tableau/
mount /dev/nvme2n1 /var/opt/tableau
echo '/dev/nvme2n1 /var/opt/tableau xfs defaults 0 0' >> /etc/fstab
echo "#Pull values from Parameter Store and save to profile"
touch /home/tableau_srv/env_vars.sh
echo "
export TABLEAU_ENVIRONMENT=staging
export TABLEAU_REPO_ENVIRONMENT=external_staging
export S3_HAPROXY_CONFIG_BUCKET=${var.haproxy_config_bucket}
export DATA_ARCHIVE_TAB_BACKUP_URL=`aws --region eu-west-2 ssm get-parameter --name data_archive_tab_ext_backup_url --query 'Parameter.Value' --output text`
export TAB_SRV_USER=`aws --region eu-west-2 ssm get-parameter --name tableau_server_username --query 'Parameter.Value' --output text`
export TAB_SRV_PASSWORD=`aws --region eu-west-2 ssm get-parameter --name tableau_server_password --query 'Parameter.Value' --output text --with-decryption`
export TAB_ADMIN_USER=`aws --region eu-west-2 ssm get-parameter --name tableau_admin_username --query 'Parameter.Value' --output text`
export TAB_ADMIN_PASSWORD=`aws --region eu-west-2 ssm get-parameter --name tableau_admin_password --query 'Parameter.Value' --output text --with-decryption`
export TAB_DB_USER=`aws --region eu-west-2 ssm get-parameter --name rds_external_tableau_username --query 'Parameter.Value' --output text --with-decryption`
export TAB_DB_PASSWORD=`aws --region eu-west-2 ssm get-parameter --name rds_external_tableau_password --query 'Parameter.Value' --output text --with-decryption`
export TAB_TABSVR_REPO_USER=`aws --region eu-west-2 ssm get-parameter --name tableau_server_repository_username --query 'Parameter.Value' --output text`
export TAB_TABSVR_REPO_PASSWORD=`aws --region eu-west-2 ssm get-parameter --name tableau_server_repository_password --query 'Parameter.Value' --output text --with-decryption`
export TAB_PRODUCT_KEY=`aws --region eu-west-2 ssm get-parameter --name tableau_ext_product_key --query 'Parameter.Value' --output text --with-decryption`
" > /home/tableau_srv/env_vars.sh
echo "#Load the env vars needed for this user_data script"
source /home/tableau_srv/env_vars.sh
echo "#Load the env vars when tableau_srv logs in"
cat >>/home/tableau_srv/.bashrc <<EOL
alias la='ls -laF'
alias atrdiag='echo "Run atrdiag as user tableau, not tableau_srv"'
alias tll='/home/tableau_srv/scripts/tableau-license-list.sh'
source /home/tableau_srv/env_vars.sh
EOL
echo "#Set password for tableau_srv"
echo $TAB_SRV_PASSWORD | passwd tableau_srv --stdin
echo "#Change ownership and permissions of tableau_srv files"
chown -R tableau_srv:tableau_srv /home/tableau_srv/
chmod 0644 /home/tableau_srv/env_vars.sh
echo "#Initialise TSM (finishes off Tableau Server install/config)"
/opt/tableau/tableau_server/packages/scripts.*/initialize-tsm --accepteula --no-activation-service -f -a tableau_srv
echo "#sourcing tableau server envs - because this script is run as root not tableau_srv"
source /etc/profile.d/tableau_server.sh
echo "#License activation - Checking environment..."
echo "#Environment == '${var.environment}'"
if [ ${var.environment} == "notprod" ]; then
echo "#TSM activate actual licenses as tableau_srv"
tsm licenses activate --license-key "$TAB_PRODUCT_KEY" --username "$TAB_SRV_USER" --password "$TAB_SRV_PASSWORD"
elif [ ${var.environment} == "prod" ]; then
echo "#TSM activate actual licenses as tableau_srv"
tsm licenses activate --license-key "$TAB_PRODUCT_KEY" --username "$TAB_SRV_USER" --password "$TAB_SRV_PASSWORD"
else
echo "ERROR: Unexpected Environment"
fi
echo "#TSM register user details"
tsm register --file /tmp/install/tab_reg_file.json -u $TAB_SRV_USER -p $TAB_SRV_PASSWORD
echo "#TSM settings (add default)"
export CLIENT_ID=`aws --region eu-west-2 ssm get-parameter --name tableau_ext_staging_openid_provider_client_id --query 'Parameter.Value' --output text`
export CLIENT_SECRET=`aws --region eu-west-2 ssm get-parameter --name tableau_ext_staging_openid_client_secret --query 'Parameter.Value' --output text --with-decryption`
export CONFIG_URL=`aws --region eu-west-2 ssm get-parameter --name tableau_ext_staging_openid_provider_config_url --query 'Parameter.Value' --output text`
export EXTERNAL_URL=`aws --region eu-west-2 ssm get-parameter --name tableau_ext_staging_openid_tableau_server_external_url --query 'Parameter.Value' --output text`
export TAB_VERSION_NUMBER=`echo $PATH | awk -F customer '{print $2}' | cut -d \. -f2- | awk -F : '{print $1}'`
cat >/opt/tableau/tableau_server/packages/scripts.$TAB_VERSION_NUMBER/config-openid.json <<EOL
{
"configEntities": {
"openIDSettings": {
"_type": "openIDSettingsType",
"enabled": true,
"clientId": "$CLIENT_ID",
"clientSecret": "$CLIENT_SECRET",
"configURL": "$CONFIG_URL",
"externalURL": "$EXTERNAL_URL"
}
}
}
EOL
cat >/opt/tableau/tableau_server/packages/scripts.$TAB_VERSION_NUMBER/config-trusted-auth.json <<EOL
{
"configEntities": {
"trustedAuthenticationSettings": {
"_type": "trustedAuthenticationSettingsType",
"trustedHosts": [ "${var.haproxy_private_ip}","${var.haproxy_private_ip2}" ]
}
}
}
EOL
tsm settings import -f /opt/tableau/tableau_server/packages/scripts.*/config.json
tsm settings import -f /opt/tableau/tableau_server/packages/scripts.*/config-openid.json
tsm settings import -f /opt/tableau/tableau_server/packages/scripts.*/config-trusted-auth.json
echo "#TSM increase extract timeout - to 6 hours (=21600 seconds)"
tsm configuration set -k backgrounder.querylimit -v 21600
# echo "#TSM configure alerting emails"
tsm configuration set -k storage.monitoring.email_enabled -v true
# echo "#TSM configure session.idle_limit to 30 mins"
tsm configuration set -k wgserver.session.idle_limit -v 30
echo "#TSM configure access to peering proxies"
tsm configuration set -k wgserver.systeminfo.allow_referrer_ips -v ${var.haproxy_private_ip},${var.haproxy_private_ip2}
echo "#TSM apply pending changes"
tsm pending-changes apply
echo "#TSM initialise & start server"
tsm initialize --start-server --request-timeout 1800
echo "#DQDashboard Customise"
export LOGO=DQDashboards_Image_Home_Office_new-01.png
export DASH_IMAGE="$DATA_ARCHIVE_TAB_BACKUP_URL/DQDashboards/Image/$LOGO"
export TMP_FOLDER=/tmp
aws s3 cp $DASH_IMAGE $TMP_FOLDER
tsm customize --server-name "HO External Carrier Portal" --username "$TAB_SRV_USER" --password "$TAB_SRV_PASSWORD"
tsm customize --signin-logo /$TMP_FOLDER/$LOGO
tsm customize --logo /$TMP_FOLDER/$LOGO
tsm customize --header-logo /$TMP_FOLDER/$LOGO
tsm data-access repository-access enable --repository-username $TAB_TABSVR_REPO_USER --repository-password $TAB_TABSVR_REPO_PASSWORD --ignore-prompt
echo "#TABCMD - initial user"
su -c "tabcmd initialuser --server 'localhost:80' --username $TAB_ADMIN_USER --password $TAB_ADMIN_PASSWORD" - tableau_srv
# Always restore from Blue
export BACKUP_LOCATION="$DATA_ARCHIVE_TAB_BACKUP_URL/blue/"
echo "#Get most recent Tableau backup from S3"
export LATEST_BACKUP_NAME=`aws s3 ls $BACKUP_LOCATION | tail -1 | awk '{print $4}'`
aws s3 cp $BACKUP_LOCATION$LATEST_BACKUP_NAME /var/opt/tableau/tableau_server/data/tabsvc/files/backups/$LATEST_BACKUP_NAME
echo "#Restore latest backup to Tableau Server"
tsm stop --username "$TAB_SRV_USER" --password "$TAB_SRV_PASSWORD" && tsm maintenance restore --file $LATEST_BACKUP_NAME --username "$TAB_SRV_USER" --password "$TAB_SRV_PASSWORD" && tsm start --username "$TAB_SRV_USER" --password "$TAB_SRV_PASSWORD"
echo "#Mount filesystem - /var/log/"
mkfs.xfs /dev/nvme1n1
mkdir -p /mnt/var/log/
mount /dev/nvme1n1 /mnt/var/log
rsync -a /var/log/ /mnt/var/log
semanage fcontext -a -t var_t "/mnt/var" && semanage fcontext -a -e /var/log /mnt/var/log && restorecon -R -v /mnt/var
echo '/dev/nvme1n1 /var/log xfs defaults 0 0' >> /etc/fstab
umount /mnt/var/log/
reboot
EOF
tags = {
Name = "ec2-staging-${local.naming_suffix_linux}"
}
lifecycle {
prevent_destroy = true
ignore_changes = [
user_data,
ami,
instance_type,
]
}
}
resource "aws_subnet" "subnet" {
vpc_id = var.apps_vpc_id
cidr_block = var.dq_external_dashboard_subnet
availability_zone = var.az
tags = {
Name = "subnet-${local.naming_suffix}"
}
}
resource "aws_route_table_association" "external_tableau_rt_association" {
subnet_id = aws_subnet.subnet.id
route_table_id = var.route_table_id
}
resource "aws_security_group" "sgrp" {
vpc_id = var.apps_vpc_id
ingress {
from_port = var.http_from_port
to_port = var.http_to_port
protocol = var.http_protocol
cidr_blocks = [
var.dq_ops_ingress_cidr,
var.acp_prod_ingress_cidr,
var.peering_cidr_block,
]
}
ingress {
from_port = var.SSH_from_port
to_port = var.SSH_to_port
protocol = var.SSH_protocol
cidr_blocks = [
var.dq_ops_ingress_cidr,
]
}
ingress {
from_port = var.TSM_from_port
to_port = var.TSM_to_port
protocol = var.http_protocol
cidr_blocks = [
var.dq_ops_ingress_cidr,
]
}
ingress {
from_port = var.rds_wg_from_port
to_port = var.rds_wg_to_port
protocol = var.http_protocol
cidr_blocks = [
var.dq_ops_ingress_cidr,
]
}
egress {
from_port = 0
to_port = 0
protocol = -1
cidr_blocks = ["0.0.0.0/0"]
}
tags = {
Name = "sg-${local.naming_suffix}"
}
}