Skip to content

azurerm_batch_pool - add support for bind_mount property#32000

Open
LingyuTang wants to merge 15 commits intohashicorp:mainfrom
LingyuTang:schema/add-containerBatchHostBindMounts-in-azurerm_batch_pool
Open

azurerm_batch_pool - add support for bind_mount property#32000
LingyuTang wants to merge 15 commits intohashicorp:mainfrom
LingyuTang:schema/add-containerBatchHostBindMounts-in-azurerm_batch_pool

Conversation

@LingyuTang
Copy link
Copy Markdown
Contributor

@LingyuTang LingyuTang commented Mar 19, 2026

Community Note

  • Please vote on this PR by adding a 👍 reaction to the original PR to help the community and maintainers prioritize for review
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for PR followers and do not help prioritize for review

Description

This PR is to support the property host_batch_bind_mounts.

PR Checklist

  • I have followed the guidelines in our Contributing Documentation.
  • I have checked to ensure there aren't other open Pull Requests for the same update/change.
  • I have checked if my changes close any open issues. If so please include appropriate closing keywords below.
  • I have updated/added Documentation as required written in a helpful and kind way to assist users that may be unfamiliar with the resource / data source.
  • I have used a meaningful PR title to help maintainers and other users understand this change and help prevent duplicate work.
    For example: “resource_name_here - description of change e.g. adding property new_property_name_here

Changes to existing Resource / Data Source

  • I have added an explanation of what my changes do and why I'd like you to include them (This may be covered by linking to an issue above, but may benefit from additional explanation).
  • I have written new tests for my resource or datasource changes & updated any relevant documentation.
  • I have successfully run tests with my changes locally. If not, please provide details on testing challenges that prevented you running the tests.
  • (For changes that include a state migration only). I have manually tested the migration path between relevant versions of the provider.

Testing

  • My submission includes Test coverage as described in the Contribution Guide and the tests pass. (if this is not possible for any reason, please include details of why you did or could not add test coverage)
image

Change Log

Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.

  • azurerm_batch_pool - add support for the host_batch_bind_mounts property

This is a (please select all that apply):

  • Bug Fix
  • New Feature (ie adding a service, resource, or data source)
  • Enhancement
  • Breaking Change

Related Issue(s)

Fixes #0000

AI Assistance Disclosure

  • AI Assisted - This contribution was made by, or with the assistance of, AI/LLMs

Rollback Plan

If a change needs to be reverted, we will publish an updated version of the provider.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

Note

If this PR changes meaningfully during the course of review please update the title and description as required.

@LingyuTang LingyuTang changed the title support containerBatchHostBindsMounts in batch pool azurerm_batch_pool - support for host_batch_bind_mounts property Mar 19, 2026
@LingyuTang LingyuTang changed the title azurerm_batch_pool - support for host_batch_bind_mounts property azurerm_batch_pool - support for host_batch_bind_mounts property Mar 19, 2026
@LingyuTang LingyuTang changed the title azurerm_batch_pool - support for host_batch_bind_mounts property azurerm_batch_pool - support for host_batch_bind_mounts property Mar 19, 2026
Copy link
Copy Markdown
Collaborator

@liuwuliuyun liuwuliuyun left a comment

Choose a reason for hiding this comment

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

Left some comments, thanks~

