primary-replica/cf-service-primary.yml [386:488]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        GroupName: !Sub '${ClusterStackName}-P-H'
        SecurityGroupIngress:
          - IpProtocol: 'tcp'
            FromPort: !Ref HTTPSPort
            ToPort: !Ref HTTPSPort
            CidrIp: '0.0.0.0/0'
            Description: "HTTPS connections from everywhere (IPv4)"
          - IpProtocol: 'tcp'
            FromPort: !Ref HTTPSPort
            ToPort: !Ref HTTPSPort
            CidrIpv6: '::/0'
            Description: "HTTPS connections from everywhere (IPv6)"

    GerritHTTPLoadBalancer:
      Type: AWS::ElasticLoadBalancingV2::LoadBalancer
      Properties:
        Name: !Sub '${ClusterStackName}-P-H'
        Type: application
        Scheme: !Ref 'LoadBalancerScheme'
        SecurityGroups:
          - !Ref GerritHTTPLoadBalancerSG
        Subnets:
          - Fn::ImportValue:
              !Join [':', [!Ref 'ClusterStackName', 'PublicSubnetOne']]
          - Fn::ImportValue:
              !Join [':', [!Ref 'ClusterStackName', 'PublicSubnetTwo']]
        Tags:
          - Key: Name
            Value: !Join ['-', [!Ref 'EnvironmentName', !Ref 'GerritServiceName', 'alb']]

    GerritSSHLoadBalancer:
        Type: AWS::ElasticLoadBalancingV2::LoadBalancer
        Properties:
            Name: !Sub '${ClusterStackName}-P-S'
            Type: network
            Scheme: !Ref 'LoadBalancerScheme'
            LoadBalancerAttributes:
              - Key: 'load_balancing.cross_zone.enabled'
                Value: true
            Subnets:
              - Fn::ImportValue:
                  !Join [':', [!Ref 'ClusterStackName', 'PublicSubnetOne']]
              - Fn::ImportValue:
                  !Join [':', [!Ref 'ClusterStackName', 'PublicSubnetTwo']]
            Tags:
                - Key: Name
                  Value: !Join ['-', [!Ref 'EnvironmentName', !Ref 'GerritServiceName', 'nlb']]

    HTTPTargetGroup:
        Type: AWS::ElasticLoadBalancingV2::TargetGroup
        DependsOn: GerritHTTPLoadBalancer
        Properties:
            VpcId:
              Fn::ImportValue:
                  !Join [':', [!Ref 'ClusterStackName', 'VPCId']]
            Port: !Ref HTTPPort
            Protocol: HTTP
            HealthCheckProtocol: HTTP
            HealthCheckPort: !Ref HTTPPort
            HealthCheckPath: '/config/server/healthcheck~status'
            Name: !Sub '${ClusterStackName}-P-H'

    HTTPListener:
        Type: AWS::ElasticLoadBalancingV2::Listener
        Properties:
            Certificates:
              - CertificateArn: !Ref CertificateArn
            DefaultActions:
            - Type: forward
              TargetGroupArn: !Ref HTTPTargetGroup
            LoadBalancerArn: !Ref GerritHTTPLoadBalancer
            Port: !Ref HTTPSPort
            Protocol: HTTPS

    SSHTargetGroup:
        Type: AWS::ElasticLoadBalancingV2::TargetGroup
        DependsOn: GerritSSHLoadBalancer
        Properties:
            VpcId:
              Fn::ImportValue:
                  !Join [':', [!Ref 'ClusterStackName', 'VPCId']]
            Port: !Ref SSHPort
            Protocol: TCP
            HealthCheckProtocol: HTTP
            HealthCheckPort: !Ref HTTPPort
            HealthCheckPath: '/config/server/healthcheck~status'
            Name: !Sub '${ClusterStackName}-P-S'

    SSHListener:
        Type: AWS::ElasticLoadBalancingV2::Listener
        Properties:
            DefaultActions:
            - Type: forward
              TargetGroupArn: !Ref SSHTargetGroup
            LoadBalancerArn: !Ref GerritSSHLoadBalancer
            Port: !Ref SSHPort
            Protocol: TCP

    ECSTaskExecutionRoleStack:
      Type: AWS::CloudFormation::Stack
      Properties:
        TemplateURL: !Join [ '', ['https://', !Ref TemplateBucketName, '.s3.amazonaws.com/cf-gerrit-task-execution-role.yml'] ]
        TimeoutInMinutes: '5'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



