[MS] provider/azurerm: Virtual Machine Scale Sets with managed disk support (#13717)
* added vmss with managed disk support * Update vmss docs * update vmss test * added vmss managed disk import test * update vmss tests * remove unused test resources * reverting breaking changes on storage_os_disk and storage_image_reference * updated vmss tests and documentation * updated vmss flatten osdisk * updated vmss resource and import test * update name in vmss osdisk * update vmss test to include a blank name * update vmss test to include a blank name
This commit is contained in:
parent
15a5a84cd1
commit
e0cd380814
|
@ -31,6 +31,29 @@ func TestAccAzureRMVirtualMachineScaleSet_importBasic(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestAccAzureRMVirtualMachineScaleSet_importBasic_managedDisk(t *testing.T) {
|
||||
resourceName := "azurerm_virtual_machine_scale_set.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccAzureRMVirtualMachineScaleSet_basicLinux_managedDisk, ri, ri, ri, ri, ri, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testCheckAzureRMVirtualMachineScaleSetDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccAzureRMVirtualMachineScaleSet_importLinux(t *testing.T) {
|
||||
resourceName := "azurerm_virtual_machine_scale_set.test"
|
||||
|
||||
|
|
|
@ -266,6 +266,14 @@ func resourceArmVirtualMachineScaleSet() *schema.Resource {
|
|||
Elem: &schema.Schema{Type: schema.TypeString},
|
||||
Set: schema.HashString,
|
||||
},
|
||||
|
||||
"load_balancer_inbound_nat_rules_ids": {
|
||||
Type: schema.TypeSet,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{Type: schema.TypeString},
|
||||
Set: schema.HashString,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -297,9 +305,21 @@ func resourceArmVirtualMachineScaleSet() *schema.Resource {
|
|||
Set: schema.HashString,
|
||||
},
|
||||
|
||||
"managed_disk_type": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
ConflictsWith: []string{"storage_profile_os_disk.vhd_containers"},
|
||||
ValidateFunc: validation.StringInSlice([]string{
|
||||
string(compute.PremiumLRS),
|
||||
string(compute.StandardLRS),
|
||||
}, true),
|
||||
},
|
||||
|
||||
"caching": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
},
|
||||
|
||||
"os_type": {
|
||||
|
@ -708,6 +728,14 @@ func flattenAzureRmVirtualMachineScaleSetNetworkProfile(profile *compute.Virtual
|
|||
config["load_balancer_backend_address_pool_ids"] = schema.NewSet(schema.HashString, addressPools)
|
||||
}
|
||||
|
||||
if properties.LoadBalancerInboundNatPools != nil {
|
||||
inboundNatPools := make([]interface{}, 0, len(*properties.LoadBalancerInboundNatPools))
|
||||
for _, rule := range *properties.LoadBalancerInboundNatPools {
|
||||
inboundNatPools = append(inboundNatPools, *rule.ID)
|
||||
}
|
||||
config["load_balancer_inbound_nat_rules_ids"] = schema.NewSet(schema.HashString, inboundNatPools)
|
||||
}
|
||||
|
||||
ipConfigs = append(ipConfigs, config)
|
||||
}
|
||||
|
||||
|
@ -735,7 +763,11 @@ func flattenAzureRMVirtualMachineScaleSetOsProfile(profile *compute.VirtualMachi
|
|||
|
||||
func flattenAzureRmVirtualMachineScaleSetStorageProfileOSDisk(profile *compute.VirtualMachineScaleSetOSDisk) []interface{} {
|
||||
result := make(map[string]interface{})
|
||||
|
||||
if profile.Name != nil {
|
||||
result["name"] = *profile.Name
|
||||
}
|
||||
|
||||
if profile.Image != nil {
|
||||
result["image"] = *profile.Image.URI
|
||||
}
|
||||
|
@ -748,6 +780,10 @@ func flattenAzureRmVirtualMachineScaleSetStorageProfileOSDisk(profile *compute.V
|
|||
result["vhd_containers"] = schema.NewSet(schema.HashString, containers)
|
||||
}
|
||||
|
||||
if profile.ManagedDisk != nil {
|
||||
result["managed_disk_type"] = string(profile.ManagedDisk.StorageAccountType)
|
||||
}
|
||||
|
||||
result["caching"] = profile.Caching
|
||||
result["create_option"] = profile.CreateOption
|
||||
result["os_type"] = profile.OsType
|
||||
|
@ -838,8 +874,8 @@ func resourceArmVirtualMachineScaleSetStorageProfileOsDiskHash(v interface{}) in
|
|||
m := v.(map[string]interface{})
|
||||
buf.WriteString(fmt.Sprintf("%s-", m["name"].(string)))
|
||||
|
||||
if m["image"] != nil {
|
||||
buf.WriteString(fmt.Sprintf("%s-", m["image"].(string)))
|
||||
if m["vhd_containers"] != nil {
|
||||
buf.WriteString(fmt.Sprintf("%s-", m["vhd_containers"].(*schema.Set).List()))
|
||||
}
|
||||
|
||||
return hashcode.String(buf.String())
|
||||
|
@ -961,6 +997,18 @@ func expandAzureRmVirtualMachineScaleSetNetworkProfile(d *schema.ResourceData) *
|
|||
ipConfiguration.LoadBalancerBackendAddressPools = &resources
|
||||
}
|
||||
|
||||
if v := ipconfig["load_balancer_inbound_nat_rules_ids"]; v != nil {
|
||||
rules := v.(*schema.Set).List()
|
||||
rulesResources := make([]compute.SubResource, 0, len(rules))
|
||||
for _, m := range rules {
|
||||
id := m.(string)
|
||||
rulesResources = append(rulesResources, compute.SubResource{
|
||||
ID: &id,
|
||||
})
|
||||
}
|
||||
ipConfiguration.LoadBalancerInboundNatPools = &rulesResources
|
||||
}
|
||||
|
||||
ipConfigurations = append(ipConfigurations, ipConfiguration)
|
||||
}
|
||||
|
||||
|
@ -1037,9 +1085,11 @@ func expandAzureRMVirtualMachineScaleSetsStorageProfileOsDisk(d *schema.Resource
|
|||
osDiskConfig := osDiskConfigs[0].(map[string]interface{})
|
||||
name := osDiskConfig["name"].(string)
|
||||
image := osDiskConfig["image"].(string)
|
||||
vhd_containers := osDiskConfig["vhd_containers"].(*schema.Set).List()
|
||||
caching := osDiskConfig["caching"].(string)
|
||||
osType := osDiskConfig["os_type"].(string)
|
||||
createOption := osDiskConfig["create_option"].(string)
|
||||
managedDiskType := osDiskConfig["managed_disk_type"].(string)
|
||||
|
||||
osDisk := &compute.VirtualMachineScaleSetOSDisk{
|
||||
Name: &name,
|
||||
|
@ -1052,18 +1102,40 @@ func expandAzureRMVirtualMachineScaleSetsStorageProfileOsDisk(d *schema.Resource
|
|||
osDisk.Image = &compute.VirtualHardDisk{
|
||||
URI: &image,
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
if len(vhd_containers) > 0 {
|
||||
var vhdContainers []string
|
||||
containers := osDiskConfig["vhd_containers"].(*schema.Set).List()
|
||||
for _, v := range containers {
|
||||
for _, v := range vhd_containers {
|
||||
str := v.(string)
|
||||
vhdContainers = append(vhdContainers, str)
|
||||
}
|
||||
osDisk.VhdContainers = &vhdContainers
|
||||
}
|
||||
|
||||
return osDisk, nil
|
||||
managedDisk := &compute.VirtualMachineScaleSetManagedDiskParameters{}
|
||||
|
||||
if managedDiskType != "" {
|
||||
if name == "" {
|
||||
osDisk.Name = nil
|
||||
managedDisk.StorageAccountType = compute.StorageAccountTypes(managedDiskType)
|
||||
osDisk.ManagedDisk = managedDisk
|
||||
} else {
|
||||
return nil, fmt.Errorf("[ERROR] Conflict between `name` and `managed_disk_type` (please set name to blank)")
|
||||
}
|
||||
}
|
||||
|
||||
//BEGIN: code to be removed after GH-13016 is merged
|
||||
if image != "" && managedDiskType != "" {
|
||||
return nil, fmt.Errorf("[ERROR] Conflict between `image` and `managed_disk_type` (only one or the other can be used)")
|
||||
}
|
||||
|
||||
if len(vhd_containers) > 0 && managedDiskType != "" {
|
||||
return nil, fmt.Errorf("[ERROR] Conflict between `vhd_containers` and `managed_disk_type` (only one or the other can be used)")
|
||||
}
|
||||
//END: code to be removed after GH-13016 is merged
|
||||
|
||||
return osDisk, nil
|
||||
}
|
||||
|
||||
func expandAzureRmVirtualMachineScaleSetStorageProfileImageReference(d *schema.ResourceData) (*compute.ImageReference, error) {
|
||||
|
@ -1137,22 +1209,22 @@ func expandAzureRmVirtualMachineScaleSetOsProfileWindowsConfig(d *schema.Resourc
|
|||
if v := osProfileConfig["winrm"]; v != nil {
|
||||
winRm := v.(*schema.Set).List()
|
||||
if len(winRm) > 0 {
|
||||
winRmListners := make([]compute.WinRMListener, 0, len(winRm))
|
||||
winRmListeners := make([]compute.WinRMListener, 0, len(winRm))
|
||||
for _, winRmConfig := range winRm {
|
||||
config := winRmConfig.(map[string]interface{})
|
||||
|
||||
protocol := config["protocol"].(string)
|
||||
winRmListner := compute.WinRMListener{
|
||||
winRmListener := compute.WinRMListener{
|
||||
Protocol: compute.ProtocolTypes(protocol),
|
||||
}
|
||||
if v := config["certificate_url"].(string); v != "" {
|
||||
winRmListner.CertificateURL = &v
|
||||
winRmListener.CertificateURL = &v
|
||||
}
|
||||
|
||||
winRmListners = append(winRmListners, winRmListner)
|
||||
winRmListeners = append(winRmListeners, winRmListener)
|
||||
}
|
||||
config.WinRM = &compute.WinRMConfiguration{
|
||||
Listeners: &winRmListners,
|
||||
Listeners: &winRmListeners,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package azurerm
|
|||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
|
@ -55,6 +56,24 @@ func TestAccAzureRMVirtualMachineScaleSet_linuxUpdated(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestAccAzureRMVirtualMachineScaleSet_basicLinux_managedDisk(t *testing.T) {
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccAzureRMVirtualMachineScaleSet_basicLinux_managedDisk, ri, ri, ri, ri, ri, ri)
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testCheckAzureRMVirtualMachineScaleSetDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testCheckAzureRMVirtualMachineScaleSetExists("azurerm_virtual_machine_scale_set.test"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccAzureRMVirtualMachineScaleSet_basicLinux_disappears(t *testing.T) {
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccAzureRMVirtualMachineScaleSet_basic, ri, ri, ri, ri, ri, ri, ri, ri)
|
||||
|
@ -151,6 +170,24 @@ func TestAccAzureRMVirtualMachineScaleSet_multipleExtensions(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestAccAzureRMVirtualMachineScaleSet_osDiskTypeConflict(t *testing.T) {
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccAzureRMVirtualMachineScaleSet_osDiskTypeConflict, ri, ri, ri, ri, ri, ri, ri)
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testCheckAzureRMVirtualMachineScaleSetDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
ExpectError: regexp.MustCompile("Conflict between `vhd_containers`"),
|
||||
//Use below code instead once GH-13019 has been merged
|
||||
//ExpectError: regexp.MustCompile("conflicts with storage_profile_os_disk.0.vhd_containers"),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testCheckAzureRMVirtualMachineScaleSetExists(name string) resource.TestCheckFunc {
|
||||
return func(s *terraform.State) error {
|
||||
// Ensure we have enough information in state to look up in API
|
||||
|
@ -341,13 +378,13 @@ func testCheckAzureRMVirtualMachineScaleSetExtension(name string) resource.TestC
|
|||
var testAccAzureRMVirtualMachineScaleSet_basic = `
|
||||
resource "azurerm_resource_group" "test" {
|
||||
name = "acctestRG-%d"
|
||||
location = "West US"
|
||||
location = "West US 2"
|
||||
}
|
||||
|
||||
resource "azurerm_virtual_network" "test" {
|
||||
name = "acctvn-%d"
|
||||
address_space = ["10.0.0.0/16"]
|
||||
location = "West US"
|
||||
location = "West US 2"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
}
|
||||
|
||||
|
@ -360,7 +397,7 @@ resource "azurerm_subnet" "test" {
|
|||
|
||||
resource "azurerm_network_interface" "test" {
|
||||
name = "acctni-%d"
|
||||
location = "West US"
|
||||
location = "West US 2"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
|
||||
ip_configuration {
|
||||
|
@ -373,7 +410,7 @@ resource "azurerm_network_interface" "test" {
|
|||
resource "azurerm_storage_account" "test" {
|
||||
name = "accsa%d"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
location = "westus"
|
||||
location = "West US 2"
|
||||
account_type = "Standard_LRS"
|
||||
|
||||
tags {
|
||||
|
@ -390,12 +427,12 @@ resource "azurerm_storage_container" "test" {
|
|||
|
||||
resource "azurerm_virtual_machine_scale_set" "test" {
|
||||
name = "acctvmss-%d"
|
||||
location = "West US"
|
||||
location = "West US 2"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
upgrade_policy_mode = "Manual"
|
||||
|
||||
sku {
|
||||
name = "Standard_A0"
|
||||
name = "Standard_D1_v2"
|
||||
tier = "Standard"
|
||||
capacity = 2
|
||||
}
|
||||
|
@ -409,7 +446,6 @@ resource "azurerm_virtual_machine_scale_set" "test" {
|
|||
network_profile {
|
||||
name = "TestNetworkProfile-%d"
|
||||
primary = true
|
||||
|
||||
ip_configuration {
|
||||
name = "TestIPConfiguration"
|
||||
subnet_id = "${azurerm_subnet.test.id}"
|
||||
|
@ -426,7 +462,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {
|
|||
storage_profile_image_reference {
|
||||
publisher = "Canonical"
|
||||
offer = "UbuntuServer"
|
||||
sku = "14.04.2-LTS"
|
||||
sku = "16.04-LTS"
|
||||
version = "latest"
|
||||
}
|
||||
}
|
||||
|
@ -438,98 +474,82 @@ func testAccAzureRMVirtualMachineScaleSet_linux(rInt int) string {
|
|||
name = "acctestrg-%d"
|
||||
location = "West Europe"
|
||||
}
|
||||
|
||||
resource "azurerm_virtual_network" "test" {
|
||||
name = "acctestvn-%d"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
location = "${azurerm_resource_group.test.location}"
|
||||
address_space = ["10.0.0.0/8"]
|
||||
}
|
||||
|
||||
resource "azurerm_subnet" "test" {
|
||||
name = "acctestsn-%d"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
virtual_network_name = "${azurerm_virtual_network.test.name}"
|
||||
address_prefix = "10.0.1.0/24"
|
||||
}
|
||||
|
||||
resource "azurerm_storage_account" "test" {
|
||||
name = "accsa%d"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
location = "${azurerm_resource_group.test.location}"
|
||||
account_type = "Standard_LRS"
|
||||
}
|
||||
|
||||
resource "azurerm_storage_container" "test" {
|
||||
name = "acctestsc-%d"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
storage_account_name = "${azurerm_storage_account.test.name}"
|
||||
container_access_type = "private"
|
||||
}
|
||||
|
||||
resource "azurerm_public_ip" "test" {
|
||||
name = "acctestpip-%d"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
location = "${azurerm_resource_group.test.location}"
|
||||
public_ip_address_allocation = "static"
|
||||
}
|
||||
|
||||
resource "azurerm_lb" "test" {
|
||||
name = "acctestlb-%d"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
location = "${azurerm_resource_group.test.location}"
|
||||
|
||||
frontend_ip_configuration {
|
||||
name = "ip-address"
|
||||
public_ip_address_id = "${azurerm_public_ip.test.id}"
|
||||
}
|
||||
}
|
||||
|
||||
resource "azurerm_lb_backend_address_pool" "test" {
|
||||
name = "acctestbap-%d"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
loadbalancer_id = "${azurerm_lb.test.id}"
|
||||
}
|
||||
|
||||
resource "azurerm_virtual_machine_scale_set" "test" {
|
||||
name = "acctestvmss-%d"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
location = "${azurerm_resource_group.test.location}"
|
||||
upgrade_policy_mode = "Automatic"
|
||||
|
||||
sku {
|
||||
name = "Standard_A0"
|
||||
tier = "Standard"
|
||||
capacity = "1"
|
||||
}
|
||||
|
||||
os_profile {
|
||||
computer_name_prefix = "prefix"
|
||||
admin_username = "ubuntu"
|
||||
admin_password = "password"
|
||||
custom_data = "custom data!"
|
||||
}
|
||||
|
||||
os_profile_linux_config {
|
||||
disable_password_authentication = true
|
||||
|
||||
ssh_keys {
|
||||
path = "/home/ubuntu/.ssh/authorized_keys"
|
||||
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"
|
||||
}
|
||||
}
|
||||
|
||||
network_profile {
|
||||
name = "TestNetworkProfile"
|
||||
primary = true
|
||||
|
||||
ip_configuration {
|
||||
name = "TestIPConfiguration"
|
||||
subnet_id = "${azurerm_subnet.test.id}"
|
||||
load_balancer_backend_address_pool_ids = ["${azurerm_lb_backend_address_pool.test.id}"]
|
||||
}
|
||||
}
|
||||
|
||||
storage_profile_os_disk {
|
||||
name = "osDiskProfile"
|
||||
caching = "ReadWrite"
|
||||
|
@ -537,7 +557,6 @@ resource "azurerm_virtual_machine_scale_set" "test" {
|
|||
os_type = "linux"
|
||||
vhd_containers = ["${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}"]
|
||||
}
|
||||
|
||||
storage_profile_image_reference {
|
||||
publisher = "Canonical"
|
||||
offer = "UbuntuServer"
|
||||
|
@ -545,7 +564,6 @@ resource "azurerm_virtual_machine_scale_set" "test" {
|
|||
version = "latest"
|
||||
}
|
||||
}
|
||||
|
||||
`, rInt, rInt, rInt, rInt, rInt, rInt, rInt, rInt, rInt)
|
||||
}
|
||||
|
||||
|
@ -555,98 +573,82 @@ func testAccAzureRMVirtualMachineScaleSet_linuxUpdated(rInt int) string {
|
|||
name = "acctestrg-%d"
|
||||
location = "West Europe"
|
||||
}
|
||||
|
||||
resource "azurerm_virtual_network" "test" {
|
||||
name = "acctestvn-%d"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
location = "${azurerm_resource_group.test.location}"
|
||||
address_space = ["10.0.0.0/8"]
|
||||
}
|
||||
|
||||
resource "azurerm_subnet" "test" {
|
||||
name = "acctestsn-%d"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
virtual_network_name = "${azurerm_virtual_network.test.name}"
|
||||
address_prefix = "10.0.1.0/24"
|
||||
}
|
||||
|
||||
resource "azurerm_storage_account" "test" {
|
||||
name = "accsa%d"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
location = "${azurerm_resource_group.test.location}"
|
||||
account_type = "Standard_LRS"
|
||||
}
|
||||
|
||||
resource "azurerm_storage_container" "test" {
|
||||
name = "acctestsc-%d"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
storage_account_name = "${azurerm_storage_account.test.name}"
|
||||
container_access_type = "private"
|
||||
}
|
||||
|
||||
resource "azurerm_public_ip" "test" {
|
||||
name = "acctestpip-%d"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
location = "${azurerm_resource_group.test.location}"
|
||||
public_ip_address_allocation = "static"
|
||||
}
|
||||
|
||||
resource "azurerm_lb" "test" {
|
||||
name = "acctestlb-%d"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
location = "${azurerm_resource_group.test.location}"
|
||||
|
||||
frontend_ip_configuration {
|
||||
name = "ip-address"
|
||||
public_ip_address_id = "${azurerm_public_ip.test.id}"
|
||||
}
|
||||
}
|
||||
|
||||
resource "azurerm_lb_backend_address_pool" "test" {
|
||||
name = "acctestbap-%d"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
loadbalancer_id = "${azurerm_lb.test.id}"
|
||||
}
|
||||
|
||||
resource "azurerm_virtual_machine_scale_set" "test" {
|
||||
name = "acctestvmss-%d"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
location = "${azurerm_resource_group.test.location}"
|
||||
upgrade_policy_mode = "Automatic"
|
||||
|
||||
sku {
|
||||
name = "Standard_A0"
|
||||
tier = "Standard"
|
||||
capacity = "1"
|
||||
}
|
||||
|
||||
os_profile {
|
||||
computer_name_prefix = "prefix"
|
||||
admin_username = "ubuntu"
|
||||
admin_password = "password"
|
||||
custom_data = "custom data!"
|
||||
}
|
||||
|
||||
os_profile_linux_config {
|
||||
disable_password_authentication = true
|
||||
|
||||
ssh_keys {
|
||||
path = "/home/ubuntu/.ssh/authorized_keys"
|
||||
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"
|
||||
}
|
||||
}
|
||||
|
||||
network_profile {
|
||||
name = "TestNetworkProfile"
|
||||
primary = true
|
||||
|
||||
ip_configuration {
|
||||
name = "TestIPConfiguration"
|
||||
subnet_id = "${azurerm_subnet.test.id}"
|
||||
load_balancer_backend_address_pool_ids = ["${azurerm_lb_backend_address_pool.test.id}"]
|
||||
}
|
||||
}
|
||||
|
||||
storage_profile_os_disk {
|
||||
name = "osDiskProfile"
|
||||
caching = "ReadWrite"
|
||||
|
@ -654,22 +656,82 @@ resource "azurerm_virtual_machine_scale_set" "test" {
|
|||
os_type = "linux"
|
||||
vhd_containers = ["${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}"]
|
||||
}
|
||||
|
||||
storage_profile_image_reference {
|
||||
publisher = "Canonical"
|
||||
offer = "UbuntuServer"
|
||||
sku = "14.04.2-LTS"
|
||||
version = "latest"
|
||||
}
|
||||
|
||||
tags {
|
||||
ThisIs = "a test"
|
||||
}
|
||||
}
|
||||
|
||||
`, rInt, rInt, rInt, rInt, rInt, rInt, rInt, rInt, rInt)
|
||||
}
|
||||
|
||||
var testAccAzureRMVirtualMachineScaleSet_basicLinux_managedDisk = `
|
||||
resource "azurerm_resource_group" "test" {
|
||||
name = "acctestRG-%d"
|
||||
location = "West US 2"
|
||||
}
|
||||
|
||||
resource "azurerm_virtual_network" "test" {
|
||||
name = "acctvn-%d"
|
||||
address_space = ["10.0.0.0/16"]
|
||||
location = "West US 2"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
}
|
||||
|
||||
resource "azurerm_subnet" "test" {
|
||||
name = "acctsub-%d"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
virtual_network_name = "${azurerm_virtual_network.test.name}"
|
||||
address_prefix = "10.0.2.0/24"
|
||||
}
|
||||
|
||||
resource "azurerm_virtual_machine_scale_set" "test" {
|
||||
name = "acctvmss-%d"
|
||||
location = "West US 2"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
upgrade_policy_mode = "Manual"
|
||||
|
||||
sku {
|
||||
name = "Standard_D1_v2"
|
||||
tier = "Standard"
|
||||
capacity = 2
|
||||
}
|
||||
|
||||
os_profile {
|
||||
computer_name_prefix = "testvm-%d"
|
||||
admin_username = "myadmin"
|
||||
admin_password = "Passwword1234"
|
||||
}
|
||||
|
||||
network_profile {
|
||||
name = "TestNetworkProfile-%d"
|
||||
primary = true
|
||||
ip_configuration {
|
||||
name = "TestIPConfiguration"
|
||||
subnet_id = "${azurerm_subnet.test.id}"
|
||||
}
|
||||
}
|
||||
|
||||
storage_profile_os_disk {
|
||||
name = ""
|
||||
caching = "ReadWrite"
|
||||
create_option = "FromImage"
|
||||
managed_disk_type = "Standard_LRS"
|
||||
}
|
||||
|
||||
storage_profile_image_reference {
|
||||
publisher = "Canonical"
|
||||
offer = "UbuntuServer"
|
||||
sku = "16.04-LTS"
|
||||
version = "latest"
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
var testAccAzureRMVirtualMachineScaleSetLoadbalancerTemplate = `
|
||||
resource "azurerm_resource_group" "test" {
|
||||
name = "acctestrg-%d"
|
||||
|
@ -723,6 +785,17 @@ resource "azurerm_lb_backend_address_pool" "test" {
|
|||
loadbalancer_id = "${azurerm_lb.test.id}"
|
||||
}
|
||||
|
||||
resource "azurerm_lb_nat_pool" "test" {
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
name = "ssh"
|
||||
loadbalancer_id = "${azurerm_lb.test.id}"
|
||||
protocol = "Tcp"
|
||||
frontend_port_start = 50000
|
||||
frontend_port_end = 50119
|
||||
backend_port = 22
|
||||
frontend_ip_configuration_name = "default"
|
||||
}
|
||||
|
||||
resource "azurerm_virtual_machine_scale_set" "test" {
|
||||
name = "acctvmss-%d"
|
||||
location = "southcentralus"
|
||||
|
@ -730,7 +803,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {
|
|||
upgrade_policy_mode = "Manual"
|
||||
|
||||
sku {
|
||||
name = "Standard_A0"
|
||||
name = "Standard_D1_v2"
|
||||
tier = "Standard"
|
||||
capacity = 1
|
||||
}
|
||||
|
@ -744,11 +817,11 @@ resource "azurerm_virtual_machine_scale_set" "test" {
|
|||
network_profile {
|
||||
name = "TestNetworkProfile"
|
||||
primary = true
|
||||
|
||||
ip_configuration {
|
||||
name = "TestIPConfiguration"
|
||||
subnet_id = "${azurerm_subnet.test.id}"
|
||||
load_balancer_backend_address_pool_ids = ["${azurerm_lb_backend_address_pool.test.id}"]
|
||||
load_balancer_backend_address_pool_ids = [ "${azurerm_lb_backend_address_pool.test.id}" ]
|
||||
load_balancer_inbound_nat_rules_ids = ["${azurerm_lb_nat_pool.test.id}"]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -756,13 +829,13 @@ resource "azurerm_virtual_machine_scale_set" "test" {
|
|||
name = "os-disk"
|
||||
caching = "ReadWrite"
|
||||
create_option = "FromImage"
|
||||
vhd_containers = ["${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}"]
|
||||
vhd_containers = [ "${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}" ]
|
||||
}
|
||||
|
||||
storage_profile_image_reference {
|
||||
publisher = "Canonical"
|
||||
offer = "UbuntuServer"
|
||||
sku = "14.04.2-LTS"
|
||||
sku = "16.04-LTS"
|
||||
version = "latest"
|
||||
}
|
||||
}
|
||||
|
@ -810,7 +883,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {
|
|||
overprovision = false
|
||||
|
||||
sku {
|
||||
name = "Standard_A0"
|
||||
name = "Standard_D1_v2"
|
||||
tier = "Standard"
|
||||
capacity = 1
|
||||
}
|
||||
|
@ -824,7 +897,6 @@ resource "azurerm_virtual_machine_scale_set" "test" {
|
|||
network_profile {
|
||||
name = "TestNetworkProfile"
|
||||
primary = true
|
||||
|
||||
ip_configuration {
|
||||
name = "TestIPConfiguration"
|
||||
subnet_id = "${azurerm_subnet.test.id}"
|
||||
|
@ -835,13 +907,13 @@ resource "azurerm_virtual_machine_scale_set" "test" {
|
|||
name = "os-disk"
|
||||
caching = "ReadWrite"
|
||||
create_option = "FromImage"
|
||||
vhd_containers = ["${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}"]
|
||||
vhd_containers = [ "${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}" ]
|
||||
}
|
||||
|
||||
storage_profile_image_reference {
|
||||
publisher = "Canonical"
|
||||
offer = "UbuntuServer"
|
||||
sku = "14.04.2-LTS"
|
||||
sku = "16.04-LTS"
|
||||
version = "latest"
|
||||
}
|
||||
}
|
||||
|
@ -889,7 +961,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {
|
|||
overprovision = false
|
||||
|
||||
sku {
|
||||
name = "Standard_A0"
|
||||
name = "Standard_D1_v2"
|
||||
tier = "Standard"
|
||||
capacity = 1
|
||||
}
|
||||
|
@ -903,7 +975,6 @@ resource "azurerm_virtual_machine_scale_set" "test" {
|
|||
network_profile {
|
||||
name = "TestNetworkProfile"
|
||||
primary = true
|
||||
|
||||
ip_configuration {
|
||||
name = "TestIPConfiguration"
|
||||
subnet_id = "${azurerm_subnet.test.id}"
|
||||
|
@ -914,13 +985,13 @@ resource "azurerm_virtual_machine_scale_set" "test" {
|
|||
name = "os-disk"
|
||||
caching = "ReadWrite"
|
||||
create_option = "FromImage"
|
||||
vhd_containers = ["${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}"]
|
||||
vhd_containers = [ "${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}" ]
|
||||
}
|
||||
|
||||
storage_profile_image_reference {
|
||||
publisher = "Canonical"
|
||||
offer = "UbuntuServer"
|
||||
sku = "14.04.2-LTS"
|
||||
sku = "16.04-LTS"
|
||||
version = "latest"
|
||||
}
|
||||
|
||||
|
@ -930,7 +1001,6 @@ resource "azurerm_virtual_machine_scale_set" "test" {
|
|||
type = "CustomScript"
|
||||
type_handler_version = "2.0"
|
||||
auto_upgrade_minor_version = true
|
||||
|
||||
settings = <<SETTINGS
|
||||
{
|
||||
"commandToExecute": "echo $HOSTNAME"
|
||||
|
@ -945,7 +1015,6 @@ SETTINGS
|
|||
SETTINGS
|
||||
}
|
||||
}
|
||||
|
||||
`
|
||||
|
||||
var testAccAzureRMVirtualMachineScaleSetMultipleExtensionsTemplate = `
|
||||
|
@ -990,7 +1059,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {
|
|||
overprovision = false
|
||||
|
||||
sku {
|
||||
name = "Standard_A0"
|
||||
name = "Standard_D1_v2"
|
||||
tier = "Standard"
|
||||
capacity = 1
|
||||
}
|
||||
|
@ -1004,7 +1073,6 @@ resource "azurerm_virtual_machine_scale_set" "test" {
|
|||
network_profile {
|
||||
name = "TestNetworkProfile"
|
||||
primary = true
|
||||
|
||||
ip_configuration {
|
||||
name = "TestIPConfiguration"
|
||||
subnet_id = "${azurerm_subnet.test.id}"
|
||||
|
@ -1015,13 +1083,13 @@ resource "azurerm_virtual_machine_scale_set" "test" {
|
|||
name = "os-disk"
|
||||
caching = "ReadWrite"
|
||||
create_option = "FromImage"
|
||||
vhd_containers = ["${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}"]
|
||||
vhd_containers = [ "${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}" ]
|
||||
}
|
||||
|
||||
storage_profile_image_reference {
|
||||
publisher = "Canonical"
|
||||
offer = "UbuntuServer"
|
||||
sku = "14.04.2-LTS"
|
||||
sku = "16.04-LTS"
|
||||
version = "latest"
|
||||
}
|
||||
|
||||
|
@ -1031,7 +1099,6 @@ resource "azurerm_virtual_machine_scale_set" "test" {
|
|||
type = "CustomScript"
|
||||
type_handler_version = "2.0"
|
||||
auto_upgrade_minor_version = true
|
||||
|
||||
settings = <<SETTINGS
|
||||
{
|
||||
"commandToExecute": "echo $HOSTNAME"
|
||||
|
@ -1055,3 +1122,79 @@ SETTINGS
|
|||
}
|
||||
}
|
||||
`
|
||||
|
||||
var testAccAzureRMVirtualMachineScaleSet_osDiskTypeConflict = `
|
||||
resource "azurerm_resource_group" "test" {
|
||||
name = "acctestRG-%d"
|
||||
location = "West US 2"
|
||||
}
|
||||
|
||||
resource "azurerm_virtual_network" "test" {
|
||||
name = "acctvn-%d"
|
||||
address_space = ["10.0.0.0/16"]
|
||||
location = "West US 2"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
}
|
||||
|
||||
resource "azurerm_subnet" "test" {
|
||||
name = "acctsub-%d"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
virtual_network_name = "${azurerm_virtual_network.test.name}"
|
||||
address_prefix = "10.0.2.0/24"
|
||||
}
|
||||
|
||||
resource "azurerm_network_interface" "test" {
|
||||
name = "acctni-%d"
|
||||
location = "West US 2"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
|
||||
ip_configuration {
|
||||
name = "testconfiguration1"
|
||||
subnet_id = "${azurerm_subnet.test.id}"
|
||||
private_ip_address_allocation = "dynamic"
|
||||
}
|
||||
}
|
||||
|
||||
resource "azurerm_virtual_machine_scale_set" "test" {
|
||||
name = "acctvmss-%d"
|
||||
location = "West US 2"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
upgrade_policy_mode = "Manual"
|
||||
|
||||
sku {
|
||||
name = "Standard_D1_v2"
|
||||
tier = "Standard"
|
||||
capacity = 2
|
||||
}
|
||||
|
||||
os_profile {
|
||||
computer_name_prefix = "testvm-%d"
|
||||
admin_username = "myadmin"
|
||||
admin_password = "Passwword1234"
|
||||
}
|
||||
|
||||
network_profile {
|
||||
name = "TestNetworkProfile-%d"
|
||||
primary = true
|
||||
ip_configuration {
|
||||
name = "TestIPConfiguration"
|
||||
subnet_id = "${azurerm_subnet.test.id}"
|
||||
}
|
||||
}
|
||||
|
||||
storage_profile_os_disk {
|
||||
name = ""
|
||||
caching = "ReadWrite"
|
||||
create_option = "FromImage"
|
||||
managed_disk_type = "Standard_LRS"
|
||||
vhd_containers = ["should_cause_conflict"]
|
||||
}
|
||||
|
||||
storage_profile_image_reference {
|
||||
publisher = "Canonical"
|
||||
offer = "UbuntuServer"
|
||||
sku = "16.04-LTS"
|
||||
version = "latest"
|
||||
}
|
||||
}
|
||||
`
|
||||
|
|
|
@ -6,12 +6,13 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
"regexp"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/arm/compute"
|
||||
"github.com/Azure/azure-sdk-for-go/arm/disk"
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
func TestAccAzureRMVirtualMachine_basicLinuxMachine(t *testing.T) {
|
||||
|
|
|
@ -106,6 +106,128 @@ resource "azurerm_virtual_machine_scale_set" "test" {
|
|||
}
|
||||
```
|
||||
|
||||
## Example Usage with Managed Disks
|
||||
|
||||
```
|
||||
resource "azurerm_resource_group" "test" {
|
||||
name = "acctestrg"
|
||||
location = "West US 2"
|
||||
}
|
||||
|
||||
resource "azurerm_virtual_network" "test" {
|
||||
name = "acctvn"
|
||||
address_space = ["10.0.0.0/16"]
|
||||
location = "West US 2"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
}
|
||||
|
||||
resource "azurerm_subnet" "test" {
|
||||
name = "acctsub"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
virtual_network_name = "${azurerm_virtual_network.test.name}"
|
||||
address_prefix = "10.0.2.0/24"
|
||||
}
|
||||
|
||||
resource "azurerm_public_ip" "test" {
|
||||
name = "test"
|
||||
location = "West US 2"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
public_ip_address_allocation = "static"
|
||||
domain_name_label = "${azurerm_resource_group.test.name}"
|
||||
|
||||
tags {
|
||||
environment = "staging"
|
||||
}
|
||||
}
|
||||
|
||||
resource "azurerm_lb" "test" {
|
||||
name = "test"
|
||||
location = "West US 2"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
|
||||
frontend_ip_configuration {
|
||||
name = "PublicIPAddress"
|
||||
public_ip_address_id = "${azurerm_public_ip.test.id}"
|
||||
}
|
||||
}
|
||||
|
||||
resource "azurerm_lb_backend_address_pool" "bpepool" {
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
loadbalancer_id = "${azurerm_lb.test.id}"
|
||||
name = "BackEndAddressPool"
|
||||
}
|
||||
|
||||
resource "azurerm_lb_nat_pool" "lbnatpool" {
|
||||
count = 3
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
name = "ssh"
|
||||
loadbalancer_id = "${azurerm_lb.test.id}"
|
||||
protocol = "Tcp"
|
||||
frontend_port_start = 50000
|
||||
frontend_port_end = 50119
|
||||
backend_port = 22
|
||||
frontend_ip_configuration_name = "PublicIPAddress"
|
||||
}
|
||||
|
||||
resource "azurerm_virtual_machine_scale_set" "test" {
|
||||
name = "mytestscaleset-1"
|
||||
location = "West US 2"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
upgrade_policy_mode = "Manual"
|
||||
|
||||
sku {
|
||||
name = "Standard_A0"
|
||||
tier = "Standard"
|
||||
capacity = 2
|
||||
}
|
||||
|
||||
storage_profile_image_reference {
|
||||
publisher = "Canonical"
|
||||
offer = "UbuntuServer"
|
||||
sku = "14.04.2-LTS"
|
||||
version = "latest"
|
||||
}
|
||||
|
||||
storage_profile_os_disk {
|
||||
name = "myosdisk"
|
||||
caching = "ReadWrite"
|
||||
create_option = "FromImage"
|
||||
managed_disk_type = "Standard_LRS"
|
||||
}
|
||||
|
||||
os_profile {
|
||||
computer_name_prefix = "testvm"
|
||||
admin_username = "myadmin"
|
||||
admin_password = "Passwword1234"
|
||||
}
|
||||
|
||||
os_profile_linux_config {
|
||||
disable_password_authentication = true
|
||||
|
||||
ssh_keys {
|
||||
path = "/home/myadmin/.ssh/authorized_keys"
|
||||
key_data = "${file("~/.ssh/demo_key.pub")}"
|
||||
}
|
||||
}
|
||||
|
||||
network_profile {
|
||||
name = "terraformnetworkprofile"
|
||||
primary = true
|
||||
|
||||
ip_configuration {
|
||||
name = "TestIPConfiguration"
|
||||
subnet_id = "${azurerm_subnet.test.id}"
|
||||
load_balancer_backend_address_pool_ids = ["${azurerm_lb_backend_address_pool.bpepool.id}"]
|
||||
load_balancer_inbound_nat_rules_ids = ["${element(azurerm_lb_nat_pool.lbnatpool.*.id, count.index)}"]
|
||||
}
|
||||
}
|
||||
|
||||
tags {
|
||||
environment = "staging"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Argument Reference
|
||||
|
||||
The following arguments are supported:
|
||||
|
@ -191,16 +313,18 @@ The following arguments are supported:
|
|||
* `name` - (Required) Specifies name of the IP configuration.
|
||||
* `subnet_id` - (Required) Specifies the identifier of the subnet.
|
||||
* `load_balancer_backend_address_pool_ids` - (Optional) Specifies an array of references to backend address pools of load balancers. A scale set can reference backend address pools of one public and one internal load balancer. Multiple scale sets cannot use the same load balancer.
|
||||
* `load_balancer_inbound_nat_rules_ids` - (Optional) Specifies an array of references to inbound NAT rules for load balancers.
|
||||
|
||||
`storage_profile_os_disk` supports the following:
|
||||
|
||||
* `name` - (Required) Specifies the disk name.
|
||||
* `vhd_containers` - (Optional) Specifies the vhd uri. This property is ignored if using a custom image.
|
||||
* `vhd_containers` - (Optional) Specifies the vhd uri. Cannot be used when `image` or `managed_disk_type` is specified.
|
||||
* `managed_disk_type` - (Optional) Specifies the type of managed disk to create. Value you must be either `Standard_LRS` or `Premium_LRS`. Cannot be used when `vhd_containers` or `image` is specified.
|
||||
* `create_option` - (Required) Specifies how the virtual machine should be created. The only possible option is `FromImage`.
|
||||
* `caching` - (Required) Specifies the caching requirements.
|
||||
* `caching` - (Optional) Specifies the caching requirements. Possible values include: `None` (default), `ReadOnly`, `ReadWrite`.
|
||||
* `image` - (Optional) Specifies the blob uri for user image. A virtual machine scale set creates an os disk in the same container as the user image.
|
||||
Updating the osDisk image causes the existing disk to be deleted and a new one created with the new image. If the VM scale set is in Manual upgrade mode then the virtual machines are not updated until they have manualUpgrade applied to them.
|
||||
If this property is set then vhd_containers is ignored.
|
||||
When setting this field `os_type` needs to be specified. Cannot be used when `vhd_containers`, `managed_disk_type` or `storage_profile_image_reference ` are specified.
|
||||
* `os_type` - (Optional) Specifies the operating system Type, valid values are windows, linux.
|
||||
|
||||
`storage_profile_image_reference` supports the following:
|
||||
|
|
Loading…
Reference in New Issue