Importability for Google DNS Managed Zone
This commit is contained in:
parent
c1c3127d8e
commit
d80885f746
|
@ -0,0 +1,28 @@
|
|||
package google
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccDnsManagedZone_importBasic(t *testing.T) {
|
||||
resourceName := "google_dns_managed_zone.foobar"
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckDnsManagedZoneDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
resource.TestStep{
|
||||
Config: testAccDnsManagedZone_basic,
|
||||
},
|
||||
|
||||
resource.TestStep{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
|
@ -14,7 +14,9 @@ func resourceDnsManagedZone() *schema.Resource {
|
|||
Create: resourceDnsManagedZoneCreate,
|
||||
Read: resourceDnsManagedZoneRead,
|
||||
Delete: resourceDnsManagedZoneDelete,
|
||||
|
||||
Importer: &schema.ResourceImporter{
|
||||
State: schema.ImportStatePassthrough,
|
||||
},
|
||||
Schema: map[string]*schema.Schema{
|
||||
"dns_name": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
|
@ -109,6 +111,9 @@ func resourceDnsManagedZoneRead(d *schema.ResourceData, meta interface{}) error
|
|||
}
|
||||
|
||||
d.Set("name_servers", zone.NameServers)
|
||||
d.Set("name", zone.Name)
|
||||
d.Set("dns_name", zone.DnsName)
|
||||
d.Set("description", zone.Description)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -150,6 +150,7 @@ To make a resource importable, please see the
|
|||
* google_compute_instance_group_manager
|
||||
* google_compute_instance_template
|
||||
* google_compute_target_pool
|
||||
* google_dns_managed_zone
|
||||
* google_project
|
||||
|
||||
### OpenStack
|
||||
|
|
Loading…
Reference in New Issue