From eff4480c15f986e253e8be557ea1495c9deeaf93 Mon Sep 17 00:00:00 2001 From: jdamick Date: Mon, 5 Dec 2016 11:41:49 -0500 Subject: [PATCH] added proxy & public ip param (#11) --- resources/bluegreen/blue.yaml | 16 +++++++++++++--- resources/bluegreen/stack_blue.yaml | 4 ++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/resources/bluegreen/blue.yaml b/resources/bluegreen/blue.yaml index ed5ed10..ab5cfca 100644 --- a/resources/bluegreen/blue.yaml +++ b/resources/bluegreen/blue.yaml @@ -41,6 +41,9 @@ Parameters: LBSubnets: Description: The subnets that the load balancer will cover Type: List + Proxy: + Type: String + Default: "" OwnerContact: Default: opensourceoffice@capitalone.com Description: Email of owner @@ -48,6 +51,9 @@ Parameters: VPCId: Description: The VPC for app to run in. Type: AWS::EC2::VPC::Id + GivePublicIP: + Default: "true" + Type: String Resources: AsgBlue: Type: AWS::AutoScaling::AutoScalingGroup @@ -66,7 +72,7 @@ Resources: LcBlue: Type: AWS::AutoScaling::LaunchConfiguration Properties: - AssociatePublicIpAddress: true + AssociatePublicIpAddress: !Ref GivePublicIP IamInstanceProfile: !Ref InstanceProfileARN ImageId: !Ref AMI InstanceMonitoring: true @@ -81,7 +87,7 @@ Resources: echo 'Blue' > /usr/share/nginx/html/index.html apt-get install -y python python-setuptools cd /opt - if [ -a /opt/aws/aws-cfn-bootstrap ]; then + if [ ! -d /opt/aws/bin ] && [ -d /opt/aws/aws-cfn-bootstrap ]; then ln -sf /opt/aws/aws-cfn-bootstrap/bin /opt/aws/bin else curl https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz -O @@ -90,7 +96,11 @@ Resources: easy_install -s /opt/aws/bin aws-cfn-bootstrap-latest.tar.gz ln -fs /opt/aws/init/ubuntu/cfn-hup /etc/init.d/cfn-hup fi - /opt/aws/bin/cfn-signal --exit-code $? --region ${AWS::Region} '${WaitHandleBlue}' + PROXY="" + if [ "${Proxy}" != "" ]; then + PROXY="--https-proxy=${Proxy}" + fi + /opt/aws/bin/cfn-signal --exit-code $? $PROXY --region ${AWS::Region} '${WaitHandleBlue}' LoadBalancer: Properties: CrossZone: true diff --git a/resources/bluegreen/stack_blue.yaml b/resources/bluegreen/stack_blue.yaml index 3e2ca71..f7f5e82 100644 --- a/resources/bluegreen/stack_blue.yaml +++ b/resources/bluegreen/stack_blue.yaml @@ -27,8 +27,12 @@ stacks: LBSecurityGroups: '{{env.LBSecurityGroups}}' Environment: dev AMI: '{{env.AMI}}' + Proxy: '{{env.PROXY}}' + GivePublicIP: '{{env.GivePublicIP}}' + OwnerContact: '{{env.OwnerContact}}' tags: <<: *common_tags + <<: *common_parameters Environment: dev bluegreen: # bluegreen example using the same stack as above vars: