Add target_group attribute to single-master

In order to orchestrate task placement constraints it is useful to know
what target group the ECS container belongs to.

this allows be very specific when deciding where a task should be
deployed to.

Specifically this change allows to set the ground to deploy a GC task on
a specific master ECS container.

Change-Id: Ideba708842f191df52a11284e4e12f34f0d14dbe
diff --git a/single-master/cf-cluster.yml b/single-master/cf-cluster.yml
index 356b252..d182d71 100644
--- a/single-master/cf-cluster.yml
+++ b/single-master/cf-cluster.yml
@@ -127,6 +127,7 @@
         Fn::Base64: !Sub |
           #!/bin/bash -xe
           echo ECS_CLUSTER=${ECSCluster} >> /etc/ecs/ecs.config
+          echo ECS_INSTANCE_ATTRIBUTES={\"target_group\":\"master\"} >> /etc/ecs/ecs.config
           # Make sure latest version of the helper scripts are installed as per recommendation:
           # https://github.com/awsdocs/aws-cloudformation-user-guide/blob/master/doc_source/cfn-helper-scripts-reference.md#using-the-latest-version
           yum install -y aws-cfn-bootstrap aws-cli xfsprogs
diff --git a/single-master/cf-service.yml b/single-master/cf-service.yml
index 9cbba11..93d6c87 100644
--- a/single-master/cf-service.yml
+++ b/single-master/cf-service.yml
@@ -212,6 +212,9 @@
             TaskRoleArn: !GetAtt ECSTaskExecutionRoleStack.Outputs.TaskExecutionRoleRef
             ExecutionRoleArn: !GetAtt ECSTaskExecutionRoleStack.Outputs.TaskExecutionRoleRef
             NetworkMode: bridge
+            PlacementConstraints:
+              - Expression: !Sub 'attribute:target_group == master'
+                Type: "memberOf"
             ContainerDefinitions:
                 - Name: !Ref GerritServiceName
                   Essential: true