@@ -273,6 +273,63 @@ func testAccCheckAzureInstanceAdvancedAttributes(
273273 }
274274}
275275
276+ func testAccCheckAzureInstanceAdvancedUpdatedAttributes (
277+ dpmt * virtualmachine.DeploymentResponse ) resource.TestCheckFunc {
278+ return func (s * terraform.State ) error {
279+
280+ if dpmt .Name != "terraform-test1" {
281+ return fmt .Errorf ("Bad name: %s" , dpmt .Name )
282+ }
283+
284+ if dpmt .VirtualNetworkName != "terraform-vnet-update-test" {
285+ return fmt .Errorf ("Bad virtual network: %s" , dpmt .VirtualNetworkName )
286+ }
287+
288+ if len (dpmt .RoleList ) != 1 {
289+ return fmt .Errorf (
290+ "Instance %s has an unexpected number of roles: %d" , dpmt .Name , len (dpmt .RoleList ))
291+ }
292+
293+ if dpmt .RoleList [0 ].RoleSize != "Basic_A1" {
294+ return fmt .Errorf ("Bad size: %s" , dpmt .RoleList [0 ].RoleSize )
295+ }
296+
297+ for _ , c := range dpmt .RoleList [0 ].ConfigurationSets {
298+ if c .ConfigurationSetType == virtualmachine .ConfigurationSetTypeNetwork {
299+ if len (c .InputEndpoints ) != 1 {
300+ return fmt .Errorf (
301+ "Instance %s has an unexpected number of endpoints %d" ,
302+ dpmt .Name , len (c .InputEndpoints ))
303+ }
304+
305+ if c .InputEndpoints [0 ].Name != "RDP" {
306+ return fmt .Errorf ("Bad endpoint name: %s" , c .InputEndpoints [0 ].Name )
307+ }
308+
309+ if c .InputEndpoints [0 ].Port != 3389 {
310+ return fmt .Errorf ("Bad endpoint port: %d" , c .InputEndpoints [0 ].Port )
311+ }
312+
313+ if len (c .SubnetNames ) != 1 {
314+ return fmt .Errorf (
315+ "Instance %s has an unexpected number of associated subnets %d" ,
316+ dpmt .Name , len (c .SubnetNames ))
317+ }
318+
319+ if c .SubnetNames [0 ] != "subnet1" {
320+ return fmt .Errorf ("Bad subnet: %s" , c .SubnetNames [0 ])
321+ }
322+
323+ if c .NetworkSecurityGroup != "terraform-security-group1" {
324+ return fmt .Errorf ("Bad security group: %s" , c .NetworkSecurityGroup )
325+ }
326+ }
327+ }
328+
329+ return nil
330+ }
331+ }
332+
276333func testAccCheckAzureInstanceUpdatedAttributes (
277334 dpmt * virtualmachine.DeploymentResponse ) resource.TestCheckFunc {
278335 return func (s * terraform.State ) error {
0 commit comments