Skip to content

Commit

Permalink
Add some wait time for IAM propagation before Firebase Realtime Datab…
Browse files Browse the repository at this point in the history
…ase is ready to be created. (GoogleCloudPlatform#12526)
  • Loading branch information
rainshen49 authored and amanMahendroo committed Dec 17, 2024
1 parent 4d2a070 commit 7dc3058
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 2 additions & 0 deletions mmv1/products/firebasedatabase/Instance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ examples:
- name: 'firebase_database_instance_default_database'
primary_resource_id: 'default'
min_version: 'beta'
# Wait for IAM propagation
external_providers: ["time"]
vars:
project_id: 'rtdb-project'
test_env_vars:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,32 @@ resource "google_project" "default" {
}
}

resource "google_project_service" "firebase" {
provider = google-beta
project = google_project.default.project_id
service = "firebase.googleapis.com"

disable_on_destroy = false
}

resource "google_firebase_project" "default" {
provider = google-beta
project = google_project.default.project_id

depends_on = [google_project_service.firebase]
}

resource "google_project_service" "firebase_database" {
provider = google-beta
project = google_firebase_project.default.project
service = "firebasedatabase.googleapis.com"

disable_on_destroy = false
}

resource "time_sleep" "wait_60_seconds" {
create_duration = "60s"
depends_on = [google_project_service.firebase_database]
}

resource "google_firebase_database_instance" "default" {
Expand All @@ -26,5 +43,5 @@ resource "google_firebase_database_instance" "default" {
region = "us-central1"
instance_id = "{{index $.Vars "project_id"}}-default-rtdb"
type = "DEFAULT_DATABASE"
depends_on = [google_project_service.firebase_database]
depends_on = [time_sleep.wait_60_seconds]
}

0 comments on commit 7dc3058

Please sign in to comment.