Skip to content
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 to use Lists instead of Sets #426

Merged
merged 23 commits into from
Oct 17, 2017

Conversation

tombuildsstuff
Copy link
Contributor

@tombuildsstuff tombuildsstuff commented Oct 13, 2017

Opening this to keep track of things, this seems fine in the initial testing of Linux - need to do some more extensive testing before proceeding with this

I've removed the failing test TestAccAzureRMVirtualMachine_windowsLicenseType because it's not possible to make this pass in our subscription (for licensing reasons) - however the test will pass in another subscription

Fixes #103
Fixes #99
Fixes #81
Fixes #72
Fixes #20

@tombuildsstuff tombuildsstuff changed the title [WIP] azurerm_virtual_machine to use Lists instead of Sets azurerm_virtual_machine to use Lists instead of Sets Oct 16, 2017
@tombuildsstuff
Copy link
Contributor Author

Existing tests (and some of the new ones) pass:

screen shot 2017-10-16 at 16 31 22


func TestAccAzureRMVirtualMachine_reorderedDisks(t *testing.T) {
var beforeVm compute.VirtualMachine
//var beforeVm, afterVm compute.VirtualMachine
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment needed?

Copy link
Contributor Author

@tombuildsstuff tombuildsstuff Oct 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't realise I'd pushed this last comma sighs I'll remove it :)

resourceName := "azurerm_virtual_machine.test"
ri := acctest.RandInt()
config := testAccAzureRMVirtualMachine_reorderedDisksBefore(ri, testLocation())
//updatedConfig := testAccAzureRMVirtualMachine_reorderedDisksAfter(ri, testLocation())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

@@ -1557,3 +1496,53 @@ func findStorageAccountResourceGroup(meta interface{}, storageAccountName string

return id.ResourceGroup, nil
}

func resourceArmVirtualMachineStorageOsProfileHash(v interface{}) int {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note here: the implicit schema.HashResource has been working pretty well for me for most complex sets I've been doing. Unless there's specific rules that this structure needs to be abide by for hashing to remove some factors from the algorithm, you might be better off just using that. Can help get rid of some more code too 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I was looking into that, unfortunately there's some fields missing from some of the Hash functions (hence why I had to change some from Set -> List -> Set) - and then just relocated them in the file :(

testCheckAzureRMVirtualMachineExists(resourceName, &beforeVm),
),
},
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concur on some of the commented out stuff here - could it just be removed as dead code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed, removed

),
},
/*
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

Copy link
Contributor

@vancluever vancluever left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @tombuildsstuff! Left a few comments on the PR here pertaining to maybe simplification of the existing set hashing and commented out tests... otherwise LGTM!

Copy link
Member

@mbfrahry mbfrahry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a minor thing about comments

@tombuildsstuff
Copy link
Contributor Author

Fixed a breaking change in the Azure API (by making the fields Computed) - Tests pass:

screen shot 2017-10-17 at 12 47 10

@tombuildsstuff tombuildsstuff merged commit 6d180a4 into master Oct 17, 2017
@tombuildsstuff tombuildsstuff deleted the vm-sets-to-list branch October 17, 2017 11:48
tombuildsstuff added a commit that referenced this pull request Oct 17, 2017
@kblackstone
Copy link

I just tested the NIC ordering and the problem is still appearing. How/when can I see this fixed?

@ghost
Copy link

ghost commented Apr 1, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.