-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[MS] Added support for custom images with VMSS + Managed Disks #203
Conversation
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.
Hey @echuvyrov
Thanks for this PR - I've taken a look and left some comments inline, my main question is around the need for a state migration - but this is off to a good start :)
Thanks!
} | ||
if image.ID != nil { | ||
result["id"] = *image.ID | ||
} |
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.
I have a feeling it shouldn't - but does this change the hash? i.e. when having previously built a resource using the VMSS resource in master
, then running terraform plan
against this branch - are there any changes shown?
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.
Hey @tombuildsstuff thanks for a quick turnaround on this; I provisioned VMSS using TF v. 0.9.11, then ran terraform plan
using my branch. Got the message
No changes. Infrastructure is up-to-date.
I believe this is expected behavior.
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.
Awesome - thanks for checking/confirming that :)
} | ||
if m["id"] != nil { | ||
buf.WriteString(fmt.Sprintf("%s-", m["id"].(string))) | ||
} |
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.
(same as above - does this require a state migration?)
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.
(same as above) + I also ran a test where I created an Image resource and then set the id to point to that resource. Running terraform plan
gave me the message
Plan: 3 to add, 0 to change, 1 to destroy.
which is also expected I believe (recreating VMSS).
Offer: &offer, | ||
Sku: &sku, | ||
Version: &version, | ||
} |
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.
tbh given this object is initialised above, we could we just assign these values here?
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.
changed
@@ -346,6 +346,27 @@ The following arguments are supported: | |||
|
|||
`storage_profile_image_reference` supports the following: | |||
|
|||
* `id` - (Optional) Specifies the ID of the (custom) image to use to create the virtual | |||
machine scale set, for example: |
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.
I'd argue we might be better linking to an example for this, rather than having this in-line - what do you think?
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.
I gave it a shot based on how I understood it - take a look and let me know if that's not what you had in mind.
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.
Thanks for making those changes - I was thinking more of linking to an example within the Examples directory on Github - but on reflection perhaps that's a future task once this has been merged, and this is fine for the moment?
azurerm/resource_arm_image_test.go
Outdated
|
||
resp, err := vmssClient.Get(resourceGroup, vmssName) | ||
if err != nil { | ||
return fmt.Errorf("Bad: Get on vmssClient: %s", err) |
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.
can we make this formatting argument %+v
to return the full error?
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.
changed
@@ -275,7 +275,7 @@ resource "azurerm_virtual_machine" "test" { | |||
... | |||
|
|||
storage_image_reference { | |||
image_id = "${azurerm_image.test.id}" | |||
id = "${azurerm_image.test.id}" |
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.
👍 good spot
Hey @tombuildsstuff I made the changes requested (hope I got them all right :)), reran the tests and checked in the code.
|
"id": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
ForceNew: true, |
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.
isn't it possible to change the image on a VMSS (and then either roll the VMSS instances automatically or manually)? As such, does this want to be without the ForceNew
?
(same question for Publisher/Offer/Sku/Version)
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.
you are right @tombuildsstuff the update operation should not force new VMSS. I have updated my code to reflect that.
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.
Hey @echuvyrov
Thanks for pushing the latest changes - I've pushed a small commit to update the documentation for the publisher
, offer
, sku
and product
fields to be Optional to match the last change, but this otherwise LGTM :)
Thanks!
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 👉 [email protected]. Thanks! |
Adding custom image support for virtual machine scale sets with managed disks