Importability for Google Compute Global Address
This commit is contained in:
parent
8d8d3a728a
commit
8092d90f25
|
@ -0,0 +1,28 @@
|
|||
package google
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccComputeGlobalAddress_importBasic(t *testing.T) {
|
||||
resourceName := "google_compute_global_address.foobar"
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckComputeGlobalAddressDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
resource.TestStep{
|
||||
Config: testAccComputeGlobalAddress_basic,
|
||||
},
|
||||
|
||||
resource.TestStep{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
|
@ -14,7 +14,12 @@ func resourceComputeGlobalAddress() *schema.Resource {
|
|||
Create: resourceComputeGlobalAddressCreate,
|
||||
Read: resourceComputeGlobalAddressRead,
|
||||
Delete: resourceComputeGlobalAddressDelete,
|
||||
|
||||
Importer: &schema.ResourceImporter{
|
||||
State: func(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
|
||||
d.Set("name", d.Id())
|
||||
return []*schema.ResourceData{d}, nil
|
||||
},
|
||||
},
|
||||
Schema: map[string]*schema.Schema{
|
||||
"name": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
|
|
Loading…
Reference in New Issue