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_batch_pool] - support for custom images with the storage_image_reference property #3530

Merged
merged 8 commits into from
Jul 4, 2019

Conversation

jcorioland
Copy link
Contributor

@jcorioland jcorioland commented May 27, 2019

This PR brings support to custom image for Azure Batch Pool.
It fixes #3352.

  • Implementation in resource
  • Implementation in data source
  • Acceptance tests
  • Documentation + Example

@ghost ghost added the size/M label May 27, 2019
@jcorioland
Copy link
Contributor Author

jcorioland commented May 27, 2019

The custom image id needs to be set in the id property of the image reference in the API. I am wondering if it's better to do it this way (like it is currently):

storage_image_reference {
    id = "${data.azurerm_image.test.id}"
}

or add an extra property to the pool, which is not nested to the image reference (like proposed in the issue) and do the assignation in the code.

@tombuildsstuff @katbyte any thoughts?

@ghost ghost added size/L documentation and removed size/M labels May 28, 2019
Copy link
Collaborator

@WodansSon WodansSon left a comment

Choose a reason for hiding this comment

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

@jcorioland thanks for this PR, this look really good just want a quick change to the docs if you don't mind. Thanks. :)

@@ -120,6 +120,21 @@ The following arguments are supported:

* `storage_image_reference` - (Required) A `storage_image_reference` for the virtual machines that will compose the Batch pool.

~> **NOTE:** It's possible to reference a custom VM image for the pool by specifying it's `id` in the `id` property of the `storage_image_reference`. This property is mutually exclusive with other properties. The VM image should be in the same region that the batch pool you are about to create. See [official documentation](https://docs.microsoft.com/en-us/azure/batch/batch-custom-images) for more details.

```
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this code sample be moved to a new section under the Example Usage section? Say something like ## Example Usage with Custom Image?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, totally agree.

@jcorioland
Copy link
Contributor Author

@jeffreyCline thank you for the review! I've made some updates according to your comment.

@jcorioland jcorioland changed the title [WIP] Add support for custom image to batch pool Add support for custom image to batch pool May 29, 2019
@jcorioland
Copy link
Contributor Author

Hey @jeffreyCline @tombuildsstuff @katbyte - any more change required on this one?

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.

Seeing test errors for this PR:

------- Stdout: -------
=== RUN   TestAccAzureRMBatchPool_customImage
=== PAUSE TestAccAzureRMBatchPool_customImage
=== CONT  TestAccAzureRMBatchPool_customImage
--- FAIL: TestAccAzureRMBatchPool_customImage (5.30s)
    testing.go:568: Step 0 error: errors during refresh:
        
        Error: Error: Image "ubuntu1604base-img" (Resource Group "batch-custom-img-rg") was not found
        
          on /opt/teamcity-agent/temp/buildTmp/tf-test282980552/main.tf line 7:
          (source code not available)
        
        
FAIL

@katbyte katbyte modified the milestones: v1.30.0, v1.31.0 Jun 7, 2019
@jcorioland
Copy link
Contributor Author

@katbyte - the tests are now fixed :) the travis ci fails because of spell checking failing on hdinsight, but nothing that seems related to this PR.

@ghost ghost removed the waiting-response label Jun 10, 2019
@jcorioland
Copy link
Contributor Author

Hi @katbyte - is it anything that you're waiting from me on this PR?

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 @jcorioland,

thanks for the updates, overall this looks good to me. I've left some comments inline mostly around with documentation and the examples. I am curious about changing ID to force new, it appears this property was ignored before?

website/docs/r/batch_pool.html.markdown Outdated Show resolved Hide resolved
website/docs/r/batch_pool.html.markdown Outdated Show resolved Hide resolved
website/docs/r/batch_pool.html.markdown Outdated Show resolved Hide resolved
examples/batch/main.tf Outdated Show resolved Hide resolved
azurerm/resource_arm_batch_pool.go Show resolved Hide resolved
@ghost ghost removed the size/L label Jun 28, 2019
@ghost ghost added the size/XL label Jun 28, 2019
@jcorioland
Copy link
Contributor Author

@katbyte thank you for the review! I've fixed the issue in the documentation and also split the example into a basic and custom-img folder to make sure we cover both use cases separately. I also made sure that the custom image example is not dependant from an existing custom image but creates it itself.
All the changes you've requested should be covered now. LMK if there is anything else I need to improve.
Thanks!

@katbyte katbyte modified the milestones: v1.31.0, v1.32.0 Jun 28, 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 @jcorioland! LGTM now 🙂

Running acc tests and will merge once they pass

@katbyte katbyte changed the title Add support for custom image to batch pool [azurerm_batch_pool] - support for custom images with the storage_image_reference property Jul 4, 2019
@katbyte katbyte merged commit 64bcf8d into hashicorp:master Jul 4, 2019
katbyte added a commit that referenced this pull request Jul 4, 2019
@ghost
Copy link

ghost commented Jul 30, 2019

This has been released in version 1.32.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.32.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Aug 3, 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 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Aug 3, 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.

Feature Request: Azure Batch custom image
3 participants