-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
azurerm_virtual_machine.vhd_uri not picked up in validation #470
Changes from 1 commit
e3ee43f
1732778
c1f245e
1785b70
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,196 @@ func TestAccAzureRMVirtualMachine_basicLinuxMachine(t *testing.T) { | |
}) | ||
} | ||
|
||
func TestAccAzureRMVirtualMachine_basicLinuxMachine_storageBlob_attach(t *testing.T) { | ||
var vm compute.VirtualMachine | ||
ri := acctest.RandInt() | ||
preConfig := testAccAzureRMVirtualMachine_basicLinuxMachine(ri, testLocation()) | ||
prepConfig := fmt.Sprintf(testAccAzureRMVirtualMachine_basicLinuxMachine_destroyVM, ri, ri, ri, ri, ri) | ||
config := fmt.Sprintf(testAccAzureRMVirtualMachine_basicLinuxMachine_storageBlob_attach, ri, ri, ri, ri, ri, ri, ri) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would it be possible to update these to use the newer-style formatting methods? in particular we now pass in the test location, allowing these tests to be run in different regions. Here's an example of what I'm referring too and the associated formatting method There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure! I'll update the PR shortly. |
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
CheckDestroy: testCheckAzureRMVirtualMachineDestroy, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: preConfig, | ||
Destroy: false, | ||
Check: resource.ComposeTestCheckFunc( | ||
testCheckAzureRMVirtualMachineExists("azurerm_virtual_machine.test", &vm), | ||
), | ||
}, | ||
{ | ||
Config: prepConfig, | ||
Destroy: false, | ||
}, | ||
{ | ||
Config: config, | ||
Check: resource.ComposeTestCheckFunc( | ||
testCheckAzureRMVirtualMachineExists("azurerm_virtual_machine.test", &vm), | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
var testAccAzureRMVirtualMachine_basicLinuxMachine_destroyVM = ` | ||
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_storage_account" "test" { | ||
name = "accsa%d" | ||
resource_group_name = "${azurerm_resource_group.test.name}" | ||
location = "West US 2" | ||
account_type = "Standard_LRS" | ||
|
||
tags { | ||
environment = "staging" | ||
} | ||
} | ||
|
||
resource "azurerm_storage_container" "test" { | ||
name = "vhds" | ||
resource_group_name = "${azurerm_resource_group.test.name}" | ||
storage_account_name = "${azurerm_storage_account.test.name}" | ||
container_access_type = "private" | ||
} | ||
` | ||
|
||
var testAccAzureRMVirtualMachine_basicLinuxMachine_storageBlob_attach = ` | ||
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_storage_account" "test" { | ||
name = "accsa%d" | ||
resource_group_name = "${azurerm_resource_group.test.name}" | ||
location = "West US 2" | ||
account_type = "Standard_LRS" | ||
|
||
tags { | ||
environment = "staging" | ||
} | ||
} | ||
|
||
resource "azurerm_storage_container" "test" { | ||
name = "vhds" | ||
resource_group_name = "${azurerm_resource_group.test.name}" | ||
storage_account_name = "${azurerm_storage_account.test.name}" | ||
container_access_type = "private" | ||
} | ||
|
||
resource "azurerm_storage_blob" "test" { | ||
name = "datadisk1.vhd" | ||
|
||
resource_group_name = "${azurerm_resource_group.test.name}" | ||
storage_account_name = "${azurerm_storage_account.test.name}" | ||
storage_container_name = "${azurerm_storage_container.test.name}" | ||
|
||
type = "page" | ||
source_uri = "${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}/myosdisk1.vhd" | ||
} | ||
|
||
resource "azurerm_virtual_machine" "test" { | ||
name = "acctvm-%d" | ||
location = "West US 2" | ||
resource_group_name = "${azurerm_resource_group.test.name}" | ||
network_interface_ids = ["${azurerm_network_interface.test.id}"] | ||
vm_size = "Standard_D1_v2" | ||
|
||
storage_image_reference { | ||
publisher = "Canonical" | ||
offer = "UbuntuServer" | ||
sku = "14.04.2-LTS" | ||
version = "latest" | ||
} | ||
|
||
storage_os_disk { | ||
name = "myosdisk1" | ||
vhd_uri = "${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}/myosdisk2.vhd" | ||
caching = "ReadWrite" | ||
create_option = "FromImage" | ||
disk_size_gb = "45" | ||
} | ||
|
||
storage_data_disk { | ||
name = "${azurerm_storage_blob.test.name}" | ||
create_option = "Attach" | ||
disk_size_gb = "45" | ||
lun = 0 | ||
vhd_uri = "${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}/datadisk1.vhd" | ||
} | ||
|
||
os_profile { | ||
computer_name = "hn%d" | ||
admin_username = "testadmin" | ||
admin_password = "Password1234!" | ||
} | ||
|
||
os_profile_linux_config { | ||
disable_password_authentication = false | ||
} | ||
|
||
tags { | ||
environment = "Production" | ||
} | ||
} | ||
` | ||
|
||
func TestAccAzureRMVirtualMachine_basicLinuxMachineSSHOnly(t *testing.T) { | ||
var vm compute.VirtualMachine | ||
ri := acctest.RandInt() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we tend to fill this in manually, once it's merged (otherwise we get merge conflicts all over the place) - as such would it be possible to revert this file?