Skip to content

Commit

Permalink
Address comments and test issues
Browse files Browse the repository at this point in the history
  • Loading branch information
lisajian committed Feb 3, 2025
1 parent f93a834 commit 68a68d6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 47 deletions.
12 changes: 8 additions & 4 deletions mmv1/products/firebasedataconnect/Service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@ create_url: projects/{{project}}/locations/{{location}}/services?serviceId={{ser
update_verb: PATCH
id_format: projects/{{project}}/locations/{{location}}/services/{{service_id}}
import_format:
- projects/{{project}}/locations/{{location}}/services/{{service_id}}
- 'projects/{{project}}/locations/{{location}}/services/{{service_id}}'
- '{{project}}/{{location}}/{{service_id}}'
- '{{location}}/{{service_id}}'
examples:
- name: firebasedataconnect_service_basic
primary_resource_id: example
primary_resource_id: default
vars:
resource_name: example-service
service_id: example-service
test_env_vars:
project_id: 'PROJECT_NAME'
autogen_async: true
async:
operation:
Expand Down Expand Up @@ -77,7 +81,7 @@ properties:
service.
output: true
- name: etag
type: String
type: Fingerprint
description: |-
Output only. This checksum is computed by the server based on the value of other
fields, and may be sent on update and delete requests to ensure the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ resource "google_project_service" "fdc" {
}

# Create an FDC service
resource "google_firebasedataconnect_service" "default" {
resource "google_firebase_data_connect_service" "default" {
project = "{{index $.TestEnvVars "project_id"}}"
location = "us-central1"
service_id = "{{index $.Vars "service_id"}}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

// ----------------------------------------------------------------------------
//
// *** AUTO GENERATED CODE *** Type: MMv1 ***
//
// ----------------------------------------------------------------------------
//
// This file is automatically generated by Magic Modules and manual
// changes will be clobbered when the file is regenerated.
//
// Please read more about how to change this file in
// .github/CONTRIBUTING.md.
//
// ----------------------------------------------------------------------------

package firebasedataconnect_test

import (
Expand All @@ -41,24 +27,24 @@ func TestAccFirebaseDataConnectService_Update(t *testing.T) {
CheckDestroy: testAccCheckFirebaseDataConnectServiceDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccFirebaseDataConnectService_basic(context),
Config: testAccFirebaseDataConnectService_update(context, "Original display name"),
},
{
ResourceName: "google_firebasedataconnect_service.default",
ResourceName: "google_firebase_data_connect_service.default",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"annotations", "labels", "location", "service_id", "terraform_labels"},
},
{
Config: testAccFirebaseDataConnectService_update(context),
Config: testAccFirebaseDataConnectService_update(context, "Updated display name"),
ConfigPlanChecks: resource.ConfigPlanChecks{
PreApply: []plancheck.PlanCheck{
plancheck.ExpectResourceAction("google_firebasedataconnect_service.default", plancheck.ResourceActionUpdate),
plancheck.ExpectResourceAction("google_firebase_data_connect_service.default", plancheck.ResourceActionUpdate),
},
},
},
{
ResourceName: "google_firebasedataconnect_service.default",
ResourceName: "google_firebase_data_connect_service.default",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"annotations", "labels", "location", "service_id", "terraform_labels"},
Expand All @@ -67,27 +53,8 @@ func TestAccFirebaseDataConnectService_Update(t *testing.T) {
})
}

func testAccFirebaseDataConnectService_basic(context map[string]interface{}) string {
return acctest.Nprintf(`
# Enable Firebase Data Connect API
resource "google_project_service" "fdc" {
project = "%{project_id}"
service = "firebasedataconnect.googleapis.com"
disable_on_destroy = false
}
# Create an FDC service
resource "google_firebasedataconnect_service" "default" {
project = "%{project_id}"
location = "us-central1"
service_id = "tf-fdc-%{random_suffix}"
depends_on = [google_project_service.fdc]
}
`, context)
}

func testAccFirebaseDataConnectService_update(context map[string]interface{}) string {
func testAccFirebaseDataConnectService_update(context map[string]interface{}, display_name string) string {
context["display_name"] = display_name
return acctest.Nprintf(`
# Enable Firebase Data Connect API
resource "google_project_service" "fdc" {
Expand All @@ -97,11 +64,11 @@ resource "google_project_service" "fdc" {
}
# Create an FDC service
resource "google_firebasedataconnect_service" "default" {
resource "google_firebase_data_connect_service" "default" {
project = "%{project_id}"
location = "us-central1"
service_id = "tf-fdc-%{random_suffix}"
display_name = "My FDC service"
display_name = "%{display_name}"
depends_on = [google_project_service.fdc]
}
Expand Down

0 comments on commit 68a68d6

Please sign in to comment.