@@ -108,6 +108,27 @@ func TestAccCloudStackInstance_Projectname(t *testing.T) {
108108 })
109109}
110110
111+ func TestAccCloudStackInstance_Projectid (t * testing.T ) {
112+ var instance cloudstack.VirtualMachine
113+
114+ resource .Test (t , resource.TestCase {
115+ PreCheck : func () { testAccPreCheck (t ) },
116+ Providers : testAccProviders ,
117+ CheckDestroy : testAccCheckCloudStackInstanceDestroy ,
118+ Steps : []resource.TestStep {
119+ resource.TestStep {
120+ Config : testAccCloudStackInstance_projectid ,
121+ Check : resource .ComposeTestCheckFunc (
122+ testAccCheckCloudStackInstanceExists (
123+ "cloudstack_instance.foobar" , & instance ),
124+ resource .TestCheckResourceAttr (
125+ "cloudstack_instance.foobar" , "project" , CLOUDSTACK_PROJECT_ID ),
126+ ),
127+ },
128+ },
129+ })
130+ }
131+
111132func testAccCheckCloudStackInstanceExists (
112133 n string , instance * cloudstack.VirtualMachine ) resource.TestCheckFunc {
113134 return func (s * terraform.State ) error {
@@ -272,3 +293,20 @@ resource "cloudstack_instance" "foobar" {
272293 CLOUDSTACK_TEMPLATE ,
273294 CLOUDSTACK_ZONE ,
274295 CLOUDSTACK_PROJECT_NAME )
296+
297+ var testAccCloudStackInstance_projectid = fmt .Sprintf (`
298+ resource "cloudstack_instance" "foobar" {
299+ name = "terraform-test"
300+ display_name = "terraform"
301+ service_offering= "%s"
302+ network = "%s"
303+ template = "%s"
304+ zone = "%s"
305+ expunge = true
306+ project = "%s"
307+ }` ,
308+ CLOUDSTACK_SERVICE_OFFERING_1 ,
309+ CLOUDSTACK_NETWORK_1 ,
310+ CLOUDSTACK_TEMPLATE ,
311+ CLOUDSTACK_ZONE ,
312+ CLOUDSTACK_PROJECT_id )
0 commit comments