-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vmss: Support for updating the customData field
- Loading branch information
1 parent
e9481ad
commit d2bbea6
Showing
4 changed files
with
188 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -181,6 +181,34 @@ func TestAccAzureRMVirtualMachineScaleSet_linuxUpdated(t *testing.T) { | |
}) | ||
} | ||
|
||
func TestAccAzureRMVirtualMachineScaleSet_customDataUpdated(t *testing.T) { | ||
resourceName := "azurerm_virtual_machine_scale_set.test" | ||
ri := acctest.RandInt() | ||
location := testLocation() | ||
config := testAccAzureRMVirtualMachineScaleSet_linux(ri, location) | ||
updatedConfig := testAccAzureRMVirtualMachineScaleSet_linuxCustomDataUpdated(ri, location) | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
CheckDestroy: testCheckAzureRMVirtualMachineScaleSetDestroy, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: config, | ||
Check: resource.ComposeTestCheckFunc( | ||
testCheckAzureRMVirtualMachineScaleSetExists(resourceName), | ||
), | ||
}, | ||
{ | ||
Config: updatedConfig, | ||
Check: resource.ComposeTestCheckFunc( | ||
testCheckAzureRMVirtualMachineScaleSetExists(resourceName), | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func TestAccAzureRMVirtualMachineScaleSet_basicLinux_managedDisk(t *testing.T) { | ||
ri := acctest.RandInt() | ||
config := testAccAzureRMVirtualMachineScaleSet_basicLinux_managedDisk(ri, testLocation()) | ||
|
@@ -1659,6 +1687,106 @@ resource "azurerm_virtual_machine_scale_set" "test" { | |
`, rInt, location, rInt, rInt, rInt, rInt, rInt, rInt, rInt, rInt) | ||
} | ||
|
||
func testAccAzureRMVirtualMachineScaleSet_linuxCustomDataUpdated(rInt int, location string) string { | ||
return fmt.Sprintf(` | ||
resource "azurerm_resource_group" "test" { | ||
name = "acctestrg-%d" | ||
location = "%s" | ||
} | ||
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_tier = "Standard" | ||
account_replication_type = "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 = "updated 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== [email protected]" | ||
} | ||
} | ||
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" | ||
create_option = "FromImage" | ||
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 = "16.04-LTS" | ||
version = "latest" | ||
} | ||
} | ||
`, rInt, location, rInt, rInt, rInt, rInt, rInt, rInt, rInt, rInt) | ||
} | ||
|
||
func testAccAzureRMVirtualMachineScaleSet_basicLinux_managedDisk(rInt int, location string) string { | ||
return fmt.Sprintf(` | ||
resource "azurerm_resource_group" "test" { | ||
|