-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds blue-green codedeploy option (#15)
* adds blue-green codedeploy option * add example
- Loading branch information
Luca Venturelli
committed
Apr 12, 2019
1 parent
bb7b3ec
commit d3846c3
Showing
3 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
resource "aws_codedeploy_deployment_group" "deployment_group" { | ||
app_name = "${var.app_name}" | ||
deployment_group_name = "${var.app_name}-${var.environment}" | ||
deployment_config_name = "CodeDeployDefault.AllAtOnce" | ||
service_role_arn = "${var.service_role_arn}" | ||
autoscaling_groups = ["${var.autoscaling_groups}"] | ||
|
||
auto_rollback_configuration { | ||
enabled = "${var.rollback_enabled}" | ||
events = "${var.rollback_events}" | ||
} | ||
|
||
blue_green_deployment_config { | ||
deployment_ready_option { | ||
action_on_timeout = "${var.action_on_timeout}" | ||
} | ||
|
||
terminate_blue_instances_on_deployment_success { | ||
action = "${var.terminate_blue_instances_on_deployment_success}" | ||
} | ||
} | ||
|
||
deployment_style { | ||
deployment_option = "WITH_TRAFFIC_CONTROL" | ||
deployment_type = "BLUE_GREEN" | ||
} | ||
|
||
trigger_configuration { | ||
trigger_events = "${var.trigger_events}" | ||
trigger_name = "${var.app_name}-${var.environment}" | ||
trigger_target_arn = "${var.trigger_target_arn}" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
variable "environment" { | ||
description = "Environment where your codedeploy deployment group is used for" | ||
} | ||
|
||
variable "app_name" { | ||
description = "Name of the app" | ||
} | ||
|
||
variable "service_role_arn" { | ||
description = "IAM role that is used by the deployment group" | ||
} | ||
|
||
variable "autoscaling_groups" { | ||
type = "list" | ||
description = "Autoscaling groups you want to attach to the deployment group" | ||
} | ||
|
||
variable "rollback_enabled" { | ||
description = "Whether to enable auto rollback" | ||
default = false | ||
} | ||
|
||
variable "rollback_events" { | ||
description = "The event types that trigger a rollback" | ||
type = "list" | ||
default = ["DEPLOYMENT_FAILURE"] | ||
} | ||
|
||
variable "trigger_events" { | ||
description = "events that can trigger the notifications" | ||
type = "list" | ||
default = ["DeploymentStop", "DeploymentRollback", "DeploymentSuccess", "DeploymentFailure", "DeploymentStart"] | ||
} | ||
|
||
variable "trigger_target_arn" { | ||
description = "ARN of the target group" | ||
} | ||
|
||
variable "action_on_timeout" { | ||
description = "When to reroute traffic from an original environment to a replacement environment in a blue/green deployment" | ||
default = "CONTINUE_DEPLOYMENT" | ||
} | ||
|
||
variable "terminate_blue_instances_on_deployment_success" { | ||
description = " The action to take on instances in the original environment after a successful blue/green deployment" | ||
default = "KEEP_ALIVE" | ||
} |