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

provisionAfterExtension field for chaining multiple extensions… #2937

Merged

Conversation

imvalient
Copy link
Contributor

I am currently working with scale sets extensions and found out there is no way to define dependencies between scale-set extensions at ARM template level, through terraform.

Reading through the GO Azure SDK I found this feature exists, so I made an implementation that translates a terraform array of extensions dependencies to the AzureRM json based provisionAfterExtensions attribute.

Usage

resource "azurerm_virtual_machine_scale_set" "test_scale_set" {
    name = "scale-set-test-extension"
    ...
    
    extension {
        name = "first-extension"
        publisher = "Microsoft.Compute"
        ...
    }

    extension {
        name = "second-extension"
        publisher = "Microsoft.Compute"
        ...
        provision_after_extensions = ["first-extension"]
    }
}

This way the second extension will start only when the first one finishes, instead of running both at the same time.

As far as i know virtual machine extensions also do not implement this feature, you can define a terraform dependece using dependsOn, this could work at creation time but, once created, if the machine scales up, the dependency is lost as its not defined in the azure rm template, if this approach is alright we could add it to that resource as well.

@tombuildsstuff tombuildsstuff added enhancement service/vmss Virtual Machine Scale Sets labels Feb 25, 2019
@imvalient
Copy link
Contributor Author

I ve been reviewing the GO SDK for virtual machines and did not find anything related to provisionAfterExtensions on it. I would appreciate if someone could review this for a final decision.

@imvalient imvalient changed the title [WIP] provisionAfterExtension field for chaining multiple extensions… provisionAfterExtension field for chaining multiple extensions… Mar 6, 2019
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Hi @imvalient,

Thank you for tis PR. Overall this looks good, however as you are updating the hash function a state migration is required to ensure that no diff is generated when users simply update to the new version.

You can find an example of a state migration function here

Additionally a test to ensure this property can be set would be ideal as well.

@ghost ghost added size/L and removed size/S labels Mar 23, 2019
@imvalient
Copy link
Contributor Author

imvalient commented Mar 26, 2019

The requested changes have been submitted.

@ghost ghost removed the waiting-response label Mar 26, 2019
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Thanks for the revisions @imvalient, this LGTM 👍

@katbyte katbyte added this to the v1.28.0 milestone May 7, 2019
@katbyte katbyte merged commit 20cd26a into hashicorp:master May 7, 2019
katbyte added a commit that referenced this pull request May 7, 2019
@ghost
Copy link

ghost commented May 17, 2019

This has been released in version 1.28.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
	version = "~> 1.28.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Jun 7, 2019

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!

@ghost ghost locked and limited conversation to collaborators Jun 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants