-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
837 lines (735 loc) · 20.7 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
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
name = "${terraform.workspace}-storage-vpc-sb"
cidr = "10.0.0.0/16"
azs = [data.aws_availability_zones.available.names[0], data.aws_availability_zones.available.names[1], ]
private_subnets = ["10.0.1.0/24", "10.0.3.0/24"]
public_subnets = ["10.0.2.0/24", "10.0.4.0/24"]
map_public_ip_on_launch = true
enable_nat_gateway = true
public_subnet_tags = {
"kubernetes.io/role/elb" = 1
"kubernetes.io/cluster/${var.cluster_name}" = "shared"
}
private_subnet_tags = {
"kubernetes.io/role/internal-elb" = 1
"kubernetes.io/cluster/${var.cluster_name}" = "shared"
}
tags = {
Terraform = "true"
Environment = "${terraform.workspace}-dev"
# long-term-test = "true"
}
}
module "apigatewayendpoint" {
count = var.enable_apigateway == 1 && var.mgmt_nodes > 0 ? 1 : 0
source = "./modules/apigateway"
region = var.region
mgmt_node_instance_ids = aws_instance.mgmt_nodes[*].id
api_gateway_id = aws_security_group.api_gateway_sg.id
loadbalancer_id = aws_security_group.loadbalancer_sg.id
public_subnets = module.vpc.public_subnets
vpc_id = module.vpc.vpc_id
}
resource "aws_security_group" "api_gateway_sg" {
name = "${terraform.workspace}-api_gateway_sg"
description = "API Gateway Security Group"
vpc_id = module.vpc.vpc_id
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
description = "allow traffic from API gateway to Loadbalancer"
}
}
resource "aws_security_group" "loadbalancer_sg" {
name = "${terraform.workspace}-loadbalancer_sg"
description = "Loadbalancer Security Group"
vpc_id = module.vpc.vpc_id
ingress {
from_port = 80
to_port = 80
protocol = "tcp"
security_groups = [aws_security_group.api_gateway_sg.id]
description = "HTTP from API gateway"
}
ingress {
from_port = 3000
to_port = 3000
protocol = "tcp"
security_groups = [aws_security_group.api_gateway_sg.id]
description = "Grafana from API gateway"
}
ingress {
from_port = 9000
to_port = 9000
protocol = "tcp"
security_groups = [aws_security_group.api_gateway_sg.id]
description = "Graylog from API gateway"
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
description = "allow traffic from API gateway to Mgmt nodes"
}
}
resource "aws_security_group" "mgmt_node_sg" {
name = "${terraform.workspace}-mgmt_node_sg"
description = "CSI Cluster Container Security Group"
vpc_id = module.vpc.vpc_id
ingress {
from_port = 2049
to_port = 2049
protocol = "tcp"
self = true
description = "EFS from mgmt nodes"
}
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
security_groups = [aws_security_group.bastion_sg.id]
description = "SSH from Bastion Server"
}
ingress {
from_port = 80
to_port = 80
protocol = "tcp"
security_groups = [aws_security_group.loadbalancer_sg.id]
description = "HTTP from Loadbalancer"
}
ingress {
from_port = 80
to_port = 80
protocol = "tcp"
self = true
description = "HTTP from other mgmt nodes"
}
ingress {
from_port = 3000
to_port = 3000
protocol = "tcp"
security_groups = [aws_security_group.loadbalancer_sg.id]
description = "Grafana from Loadbalancer"
}
ingress {
from_port = 9000
to_port = 9000
protocol = "tcp"
security_groups = [aws_security_group.loadbalancer_sg.id]
description = "Graylog from Loadbalancer"
}
ingress {
from_port = 2375
to_port = 2375
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
description = "docker engine API"
}
# Docker Swarm Manager Ports: start
ingress {
from_port = 2377
to_port = 2377
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
description = "Docker Swarm Manager Communication"
}
ingress {
from_port = 7946
to_port = 7946
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
description = "Docker Swarm Node Communication TCP"
}
ingress {
from_port = 7946
to_port = 7946
protocol = "udp"
cidr_blocks = ["0.0.0.0/0"]
description = "Docker Swarm Node Communication UDP"
}
ingress {
from_port = 4789
to_port = 4789
protocol = "udp"
cidr_blocks = ["0.0.0.0/0"]
description = "Docker Swarm Overlay Network"
}
# Graylog GELF
ingress {
from_port = 12202
to_port = 12202
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
description = "Graylog GELF Communication TCP"
}
# fdb
ingress {
from_port = 4800
to_port = 4800
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
ingress {
from_port = 4500
to_port = 4500
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
egress {
from_port = 0
to_port = 0
protocol = -1
cidr_blocks = ["0.0.0.0/0"]
description = "all output traffic so that packages can be downloaded"
}
ingress {
from_port = 8
to_port = 0
protocol = "icmp"
self = true
description = "allow ICMP Echo"
}
}
resource "aws_security_group" "storage_nodes_sg" {
name = "${terraform.workspace}-storage_nodes_sg"
description = "CSI Cluster Container Security Group"
vpc_id = module.vpc.vpc_id
ingress {
from_port = 4420
to_port = 4420
protocol = "tcp"
self = true
description = "storage nodes discovery"
}
ingress {
from_port = 9090
to_port = 9290
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
description = "storage node lvol connect"
}
ingress {
from_port = 5000
to_port = 5000
protocol = "tcp"
security_groups = [aws_security_group.mgmt_node_sg.id, aws_security_group.extra_nodes_sg.id]
description = "access SNodeAPI from mgmt and k3s nodes"
}
ingress {
from_port = 5000
to_port = 5000
protocol = "tcp"
self = true
description = "access SNodeAPI from snode node workers"
}
ingress {
from_port = 8080
to_port = 8080
protocol = "tcp"
security_groups = [aws_security_group.mgmt_node_sg.id]
description = "For SPDK Proxy for the storage node from mgmt node"
}
ingress {
from_port = 8080
to_port = 8080
protocol = "tcp"
self = true
description = "For SPDK Proxy for the storage node from other storage nodes"
}
ingress {
from_port = 2375
to_port = 2375
protocol = "tcp"
security_groups = [aws_security_group.mgmt_node_sg.id]
description = "docker engine API"
}
ingress {
from_port = 8
to_port = 0
protocol = "icmp"
security_groups = [aws_security_group.mgmt_node_sg.id]
description = "allow ICMP Echo"
}
ingress {
from_port = 9100
to_port = 9100
protocol = "tcp"
security_groups = [aws_security_group.mgmt_node_sg.id]
description = "prometheus scrape from mgmt nodes"
}
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
security_groups = [aws_security_group.bastion_sg.id]
description = "SSH from Bastion Server"
}
# Docker Swarm Ports: start
ingress {
from_port = 2377
to_port = 2377
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
description = "Docker Swarm Manager Communication"
}
ingress {
from_port = 7946
to_port = 7946
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
description = "Docker Swarm Node Communication TCP"
}
ingress {
from_port = 7946
to_port = 7946
protocol = "udp"
cidr_blocks = ["0.0.0.0/0"]
description = "Docker Swarm Node Communication UDP"
}
ingress {
from_port = 4789
to_port = 4789
protocol = "udp"
cidr_blocks = ["0.0.0.0/0"]
description = "Docker Swarm Overlay Network"
}
# Graylog GELF
ingress {
from_port = 12201
to_port = 12201
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
description = "Graylog GELF Communication TCP"
}
ingress {
from_port = 12201
to_port = 12201
protocol = "udp"
cidr_blocks = ["0.0.0.0/0"]
description = "Graylog GELF Communication TCP"
}
ingress {
from_port = 6443
to_port = 6443
protocol = "tcp"
cidr_blocks = var.whitelist_ips
description = "k3s cluster"
}
ingress {
from_port = 10250
to_port = 10255
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
description = "k8s node communication"
}
ingress {
from_port = 53
to_port = 53
protocol = "udp"
cidr_blocks = ["0.0.0.0/0"]
description = "Allow DNS resolution from worker nodes"
}
ingress {
from_port = 1025
to_port = 65535
protocol = "udp"
cidr_blocks = ["0.0.0.0/0"]
description = "Allow UDP traffic on ephemeral ports"
}
# end
egress {
from_port = 0
to_port = 0
protocol = -1
cidr_blocks = ["0.0.0.0/0"]
description = "all output traffic so that packages can be downloaded"
}
}
resource "aws_security_group" "extra_nodes_sg" {
name = "${terraform.workspace}-extra_nodes_sg"
description = "CSI Cluster Container Security Group"
vpc_id = module.vpc.vpc_id
ingress {
from_port = 6443
to_port = 6443
protocol = "tcp"
cidr_blocks = var.whitelist_ips
description = "k3s cluster"
}
ingress {
from_port = 8080
to_port = 8080
protocol = "tcp"
security_groups = [aws_security_group.mgmt_node_sg.id]
description = "For SPDK Proxy for the storage node"
}
ingress {
from_port = 2375
to_port = 2375
protocol = "tcp"
security_groups = [aws_security_group.mgmt_node_sg.id]
description = "docker engine API"
}
ingress {
from_port = 8
to_port = 0
protocol = "icmp"
security_groups = [aws_security_group.mgmt_node_sg.id]
description = "allow ICMP Echo"
}
ingress {
from_port = 5000
to_port = 5000
protocol = "tcp"
cidr_blocks = var.whitelist_ips
description = "k3s cluster"
}
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = var.whitelist_ips
description = ""
}
ingress {
from_port = 10250
to_port = 10255
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
description = "k8s node communication"
}
ingress {
from_port = 53
to_port = 53
protocol = "udp"
cidr_blocks = ["0.0.0.0/0"]
description = "Allow DNS resolution from worker nodes"
}
ingress {
from_port = 1025
to_port = 65535
protocol = "udp"
cidr_blocks = ["0.0.0.0/0"]
description = "Allow UDP traffic on ephemeral ports"
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}
resource "aws_security_group" "bastion_sg" {
name = "${terraform.workspace}-bastion_sg"
description = "CSI Cluster Container Security Group"
vpc_id = module.vpc.vpc_id
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = var.whitelist_ips
description = ""
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}
# create assumed role
data "aws_iam_policy_document" "assume_role_policy" {
statement {
effect = "Allow"
principals {
type = "Service"
identifiers = ["ec2.amazonaws.com"]
}
actions = [
"sts:AssumeRole",
]
}
}
# create a policy
resource "aws_iam_policy" "mgmt_policy" {
name = "${terraform.workspace}-mgmt_node_policy"
description = "Policy for allowing EC2 to communicate with other resources"
policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
"Effect" : "Allow",
"Action" : [
"ec2:DescribeAvailabilityZones",
"ec2:DescribeSubnets",
"ec2:DescribeNetworkInterfaces",
"ec2:DescribeInstances",
"ec2:DescribeInstanceAttribute",
"ec2:DescribeSecurityGroups",
"ec2:DescribeTags",
"ec2:DescribeVolumes",
"ec2:RunInstances",
"ec2:CreateVolume",
"ec2:AttachVolume",
"ec2:DetachVolume",
"ec2:CreateTags"
],
"Resource" : "*"
},
{
"Effect" : "Allow",
"Action" : "sts:GetServiceBearerToken",
"Resource" : "*"
},
{
"Effect" : "Allow",
"Action" : "iam:PassRole",
"Resource" : "*"
},
{
Action = [
"codeartifact:GetAuthorizationToken",
"codeartifact:GetRepositoryEndpoint",
"codeartifact:ReadFromRepository",
],
Effect = "Allow",
Resource = [
"arn:aws:codeartifact:eu-west-1:565979732541:repository/simplyblock/sbcli",
"arn:aws:codeartifact:eu-west-1:565979732541:domain/simplyblock"
]
},
{
Action = [
"ssm:SendCommand",
],
Effect = "Allow",
Resource = [
"arn:aws:ec2:${var.region}:${local.account_id}:instance/*",
"arn:aws:ssm:${var.region}::document/AWS-RunShellScript",
"arn:aws:ssm:${var.region}:${local.account_id}:*"
]
},
{
Action = [
"ssm:GetCommandInvocation"
],
Effect = "Allow",
Resource = [
"arn:aws:ssm:${var.region}:${local.account_id}:*"
]
},
{
"Effect" : "Allow",
"Action" : [
"s3:GetObject"
],
"Resource" : [
"${aws_s3_bucket.tfengine_logs.arn}/*",
"arn:aws:s3:::${var.tf_state_bucket_name}/*"
]
},
{
"Effect" : "Allow",
"Action" : [
"s3:ListBucket"
],
"Resource" : [
"arn:aws:s3:::${var.tf_state_bucket_name}"
]
}
]
})
}
# create a role with an assumed policy
resource "aws_iam_role" "role" {
path = "/"
assume_role_policy = data.aws_iam_policy_document.assume_role_policy.json
}
# attach policy to the role
resource "aws_iam_role_policy_attachment" "s3_get_object_attachment" {
role = aws_iam_role.role.name
policy_arn = aws_iam_policy.mgmt_policy.arn
}
# create instance profile
resource "aws_iam_instance_profile" "inst_profile" {
name = "simplyblock-instance-profile-${terraform.workspace}"
role = aws_iam_role.role.name
}
resource "aws_instance" "bastion" {
ami = local.region_ami_map[var.region] # RHEL 9
instance_type = "t2.micro"
key_name = local.selected_key_name
vpc_security_group_ids = [aws_security_group.bastion_sg.id]
subnet_id = module.vpc.public_subnets[0]
iam_instance_profile = aws_iam_instance_profile.inst_profile.name
root_block_device {
volume_size = 45
}
tags = {
Name = "${terraform.workspace}-bastion"
}
}
resource "aws_instance" "mgmt_nodes" {
count = var.mgmt_nodes
ami = local.region_ami_map[var.region] # RHEL 9
instance_type = var.mgmt_nodes_instance_type
key_name = local.selected_key_name
vpc_security_group_ids = [aws_security_group.mgmt_node_sg.id]
subnet_id = module.vpc.private_subnets[local.az_index]
iam_instance_profile = aws_iam_instance_profile.inst_profile.name
root_block_device {
volume_size = 100
}
tags = {
Name = "${terraform.workspace}-mgmt-${count.index + 1}"
}
lifecycle {
ignore_changes = [
subnet_id,
]
}
user_data = <<EOF
#!/bin/bash
echo "installing sbcli.."
sudo yum install -y pip jq
pip install ${local.sbcli_pkg}
sudo yum install -y fio nvme-cli unzip;
sudo modprobe nvme-tcp
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
EOF
}
resource "aws_instance" "storage_nodes" {
for_each = local.snodes
ami = local.ami_map[var.storage_nodes_arch][var.region] # RHEL 9
instance_type = var.storage_nodes_instance_type
key_name = local.selected_key_name
vpc_security_group_ids = [aws_security_group.storage_nodes_sg.id]
subnet_id = module.vpc.private_subnets[local.az_index]
iam_instance_profile = aws_iam_instance_profile.inst_profile.name
root_block_device {
volume_size = 45
}
tags = {
Name = "${terraform.workspace}-storage-${each.value + 1}"
}
lifecycle {
ignore_changes = [
subnet_id,
]
}
user_data = <<EOF
#!/bin/bash
sudo sysctl -w vm.nr_hugepages=${var.nr_hugepages}
cat /proc/meminfo | grep -i hug
echo "installing sbcli.."
sudo yum install -y pip unzip
pip install ${local.sbcli_pkg}
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
if [ "${var.snode_deploy_on_k8s}" = "false" ]; then
${var.sbcli_cmd} storage-node deploy
fi
EOF
}
resource "aws_instance" "sec_storage_nodes" {
for_each = local.sec_snodes
ami = local.ami_map[var.storage_nodes_arch][var.region] # RHEL 9
instance_type = var.sec_storage_nodes_instance_type
key_name = local.selected_key_name
vpc_security_group_ids = [aws_security_group.storage_nodes_sg.id]
subnet_id = module.vpc.private_subnets[local.az_index]
iam_instance_profile = aws_iam_instance_profile.inst_profile.name
root_block_device {
volume_size = 45
}
tags = {
Name = "${terraform.workspace}-sec-storage-${each.value + 1}"
}
lifecycle {
ignore_changes = [
subnet_id,
]
}
user_data = <<EOF
#!/bin/bash
sudo sysctl -w vm.nr_hugepages=${var.nr_hugepages}
cat /proc/meminfo | grep -i hug
echo "installing sbcli.."
sudo yum install -y pip unzip
pip install ${local.sbcli_pkg}
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
if [ "${var.snode_deploy_on_k8s}" = "false" ]; then
${var.sbcli_cmd} storage-node deploy
fi
EOF
}
resource "aws_ebs_volume" "storage_nodes_ebs" {
count = var.volumes_per_storage_nodes > 0 && var.storage_nodes > 0 ? var.storage_nodes : 0
availability_zone = data.aws_availability_zones.available.names[local.az_index]
size = var.storage_nodes_ebs_size1
tags = {
Name = "simplyblock-jm"
}
lifecycle {
ignore_changes = [
availability_zone,
]
}
}
resource "aws_ebs_volume" "storage_nodes_ebs2" {
for_each = var.storage_nodes > 0 ? local.node_disks : {}
availability_zone = data.aws_availability_zones.available.names[local.az_index]
size = var.storage_nodes_ebs_size2
tags = {
Name = "simplyblock-storage"
}
lifecycle {
ignore_changes = [
availability_zone,
]
}
}
resource "aws_volume_attachment" "attach_sn2" {
for_each = var.storage_nodes > 0 ? local.node_disks : {}
device_name = each.value.disk_dev_path
volume_id = aws_ebs_volume.storage_nodes_ebs2[each.key].id
instance_id = aws_instance.storage_nodes[each.value.node_name].id
}
resource "aws_volume_attachment" "attach_sn" {
count = var.volumes_per_storage_nodes > 0 && var.storage_nodes > 0 ? var.storage_nodes : 0
device_name = "/dev/sdh"
volume_id = aws_ebs_volume.storage_nodes_ebs[count.index].id
instance_id = aws_instance.storage_nodes[count.index].id
}
# can be used for testing caching nodes
resource "aws_instance" "extra_nodes" {
count = var.extra_nodes
ami = local.ami_map[var.extra_nodes_arch][var.region] # RHEL 9
instance_type = var.extra_nodes_instance_type
key_name = local.selected_key_name
vpc_security_group_ids = [aws_security_group.extra_nodes_sg.id]
subnet_id = module.vpc.public_subnets[1]
iam_instance_profile = aws_iam_instance_profile.inst_profile.name
root_block_device {
volume_size = 45
}
tags = {
Name = "${terraform.workspace}-k8scluster-${count.index + 1}"
}
user_data = <<EOF
#!/bin/bash
sudo sysctl -w vm.nr_hugepages=${var.nr_hugepages}
cat /proc/meminfo | grep -i hug
EOF
}