forked from gophercloud/gophercloud
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable import instance (gophercloud#768)
* Enable import instance Since openstack does not keep track of NIC ordering, the user must specify network in the order of the imported state. * Add a test case and documentation.
- Loading branch information
1 parent
3a2a39e
commit ef78348
Showing
3 changed files
with
307 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package openstack | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform/helper/resource" | ||
) | ||
|
||
func TestAccComputeV2Instance_importBasic(t *testing.T) { | ||
resourceName := "openstack_compute_instance_v2.instance_1" | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
CheckDestroy: testAccCheckComputeV2InstanceDestroy, | ||
Steps: []resource.TestStep{ | ||
resource.TestStep{ | ||
Config: testAccComputeV2Instance_basic, | ||
}, | ||
|
||
resource.TestStep{ | ||
ResourceName: resourceName, | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{ | ||
"stop_before_destroy", | ||
"force_delete", | ||
}, | ||
}, | ||
}, | ||
}) | ||
} | ||
func TestAccComputeV2Instance_importbootFromVolumeForceNew_1(t *testing.T) { | ||
resourceName := "openstack_compute_instance_v2.instance_1" | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
CheckDestroy: testAccCheckComputeV2InstanceDestroy, | ||
Steps: []resource.TestStep{ | ||
resource.TestStep{ | ||
Config: testAccComputeV2Instance_bootFromVolumeForceNew_1, | ||
}, | ||
resource.TestStep{ | ||
ResourceName: resourceName, | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{ | ||
"stop_before_destroy", | ||
"force_delete", | ||
}, | ||
}, | ||
}, | ||
}) | ||
} | ||
func TestAccComputeV2Instance_importbootFromVolumeImage(t *testing.T) { | ||
resourceName := "openstack_compute_instance_v2.instance_1" | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
CheckDestroy: testAccCheckComputeV2InstanceDestroy, | ||
Steps: []resource.TestStep{ | ||
resource.TestStep{ | ||
Config: testAccComputeV2Instance_bootFromVolumeImage, | ||
}, | ||
resource.TestStep{ | ||
ResourceName: resourceName, | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{ | ||
"stop_before_destroy", | ||
"force_delete", | ||
}, | ||
}, | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters