github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/website/source/docs/providers/aws/r/codedeploy_deployment_group.html.markdown (about) 1 --- 2 layout: "aws" 3 page_title: "AWS: aws_codedeploy_deployment_group" 4 sidebar_current: "docs-aws-resource-codedeploy-deployment-group" 5 description: |- 6 Provides a CodeDeploy deployment group. 7 --- 8 9 # aws\_codedeploy\_deployment\_group 10 11 Provides a CodeDeploy deployment group for an application 12 13 ## Example Usage 14 15 ``` 16 resource "aws_codedeploy_app" "foo_app" { 17 name = "foo_app" 18 } 19 20 resource "aws_iam_role_policy" "foo_policy" { 21 name = "foo_policy" 22 role = "${aws_iam_role.foo_role.id}" 23 24 policy = <<EOF 25 { 26 "Version": "2012-10-17", 27 "Statement": [ 28 { 29 "Effect": "Allow", 30 "Action": [ 31 "autoscaling:CompleteLifecycleAction", 32 "autoscaling:DeleteLifecycleHook", 33 "autoscaling:DescribeAutoScalingGroups", 34 "autoscaling:DescribeLifecycleHooks", 35 "autoscaling:PutLifecycleHook", 36 "autoscaling:RecordLifecycleActionHeartbeat", 37 "ec2:DescribeInstances", 38 "ec2:DescribeInstanceStatus", 39 "tag:GetTags", 40 "tag:GetResources" 41 ], 42 "Resource": "*" 43 } 44 ] 45 } 46 EOF 47 } 48 49 resource "aws_iam_role" "foo_role" { 50 name = "foo_role" 51 52 assume_role_policy = <<EOF 53 { 54 "Version": "2012-10-17", 55 "Statement": [ 56 { 57 "Sid": "", 58 "Effect": "Allow", 59 "Principal": { 60 "Service": [ 61 "codedeploy.amazonaws.com" 62 ] 63 }, 64 "Action": "sts:AssumeRole" 65 } 66 ] 67 } 68 EOF 69 } 70 71 resource "aws_codedeploy_deployment_group" "foo" { 72 app_name = "${aws_codedeploy_app.foo_app.name}" 73 deployment_group_name = "bar" 74 service_role_arn = "${aws_iam_role.foo_role.arn}" 75 76 ec2_tag_filter { 77 key = "filterkey" 78 type = "KEY_AND_VALUE" 79 value = "filtervalue" 80 } 81 82 trigger_configuration { 83 trigger_events = ["DeploymentFailure"] 84 trigger_name = "foo-trigger" 85 trigger_target_arn = "foo-topic-arn" 86 } 87 88 auto_rollback_configuration { 89 enabled = true 90 events = ["DEPLOYMENT_FAILURE"] 91 } 92 93 alarm_configuration { 94 alarms = ["my-alarm-name"] 95 enabled = true 96 } 97 } 98 ``` 99 100 ## Argument Reference 101 102 The following arguments are supported: 103 104 * `app_name` - (Required) The name of the application. 105 * `deployment_group_name` - (Required) The name of the deployment group. 106 * `service_role_arn` - (Required) The service role ARN that allows deployments. 107 * `autoscaling_groups` - (Optional) Autoscaling groups associated with the deployment group. 108 * `deployment_config_name` - (Optional) The name of the group's deployment config. The default is "CodeDeployDefault.OneAtATime". 109 * `ec2_tag_filter` - (Optional) Tag filters associated with the group. See the AWS docs for details. 110 * `on_premises_instance_tag_filter` - (Optional) On premise tag filters associated with the group. See the AWS docs for details. 111 * `trigger_configuration` - (Optional) A Trigger Configuration block. Trigger Configurations are documented below. 112 * `auto_rollback_configuration` - (Optional) The automatic rollback configuration associated with the deployment group, documented below. 113 * `alarm_configuration` - (Optional) A list of alarms associated with the deployment group, documented below. 114 115 Both ec2_tag_filter and on_premises_tag_filter blocks support the following: 116 117 * `key` - (Optional) The key of the tag filter. 118 * `type` - (Optional) The type of the tag filter, either KEY_ONLY, VALUE_ONLY, or KEY_AND_VALUE. 119 * `value` - (Optional) The value of the tag filter. 120 121 Add triggers to a Deployment Group to receive notifications about events related to deployments or instances in the group. Notifications are sent to subscribers of the SNS topic associated with the trigger. CodeDeploy must have permission to publish to the topic from this deployment group. Trigger Configurations support the following: 122 123 * `trigger_events` - (Required) The event type or types for which notifications are triggered. The following values are supported: `DeploymentStart`, `DeploymentSuccess`, `DeploymentFailure`, `DeploymentStop`, `InstanceStart`, `InstanceSuccess`, `InstanceFailure`. 124 * `trigger_name` - (Required) The name of the notification trigger. 125 * `trigger_target_arn` - (Required) The ARN of the SNS topic through which notifications are sent. 126 127 You can configure a deployment group to automatically rollback when a deployment fails or when a monitoring threshold you specify is met. In this case, the last known good version of an application revision is deployed. Only one rollback configuration block is allowed. 128 129 * `enabled` - (Optional) Indicates whether a defined automatic rollback configuration is currently enabled for this Deployment Group. If you enable automatic rollback, you must specify at least one event type. 130 * `events` - (Optional) The event type or types that trigger a rollback. Supported types are `DEPLOYMENT_FAILURE` and `DEPLOYMENT_STOP_ON_ALARM`. 131 132 You can configure a deployment to stop when a CloudWatch alarm detects that a metric has fallen below or exceeded a defined threshold. Only one alarm configuration block is allowed. 133 134 * `alarms` - (Optional) A list of alarms configured for the deployment group. A maximum of 10 alarms can be added to a deployment group. 135 * `enabled` - (Optional) Indicates whether the alarm configuration is enabled. This option is useful when you want to temporarily deactivate alarm monitoring for a deployment group without having to add the same alarms again later. 136 * `ignore_poll_alarm_failure` - (Optional) Indicates whether a deployment should continue if information about the current state of alarms cannot be retrieved from CloudWatch. The default value is `false`. 137 * `true`: The deployment will proceed even if alarm status information can't be retrieved. 138 * `false`: The deployment will stop if alarm status information can't be retrieved. 139 140 ## Attributes Reference 141 142 The following attributes are exported: 143 144 * `id` - The deployment group's ID. 145 * `app_name` - The group's assigned application. 146 * `deployment_group_name` - The group's name. 147 * `service_role_arn` - The group's service role ARN. 148 * `autoscaling_groups` - The autoscaling groups associated with the deployment group. 149 * `deployment_config_name` - The name of the group's deployment config.