single-primary/cf-service.yml [362:465]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        GroupName: !Sub '${ClusterStackName}-P-H'
        SecurityGroupIngress:
          - IpProtocol: 'tcp'
            FromPort: !Ref HTTPSPort
            ToPort: !Ref HTTPSPort
            CidrIp: '0.0.0.0/0'
            Description: "HTTPS connections from everywhere (IPv4)"
          - IpProtocol: 'tcp'
            FromPort: !Ref HTTPSPort
            ToPort: !Ref HTTPSPort
            CidrIpv6: '::/0'
            Description: "HTTPS connections from everywhere (IPv6)"


    GerritHTTPLoadBalancer:
      Type: AWS::ElasticLoadBalancingV2::LoadBalancer
      Properties:
        Name: !Sub '${ClusterStackName}-P-H'
        Type: application
        Scheme: !Ref 'LoadBalancerScheme'
        SecurityGroups:
          - !Ref GerritHTTPLoadBalancerSG
        Subnets:
          - Fn::ImportValue:
              !Join [':', [!Ref 'ClusterStackName', 'PublicSubnetOne']]
          - Fn::ImportValue:
              !Join [':', [!Ref 'ClusterStackName', 'PublicSubnetTwo']]
        Tags:
          - Key: Name
            Value: !Join ['-', [!Ref 'EnvironmentName', !Ref 'GerritServiceName', 'alb']]

    GerritSSHLoadBalancer:
        Type: AWS::ElasticLoadBalancingV2::LoadBalancer
        Properties:
            Name: !Sub '${ClusterStackName}-P-S'
            Type: network
            Scheme: !Ref 'LoadBalancerScheme'
            LoadBalancerAttributes:
              - Key: 'load_balancing.cross_zone.enabled'
                Value: true
            Subnets:
              - Fn::ImportValue:
                  !Join [':', [!Ref 'ClusterStackName', 'PublicSubnetOne']]
              - Fn::ImportValue:
                  !Join [':', [!Ref 'ClusterStackName', 'PublicSubnetTwo']]
            Tags:
                - Key: Name
                  Value: !Join ['-', [!Ref 'EnvironmentName', !Ref 'GerritServiceName', 'nlb']]

    HTTPTargetGroup:
        Type: AWS::ElasticLoadBalancingV2::TargetGroup
        DependsOn: GerritHTTPLoadBalancer
        Properties:
            VpcId:
              Fn::ImportValue:
                !Join [':', [!Ref 'ClusterStackName', 'VPCId']]
            Port: !Ref HTTPPort
            Protocol: HTTP
            HealthCheckProtocol: HTTP
            HealthCheckPort: !Ref HTTPPort
            HealthCheckPath: '/config/server/healthcheck~status'
            Name: !Sub '${ClusterStackName}-P-H'

    HTTPListener:
        Type: AWS::ElasticLoadBalancingV2::Listener
        Properties:
            Certificates:
              - CertificateArn: !Ref CertificateArn
            DefaultActions:
            - Type: forward
              TargetGroupArn: !Ref HTTPTargetGroup
            LoadBalancerArn: !Ref GerritHTTPLoadBalancer
            Port: !Ref HTTPSPort
            Protocol: HTTPS

    SSHTargetGroup:
        Type: AWS::ElasticLoadBalancingV2::TargetGroup
        DependsOn: GerritSSHLoadBalancer
        Properties:
            VpcId:
              Fn::ImportValue:
                  !Join [':', [!Ref 'ClusterStackName', 'VPCId']]
            Port: !Ref SSHPort
            Protocol: TCP
            HealthCheckProtocol: HTTP
            HealthCheckPort: !Ref HTTPPort
            HealthCheckPath: '/config/server/healthcheck~status'
            Name: !Sub '${ClusterStackName}-P-S'

    SSHListener:
        Type: AWS::ElasticLoadBalancingV2::Listener
        Properties:
            DefaultActions:
            - Type: forward
              TargetGroupArn: !Ref SSHTargetGroup
            LoadBalancerArn: !Ref GerritSSHLoadBalancer
            Port: !Ref SSHPort
            Protocol: TCP

    ECSTaskExecutionRoleStack:
      Type: AWS::CloudFormation::Stack
      Properties:
        TemplateURL: !Join [ '', ['https://', !Ref TemplateBucketName, '.s3.amazonaws.com/cf-gerrit-task-execution-role.yml'] ]
        TimeoutInMinutes: '5'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



