Search code examples
firebasegoogle-cloud-platformterraformgcloudfirebase-cli

Can I create and configure a GCP project + Firebase completely from the CLI or a script?


I am using gcloud + firebase cli to explore a reproducible way to create and configure a GCP + Firebase project.

I have created the GCP project using gcloud cli tool. I have then used firebase cli to run the command firebase init firestore.

Ulimately it ended up outputting...

Error: It looks like you haven't used Cloud Firestore in this project before. Go to https://console.firebase.google.com/project/my-project/firestore to create your Cloud Firestore database.

Is there a way I can "create my firestore database" using a cli tool or scripting api, instead of having to navigate to a web GUI tool and manually execute steps?


Solution

  • Unless Firebase do more behind the scenes, creating a Firestore instance could be as simple as this command from the GCloud CLI reference:

    gcloud firestore databases create --region=us-central --project=my-project
    

    The documentation for the entire create-provision cycle (from GCP's perspective) is here - including Terraform details (some commands may have been released since the docs were written).