Skip to content

Commit

Permalink
refactor: add init_firestore toggle (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerthatdev authored Jul 26, 2023
1 parent 9ecf36a commit 00e7256
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions infra/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
2 changes: 1 addition & 1 deletion infra/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions infra/metadata.display.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions infra/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions infra/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 00e7256

Please sign in to comment.