diff --git a/templates/terraform/encoders/app_profile.erb b/templates/terraform/encoders/app_profile.erb index cf1fb633275d..b44d9f56de66 100644 --- a/templates/terraform/encoders/app_profile.erb +++ b/templates/terraform/encoders/app_profile.erb @@ -19,4 +19,4 @@ obj["multiClusterRoutingUseAny"] = bigtableadmin.MultiClusterRoutingUseAny{} } - return obj, nil \ No newline at end of file + return obj, nil diff --git a/third_party/terraform/tests/resource_bigtable_app_profile_test.go b/third_party/terraform/tests/resource_bigtable_app_profile_test.go index c776f9d82bd8..c8821abb7e38 100644 --- a/third_party/terraform/tests/resource_bigtable_app_profile_test.go +++ b/third_party/terraform/tests/resource_bigtable_app_profile_test.go @@ -44,10 +44,11 @@ func TestAccBigtableAppProfile_singleClusterRouting(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccBigtableAppProfile_singleClusterRouting(instanceName), - Check: resource.ComposeTestCheckFunc( - testAccBigtableAppProfileExists( - "google_bigtable_app_profile.ap"), - ), + }, + { + ResourceName: "google_bigtable_app_profile.ap", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -77,34 +78,6 @@ func testAccCheckBigtableAppProfileDestroy(s *terraform.State) error { return nil } -func testAccBigtableAppProfileExists(n string) resource.TestCheckFunc { - var ctx = context.Background() - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[n] - if !ok { - return fmt.Errorf("Not found: %s", n) - } - - if rs.Primary.ID == "" { - return fmt.Errorf("No ID is set") - } - config := testAccProvider.Meta().(*Config) - c, err := config.bigtableClientFactory.NewInstanceAdminClient(config.Project) - if err != nil { - return fmt.Errorf("Error starting instance admin client. %s", err) - } - - defer c.Close() - - _, err = c.GetAppProfile(ctx, rs.Primary.Attributes["instance"], rs.Primary.Attributes["app_profile_id"]) - if err != nil { - return fmt.Errorf("Error retrieving app profile %s for instance %s.", rs.Primary.Attributes["app_profile_id"], rs.Primary.Attributes["instance"]) - } - - return nil - } -} - func testAccBigtableAppProfile_multiClusterRouting(instanceName string) string { return fmt.Sprintf(` resource "google_bigtable_instance" "instance" {