-
Notifications
You must be signed in to change notification settings - Fork 1
/
07-autoscaling-group.tf
68 lines (66 loc) · 2.15 KB
/
07-autoscaling-group.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
######################################
#Asg 1
######################################
resource "aws_autoscaling_group" "index" {
name_prefix = "index-"
max_size = var.max_size
min_size = var.min_size
health_check_grace_period = 300
health_check_type = "EC2"
desired_capacity = var.desired_size
launch_configuration = aws_launch_configuration.index.name
target_group_arns = [ aws_lb_target_group.index.arn ]
vpc_zone_identifier = [-choose-public-subnet-one-,-choose-public-subnet-two-]
tag {
key = "Name"
value = "index"
propagate_at_launch = true
}
lifecycle {
create_before_destroy = true
}
}
######################################
#Asg 2
######################################
resource "aws_autoscaling_group" "path1" {
name_prefix = "path1-"
max_size = var.max_size
min_size = var.min_size
health_check_grace_period = 300
health_check_type = "EC2"
desired_capacity = var.desired_size
launch_configuration = aws_launch_configuration.blog.name
target_group_arns = [ aws_lb_target_group.blog.arn ]
vpc_zone_identifier = [-choose-public-subnet-one-,-choose-public-subnet-two-]
tag {
key = "Name"
value = "path1"
propagate_at_launch = true
}
lifecycle {
create_before_destroy = true
}
}
######################################
#Asg for about
######################################
resource "aws_autoscaling_group" "path2" {
name_prefix = "path2-"
max_size = var.max_size
min_size = var.min_size
health_check_grace_period = 300
health_check_type = "EC2"
desired_capacity = var.desired_size
launch_configuration = aws_launch_configuration.about.name
target_group_arns = [ aws_lb_target_group.about.arn ]
vpc_zone_identifier = [-choose-public-subnet-one-,-choose-public-subnet-two-]
tag {
key = "Name"
value = "path2"
propagate_at_launch = true
}
lifecycle {
create_before_destroy = true
}
}