File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ data "aws_ami" "this" {
37
37
}
38
38
39
39
resource "aws_launch_configuration" "this" {
40
- name = " ${ var . deployment_name } -ecs-launch-configuration"
40
+ name_prefix = " ${ var . deployment_name } -ecs-launch-configuration- "
41
41
image_id = data. aws_ami . this . id
42
42
instance_type = var. instance_type # e.g. t2.medium
43
43
@@ -65,6 +65,10 @@ resource "aws_launch_configuration" "this" {
65
65
66
66
# Allow the EC2 instances to access AWS resources on your behalf, using this instance profile and the permissions defined there
67
67
iam_instance_profile = aws_iam_instance_profile. ec2 . arn
68
+
69
+ lifecycle {
70
+ create_before_destroy = true
71
+ }
68
72
}
69
73
70
74
resource "aws_autoscaling_group" "this" {
@@ -99,6 +103,10 @@ resource "aws_autoscaling_group" "this" {
99
103
value = " ${ var . deployment_name } -ec2-instance"
100
104
propagate_at_launch = true
101
105
}
106
+
107
+ lifecycle {
108
+ create_before_destroy = true
109
+ }
102
110
}
103
111
104
112
# Attach an autoscaling policy to the spot cluster to target 70% MemoryReservation on the ECS cluster.
You can’t perform that action at this time.
0 commit comments