FEATURES PRICING ABOUT DOCS LOGIN

aws_codedeploy_deployment_group

Provides a CodeDeploy deployment group for an application

Example Usage

resource "aws_codedeploy_app" "foo_app" {
    name = "foo_app"
}

resource "aws_iam_role_policy" "foo_policy" {
    name = "foo_policy"
    role = "${aws_iam_role.foo_role.id}"
    policy = <<EOF
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "autoscaling:CompleteLifecycleAction",
                "autoscaling:DeleteLifecycleHook",
                "autoscaling:DescribeAutoScalingGroups",
                "autoscaling:DescribeLifecycleHooks",
                "autoscaling:PutLifecycleHook",
                "autoscaling:RecordLifecycleActionHeartbeat",
                "ec2:DescribeInstances",
                "ec2:DescribeInstanceStatus",
                "tag:GetTags",
                "tag:GetResources"
            ],
            "Resource": "*"
        }
    ]
}
EOF
}

resource "aws_iam_role" "foo_role" {
    name = "foo_role"
    assume_role_policy = <<EOF
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "",
      "Effect": "Allow",
      "Principal": {
        "Service": [
          "codedeploy.amazonaws.com"
        ]
      },
      "Action": "sts:AssumeRole"
    }
  ]
}
EOF
}

resource "aws_codedeploy_deployment_group" "foo" {
    app_name = "${aws_codedeploy_app.foo_app.name}"
    deployment_group_name = "bar"
    service_role_arn = "${aws_iam_role.foo_role.arn}"

    ec2_tag_filter {
        key = "filterkey"
        type = "KEY_AND_VALUE"
        value = "filtervalue"
    }

    trigger_configuration {
        trigger_events = ["DeploymentFailure"]
        trigger_name = "foo-trigger"
        trigger_target_arn = "foo-topic-arn"
    }
}

Argument Reference

The following arguments are supported:

Both ec2_tag_filter and on_premises_tag_filter blocks support the following:

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:

Attributes Reference

The following attributes are exported:


See the source of this document at Terraform.io

REQUEST A DEMO