github.com/verrazzano/verrazzano@v1.7.1/tests/e2e/config/scripts/terraform/cluster/init.sh (about)

     1  #!/bin/bash
     2  #
     3  # Copyright (c) 2020, 2021, Oracle and/or its affiliates.
     4  # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
     5  #
     6  
     7  SCRIPT_DIR=$(cd $(dirname "$0"); pwd -P)
     8  
     9  for REQUIRED_ENV_VAR in $(cat ${SCRIPT_DIR}/required-env-vars); do
    10    if [ -z "${!REQUIRED_ENV_VAR}" ] ; then
    11      echo "${REQUIRED_ENV_VAR} not set"
    12      exit 1
    13    fi
    14  done
    15  
    16  #download terraform
    17  if [ ! -f $SCRIPT_DIR/terraform ];
    18  then
    19    curl https://releases.hashicorp.com/terraform/0.14.10/terraform_0.14.10_$(uname -s | tr '[:upper:]' '[:lower:]')_amd64.zip -o $SCRIPT_DIR/terraform_0.14.10.zip
    20    unzip $SCRIPT_DIR/terraform_0.14.10.zip -d $SCRIPT_DIR/
    21    rm $SCRIPT_DIR/terraform_0.14.10.zip
    22  fi
    23  
    24  if [ ! -f $SCRIPT_DIR/terraform ];
    25  then
    26    echo "terraform is required and can not be found."
    27    exit 1
    28  fi
    29  
    30  set -e