Comment thread internal/services/batch/batch_pool_resource.go Outdated
Comment thread internal/services/batch/batch_pool.go Outdated
Comment thread internal/services/batch/batch_pool_resource.go Outdated
Comment thread internal/services/batch/batch_pool_resource.go Outdated
Comment thread website/docs/d/batch_pool.html.markdown Outdated
Comment thread website/docs/r/batch_pool.html.markdown Outdated
Comment thread website/docs/d/batch_pool.html.markdown Outdated
@LingyuTang LingyuTang changed the title azurerm_batch_pool - support for host_batch_bind_mounts property azurerm_batch_pool - support for host_directory_mount property Mar 27, 2026
@LingyuTang LingyuTang changed the title azurerm_batch_pool - support for host_directory_mount property azurerm_batch_pool - support for host_directory_mount property Mar 27, 2026
@LingyuTang LingyuTang changed the title azurerm_batch_pool - support for host_directory_mount property azurerm_batch_pool - support for host_batch_bind_mounts property Mar 27, 2026
@LingyuTang LingyuTang changed the title azurerm_batch_pool - support for host_batch_bind_mounts property azurerm_batch_pool - support for host_directory_mount property Mar 27, 2026
@LingyuTang
Copy link
Copy Markdown
Contributor Author

Hey @liuwuliuyun thanks for reviewing. I have made the changes based on your above comments and test result. Let me know if further actions needed.

Comment thread internal/services/batch/batch_pool.go Outdated
Comment thread internal/services/batch/batch_pool.go Outdated
Comment thread internal/services/batch/batch_pool.go Outdated
Comment thread website/docs/d/batch_pool.html.markdown Outdated
Comment thread website/docs/r/batch_pool.html.markdown
Comment thread internal/services/batch/batch_pool_resource.go
Comment thread internal/services/batch/batch_pool_resource_test.go Outdated
@LingyuTang
Copy link
Copy Markdown
Contributor Author

Hey @liuwuliuyun , thanks for reviewing. I have made below changes:

  1. change the property name to bind_mount as discussed so it more aligned with the portal
  2. omit the error message
  3. fix other issues on the documentation
    I have tested with azapi that change bind_mount and bind_mount.source won't destroy the resource, the changes will happen in place. So I kept the schema unchanged.

Copy link
Copy Markdown
Collaborator

@liuwuliuyun liuwuliuyun left a comment

Choose a reason for hiding this comment

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

Hi @LingyuTang , the PR looks good to me know. Before you ask for another reviewer, could you help to address the linter issue in the pipeline? Thanks

Comment thread internal/services/batch/batch_pool_resource.go
@LingyuTang
Copy link
Copy Markdown
Contributor Author

Hey @magodo, thanks for reviewing this. I have updated branch as discussed - remove one of the repetitive update test and reuse complete test.

Copy link
Copy Markdown
Collaborator

@magodo magodo 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 this PR!
I have left some additional mostly minor comments that once addressed this should be good to merge 👍

Comment on lines +1103 to +1107
if containerConfiguration, err := ExpandBatchPoolContainerConfiguration(v.([]interface{})); err == nil {
parameters.Properties.DeploymentConfiguration.VirtualMachineConfiguration.ContainerConfiguration = containerConfiguration
} else {
return fmt.Errorf("expanding `container_configuration` for %s: %+v", *id, err)
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we reorder this like below:

Suggested change
if containerConfiguration, err := ExpandBatchPoolContainerConfiguration(v.([]interface{})); err == nil {
parameters.Properties.DeploymentConfiguration.VirtualMachineConfiguration.ContainerConfiguration = containerConfiguration
} else {
return fmt.Errorf("expanding `container_configuration` for %s: %+v", *id, err)
}
containerConfiguration, err := ExpandBatchPoolContainerConfiguration(v.([]interface{}))
if err != nil {
return fmt.Errorf("expanding `container_configuration` for %s: %+v", *id, err)
}
parameters.Properties.DeploymentConfiguration.VirtualMachineConfiguration.ContainerConfiguration = containerConfiguration

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion and I have changed the order as you suggested. Just out of curiosity, can I ask why this is preferred over the original one?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Go's convention is to avoid if ... else ....

@LingyuTang LingyuTang marked this pull request as ready for review April 14, 2026 00:28
@LingyuTang LingyuTang requested review from a team and WodansSon as code owners April 14, 2026 00:28
@LingyuTang
Copy link
Copy Markdown
Contributor Author

This PR is now ready for review.

@magodo magodo removed their assignment Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants