Skip to content
This repository has been archived by the owner on Feb 11, 2020. It is now read-only.

Commit

Permalink
Fix gcp create-initial-terraform-state vars
Browse files Browse the repository at this point in the history
  • Loading branch information
Kris Hicks committed Jun 27, 2017
1 parent 9bff79e commit f2e6b56
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions install-pcf/gcp/tasks/create-initial-terraform-state/task.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@

set -eu

echo $GOOGLE_CREDENTIALS > gcloud.key
echo $GCP_SERVICE_ACCOUNT_KEY > gcloud.key
gcloud auth activate-service-account --key-file=gcloud.key

files=$(gsutil ls "gs://${GCP_SERVICE_ACCOUNT_KEY}")
files=$(gsutil ls "gs://${TERRAFORM_STATEFILE_BUCKET}")

if [ $(echo $files | grep -c terraform.tfstate) == 0 ]; then
echo "{\"version\": 3}" > terraform.tfstate
gsutil cp terraform.tfstate "gs://${GCP_SERVICE_ACCOUNT_KEY}/terraform.tfstate"
gsutil cp terraform.tfstate "gs://${TERRAFORM_STATEFILE_BUCKET}/terraform.tfstate"
else
echo "terraform.tfstate file found, skipping"
exit 0
Expand Down

0 comments on commit f2e6b56

Please sign in to comment.