Merge branch 'g-route-import' of https://github.com/skalle/terraform into skalle-g-route-import

This commit is contained in:
stack72 2017-05-04 19:13:58 +03:00
commit 1025748ce0
No known key found for this signature in database
GPG Key ID: 8619A619B085CB16
2 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,45 @@
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,
},
},
})
}

View File

@ -14,6 +14,9 @@ func resourceComputeRoute() *schema.Resource {
Create: resourceComputeRouteCreate, Create: resourceComputeRouteCreate,
Read: resourceComputeRouteRead, Read: resourceComputeRouteRead,
Delete: resourceComputeRouteDelete, Delete: resourceComputeRouteDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},
Schema: map[string]*schema.Schema{ Schema: map[string]*schema.Schema{
"dest_range": &schema.Schema{ "dest_range": &schema.Schema{