github.com/alkar/terraform@v0.9.6-0.20170517124458-a4cddf6ebf59/builtin/providers/azurerm/resource_arm_virtual_machine_scale_set_test.go (about) 1 package azurerm 2 3 import ( 4 "fmt" 5 "net/http" 6 "regexp" 7 "testing" 8 9 "github.com/Azure/azure-sdk-for-go/arm/compute" 10 "github.com/hashicorp/terraform/helper/acctest" 11 "github.com/hashicorp/terraform/helper/resource" 12 "github.com/hashicorp/terraform/terraform" 13 ) 14 15 func TestAccAzureRMVirtualMachineScaleSet_basic(t *testing.T) { 16 ri := acctest.RandInt() 17 config := fmt.Sprintf(testAccAzureRMVirtualMachineScaleSet_basic, ri, ri, ri, ri, ri, ri, ri, ri) 18 resource.Test(t, resource.TestCase{ 19 PreCheck: func() { testAccPreCheck(t) }, 20 Providers: testAccProviders, 21 CheckDestroy: testCheckAzureRMVirtualMachineScaleSetDestroy, 22 Steps: []resource.TestStep{ 23 { 24 Config: config, 25 Check: resource.ComposeTestCheckFunc( 26 testCheckAzureRMVirtualMachineScaleSetExists("azurerm_virtual_machine_scale_set.test"), 27 28 // single placement group should default to true 29 testCheckAzureRMVirtualMachineScaleSetSinglePlacementGroup("azurerm_virtual_machine_scale_set.test", true), 30 ), 31 }, 32 }, 33 }) 34 } 35 36 func TestAccAzureRMVirtualMachineScaleSet_singlePlacementGroupFalse(t *testing.T) { 37 ri := acctest.RandInt() 38 config := fmt.Sprintf(testAccAzureRMVirtualMachineScaleSet_singlePlacementGroupFalse, ri) 39 resource.Test(t, resource.TestCase{ 40 PreCheck: func() { testAccPreCheck(t) }, 41 Providers: testAccProviders, 42 CheckDestroy: testCheckAzureRMVirtualMachineScaleSetDestroy, 43 Steps: []resource.TestStep{ 44 { 45 Config: config, 46 Check: resource.ComposeTestCheckFunc( 47 testCheckAzureRMVirtualMachineScaleSetExists("azurerm_virtual_machine_scale_set.test"), 48 testCheckAzureRMVirtualMachineScaleSetSinglePlacementGroup("azurerm_virtual_machine_scale_set.test", false), 49 ), 50 }, 51 }, 52 }) 53 } 54 55 func TestAccAzureRMVirtualMachineScaleSet_linuxUpdated(t *testing.T) { 56 resourceName := "azurerm_virtual_machine_scale_set.test" 57 ri := acctest.RandInt() 58 config := testAccAzureRMVirtualMachineScaleSet_linux(ri) 59 updatedConfig := testAccAzureRMVirtualMachineScaleSet_linuxUpdated(ri) 60 61 resource.Test(t, resource.TestCase{ 62 PreCheck: func() { testAccPreCheck(t) }, 63 Providers: testAccProviders, 64 CheckDestroy: testCheckAzureRMVirtualMachineScaleSetDestroy, 65 Steps: []resource.TestStep{ 66 { 67 Config: config, 68 Check: resource.ComposeTestCheckFunc( 69 testCheckAzureRMVirtualMachineScaleSetExists(resourceName), 70 ), 71 }, 72 { 73 Config: updatedConfig, 74 Check: resource.ComposeTestCheckFunc( 75 testCheckAzureRMVirtualMachineScaleSetExists(resourceName), 76 ), 77 }, 78 }, 79 }) 80 } 81 82 func TestAccAzureRMVirtualMachineScaleSet_basicLinux_managedDisk(t *testing.T) { 83 ri := acctest.RandInt() 84 config := fmt.Sprintf(testAccAzureRMVirtualMachineScaleSet_basicLinux_managedDisk, ri, ri, ri, ri, ri, ri) 85 resource.Test(t, resource.TestCase{ 86 PreCheck: func() { testAccPreCheck(t) }, 87 Providers: testAccProviders, 88 CheckDestroy: testCheckAzureRMVirtualMachineScaleSetDestroy, 89 Steps: []resource.TestStep{ 90 { 91 Config: config, 92 Check: resource.ComposeTestCheckFunc( 93 testCheckAzureRMVirtualMachineScaleSetExists("azurerm_virtual_machine_scale_set.test"), 94 ), 95 }, 96 }, 97 }) 98 } 99 100 func TestAccAzureRMVirtualMachineScaleSet_basicLinux_disappears(t *testing.T) { 101 ri := acctest.RandInt() 102 config := fmt.Sprintf(testAccAzureRMVirtualMachineScaleSet_basic, ri, ri, ri, ri, ri, ri, ri, ri) 103 resource.Test(t, resource.TestCase{ 104 PreCheck: func() { testAccPreCheck(t) }, 105 Providers: testAccProviders, 106 CheckDestroy: testCheckAzureRMVirtualMachineScaleSetDestroy, 107 Steps: []resource.TestStep{ 108 { 109 Config: config, 110 Check: resource.ComposeTestCheckFunc( 111 testCheckAzureRMVirtualMachineScaleSetExists("azurerm_virtual_machine_scale_set.test"), 112 testCheckAzureRMVirtualMachineScaleSetDisappears("azurerm_virtual_machine_scale_set.test"), 113 ), 114 ExpectNonEmptyPlan: true, 115 }, 116 }, 117 }) 118 } 119 120 func TestAccAzureRMVirtualMachineScaleSet_loadBalancer(t *testing.T) { 121 ri := acctest.RandInt() 122 config := fmt.Sprintf(testAccAzureRMVirtualMachineScaleSetLoadbalancerTemplate, ri, ri, ri, ri, ri, ri, ri) 123 resource.Test(t, resource.TestCase{ 124 PreCheck: func() { testAccPreCheck(t) }, 125 Providers: testAccProviders, 126 CheckDestroy: testCheckAzureRMVirtualMachineScaleSetDestroy, 127 Steps: []resource.TestStep{ 128 { 129 Config: config, 130 Check: resource.ComposeTestCheckFunc( 131 testCheckAzureRMVirtualMachineScaleSetExists("azurerm_virtual_machine_scale_set.test"), 132 testCheckAzureRMVirtualMachineScaleSetHasLoadbalancer("azurerm_virtual_machine_scale_set.test"), 133 ), 134 }, 135 }, 136 }) 137 } 138 139 func TestAccAzureRMVirtualMachineScaleSet_overprovision(t *testing.T) { 140 ri := acctest.RandInt() 141 config := fmt.Sprintf(testAccAzureRMVirtualMachineScaleSetOverprovisionTemplate, ri, ri, ri, ri, ri, ri) 142 resource.Test(t, resource.TestCase{ 143 PreCheck: func() { testAccPreCheck(t) }, 144 Providers: testAccProviders, 145 CheckDestroy: testCheckAzureRMVirtualMachineScaleSetDestroy, 146 Steps: []resource.TestStep{ 147 { 148 Config: config, 149 Check: resource.ComposeTestCheckFunc( 150 testCheckAzureRMVirtualMachineScaleSetExists("azurerm_virtual_machine_scale_set.test"), 151 testCheckAzureRMVirtualMachineScaleSetOverprovision("azurerm_virtual_machine_scale_set.test"), 152 ), 153 }, 154 }, 155 }) 156 } 157 158 func TestAccAzureRMVirtualMachineScaleSet_extension(t *testing.T) { 159 ri := acctest.RandInt() 160 config := fmt.Sprintf(testAccAzureRMVirtualMachineScaleSetExtensionTemplate, ri, ri, ri, ri, ri, ri) 161 resource.Test(t, resource.TestCase{ 162 PreCheck: func() { testAccPreCheck(t) }, 163 Providers: testAccProviders, 164 CheckDestroy: testCheckAzureRMVirtualMachineScaleSetDestroy, 165 Steps: []resource.TestStep{ 166 { 167 Config: config, 168 Check: resource.ComposeTestCheckFunc( 169 testCheckAzureRMVirtualMachineScaleSetExists("azurerm_virtual_machine_scale_set.test"), 170 testCheckAzureRMVirtualMachineScaleSetExtension("azurerm_virtual_machine_scale_set.test"), 171 ), 172 }, 173 }, 174 }) 175 } 176 177 func TestAccAzureRMVirtualMachineScaleSet_multipleExtensions(t *testing.T) { 178 ri := acctest.RandInt() 179 config := fmt.Sprintf(testAccAzureRMVirtualMachineScaleSetMultipleExtensionsTemplate, ri, ri, ri, ri, ri, ri) 180 resource.Test(t, resource.TestCase{ 181 PreCheck: func() { testAccPreCheck(t) }, 182 Providers: testAccProviders, 183 CheckDestroy: testCheckAzureRMVirtualMachineScaleSetDestroy, 184 Steps: []resource.TestStep{ 185 { 186 Config: config, 187 Check: resource.ComposeTestCheckFunc( 188 testCheckAzureRMVirtualMachineScaleSetExists("azurerm_virtual_machine_scale_set.test"), 189 testCheckAzureRMVirtualMachineScaleSetExtension("azurerm_virtual_machine_scale_set.test"), 190 ), 191 }, 192 }, 193 }) 194 } 195 196 func TestAccAzureRMVirtualMachineScaleSet_osDiskTypeConflict(t *testing.T) { 197 ri := acctest.RandInt() 198 config := fmt.Sprintf(testAccAzureRMVirtualMachineScaleSet_osDiskTypeConflict, ri, ri, ri, ri, ri, ri, ri) 199 resource.Test(t, resource.TestCase{ 200 PreCheck: func() { testAccPreCheck(t) }, 201 Providers: testAccProviders, 202 CheckDestroy: testCheckAzureRMVirtualMachineScaleSetDestroy, 203 Steps: []resource.TestStep{ 204 { 205 Config: config, 206 ExpectError: regexp.MustCompile("Conflict between `vhd_containers`"), 207 //Use below code instead once GH-13019 has been merged 208 //ExpectError: regexp.MustCompile("conflicts with storage_profile_os_disk.0.vhd_containers"), 209 }, 210 }, 211 }) 212 } 213 214 func testGetAzureRMVirtualMachineScaleSet(s *terraform.State, resourceName string) (result *compute.VirtualMachineScaleSet, err error) { 215 // Ensure we have enough information in state to look up in API 216 rs, ok := s.RootModule().Resources[resourceName] 217 if !ok { 218 return nil, fmt.Errorf("Not found: %s", resourceName) 219 } 220 221 // Name of the actual scale set 222 name := rs.Primary.Attributes["name"] 223 224 resourceGroup, hasResourceGroup := rs.Primary.Attributes["resource_group_name"] 225 if !hasResourceGroup { 226 return nil, fmt.Errorf("Bad: no resource group found in state for virtual machine: scale set %s", name) 227 } 228 229 conn := testAccProvider.Meta().(*ArmClient).vmScaleSetClient 230 231 vmss, err := conn.Get(resourceGroup, name) 232 if err != nil { 233 return nil, fmt.Errorf("Bad: Get on vmScaleSetClient: %s", err) 234 } 235 236 if vmss.StatusCode == http.StatusNotFound { 237 return nil, fmt.Errorf("Bad: VirtualMachineScaleSet %q (resource group: %q) does not exist", name, resourceGroup) 238 } 239 240 return &vmss, err 241 } 242 243 func testCheckAzureRMVirtualMachineScaleSetExists(name string) resource.TestCheckFunc { 244 return func(s *terraform.State) error { 245 _, err := testGetAzureRMVirtualMachineScaleSet(s, name) 246 return err 247 } 248 } 249 250 func testCheckAzureRMVirtualMachineScaleSetDisappears(name string) resource.TestCheckFunc { 251 return func(s *terraform.State) error { 252 // Ensure we have enough information in state to look up in API 253 rs, ok := s.RootModule().Resources[name] 254 if !ok { 255 return fmt.Errorf("Not found: %s", name) 256 } 257 258 name := rs.Primary.Attributes["name"] 259 resourceGroup, hasResourceGroup := rs.Primary.Attributes["resource_group_name"] 260 if !hasResourceGroup { 261 return fmt.Errorf("Bad: no resource group found in state for virtual machine: scale set %s", name) 262 } 263 264 conn := testAccProvider.Meta().(*ArmClient).vmScaleSetClient 265 266 _, err := conn.Delete(resourceGroup, name, make(chan struct{})) 267 if err != nil { 268 return fmt.Errorf("Bad: Delete on vmScaleSetClient: %s", err) 269 } 270 271 return nil 272 } 273 } 274 275 func testCheckAzureRMVirtualMachineScaleSetDestroy(s *terraform.State) error { 276 conn := testAccProvider.Meta().(*ArmClient).vmScaleSetClient 277 278 for _, rs := range s.RootModule().Resources { 279 if rs.Type != "azurerm_virtual_machine_scale_set" { 280 continue 281 } 282 283 name := rs.Primary.Attributes["name"] 284 resourceGroup := rs.Primary.Attributes["resource_group_name"] 285 286 resp, err := conn.Get(resourceGroup, name) 287 288 if err != nil { 289 return nil 290 } 291 292 if resp.StatusCode != http.StatusNotFound { 293 return fmt.Errorf("Virtual Machine Scale Set still exists:\n%#v", resp.VirtualMachineScaleSetProperties) 294 } 295 } 296 297 return nil 298 } 299 300 func testCheckAzureRMVirtualMachineScaleSetHasLoadbalancer(name string) resource.TestCheckFunc { 301 return func(s *terraform.State) error { 302 resp, err := testGetAzureRMVirtualMachineScaleSet(s, name) 303 if err != nil { 304 return err 305 } 306 307 n := resp.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations 308 if n == nil || len(*n) == 0 { 309 return fmt.Errorf("Bad: Could not get network interface configurations for scale set %v", name) 310 } 311 312 ip := (*n)[0].IPConfigurations 313 if ip == nil || len(*ip) == 0 { 314 return fmt.Errorf("Bad: Could not get ip configurations for scale set %v", name) 315 } 316 317 pools := (*ip)[0].LoadBalancerBackendAddressPools 318 if pools == nil || len(*pools) == 0 { 319 return fmt.Errorf("Bad: Load balancer backend pools is empty for scale set %v", name) 320 } 321 322 return nil 323 } 324 } 325 326 func testCheckAzureRMVirtualMachineScaleSetOverprovision(name string) resource.TestCheckFunc { 327 return func(s *terraform.State) error { 328 resp, err := testGetAzureRMVirtualMachineScaleSet(s, name) 329 if err != nil { 330 return err 331 } 332 333 if *resp.Overprovision { 334 return fmt.Errorf("Bad: Overprovision should have been false for scale set %v", name) 335 } 336 337 return nil 338 } 339 } 340 341 func testCheckAzureRMVirtualMachineScaleSetSinglePlacementGroup(name string, expectedSinglePlacementGroup bool) resource.TestCheckFunc { 342 return func(s *terraform.State) error { 343 resp, err := testGetAzureRMVirtualMachineScaleSet(s, name) 344 if err != nil { 345 return err 346 } 347 348 if *resp.SinglePlacementGroup != expectedSinglePlacementGroup { 349 return fmt.Errorf("Bad: Overprovision should have been %t for scale set %v", expectedSinglePlacementGroup, name) 350 } 351 352 return nil 353 } 354 } 355 356 func testCheckAzureRMVirtualMachineScaleSetExtension(name string) resource.TestCheckFunc { 357 return func(s *terraform.State) error { 358 resp, err := testGetAzureRMVirtualMachineScaleSet(s, name) 359 if err != nil { 360 return err 361 } 362 363 n := resp.VirtualMachineProfile.ExtensionProfile.Extensions 364 if n == nil || len(*n) == 0 { 365 return fmt.Errorf("Bad: Could not get extensions for scale set %v", name) 366 } 367 368 return nil 369 } 370 } 371 372 var testAccAzureRMVirtualMachineScaleSet_basic = ` 373 resource "azurerm_resource_group" "test" { 374 name = "acctestRG-%d" 375 location = "West US 2" 376 } 377 378 resource "azurerm_virtual_network" "test" { 379 name = "acctvn-%d" 380 address_space = ["10.0.0.0/16"] 381 location = "West US 2" 382 resource_group_name = "${azurerm_resource_group.test.name}" 383 } 384 385 resource "azurerm_subnet" "test" { 386 name = "acctsub-%d" 387 resource_group_name = "${azurerm_resource_group.test.name}" 388 virtual_network_name = "${azurerm_virtual_network.test.name}" 389 address_prefix = "10.0.2.0/24" 390 } 391 392 resource "azurerm_network_interface" "test" { 393 name = "acctni-%d" 394 location = "West US 2" 395 resource_group_name = "${azurerm_resource_group.test.name}" 396 397 ip_configuration { 398 name = "testconfiguration1" 399 subnet_id = "${azurerm_subnet.test.id}" 400 private_ip_address_allocation = "dynamic" 401 } 402 } 403 404 resource "azurerm_storage_account" "test" { 405 name = "accsa%d" 406 resource_group_name = "${azurerm_resource_group.test.name}" 407 location = "West US 2" 408 account_type = "Standard_LRS" 409 410 tags { 411 environment = "staging" 412 } 413 } 414 415 resource "azurerm_storage_container" "test" { 416 name = "vhds" 417 resource_group_name = "${azurerm_resource_group.test.name}" 418 storage_account_name = "${azurerm_storage_account.test.name}" 419 container_access_type = "private" 420 } 421 422 resource "azurerm_virtual_machine_scale_set" "test" { 423 name = "acctvmss-%d" 424 location = "West US 2" 425 resource_group_name = "${azurerm_resource_group.test.name}" 426 upgrade_policy_mode = "Manual" 427 428 sku { 429 name = "Standard_D1_v2" 430 tier = "Standard" 431 capacity = 2 432 } 433 434 os_profile { 435 computer_name_prefix = "testvm-%d" 436 admin_username = "myadmin" 437 admin_password = "Passwword1234" 438 } 439 440 network_profile { 441 name = "TestNetworkProfile-%d" 442 primary = true 443 ip_configuration { 444 name = "TestIPConfiguration" 445 subnet_id = "${azurerm_subnet.test.id}" 446 } 447 } 448 449 storage_profile_os_disk { 450 name = "osDiskProfile" 451 caching = "ReadWrite" 452 create_option = "FromImage" 453 vhd_containers = ["${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}"] 454 } 455 456 storage_profile_image_reference { 457 publisher = "Canonical" 458 offer = "UbuntuServer" 459 sku = "16.04-LTS" 460 version = "latest" 461 } 462 } 463 ` 464 465 var testAccAzureRMVirtualMachineScaleSet_singlePlacementGroupFalse = ` 466 resource "azurerm_resource_group" "test" { 467 name = "acctestRG-%[1]d" 468 location = "West US 2" 469 } 470 471 resource "azurerm_virtual_network" "test" { 472 name = "acctvn-%[1]d" 473 address_space = ["10.0.0.0/16"] 474 location = "West US 2" 475 resource_group_name = "${azurerm_resource_group.test.name}" 476 } 477 478 resource "azurerm_subnet" "test" { 479 name = "acctsub-%[1]d" 480 resource_group_name = "${azurerm_resource_group.test.name}" 481 virtual_network_name = "${azurerm_virtual_network.test.name}" 482 address_prefix = "10.0.2.0/24" 483 } 484 485 resource "azurerm_network_interface" "test" { 486 name = "acctni-%[1]d" 487 location = "West US 2" 488 resource_group_name = "${azurerm_resource_group.test.name}" 489 490 ip_configuration { 491 name = "testconfiguration1" 492 subnet_id = "${azurerm_subnet.test.id}" 493 private_ip_address_allocation = "dynamic" 494 } 495 } 496 497 resource "azurerm_storage_account" "test" { 498 name = "accsa%[1]d" 499 resource_group_name = "${azurerm_resource_group.test.name}" 500 location = "West US 2" 501 account_type = "Standard_LRS" 502 503 tags { 504 environment = "staging" 505 } 506 } 507 508 resource "azurerm_storage_container" "test" { 509 name = "vhds" 510 resource_group_name = "${azurerm_resource_group.test.name}" 511 storage_account_name = "${azurerm_storage_account.test.name}" 512 container_access_type = "private" 513 } 514 515 resource "azurerm_virtual_machine_scale_set" "test" { 516 name = "acctvmss-%[1]d" 517 location = "West US 2" 518 resource_group_name = "${azurerm_resource_group.test.name}" 519 upgrade_policy_mode = "Manual" 520 single_placement_group = false 521 522 sku { 523 name = "Standard_D1_v2" 524 tier = "Standard" 525 capacity = 2 526 } 527 528 os_profile { 529 computer_name_prefix = "testvm-%[1]d" 530 admin_username = "myadmin" 531 admin_password = "Passwword1234" 532 } 533 534 network_profile { 535 name = "TestNetworkProfile-%[1]d" 536 primary = true 537 ip_configuration { 538 name = "TestIPConfiguration" 539 subnet_id = "${azurerm_subnet.test.id}" 540 } 541 } 542 543 storage_profile_os_disk { 544 name = "" 545 caching = "ReadWrite" 546 create_option = "FromImage" 547 managed_disk_type = "Standard_LRS" 548 } 549 550 storage_profile_image_reference { 551 publisher = "Canonical" 552 offer = "UbuntuServer" 553 sku = "16.04-LTS" 554 version = "latest" 555 } 556 } 557 ` 558 559 func testAccAzureRMVirtualMachineScaleSet_linux(rInt int) string { 560 return fmt.Sprintf(` 561 resource "azurerm_resource_group" "test" { 562 name = "acctestrg-%d" 563 location = "West Europe" 564 } 565 resource "azurerm_virtual_network" "test" { 566 name = "acctestvn-%d" 567 resource_group_name = "${azurerm_resource_group.test.name}" 568 location = "${azurerm_resource_group.test.location}" 569 address_space = ["10.0.0.0/8"] 570 } 571 resource "azurerm_subnet" "test" { 572 name = "acctestsn-%d" 573 resource_group_name = "${azurerm_resource_group.test.name}" 574 virtual_network_name = "${azurerm_virtual_network.test.name}" 575 address_prefix = "10.0.1.0/24" 576 } 577 resource "azurerm_storage_account" "test" { 578 name = "accsa%d" 579 resource_group_name = "${azurerm_resource_group.test.name}" 580 location = "${azurerm_resource_group.test.location}" 581 account_type = "Standard_LRS" 582 } 583 resource "azurerm_storage_container" "test" { 584 name = "acctestsc-%d" 585 resource_group_name = "${azurerm_resource_group.test.name}" 586 storage_account_name = "${azurerm_storage_account.test.name}" 587 container_access_type = "private" 588 } 589 resource "azurerm_public_ip" "test" { 590 name = "acctestpip-%d" 591 resource_group_name = "${azurerm_resource_group.test.name}" 592 location = "${azurerm_resource_group.test.location}" 593 public_ip_address_allocation = "static" 594 } 595 resource "azurerm_lb" "test" { 596 name = "acctestlb-%d" 597 resource_group_name = "${azurerm_resource_group.test.name}" 598 location = "${azurerm_resource_group.test.location}" 599 frontend_ip_configuration { 600 name = "ip-address" 601 public_ip_address_id = "${azurerm_public_ip.test.id}" 602 } 603 } 604 resource "azurerm_lb_backend_address_pool" "test" { 605 name = "acctestbap-%d" 606 resource_group_name = "${azurerm_resource_group.test.name}" 607 loadbalancer_id = "${azurerm_lb.test.id}" 608 } 609 resource "azurerm_virtual_machine_scale_set" "test" { 610 name = "acctestvmss-%d" 611 resource_group_name = "${azurerm_resource_group.test.name}" 612 location = "${azurerm_resource_group.test.location}" 613 upgrade_policy_mode = "Automatic" 614 sku { 615 name = "Standard_A0" 616 tier = "Standard" 617 capacity = "1" 618 } 619 os_profile { 620 computer_name_prefix = "prefix" 621 admin_username = "ubuntu" 622 admin_password = "password" 623 custom_data = "custom data!" 624 } 625 os_profile_linux_config { 626 disable_password_authentication = true 627 ssh_keys { 628 path = "/home/ubuntu/.ssh/authorized_keys" 629 key_data = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDCsTcryUl51Q2VSEHqDRNmceUFo55ZtcIwxl2QITbN1RREti5ml/VTytC0yeBOvnZA4x4CFpdw/lCDPk0yrH9Ei5vVkXmOrExdTlT3qI7YaAzj1tUVlBd4S6LX1F7y6VLActvdHuDDuXZXzCDd/97420jrDfWZqJMlUK/EmCE5ParCeHIRIvmBxcEnGfFIsw8xQZl0HphxWOtJil8qsUWSdMyCiJYYQpMoMliO99X40AUc4/AlsyPyT5ddbKk08YrZ+rKDVHF7o29rh4vi5MmHkVgVQHKiKybWlHq+b71gIAUQk9wrJxD+dqt4igrmDSpIjfjwnd+l5UIn5fJSO5DYV4YT/4hwK7OKmuo7OFHD0WyY5YnkYEMtFgzemnRBdE8ulcT60DQpVgRMXFWHvhyCWy0L6sgj1QWDZlLpvsIvNfHsyhKFMG1frLnMt/nP0+YCcfg+v1JYeCKjeoJxB8DWcRBsjzItY0CGmzP8UYZiYKl/2u+2TgFS5r7NWH11bxoUzjKdaa1NLw+ieA8GlBFfCbfWe6YVB9ggUte4VtYFMZGxOjS2bAiYtfgTKFJv+XqORAwExG6+G2eDxIDyo80/OA9IG7Xv/jwQr7D6KDjDuULFcN/iTxuttoKrHeYz1hf5ZQlBdllwJHYx6fK2g8kha6r2JIQKocvsAXiiONqSfw== hello@world.com" 630 } 631 } 632 network_profile { 633 name = "TestNetworkProfile" 634 primary = true 635 ip_configuration { 636 name = "TestIPConfiguration" 637 subnet_id = "${azurerm_subnet.test.id}" 638 load_balancer_backend_address_pool_ids = ["${azurerm_lb_backend_address_pool.test.id}"] 639 } 640 } 641 storage_profile_os_disk { 642 name = "osDiskProfile" 643 caching = "ReadWrite" 644 create_option = "FromImage" 645 os_type = "linux" 646 vhd_containers = ["${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}"] 647 } 648 storage_profile_image_reference { 649 publisher = "Canonical" 650 offer = "UbuntuServer" 651 sku = "14.04.2-LTS" 652 version = "latest" 653 } 654 } 655 `, rInt, rInt, rInt, rInt, rInt, rInt, rInt, rInt, rInt) 656 } 657 658 func testAccAzureRMVirtualMachineScaleSet_linuxUpdated(rInt int) string { 659 return fmt.Sprintf(` 660 resource "azurerm_resource_group" "test" { 661 name = "acctestrg-%d" 662 location = "West Europe" 663 } 664 resource "azurerm_virtual_network" "test" { 665 name = "acctestvn-%d" 666 resource_group_name = "${azurerm_resource_group.test.name}" 667 location = "${azurerm_resource_group.test.location}" 668 address_space = ["10.0.0.0/8"] 669 } 670 resource "azurerm_subnet" "test" { 671 name = "acctestsn-%d" 672 resource_group_name = "${azurerm_resource_group.test.name}" 673 virtual_network_name = "${azurerm_virtual_network.test.name}" 674 address_prefix = "10.0.1.0/24" 675 } 676 resource "azurerm_storage_account" "test" { 677 name = "accsa%d" 678 resource_group_name = "${azurerm_resource_group.test.name}" 679 location = "${azurerm_resource_group.test.location}" 680 account_type = "Standard_LRS" 681 } 682 resource "azurerm_storage_container" "test" { 683 name = "acctestsc-%d" 684 resource_group_name = "${azurerm_resource_group.test.name}" 685 storage_account_name = "${azurerm_storage_account.test.name}" 686 container_access_type = "private" 687 } 688 resource "azurerm_public_ip" "test" { 689 name = "acctestpip-%d" 690 resource_group_name = "${azurerm_resource_group.test.name}" 691 location = "${azurerm_resource_group.test.location}" 692 public_ip_address_allocation = "static" 693 } 694 resource "azurerm_lb" "test" { 695 name = "acctestlb-%d" 696 resource_group_name = "${azurerm_resource_group.test.name}" 697 location = "${azurerm_resource_group.test.location}" 698 frontend_ip_configuration { 699 name = "ip-address" 700 public_ip_address_id = "${azurerm_public_ip.test.id}" 701 } 702 } 703 resource "azurerm_lb_backend_address_pool" "test" { 704 name = "acctestbap-%d" 705 resource_group_name = "${azurerm_resource_group.test.name}" 706 loadbalancer_id = "${azurerm_lb.test.id}" 707 } 708 resource "azurerm_virtual_machine_scale_set" "test" { 709 name = "acctestvmss-%d" 710 resource_group_name = "${azurerm_resource_group.test.name}" 711 location = "${azurerm_resource_group.test.location}" 712 upgrade_policy_mode = "Automatic" 713 sku { 714 name = "Standard_A0" 715 tier = "Standard" 716 capacity = "1" 717 } 718 os_profile { 719 computer_name_prefix = "prefix" 720 admin_username = "ubuntu" 721 admin_password = "password" 722 custom_data = "custom data!" 723 } 724 os_profile_linux_config { 725 disable_password_authentication = true 726 ssh_keys { 727 path = "/home/ubuntu/.ssh/authorized_keys" 728 key_data = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDCsTcryUl51Q2VSEHqDRNmceUFo55ZtcIwxl2QITbN1RREti5ml/VTytC0yeBOvnZA4x4CFpdw/lCDPk0yrH9Ei5vVkXmOrExdTlT3qI7YaAzj1tUVlBd4S6LX1F7y6VLActvdHuDDuXZXzCDd/97420jrDfWZqJMlUK/EmCE5ParCeHIRIvmBxcEnGfFIsw8xQZl0HphxWOtJil8qsUWSdMyCiJYYQpMoMliO99X40AUc4/AlsyPyT5ddbKk08YrZ+rKDVHF7o29rh4vi5MmHkVgVQHKiKybWlHq+b71gIAUQk9wrJxD+dqt4igrmDSpIjfjwnd+l5UIn5fJSO5DYV4YT/4hwK7OKmuo7OFHD0WyY5YnkYEMtFgzemnRBdE8ulcT60DQpVgRMXFWHvhyCWy0L6sgj1QWDZlLpvsIvNfHsyhKFMG1frLnMt/nP0+YCcfg+v1JYeCKjeoJxB8DWcRBsjzItY0CGmzP8UYZiYKl/2u+2TgFS5r7NWH11bxoUzjKdaa1NLw+ieA8GlBFfCbfWe6YVB9ggUte4VtYFMZGxOjS2bAiYtfgTKFJv+XqORAwExG6+G2eDxIDyo80/OA9IG7Xv/jwQr7D6KDjDuULFcN/iTxuttoKrHeYz1hf5ZQlBdllwJHYx6fK2g8kha6r2JIQKocvsAXiiONqSfw== hello@world.com" 729 } 730 } 731 network_profile { 732 name = "TestNetworkProfile" 733 primary = true 734 ip_configuration { 735 name = "TestIPConfiguration" 736 subnet_id = "${azurerm_subnet.test.id}" 737 load_balancer_backend_address_pool_ids = ["${azurerm_lb_backend_address_pool.test.id}"] 738 } 739 } 740 storage_profile_os_disk { 741 name = "osDiskProfile" 742 caching = "ReadWrite" 743 create_option = "FromImage" 744 os_type = "linux" 745 vhd_containers = ["${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}"] 746 } 747 storage_profile_image_reference { 748 publisher = "Canonical" 749 offer = "UbuntuServer" 750 sku = "14.04.2-LTS" 751 version = "latest" 752 } 753 tags { 754 ThisIs = "a test" 755 } 756 } 757 `, rInt, rInt, rInt, rInt, rInt, rInt, rInt, rInt, rInt) 758 } 759 760 var testAccAzureRMVirtualMachineScaleSet_basicLinux_managedDisk = ` 761 resource "azurerm_resource_group" "test" { 762 name = "acctestRG-%d" 763 location = "West US 2" 764 } 765 766 resource "azurerm_virtual_network" "test" { 767 name = "acctvn-%d" 768 address_space = ["10.0.0.0/16"] 769 location = "West US 2" 770 resource_group_name = "${azurerm_resource_group.test.name}" 771 } 772 773 resource "azurerm_subnet" "test" { 774 name = "acctsub-%d" 775 resource_group_name = "${azurerm_resource_group.test.name}" 776 virtual_network_name = "${azurerm_virtual_network.test.name}" 777 address_prefix = "10.0.2.0/24" 778 } 779 780 resource "azurerm_virtual_machine_scale_set" "test" { 781 name = "acctvmss-%d" 782 location = "West US 2" 783 resource_group_name = "${azurerm_resource_group.test.name}" 784 upgrade_policy_mode = "Manual" 785 786 sku { 787 name = "Standard_D1_v2" 788 tier = "Standard" 789 capacity = 2 790 } 791 792 os_profile { 793 computer_name_prefix = "testvm-%d" 794 admin_username = "myadmin" 795 admin_password = "Passwword1234" 796 } 797 798 network_profile { 799 name = "TestNetworkProfile-%d" 800 primary = true 801 ip_configuration { 802 name = "TestIPConfiguration" 803 subnet_id = "${azurerm_subnet.test.id}" 804 } 805 } 806 807 storage_profile_os_disk { 808 name = "" 809 caching = "ReadWrite" 810 create_option = "FromImage" 811 managed_disk_type = "Standard_LRS" 812 } 813 814 storage_profile_image_reference { 815 publisher = "Canonical" 816 offer = "UbuntuServer" 817 sku = "16.04-LTS" 818 version = "latest" 819 } 820 } 821 ` 822 823 var testAccAzureRMVirtualMachineScaleSetLoadbalancerTemplate = ` 824 resource "azurerm_resource_group" "test" { 825 name = "acctestrg-%d" 826 location = "southcentralus" 827 } 828 829 resource "azurerm_virtual_network" "test" { 830 name = "acctvn-%d" 831 address_space = ["10.0.0.0/16"] 832 location = "southcentralus" 833 resource_group_name = "${azurerm_resource_group.test.name}" 834 } 835 836 resource "azurerm_subnet" "test" { 837 name = "acctsub-%d" 838 resource_group_name = "${azurerm_resource_group.test.name}" 839 virtual_network_name = "${azurerm_virtual_network.test.name}" 840 address_prefix = "10.0.2.0/24" 841 } 842 843 resource "azurerm_storage_account" "test" { 844 name = "accsa%d" 845 resource_group_name = "${azurerm_resource_group.test.name}" 846 location = "southcentralus" 847 account_type = "Standard_LRS" 848 } 849 850 resource "azurerm_storage_container" "test" { 851 name = "vhds" 852 resource_group_name = "${azurerm_resource_group.test.name}" 853 storage_account_name = "${azurerm_storage_account.test.name}" 854 container_access_type = "private" 855 } 856 857 resource "azurerm_lb" "test" { 858 name = "acctestlb-%d" 859 location = "southcentralus" 860 resource_group_name = "${azurerm_resource_group.test.name}" 861 862 frontend_ip_configuration { 863 name = "default" 864 subnet_id = "${azurerm_subnet.test.id}" 865 private_ip_address_allocation = "Dynamic" 866 } 867 } 868 869 resource "azurerm_lb_backend_address_pool" "test" { 870 name = "test" 871 resource_group_name = "${azurerm_resource_group.test.name}" 872 location = "southcentralus" 873 loadbalancer_id = "${azurerm_lb.test.id}" 874 } 875 876 resource "azurerm_lb_nat_pool" "test" { 877 resource_group_name = "${azurerm_resource_group.test.name}" 878 name = "ssh" 879 loadbalancer_id = "${azurerm_lb.test.id}" 880 protocol = "Tcp" 881 frontend_port_start = 50000 882 frontend_port_end = 50119 883 backend_port = 22 884 frontend_ip_configuration_name = "default" 885 } 886 887 resource "azurerm_virtual_machine_scale_set" "test" { 888 name = "acctvmss-%d" 889 location = "southcentralus" 890 resource_group_name = "${azurerm_resource_group.test.name}" 891 upgrade_policy_mode = "Manual" 892 893 sku { 894 name = "Standard_D1_v2" 895 tier = "Standard" 896 capacity = 1 897 } 898 899 os_profile { 900 computer_name_prefix = "testvm-%d" 901 admin_username = "myadmin" 902 admin_password = "Passwword1234" 903 } 904 905 network_profile { 906 name = "TestNetworkProfile" 907 primary = true 908 ip_configuration { 909 name = "TestIPConfiguration" 910 subnet_id = "${azurerm_subnet.test.id}" 911 load_balancer_backend_address_pool_ids = [ "${azurerm_lb_backend_address_pool.test.id}" ] 912 load_balancer_inbound_nat_rules_ids = ["${azurerm_lb_nat_pool.test.id}"] 913 } 914 } 915 916 storage_profile_os_disk { 917 name = "os-disk" 918 caching = "ReadWrite" 919 create_option = "FromImage" 920 vhd_containers = [ "${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}" ] 921 } 922 923 storage_profile_image_reference { 924 publisher = "Canonical" 925 offer = "UbuntuServer" 926 sku = "16.04-LTS" 927 version = "latest" 928 } 929 } 930 ` 931 932 var testAccAzureRMVirtualMachineScaleSetOverprovisionTemplate = ` 933 resource "azurerm_resource_group" "test" { 934 name = "acctestrg-%d" 935 location = "southcentralus" 936 } 937 938 resource "azurerm_virtual_network" "test" { 939 name = "acctvn-%d" 940 address_space = ["10.0.0.0/16"] 941 location = "southcentralus" 942 resource_group_name = "${azurerm_resource_group.test.name}" 943 } 944 945 resource "azurerm_subnet" "test" { 946 name = "acctsub-%d" 947 resource_group_name = "${azurerm_resource_group.test.name}" 948 virtual_network_name = "${azurerm_virtual_network.test.name}" 949 address_prefix = "10.0.2.0/24" 950 } 951 952 resource "azurerm_storage_account" "test" { 953 name = "accsa%d" 954 resource_group_name = "${azurerm_resource_group.test.name}" 955 location = "southcentralus" 956 account_type = "Standard_LRS" 957 } 958 959 resource "azurerm_storage_container" "test" { 960 name = "vhds" 961 resource_group_name = "${azurerm_resource_group.test.name}" 962 storage_account_name = "${azurerm_storage_account.test.name}" 963 container_access_type = "private" 964 } 965 966 resource "azurerm_virtual_machine_scale_set" "test" { 967 name = "acctvmss-%d" 968 location = "southcentralus" 969 resource_group_name = "${azurerm_resource_group.test.name}" 970 upgrade_policy_mode = "Manual" 971 overprovision = false 972 973 sku { 974 name = "Standard_D1_v2" 975 tier = "Standard" 976 capacity = 1 977 } 978 979 os_profile { 980 computer_name_prefix = "testvm-%d" 981 admin_username = "myadmin" 982 admin_password = "Passwword1234" 983 } 984 985 network_profile { 986 name = "TestNetworkProfile" 987 primary = true 988 ip_configuration { 989 name = "TestIPConfiguration" 990 subnet_id = "${azurerm_subnet.test.id}" 991 } 992 } 993 994 storage_profile_os_disk { 995 name = "os-disk" 996 caching = "ReadWrite" 997 create_option = "FromImage" 998 vhd_containers = [ "${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}" ] 999 } 1000 1001 storage_profile_image_reference { 1002 publisher = "Canonical" 1003 offer = "UbuntuServer" 1004 sku = "16.04-LTS" 1005 version = "latest" 1006 } 1007 } 1008 ` 1009 1010 var testAccAzureRMVirtualMachineScaleSetExtensionTemplate = ` 1011 resource "azurerm_resource_group" "test" { 1012 name = "acctestrg-%d" 1013 location = "southcentralus" 1014 } 1015 1016 resource "azurerm_virtual_network" "test" { 1017 name = "acctvn-%d" 1018 address_space = ["10.0.0.0/16"] 1019 location = "southcentralus" 1020 resource_group_name = "${azurerm_resource_group.test.name}" 1021 } 1022 1023 resource "azurerm_subnet" "test" { 1024 name = "acctsub-%d" 1025 resource_group_name = "${azurerm_resource_group.test.name}" 1026 virtual_network_name = "${azurerm_virtual_network.test.name}" 1027 address_prefix = "10.0.2.0/24" 1028 } 1029 1030 resource "azurerm_storage_account" "test" { 1031 name = "accsa%d" 1032 resource_group_name = "${azurerm_resource_group.test.name}" 1033 location = "southcentralus" 1034 account_type = "Standard_LRS" 1035 } 1036 1037 resource "azurerm_storage_container" "test" { 1038 name = "vhds" 1039 resource_group_name = "${azurerm_resource_group.test.name}" 1040 storage_account_name = "${azurerm_storage_account.test.name}" 1041 container_access_type = "private" 1042 } 1043 1044 resource "azurerm_virtual_machine_scale_set" "test" { 1045 name = "acctvmss-%d" 1046 location = "southcentralus" 1047 resource_group_name = "${azurerm_resource_group.test.name}" 1048 upgrade_policy_mode = "Manual" 1049 overprovision = false 1050 1051 sku { 1052 name = "Standard_D1_v2" 1053 tier = "Standard" 1054 capacity = 1 1055 } 1056 1057 os_profile { 1058 computer_name_prefix = "testvm-%d" 1059 admin_username = "myadmin" 1060 admin_password = "Passwword1234" 1061 } 1062 1063 network_profile { 1064 name = "TestNetworkProfile" 1065 primary = true 1066 ip_configuration { 1067 name = "TestIPConfiguration" 1068 subnet_id = "${azurerm_subnet.test.id}" 1069 } 1070 } 1071 1072 storage_profile_os_disk { 1073 name = "os-disk" 1074 caching = "ReadWrite" 1075 create_option = "FromImage" 1076 vhd_containers = [ "${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}" ] 1077 } 1078 1079 storage_profile_image_reference { 1080 publisher = "Canonical" 1081 offer = "UbuntuServer" 1082 sku = "16.04-LTS" 1083 version = "latest" 1084 } 1085 1086 extension { 1087 name = "CustomScript" 1088 publisher = "Microsoft.Azure.Extensions" 1089 type = "CustomScript" 1090 type_handler_version = "2.0" 1091 auto_upgrade_minor_version = true 1092 settings = <<SETTINGS 1093 { 1094 "commandToExecute": "echo $HOSTNAME" 1095 } 1096 SETTINGS 1097 1098 protected_settings = <<SETTINGS 1099 { 1100 "storageAccountName": "${azurerm_storage_account.test.name}", 1101 "storageAccountKey": "${azurerm_storage_account.test.primary_access_key}" 1102 } 1103 SETTINGS 1104 } 1105 } 1106 ` 1107 1108 var testAccAzureRMVirtualMachineScaleSetMultipleExtensionsTemplate = ` 1109 resource "azurerm_resource_group" "test" { 1110 name = "acctestrg-%d" 1111 location = "southcentralus" 1112 } 1113 1114 resource "azurerm_virtual_network" "test" { 1115 name = "acctvn-%d" 1116 address_space = ["10.0.0.0/16"] 1117 location = "southcentralus" 1118 resource_group_name = "${azurerm_resource_group.test.name}" 1119 } 1120 1121 resource "azurerm_subnet" "test" { 1122 name = "acctsub-%d" 1123 resource_group_name = "${azurerm_resource_group.test.name}" 1124 virtual_network_name = "${azurerm_virtual_network.test.name}" 1125 address_prefix = "10.0.2.0/24" 1126 } 1127 1128 resource "azurerm_storage_account" "test" { 1129 name = "accsa%d" 1130 resource_group_name = "${azurerm_resource_group.test.name}" 1131 location = "southcentralus" 1132 account_type = "Standard_LRS" 1133 } 1134 1135 resource "azurerm_storage_container" "test" { 1136 name = "vhds" 1137 resource_group_name = "${azurerm_resource_group.test.name}" 1138 storage_account_name = "${azurerm_storage_account.test.name}" 1139 container_access_type = "private" 1140 } 1141 1142 resource "azurerm_virtual_machine_scale_set" "test" { 1143 name = "acctvmss-%d" 1144 location = "southcentralus" 1145 resource_group_name = "${azurerm_resource_group.test.name}" 1146 upgrade_policy_mode = "Manual" 1147 overprovision = false 1148 1149 sku { 1150 name = "Standard_D1_v2" 1151 tier = "Standard" 1152 capacity = 1 1153 } 1154 1155 os_profile { 1156 computer_name_prefix = "testvm-%d" 1157 admin_username = "myadmin" 1158 admin_password = "Passwword1234" 1159 } 1160 1161 network_profile { 1162 name = "TestNetworkProfile" 1163 primary = true 1164 ip_configuration { 1165 name = "TestIPConfiguration" 1166 subnet_id = "${azurerm_subnet.test.id}" 1167 } 1168 } 1169 1170 storage_profile_os_disk { 1171 name = "os-disk" 1172 caching = "ReadWrite" 1173 create_option = "FromImage" 1174 vhd_containers = [ "${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}" ] 1175 } 1176 1177 storage_profile_image_reference { 1178 publisher = "Canonical" 1179 offer = "UbuntuServer" 1180 sku = "16.04-LTS" 1181 version = "latest" 1182 } 1183 1184 extension { 1185 name = "CustomScript" 1186 publisher = "Microsoft.Azure.Extensions" 1187 type = "CustomScript" 1188 type_handler_version = "2.0" 1189 auto_upgrade_minor_version = true 1190 settings = <<SETTINGS 1191 { 1192 "commandToExecute": "echo $HOSTNAME" 1193 } 1194 SETTINGS 1195 1196 protected_settings = <<SETTINGS 1197 { 1198 "storageAccountName": "${azurerm_storage_account.test.name}", 1199 "storageAccountKey": "${azurerm_storage_account.test.primary_access_key}" 1200 } 1201 SETTINGS 1202 } 1203 1204 extension { 1205 name = "Docker" 1206 publisher = "Microsoft.Azure.Extensions" 1207 type = "DockerExtension" 1208 type_handler_version = "1.0" 1209 auto_upgrade_minor_version = true 1210 } 1211 } 1212 ` 1213 1214 var testAccAzureRMVirtualMachineScaleSet_osDiskTypeConflict = ` 1215 resource "azurerm_resource_group" "test" { 1216 name = "acctestRG-%d" 1217 location = "West US 2" 1218 } 1219 1220 resource "azurerm_virtual_network" "test" { 1221 name = "acctvn-%d" 1222 address_space = ["10.0.0.0/16"] 1223 location = "West US 2" 1224 resource_group_name = "${azurerm_resource_group.test.name}" 1225 } 1226 1227 resource "azurerm_subnet" "test" { 1228 name = "acctsub-%d" 1229 resource_group_name = "${azurerm_resource_group.test.name}" 1230 virtual_network_name = "${azurerm_virtual_network.test.name}" 1231 address_prefix = "10.0.2.0/24" 1232 } 1233 1234 resource "azurerm_network_interface" "test" { 1235 name = "acctni-%d" 1236 location = "West US 2" 1237 resource_group_name = "${azurerm_resource_group.test.name}" 1238 1239 ip_configuration { 1240 name = "testconfiguration1" 1241 subnet_id = "${azurerm_subnet.test.id}" 1242 private_ip_address_allocation = "dynamic" 1243 } 1244 } 1245 1246 resource "azurerm_virtual_machine_scale_set" "test" { 1247 name = "acctvmss-%d" 1248 location = "West US 2" 1249 resource_group_name = "${azurerm_resource_group.test.name}" 1250 upgrade_policy_mode = "Manual" 1251 1252 sku { 1253 name = "Standard_D1_v2" 1254 tier = "Standard" 1255 capacity = 2 1256 } 1257 1258 os_profile { 1259 computer_name_prefix = "testvm-%d" 1260 admin_username = "myadmin" 1261 admin_password = "Passwword1234" 1262 } 1263 1264 network_profile { 1265 name = "TestNetworkProfile-%d" 1266 primary = true 1267 ip_configuration { 1268 name = "TestIPConfiguration" 1269 subnet_id = "${azurerm_subnet.test.id}" 1270 } 1271 } 1272 1273 storage_profile_os_disk { 1274 name = "" 1275 caching = "ReadWrite" 1276 create_option = "FromImage" 1277 managed_disk_type = "Standard_LRS" 1278 vhd_containers = ["should_cause_conflict"] 1279 } 1280 1281 storage_profile_image_reference { 1282 publisher = "Canonical" 1283 offer = "UbuntuServer" 1284 sku = "16.04-LTS" 1285 version = "latest" 1286 } 1287 } 1288 `