-
Notifications
You must be signed in to change notification settings - Fork 64
/
ci_smoke_test.sh
46 lines (40 loc) · 1.81 KB
/
ci_smoke_test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
# Required environment variables:
# GOOGLE_APPLICATION_CREDENTIALS=the path to your service account credentials file - or - GCP_CREDENTIALS: your service account json string
# GCP_PROJECT=the name of your project e.g. development-12345
# TERRAFORM_PATH=the path to your terraform binary; will default to "terraform"
set -euxo pipefail
ssh-keygen -f id_rsa -t rsa -N ''
chmod 600 id_rsa
# Download the terraform binary in the current directory
wget https://releases.hashicorp.com/terraform/0.11.14/terraform_0.11.14_linux_amd64.zip
unzip ./terraform*.zip
chmod +x terraform
rm ./terraform*.zip
if [[ ! -v TERRAFORM_PATH ]]
then
TERRAFORM_PATH="terraform"
fi
cd gcp
if [[ ! -v GOOGLE_APPLICATION_CREDENTIALS ]]
then
echo "$GCP_CREDENTIALS" > creds.json
export GOOGLE_APPLICATION_CREDENTIALS=${PWD}/creds.json
fi
${TERRAFORM_PATH} init
${TERRAFORM_PATH} validate -var "gcp_project=${GCP_PROJECT}" -var "gcp_ssh_pub_key_file=${PWD}/../id_rsa.pub"
${TERRAFORM_PATH} plan -var "gcp_project=${GCP_PROJECT}" -var "gcp_ssh_pub_key_file=${PWD}/../id_rsa.pub"
${TERRAFORM_PATH} validate -var-file desired_cluster_profile.tfvars.example -var "gcp_project=${GCP_PROJECT}" -var "gcp_ssh_pub_key_file=${PWD}/../id_rsa.pub"
${TERRAFORM_PATH} plan -var-file desired_cluster_profile.tfvars.example -var "gcp_project=${GCP_PROJECT}" -var "gcp_ssh_pub_key_file=${PWD}/../id_rsa.pub"
cd ../aws
${TERRAFORM_PATH} init
${TERRAFORM_PATH} validate
${TERRAFORM_PATH} plan
${TERRAFORM_PATH} validate -var-file desired_cluster_profile.tfvars.example
${TERRAFORM_PATH} plan -var-file desired_cluster_profile.tfvars.example
cd ../azure
${TERRAFORM_PATH} init
${TERRAFORM_PATH} validate
${TERRAFORM_PATH} plan
${TERRAFORM_PATH} validate -var-file desired_cluster_profile.tfvars.example
${TERRAFORM_PATH} plan -var-file desired_cluster_profile.tfvars.example