github.com/pbthorste/terraform@v0.8.6-0.20170127005045-deb56bd93da2/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 policy = <<EOF 24 { 25 "Version": "2012-10-17", 26 "Statement": [ 27 { 28 "Effect": "Allow", 29 "Action": [ 30 "autoscaling:CompleteLifecycleAction", 31 "autoscaling:DeleteLifecycleHook", 32 "autoscaling:DescribeAutoScalingGroups", 33 "autoscaling:DescribeLifecycleHooks", 34 "autoscaling:PutLifecycleHook", 35 "autoscaling:RecordLifecycleActionHeartbeat", 36 "ec2:DescribeInstances", 37 "ec2:DescribeInstanceStatus", 38 "tag:GetTags", 39 "tag:GetResources" 40 ], 41 "Resource": "*" 42 } 43 ] 44 } 45 EOF 46 } 47 48 resource "aws_iam_role" "foo_role" { 49 name = "foo_role" 50 assume_role_policy = <<EOF 51 { 52 "Version": "2012-10-17", 53 "Statement": [ 54 { 55 "Sid": "", 56 "Effect": "Allow", 57 "Principal": { 58 "Service": [ 59 "codedeploy.amazonaws.com" 60 ] 61 }, 62 "Action": "sts:AssumeRole" 63 } 64 ] 65 } 66 EOF 67 } 68 69 resource "aws_codedeploy_deployment_group" "foo" { 70 app_name = "${aws_codedeploy_app.foo_app.name}" 71 deployment_group_name = "bar" 72 service_role_arn = "${aws_iam_role.foo_role.arn}" 73 74 ec2_tag_filter { 75 key = "filterkey" 76 type = "KEY_AND_VALUE" 77 value = "filtervalue" 78 } 79 80 trigger_configuration { 81 trigger_events = ["DeploymentFailure"] 82 trigger_name = "foo-trigger" 83 trigger_target_arn = "foo-topic-arn" 84 } 85 86 auto_rollback_configuration { 87 enabled = true 88 events = ["DEPLOYMENT_FAILURE"] 89 } 90 91 alarm_configuration { 92 alarms = ["my-alarm-name"] 93 enabled = true 94 } 95 } 96 ``` 97 98 ## Argument Reference 99 100 The following arguments are supported: 101 102 * `app_name` - (Required) The name of the application. 103 * `deployment_group_name` - (Required) The name of the deployment group. 104 * `service_role_arn` - (Required) The service role ARN that allows deployments. 105 * `autoscaling_groups` - (Optional) Autoscaling groups associated with the deployment group. 106 * `deployment_config_name` - (Optional) The name of the group's deployment config. The default is "CodeDeployDefault.OneAtATime". 107 * `ec2_tag_filter` - (Optional) Tag filters associated with the group. See the AWS docs for details. 108 * `on_premises_instance_tag_filter` - (Optional) On premise tag filters associated with the group. See the AWS docs for details. 109 * `trigger_configuration` - (Optional) A Trigger Configuration block. Trigger Configurations are documented below. 110 * `auto_rollback_configuration` - (Optional) The automatic rollback configuration associated with the deployment group, documented below. 111 * `alarm_configuration` - (Optional) A list of alarms associated with the deployment group, documented below. 112 113 Both ec2_tag_filter and on_premises_tag_filter blocks support the following: 114 115 * `key` - (Optional) The key of the tag filter. 116 * `type` - (Optional) The type of the tag filter, either KEY_ONLY, VALUE_ONLY, or KEY_AND_VALUE. 117 * `value` - (Optional) The value of the tag filter. 118 119 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: 120 121 * `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`. 122 * `trigger_name` - (Required) The name of the notification trigger. 123 * `trigger_target_arn` - (Required) The ARN of the SNS topic through which notifications are sent. 124 125 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. 126 127 * `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. 128 * `events` - (Optional) The event type or types that trigger a rollback. Supported types are `DEPLOYMENT_FAILURE` and `DEPLOYMENT_STOP_ON_ALARM`. 129 130 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. 131 132 * `alarms` - (Optional) A list of alarms configured for the deployment group. A maximum of 10 alarms can be added to a deployment group. 133 * `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. 134 * `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`. 135 * `true`: The deployment will proceed even if alarm status information can't be retrieved. 136 * `false`: The deployment will stop if alarm status information can't be retrieved. 137 138 ## Attributes Reference 139 140 The following attributes are exported: 141 142 * `id` - The deployment group's ID. 143 * `app_name` - The group's assigned application. 144 * `deployment_group_name` - The group's name. 145 * `service_role_arn` - The group's service role ARN. 146 * `autoscaling_groups` - The autoscaling groups associated with the deployment group. 147 * `deployment_config_name` - The name of the group's deployment config.