added test for instance creation with project name
This commit is contained in:
parent
7e49714c3d
commit
5687045f10
|
@ -87,6 +87,27 @@ func TestAccCloudStackInstance_fixedIP(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestAccCloudStackInstance_Projectname(t *testing.T) {
|
||||
var instance cloudstack.VirtualMachine
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckCloudStackInstanceDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
resource.TestStep{
|
||||
Config: testAccCloudStackInstance_projectname,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckCloudStackInstanceExists(
|
||||
"cloudstack_instance.foobar", &instance),
|
||||
resource.TestCheckResourceAttr(
|
||||
"cloudstack_instance.foobar", "project", CLOUDSTACK_PROJECT_NAME),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccCheckCloudStackInstanceExists(
|
||||
n string, instance *cloudstack.VirtualMachine) resource.TestCheckFunc {
|
||||
return func(s *terraform.State) error {
|
||||
|
@ -233,3 +254,21 @@ resource "cloudstack_instance" "foobar" {
|
|||
CLOUDSTACK_NETWORK_1_IPADDRESS,
|
||||
CLOUDSTACK_TEMPLATE,
|
||||
CLOUDSTACK_ZONE)
|
||||
|
||||
|
||||
var testAccCloudStackInstance_projectname = fmt.Sprintf(`
|
||||
resource "cloudstack_instance" "foobar" {
|
||||
name = "terraform-test"
|
||||
display_name = "terraform"
|
||||
service_offering= "%s"
|
||||
network = "%s"
|
||||
template = "%s"
|
||||
zone = "%s"
|
||||
expunge = true
|
||||
project = "%s"
|
||||
}`,
|
||||
CLOUDSTACK_SERVICE_OFFERING_1,
|
||||
CLOUDSTACK_NETWORK_1,
|
||||
CLOUDSTACK_TEMPLATE,
|
||||
CLOUDSTACK_ZONE,
|
||||
CLOUDSTACK_PROJECT_NAME)
|
||||
|
|
Loading…
Reference in New Issue