vmware-archive / terraforming-gcp

use terraform, deploy yourself a pcf
Apache License 2.0
71 stars 86 forks source link

Add pks output for director blobstore service account key #118

Closed JaysonBH closed 5 years ago

JaysonBH commented 5 years ago

This PR adds the terraform output for the director's blobstore service account key, under the terraforming-pks directory.

The service account key is already created under the modules/infra/output terraform.

This PR will just Expose it to terraforming pks with the below when the opsman_storage_bucket_count = 1 variable has been added to the terraform.tfvars file:

terraform output director_blobstore_service_account_key

and the below to get the one line string variation for Automation

terraform output director_blobstore_service_account_key | jq 'tostring'

Usage:

export DIR_SERVICE_ACCOUNT_KEY=`terraform output director_blobstore_service_account_key | jq 'tostring'`
export DIR_GCS_BUCKET=`terraform output director_blobstore_bucket`
export BLOBSTORE_JSON="blobstore_config.json"

cat > $BLOBSTORE_JSON <<EOL
{
  "blobstore_type": "gcs",
  "gcs_blobstore_options": {
      "bucket_name": "${DIR_GCS_BUCKET}",
      "storage_class": "MULTI_REGIONAL",
      "service_account_key": ${DIR_SERVICE_ACCOUNT_KEY}
  }
}
EOL

om configure-director --director-configuration "$(cat $BLOBSTORE_JSON)"

This was also tested to display as blank when the optional opsman_storage_bucket_count = 1 variable has been Not been added to the terraform.tfvars file.