From 04665206265c063ae6e53f1fef1cf76a346431a7 Mon Sep 17 00:00:00 2001 From: Joe Topjian Date: Sun, 3 Jul 2016 09:38:21 -0600 Subject: [PATCH] provider/openstack: Support Import openstack_compute_servergroup_v2 (#7349) --- ...t_openstack_compute_servergroup_v2_test.go | 29 +++++++++++++++++++ ...source_openstack_compute_servergroup_v2.go | 3 ++ 2 files changed, 32 insertions(+) create mode 100644 builtin/providers/openstack/import_openstack_compute_servergroup_v2_test.go diff --git a/builtin/providers/openstack/import_openstack_compute_servergroup_v2_test.go b/builtin/providers/openstack/import_openstack_compute_servergroup_v2_test.go new file mode 100644 index 000000000..5963ba950 --- /dev/null +++ b/builtin/providers/openstack/import_openstack_compute_servergroup_v2_test.go @@ -0,0 +1,29 @@ +package openstack + +import ( + "testing" + + "github.com/hashicorp/terraform/helper/resource" +) + +func TestAccComputeV2ServerGroup_importBasic(t *testing.T) { + resourceName := "openstack_compute_servergroup_v2.mysg" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckComputeV2ServerGroupDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccComputeV2ServerGroup_basic, + }, + + resource.TestStep{ + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"region"}, + }, + }, + }) +} diff --git a/builtin/providers/openstack/resource_openstack_compute_servergroup_v2.go b/builtin/providers/openstack/resource_openstack_compute_servergroup_v2.go index 64cc61ff2..c0632d0d8 100644 --- a/builtin/providers/openstack/resource_openstack_compute_servergroup_v2.go +++ b/builtin/providers/openstack/resource_openstack_compute_servergroup_v2.go @@ -14,6 +14,9 @@ func resourceComputeServerGroupV2() *schema.Resource { Read: resourceComputeServerGroupV2Read, Update: nil, Delete: resourceComputeServerGroupV2Delete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "region": &schema.Schema{