#!/bin/bash
export PROJECT_ID={{gcp_project_id}}

gcloud config set project $PROJECT_ID

# NOTE: we pipe yes to this command, as users who have not enabled the TPU API
# can hit this call and get stuck forever in:
#  API [tpu.googleapis.com] not enabled on project [123456]. Would you like to enable and retry (this will take a few minutes)? (y/N)?
yes | gcloud compute tpus create {{tpu_name}} \
--zone={{zones}} \
--version={{runtime_version}} \
--accelerator-type={{tpu_type}} \
--network={{vpc_name}}
