Skip to content
This repository was archived by the owner on Nov 2, 2024. It is now read-only.

Commit af0d2cf

Browse files
committed
chore: dirty patch
due to broken --uri in commands: * gcloud storage bucket list * gcloud storage objects list the solution has to be changed to use "name" field for validation instead of gs:// URI
1 parent 856006f commit af0d2cf

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

provisioning/sandboxctl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,8 @@ local_iam_user() {
417417
prepare_terraform_state() {
418418
TF_BUCKET_NAME="${PROJECT_ID}-cloud-ops-sandbox-tf-state"
419419
local URIS
420-
URIS=$(gcloud storage buckets list "gs://${TF_BUCKET_NAME}*" --format="value(storage_url)" --project "${PROJECT_ID}")
421-
if [[ -z "${URIS}" ]]; then
420+
NAMES=$(gcloud storage buckets list "gs://${TF_BUCKET_NAME}*" --format="value(name)" --project "${PROJECT_ID}")
421+
if [[ -z "${NAMES}" ]]; then
422422
info "Creating storage bucket to host Cloud Ops Sandbox state..."
423423
retry 3 gcloud storage buckets create "gs://${TF_BUCKET_NAME}" --project "${PROJECT_ID}"
424424
fi
@@ -429,6 +429,7 @@ prepare_terraform_state() {
429429
fi
430430
}
431431

432+
does_
432433
does_terraform_state_exist() {
433434
TF_BUCKET_NAME="${PROJECT_ID}-cloud-ops-sandbox-tf-state"
434435
local STATE_OBJ_URI
@@ -438,8 +439,8 @@ does_terraform_state_exist() {
438439
STATE_OBJ_URI="gs://${TF_BUCKET_NAME}/${TERRAFORM_PREFIX}/default.tfstate"
439440
fi
440441
local URIS
441-
URIS=$(gcloud storage objects list "${STATE_OBJ_URI}" --format="value(storage_url)" --project "${PROJECT_ID}")
442-
if [[ -z "${URIS}" ]]; then
442+
NAMES=$(gcloud storage objects list "${STATE_OBJ_URI}" --format="value(name)" --project "${PROJECT_ID}")
443+
if [[ -z "${NAMES}" ]]; then
443444
false
444445
return
445446
fi

0 commit comments

Comments
 (0)