diff --git a/infra/README.md b/infra/README.md index 3feacc892..bfe72a717 100644 --- a/infra/README.md +++ b/infra/README.md @@ -47,6 +47,7 @@ Functional examples are included in the |------|-------------|------|---------|:--------:| | deployment\_name | Identifier for the deployment. Used in some resource names. | `string` | `"dev-journey"` | no | | enable\_apis | Whether or not to enable underlying apis in this solution. | `bool` | `true` | no | +| init\_firestore | Whether or not to initialize a Firestore instance. | `bool` | `true` | no | | initial\_run\_image | Initial image to deploy to Cloud Run service. | `string` | `"gcr.io/hsa-public/developer-journey/app"` | no | | labels | A set of key/value label pairs to assign to the resources deployed by this solution. | `map(string)` | `{}` | no | | project\_id | The project ID to deploy resources to. | `string` | n/a | yes | diff --git a/infra/main.tf b/infra/main.tf index 87eeb04d0..d509979d3 100644 --- a/infra/main.tf +++ b/infra/main.tf @@ -311,7 +311,7 @@ data "google_cloud_asset_resources_search_all" "firestore_database" { # If a Firestore database exists on the project, Terraform will skip this resource resource "google_firestore_database" "database" { - count = local.firestore_enabled ? 0 : 1 + count = var.init_firestore && !local.firestore_enabled ? 1 : 0 project = var.project_id name = "(default)" location_id = "nam5" diff --git a/infra/metadata.display.yaml b/infra/metadata.display.yaml index 6ded1ca3e..bb092135b 100644 --- a/infra/metadata.display.yaml +++ b/infra/metadata.display.yaml @@ -34,6 +34,9 @@ spec: enable_apis: name: enable_apis title: Enable Apis + init_firestore: + name: init_firestore + title: Init Firestore initial_run_image: name: initial_run_image title: Initial Run Image diff --git a/infra/metadata.yaml b/infra/metadata.yaml index 3d90ef3e9..bba188a9d 100644 --- a/infra/metadata.yaml +++ b/infra/metadata.yaml @@ -47,6 +47,10 @@ spec: description: Whether or not to enable underlying apis in this solution. varType: bool defaultValue: true + - name: init_firestore + description: Whether or not to initialize a Firestore instance. + varType: bool + defaultValue: true - name: initial_run_image description: Initial image to deploy to Cloud Run service. varType: string diff --git a/infra/variables.tf b/infra/variables.tf index 15a7ac068..46e66d656 100644 --- a/infra/variables.tf +++ b/infra/variables.tf @@ -48,3 +48,9 @@ variable "region" { default = "us-central1" description = "Google Cloud region" } + +variable "init_firestore" { + type = bool + description = "Whether or not to initialize a Firestore instance." + default = true +}