diff --git a/builtin/providers/google/import_compute_route_test.go b/builtin/providers/google/import_compute_route_test.go new file mode 100644 index 000000000..a4bfb9893 --- /dev/null +++ b/builtin/providers/google/import_compute_route_test.go @@ -0,0 +1,47 @@ +package google + +import ( + "testing" + + "github.com/hashicorp/terraform/helper/resource" +) + +func TestAccComputeRoute_importBasic(t *testing.T) { + resourceName := "google_compute_network.foobar" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckComputeRouteDestroy, + Steps: []resource.TestStep{ + { + Config: testAccComputeRoute_basic, + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccComputeRoute_importDefaultInternetGateway(t *testing.T) { + resourceName := "google_compute_network.foobar" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckComputeRouteDestroy, + Steps: []resource.TestStep{ + { + Config: testAccComputeRoute_defaultInternetGateway, + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} diff --git a/builtin/providers/google/resource_compute_route.go b/builtin/providers/google/resource_compute_route.go index ac5760f96..3d7b80616 100644 --- a/builtin/providers/google/resource_compute_route.go +++ b/builtin/providers/google/resource_compute_route.go @@ -14,6 +14,9 @@ func resourceComputeRoute() *schema.Resource { Create: resourceComputeRouteCreate, Read: resourceComputeRouteRead, Delete: resourceComputeRouteDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "dest_range": &schema.Schema{