File tree Expand file tree Collapse file tree 5 files changed +22
-21
lines changed Expand file tree Collapse file tree 5 files changed +22
-21
lines changed Original file line number Diff line number Diff line change @@ -5,10 +5,15 @@ data "aws_ami" "amzn" {
5
5
6
6
filter {
7
7
name = " name"
8
- values = [" amzn -ami-*" ]
8
+ values = [" amzn2 -ami-ecs-hvm *" ]
9
9
}
10
10
11
- name_regex = " .+-amazon-ecs-optimized$"
11
+ filter {
12
+ name = " architecture"
13
+ values = [var . architecture ]
14
+ }
15
+
16
+ name_regex = " .+-ebs$"
12
17
}
13
18
14
19
data "aws_caller_identity" "current" {}
Original file line number Diff line number Diff line change @@ -16,6 +16,11 @@ variable "instance_type_3" {
16
16
description = " Instance type for ECS workers (third priority)"
17
17
}
18
18
19
+ variable "architecture" {
20
+ default = " x86_64"
21
+ description = " Architecture to select the AMI, x86_64 or arm64"
22
+ }
23
+
19
24
variable "on_demand_percentage" {
20
25
description = " Percentage of on-demand intances vs spot"
21
26
default = 100
@@ -159,12 +164,7 @@ variable "autoscaling_default_cooldown" {
159
164
160
165
variable "instance_volume_size" {
161
166
description = " Volume size for docker volume (in GB)"
162
- default = 22
163
- }
164
-
165
- variable "instance_volume_size_root" {
166
- description = " Volume size for root volume (in GB)"
167
- default = 16
167
+ default = 30
168
168
}
169
169
170
170
variable "lb_access_logs_bucket" {
@@ -217,3 +217,9 @@ variable "alarm_prefix" {
217
217
description = " String prefix for cloudwatch alarms. (Optional)"
218
218
default = " "
219
219
}
220
+
221
+ variable "kms_key_arn" {
222
+ type = string
223
+ description = " ARN of a KMS Key to use on EFS and EBS volumes"
224
+ default = " "
225
+ }
Original file line number Diff line number Diff line change @@ -20,16 +20,10 @@ resource "aws_launch_template" "ecs" {
20
20
block_device_mappings {
21
21
device_name = " /dev/xvda"
22
22
23
- ebs {
24
- volume_size = var. instance_volume_size_root
25
- }
26
- }
27
-
28
- block_device_mappings {
29
- device_name = " /dev/xvdcz"
30
-
31
23
ebs {
32
24
volume_size = var. instance_volume_size
25
+ encrypted = true
26
+ kms_key_id = var. kms_key_arn != " " ? var. kms_key_arn : null
33
27
}
34
28
}
35
29
Original file line number Diff line number Diff line change 1
1
resource "aws_efs_file_system" "ecs" {
2
2
creation_token = " ecs-${ var . name } "
3
3
encrypted = true
4
+ kms_key_id = var. kms_key_arn != " " ? var. kms_key_arn : null
4
5
5
6
throughput_mode = var. throughput_mode
6
7
provisioned_throughput_in_mibps = var. provisioned_throughput_in_mibps
Original file line number Diff line number Diff line change @@ -18,11 +18,6 @@ yum update -y
18
18
yum install -y amazon-efs-utils aws-cli
19
19
20
20
21
- echo " ### INSTALL SSM AGENT"
22
- cd /tmp
23
- yum install -y https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm
24
- restart amazon-ssm-agent
25
-
26
21
echo " ### SETUP EFS"
27
22
EFS_DIR=/mnt/efs
28
23
EFS_ID=${tf_efs_id}
You can’t perform that action at this time.
0 commit comments