diff options
-rwxr-xr-x | ops/tf-gcs-init/tf-gcs-init.sh | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ops/tf-gcs-init/tf-gcs-init.sh b/ops/tf-gcs-init/tf-gcs-init.sh index 3a8f2b3..95d4d7e 100755 --- a/ops/tf-gcs-init/tf-gcs-init.sh +++ b/ops/tf-gcs-init/tf-gcs-init.sh @@ -26,7 +26,7 @@ GCP_SERVICE_ACCOUNT_ROLES=( ) function bucket:exist() { - if gsutil ls gs://${1} &>/dev/null; then + if gsutil ls gs://"${1}" &>/dev/null; then true else false @@ -67,11 +67,11 @@ function service_account() { } function service_account:has_role() { - [[ $(gcloud projects get-iam-policy ${1} --flatten=bindings --filter="bindings.members=serviceAccount:${2} AND bindings.role=$3" 2>/dev/null | wc -l) -ne 0 ]] + [[ $(gcloud projects get-iam-policy "${1}" --flatten=bindings --filter="bindings.members=serviceAccount:${2} AND bindings.role=$3" 2>/dev/null | wc -l) -ne 0 ]] } function service_account:admins_token_creator() { - [[ $(gcloud --project=${1} iam service-accounts get-iam-policy ${GCP_SERVICE_ACCOUNT} --flatten=bindings --filter="bindings.members=user:${GCP_ADMIN_ACCOUNT} AND bindings.role=roles/iam.serviceAccountTokenCreator" 2>/dev/null | wc -l) -ne 0 ]] + [[ $(gcloud --project="${1}" iam service-accounts get-iam-policy ${GCP_SERVICE_ACCOUNT} --flatten=bindings --filter="bindings.members=user:${GCP_ADMIN_ACCOUNT} AND bindings.role=roles/iam.serviceAccountTokenCreator" 2>/dev/null | wc -l) -ne 0 ]] } function roles() { |