diff --git a/builder/googlecompute/startup.go b/builder/googlecompute/startup.go index a94c91141..687afec98 100644 --- a/builder/googlecompute/startup.go +++ b/builder/googlecompute/startup.go @@ -21,7 +21,7 @@ GetMetadata () { echo "$(curl -f -H "Metadata-Flavor: Google" ${BASEMETADATAURL}/${1} 2> /dev/null)" } -ZONE=$(GetMetadata zone | grep -oP "[^/]*$") +ZONE=$(basename $(GetMetadata zone)) SetMetadata () { gcloud compute instances add-metadata ${HOSTNAME} --metadata ${1}=${2} --zone ${ZONE}