-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathcd_dg.tf
59 lines (47 loc) · 1.42 KB
/
cd_dg.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
resource "aws_codedeploy_app" "demo_app" {
name = "demo_app"
compute_platform = "Server"
}
resource "aws_sns_topic" "demo_sns_topic" {
name = "demo_sns_topic"
}
resource "aws_codedeploy_deployment_config" "demo_config" {
deployment_config_name = "CodeDeployDefault2.EC2AllAtOnce"
#traffic_routing_config {
# type = "AllAtOnce"
#}
# Terraform: Should be "null" for EC2/Server
minimum_healthy_hosts {
type = "HOST_COUNT"
value = 0
}
}
resource "aws_codedeploy_deployment_group" "cd_dg1" {
app_name = aws_codedeploy_app.demo_app.name
deployment_group_name = "cd_dg1"
service_role_arn = aws_iam_role.devops_codedeploy_role.arn
trigger_configuration {
trigger_events = ["DeploymentFailure", "DeploymentSuccess", "DeploymentFailure", "DeploymentStop",
"InstanceStart", "InstanceSuccess", "InstanceFailure"]
trigger_name = "event-trigger"
trigger_target_arn = aws_sns_topic.demo_sns_topic.arn
}
auto_rollback_configuration {
enabled = false
events = ["DEPLOYMENT_FAILURE"]
}
alarm_configuration {
alarms = ["my-alarm-name"]
enabled = true
}
load_balancer_info {
target_group_info {
name = aws_lb_target_group.external_alb_tg_app1.name
}
}
deployment_style {
deployment_option = "WITH_TRAFFIC_CONTROL"
deployment_type = "IN_PLACE"
}
autoscaling_groups = [aws_autoscaling_group.devops_web_asg.id]
}