github.com/jasonkeene/cli@v6.14.1-0.20160816203908-ca5715166dfb+incompatible/ci/infrastructure/tasks/destroy-cf-lite.yml (about)

     1  ---
     2  platform: linux
     3  
     4  image: docker:///cloudfoundry/cli-ci
     5  
     6  params:
     7    AWS_ACCESS_KEY_ID:
     8    AWS_SECRET_ACCESS_KEY:
     9    AWS_REGION:
    10    LITE_INSTANCE_NAME:
    11  
    12  run:
    13    path: bash
    14    args:
    15    - -c
    16    - |
    17      set -ex
    18  
    19      export AWS_DEFAULT_REGION="${AWS_REGION}"
    20  
    21      INSTANCE_IDS="$(aws ec2 describe-instances \
    22        --region "${AWS_REGION}" \
    23        --filters "Name=tag:Name,Values=${LITE_INSTANCE_NAME}" | \
    24        jq -r ".Reservations | map(.Instances[0]) | \
    25          map(.InstanceId) | join(\" \")")"
    26  
    27      if [[ ! -z $INSTANCE_IDS ]]; then
    28        aws ec2 terminate-instances \
    29          --region "${AWS_REGION}" \
    30          --instance-ids ${INSTANCE_IDS}
    31        sleep 60
    32      fi