I am looking to enable an API in all of my projects, but only create the BigQuery dataset in one project. I've tried different ways, but the dataset is being created in every project. Any suggestions on how to combine these two into one bash script so that the API is enabled in all projects, but the dataset is only created in one project?
#!/bin/bash
for project in $(gcloud projects list --format="value(projectId)")
do
echo "ProjectId: $project"
gcloud config set project $project
gcloud services enable compute.googleapis.com --project $project
bq mk testdataset <insert projectid>
done