Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update firebase_database_instance docs and samples for region #5088

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/7106.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none
Updates description for firebase_database_instance.region
```
9 changes: 5 additions & 4 deletions google-beta/resource_firebase_database_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,11 @@ func resourceFirebaseDatabaseInstance() *schema.Resource {
Instance IDs cannot be reused after deletion.`,
},
"region": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: `A reference to the region where the Firebase Realtime database resides.`,
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: `A reference to the region where the Firebase Realtime database resides.
Check all [available regions](https://firebase.google.com/docs/projects/locations#rtdb-locations)`,
},
"type": {
Type: schema.TypeString,
Expand Down
28 changes: 13 additions & 15 deletions google-beta/resource_firebase_database_instance_generated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
)

func TestAccFirebaseDatabaseInstance_firebaseDatabaseInstanceExample(t *testing.T) {
func TestAccFirebaseDatabaseInstance_firebaseDatabaseInstanceBasicExample(t *testing.T) {
t.Parallel()

context := map[string]interface{}{
"project_id": getTestProjectFromEnv(),
"region": getTestRegionFromEnv(),
"random_suffix": randString(t, 10),
}

Expand All @@ -38,7 +37,7 @@ func TestAccFirebaseDatabaseInstance_firebaseDatabaseInstanceExample(t *testing.
CheckDestroy: testAccCheckFirebaseDatabaseInstanceDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccFirebaseDatabaseInstance_firebaseDatabaseInstanceExample(context),
Config: testAccFirebaseDatabaseInstance_firebaseDatabaseInstanceBasicExample(context),
},
{
ResourceName: "google_firebase_database_instance.basic",
Expand All @@ -50,23 +49,22 @@ func TestAccFirebaseDatabaseInstance_firebaseDatabaseInstanceExample(t *testing.
})
}

func testAccFirebaseDatabaseInstance_firebaseDatabaseInstanceExample(context map[string]interface{}) string {
func testAccFirebaseDatabaseInstance_firebaseDatabaseInstanceBasicExample(context map[string]interface{}) string {
return Nprintf(`
resource "google_firebase_database_instance" "basic" {
provider = google-beta
project = "%{project_id}"
region = "%{region}"
region = "us-central1"
instance_id = "tf-test-active-db%{random_suffix}"
}
`, context)
}

func TestAccFirebaseDatabaseInstance_firebaseDatabaseInstanceDisabledExample(t *testing.T) {
func TestAccFirebaseDatabaseInstance_firebaseDatabaseInstanceFullExample(t *testing.T) {
t.Parallel()

context := map[string]interface{}{
"project_id": getTestProjectFromEnv(),
"region": getTestRegionFromEnv(),
"random_suffix": randString(t, 10),
}

Expand All @@ -76,7 +74,7 @@ func TestAccFirebaseDatabaseInstance_firebaseDatabaseInstanceDisabledExample(t *
CheckDestroy: testAccCheckFirebaseDatabaseInstanceDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccFirebaseDatabaseInstance_firebaseDatabaseInstanceDisabledExample(context),
Config: testAccFirebaseDatabaseInstance_firebaseDatabaseInstanceFullExample(context),
},
{
ResourceName: "google_firebase_database_instance.full",
Expand All @@ -88,25 +86,24 @@ func TestAccFirebaseDatabaseInstance_firebaseDatabaseInstanceDisabledExample(t *
})
}

func testAccFirebaseDatabaseInstance_firebaseDatabaseInstanceDisabledExample(context map[string]interface{}) string {
func testAccFirebaseDatabaseInstance_firebaseDatabaseInstanceFullExample(context map[string]interface{}) string {
return Nprintf(`
resource "google_firebase_database_instance" "full" {
provider = google-beta
project = "%{project_id}"
region = "%{region}"
region = "europe-west1"
instance_id = "tf-test-disabled-db%{random_suffix}"
type = "USER_DATABASE"
desired_state = "DISABLED"
}
`, context)
}

func TestAccFirebaseDatabaseInstance_firebaseDatabaseInstanceDefaultExample(t *testing.T) {
func TestAccFirebaseDatabaseInstance_firebaseDatabaseInstanceDefaultDatabaseExample(t *testing.T) {
t.Parallel()

context := map[string]interface{}{
"org_id": getTestOrgFromEnv(t),
"region": getTestRegionFromEnv(),
"random_suffix": randString(t, 10),
}

Expand All @@ -116,7 +113,7 @@ func TestAccFirebaseDatabaseInstance_firebaseDatabaseInstanceDefaultExample(t *t
CheckDestroy: testAccCheckFirebaseDatabaseInstanceDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccFirebaseDatabaseInstance_firebaseDatabaseInstanceDefaultExample(context),
Config: testAccFirebaseDatabaseInstance_firebaseDatabaseInstanceDefaultDatabaseExample(context),
},
{
ResourceName: "google_firebase_database_instance.default",
Expand All @@ -128,7 +125,7 @@ func TestAccFirebaseDatabaseInstance_firebaseDatabaseInstanceDefaultExample(t *t
})
}

func testAccFirebaseDatabaseInstance_firebaseDatabaseInstanceDefaultExample(context map[string]interface{}) string {
func testAccFirebaseDatabaseInstance_firebaseDatabaseInstanceDefaultDatabaseExample(context map[string]interface{}) string {
return Nprintf(`
resource "google_project" "default" {
provider = google-beta
Expand All @@ -154,9 +151,10 @@ resource "google_project_service" "firebase_database" {
resource "google_firebase_database_instance" "default" {
provider = google-beta
project = google_firebase_project.default.project
region = "%{region}"
region = "us-central1"
instance_id = "tf-test-rtdb-project%{random_suffix}-default-rtdb"
type = "DEFAULT_DATABASE"
depends_on = [google_project_service.firebase_database]
}
`, context)
}
Expand Down
14 changes: 8 additions & 6 deletions website/docs/r/firebase_database_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,31 @@ To get more information about Instance, see:
* How-to Guides
* [Official Documentation](https://firebase.google.com/products/realtime-database)

## Example Usage - Firebase Database Instance
## Example Usage - Firebase Database Instance Basic


```hcl
resource "google_firebase_database_instance" "basic" {
provider = google-beta
project = "my-project-name"
region = "us-west1"
region = "us-central1"
instance_id = "active-db"
}
```
## Example Usage - Firebase Database Instance Disabled
## Example Usage - Firebase Database Instance Full


```hcl
resource "google_firebase_database_instance" "full" {
provider = google-beta
project = "my-project-name"
region = "us-west1"
region = "europe-west1"
instance_id = "disabled-db"
type = "USER_DATABASE"
desired_state = "DISABLED"
}
```
## Example Usage - Firebase Database Instance Default
## Example Usage - Firebase Database Instance Default Database


```hcl
Expand Down Expand Up @@ -83,9 +83,10 @@ resource "google_project_service" "firebase_database" {
resource "google_firebase_database_instance" "default" {
provider = google-beta
project = google_firebase_project.default.project
region = "us-west1"
region = "us-central1"
instance_id = "rtdb-project-default-rtdb"
type = "DEFAULT_DATABASE"
depends_on = [google_project_service.firebase_database]
}
```

Expand All @@ -97,6 +98,7 @@ The following arguments are supported:
* `region` -
(Required)
A reference to the region where the Firebase Realtime database resides.
Check all [available regions](https://firebase.google.com/docs/projects/locations#rtdb-locations)

* `instance_id` -
(Required)
Expand Down