diff --git a/builtin/providers/digitalocean/import_digitalocean_domain_test.go b/builtin/providers/digitalocean/import_digitalocean_domain_test.go new file mode 100644 index 000000000..1f8202398 --- /dev/null +++ b/builtin/providers/digitalocean/import_digitalocean_domain_test.go @@ -0,0 +1,34 @@ +package digitalocean + +import ( + "testing" + + "fmt" + + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" +) + +func TestAccDigitalOceanDomain_importBasic(t *testing.T) { + resourceName := "digitalocean_domain.foobar" + domainName := fmt.Sprintf("foobar-test-terraform-%s.com", acctest.RandString(10)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckDigitalOceanDomainDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: fmt.Sprintf(testAccCheckDigitalOceanDomainConfig_basic, domainName), + }, + + resource.TestStep{ + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "ip_address"}, //we ignore the IP Address as we do not set to state + }, + }, + }) +} diff --git a/builtin/providers/digitalocean/resource_digitalocean_domain.go b/builtin/providers/digitalocean/resource_digitalocean_domain.go index 657acb21d..0b9ac6d5a 100644 --- a/builtin/providers/digitalocean/resource_digitalocean_domain.go +++ b/builtin/providers/digitalocean/resource_digitalocean_domain.go @@ -13,6 +13,9 @@ func resourceDigitalOceanDomain() *schema.Resource { Create: resourceDigitalOceanDomainCreate, Read: resourceDigitalOceanDomainRead, Delete: resourceDigitalOceanDomainDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "name": &schema.Schema{