github.com/jrasell/terraform@v0.6.17-0.20160523115548-2652f5232949/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 ``` 87 88 ## Argument Reference 89 90 The following arguments are supported: 91 92 * `app_name` - (Required) The name of the application. 93 * `deployment_group_name` - (Required) The name of the deployment group. 94 * `service_role_arn` - (Required) The service role ARN that allows deployments. 95 * `autoscaling_groups` - (Optional) Autoscaling groups associated with the deployment group. 96 * `deployment_config_name` - (Optional) The name of the group's deployment config. The default is "CodeDeployDefault.OneAtATime". 97 * `ec2_tag_filter` - (Optional) Tag filters associated with the group. See the AWS docs for details. 98 * `on_premises_instance_tag_filter` - (Optional) On premise tag filters associated with the group. See the AWS docs for details. 99 * `trigger_configuration` - (Optional) A Trigger Configuration block. Trigger Configurations are documented below. 100 101 Both ec2_tag_filter and on_premises_tag_filter blocks support the following: 102 103 * `key` - (Optional) The key of the tag filter. 104 * `type` - (Optional) The type of the tag filter, either KEY_ONLY, VALUE_ONLY, or KEY_AND_VALUE. 105 * `value` - (Optional) The value of the tag filter. 106 107 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: 108 109 * `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`. 110 * `trigger_name` - (Required) The name of the notification trigger. 111 * `trigger_target_arn` - (Required) The ARN of the SNS topic through which notifications are sent. 112 113 ## Attributes Reference 114 115 The following attributes are exported: 116 117 * `id` - The deployment group's ID. 118 * `app_name` - The group's assigned application. 119 * `deployment_group_name` - The group's name. 120 * `service_role_arn` - The group's service role ARN. 121 * `autoscaling_groups` - The autoscaling groups associated with the deployment group. 122 * `deployment_config_name` - The name of the group's deployment config.