Search code examples
deploymentgoogle-cloud-platformgoogle-cloud-sdk

Google Cloud Platform - Specifying Project Name


I am trying to follow Google's instructions on deploying a Cloud Function from the command line. I cloned their sample project, but when I used gcloud functions deploy to deploy it, it complained that it failed to find attribute [project]. I had to provide that manually.

Where in their docs to they talk about setting the project attribute? I must've missed it, and it seems pretty important ...


Solution

  • When you install the Google Cloud SDK (which provides the gcloud command), you have the opportunity to create one or more configurations (including the default). Think of these as "profiles" for your interaction with GCP. A configuration includes:

    • Your identity
    • Your default project
    • Your default region/zone

    See the following article:

    It sounds like you either didn't run gcloud init or didn't identify a project you wanted to use when you did run it. When you subsequently run gcloud commands and don't specify a project, then the current configuration project will be used. If you didn't set one, then that would explain the error encountered.