Google Firebase Project Location

This page shows how to write Terraform for Firebase Project Location and write them securely.

google_firebase_project_location (Terraform)

The Project Location in Firebase can be configured in Terraform with the resource name google_firebase_project_location. The following sections describe 4 examples of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L1
resource "google_firebase_project_location" "project_location" {
  depends_on  = [var.depends]
  count       = length(var.project_location)
  location_id = lookup(var.project_location[count.index], "location_id")
  project     = element(var.firebase_project, lookup(var.project_location[count.index], "project_id"))
  provider    = "google-beta"
firebase.tf#L6
resource "google_firebase_project_location" "basic" {
  provider = google-beta.owner
  project = google_firebase_project.default.project

  location_id = "europe-west"
}
project.tf#L31
resource "google_firebase_project_location" "basic" {
  provider    = google-beta
  project     = google_firebase_project.default.project
  location_id = var.location_id
}

main.tf#L57
resource "google_firebase_project_location" "hosting" {
  provider    = google-beta
  project     = google_firebase_project.hosting.project
  location_id = var.firebase_location_id
}

Review your Terraform file for Google best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

The following arguments are supported:

  • location_id - (Required) The ID of the default GCP resource location for the Project. The location must be one of the available GCP resource locations.

  • project - (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

In addition to the arguments listed above, the following computed attributes are exported:

  • id - an identifier for the resource with format projects/[[project]]

Explanation in Terraform Registry

Sets the default Google Cloud Platform (GCP) resource location for the specified FirebaseProject. This method creates an App Engine application with a default Cloud Storage bucket, located in the specified locationId. This location must be one of the available GCP resource locations. After the default GCP resource location is finalized, or if it was already set, it cannot be changed. The default GCP resource location for the specified FirebaseProject might already be set because either the GCP Project already has an App Engine application or defaultLocation.finalize was previously called with a specified locationId. Any new calls to defaultLocation.finalize with a different specified locationId will return a 409 error.

Warning: This resource is in beta, and should be used with the terraform-provider-google-beta provider. See Provider Versions for more details on beta resources. To get more information about ProjectLocation, see:

Frequently asked questions

What is Google Firebase Project Location?

Google Firebase Project Location is a resource for Firebase of Google Cloud Platform. Settings can be wrote in Terraform.

Where can I find the example code for the Google Firebase Project Location?

For Terraform, the mikamakusa/terraform, petomalina/cloudevents and varun-4410/Covid19-App source code examples are useful. See the Terraform Example section for further details.

security-icon

Automate config file reviews on your commits

Fix issues in your infrastructure as code with auto-generated patches.