github.com/m3db/m3@v1.5.0/scripts/vagrant/shared/stop_vagrant.sh (about)

     1  #!/bin/bash
     2  
     3  set -xe
     4  
     5  export BOX="ubuntu/xenial64"
     6  PROVIDER=${PROVIDER:-virtualbox}
     7  
     8  if [[ "$PROVIDER" != "virtualbox" ]]; then
     9      if [[ "$USER" == "" ]]; then
    10          echo "USER env var not set"
    11          exit 1
    12      fi
    13      if [[ "$SSH_KEY" == "" ]]; then
    14          echo "SSH_KEY env var not set"
    15          exit 1
    16      fi
    17  fi
    18  
    19  if [[ "$PROVIDER" == "google" ]]; then
    20      export BOX="google/gce"
    21  
    22      if [[ "$GOOGLE_PROJECT_ID" == "" ]]; then
    23          echo "GOOGLE_PROJECT_ID env var not set"
    24          exit 1
    25      fi
    26      if [[ "$GOOGLE_JSON_KEY_LOCATION" == "" ]]; then
    27          echo "GOOGLE_JSON_KEY_LOCATION env var not set"
    28          exit 1
    29      fi
    30  fi
    31  
    32  if [[ "$PROVIDER" == "azure" ]]; then
    33      export BOX="azure"
    34  
    35      if [[ "$AZURE_TENANT_ID" == "" ]]; then
    36          echo "AZURE_TENANT_ID env var not set"
    37          exit 1
    38      fi
    39      if [[ "$AZURE_CLIENT_ID" == "" ]]; then
    40          echo "AZURE_CLIENT_ID env var not set"
    41          exit 1
    42      fi
    43      if [[ "$AZURE_CLIENT_SECRET" == "" ]]; then
    44          echo "AZURE_CLIENT_SECRET env var not set"
    45          exit 1
    46      fi
    47      if [[ "$AZURE_SUBSCRIPTION_ID" == "" ]]; then
    48          echo "AZURE_SUBSCRIPTION_ID env var not set"
    49          exit 1
    50      fi
    51  fi
    52  
    53  # Destroy boxes
    54  echo "Terminate boxes"
    55  vagrant destroy --parallel primary secondary benchmarker