terraform-provider-azurerm icon indicating copy to clipboard operation
terraform-provider-azurerm copied to clipboard

[Enhance azurerm_batch_account] - Support authentication mode

Open xuzhang3 opened this issue 3 years ago • 4 comments

  1. Support configure authentication modes.
  2. Support configure storage account authentication mode and node identity.

AccTest:

=== RUN   TestAccBatchAccount_autoStorageBatchAuthMode
=== PAUSE TestAccBatchAccount_autoStorageBatchAuthMode
=== CONT  TestAccBatchAccount_autoStorageBatchAuthMode
--- PASS: TestAccBatchAccount_autoStorageBatchAuthMode (307.75s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/batch 310.450s
=== RUN   TestAccBatchAccount_autoStorage
=== PAUSE TestAccBatchAccount_autoStorage
=== RUN   TestAccBatchAccount_autoStorageBatchAuthMode
=== PAUSE TestAccBatchAccount_autoStorageBatchAuthMode
=== CONT  TestAccBatchAccount_autoStorage
=== CONT  TestAccBatchAccount_autoStorageBatchAuthMode
--- PASS: TestAccBatchAccount_autoStorageBatchAuthMode (298.28s)
--- PASS: TestAccBatchAccount_autoStorage (327.57s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/batch 330.564s
=== RUN   TestAccBatchAccount_authenticationModesUpdate
=== PAUSE TestAccBatchAccount_authenticationModesUpdate
=== CONT  TestAccBatchAccount_authenticationModesUpdate
--- PASS: TestAccBatchAccount_authenticationModesUpdate (370.56s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/batch 372.387s
=== RUN   TestAccBatchAccount_authenticationModes
=== PAUSE TestAccBatchAccount_authenticationModes
=== RUN   TestAccBatchAccount_authenticationModesUpdate
=== PAUSE TestAccBatchAccount_authenticationModesUpdate
=== CONT  TestAccBatchAccount_authenticationModes
=== CONT  TestAccBatchAccount_authenticationModesUpdate
--- PASS: TestAccBatchAccount_authenticationModes (290.05s)
--- PASS: TestAccBatchAccount_authenticationModesUpdate (427.26s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/batch 430.474s
=== RUN   TestAccBatchAccount_complete
=== PAUSE TestAccBatchAccount_complete
=== CONT  TestAccBatchAccount_complete
--- PASS: TestAccBatchAccount_complete (441.20s)
PASS
=== RUN   TestAccBatchAccount_requiresImport
=== PAUSE TestAccBatchAccount_requiresImport
=== CONT  TestAccBatchAccount_requiresImport
--- PASS: TestAccBatchAccount_requiresImport (308.46s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/batch 310.450s

xuzhang3 avatar May 12 '22 10:05 xuzhang3

@katbyte Test failed due to sub/region resource quota limit(https://docs.microsoft.com/en-us/azure/batch/batch-quota-limit#resource-quotas). I also updated some constraint and test cases.

=== RUN   TestAccBatchAccount_autoStorage
=== PAUSE TestAccBatchAccount_autoStorage
=== RUN   TestAccBatchAccount_autoStorageBatchAuthMode
=== PAUSE TestAccBatchAccount_autoStorageBatchAuthMode
=== CONT  TestAccBatchAccount_autoStorage
=== CONT  TestAccBatchAccount_autoStorageBatchAuthMode
--- PASS: TestAccBatchAccount_autoStorageBatchAuthMode (345.91s)
--- PASS: TestAccBatchAccount_autoStorage (352.89s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/batch 355.667s
=== RUN   TestAccBatchAccount_requiresImport
=== PAUSE TestAccBatchAccount_requiresImport
=== CONT  TestAccBatchAccount_requiresImport
--- PASS: TestAccBatchAccount_requiresImport (315.10s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/batch 317.096s
=== RUN   TestAccBatchAccount_cmk
=== PAUSE TestAccBatchAccount_cmk
=== CONT  TestAccBatchAccount_cmk
--- PASS: TestAccBatchAccount_cmk (552.99s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/batch 555.313s
=== RUN   TestAccBatchAccount_identity
=== PAUSE TestAccBatchAccount_identity
=== CONT  TestAccBatchAccount_identity
--- PASS: TestAccBatchAccount_identity (524.15s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/batch 526.525s
=== RUN   TestAccBatchAccount_complete
=== PAUSE TestAccBatchAccount_complete
=== CONT  TestAccBatchAccount_complete
--- PASS: TestAccBatchAccount_complete (512.35s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/batch 514.741s

xuzhang3 avatar Jun 01 '22 10:06 xuzhang3

@katbyte I forget to update the test cases, new property need to set default values.

AccTest

=== RUN TestAccBatchAccountDataSource_basic === PAUSE TestAccBatchAccountDataSource_basic === RUN TestAccBatchAccountDataSource_complete === PAUSE TestAccBatchAccountDataSource_complete === RUN TestAccBatchAccountDataSource_userSubscription === PAUSE TestAccBatchAccountDataSource_userSubscription === RUN TestAccBatchAccountDataSource_cmk === PAUSE TestAccBatchAccountDataSource_cmk === CONT TestAccBatchAccountDataSource_basic === CONT TestAccBatchAccountDataSource_userSubscription === CONT TestAccBatchAccountDataSource_complete === CONT TestAccBatchAccountDataSource_cmk === CONT TestAccBatchAccountDataSource_userSubscription --- PASS: TestAccBatchAccountDataSource_userSubscription (27.07s) --- PASS: TestAccBatchAccountDataSource_basic (275.51s) --- PASS: TestAccBatchAccountDataSource_complete (305.56s) --- PASS: TestAccBatchAccountDataSource_cmk (509.07s) PASS PASS github.com/hashicorp/terraform-provider-azurerm/internal/services/batch 511.062s

=== RUN TestAccBatchPool_basic === PAUSE TestAccBatchPool_basic === RUN TestAccBatchPool_identity === PAUSE TestAccBatchPool_identity === RUN TestAccBatchPool_identityUpdate === PAUSE TestAccBatchPool_identityUpdate === RUN TestAccBatchPool_requiresImport === PAUSE TestAccBatchPool_requiresImport === RUN TestAccBatchPool_fixedScale_complete === PAUSE TestAccBatchPool_fixedScale_complete === RUN TestAccBatchPool_autoScale_complete === PAUSE TestAccBatchPool_autoScale_complete === RUN TestAccBatchPool_completeUpdated === PAUSE TestAccBatchPool_completeUpdated === RUN TestAccBatchPool_startTask_basic === PAUSE TestAccBatchPool_startTask_basic === RUN TestAccBatchPool_startTask_complete === PAUSE TestAccBatchPool_startTask_complete === RUN TestAccBatchPool_startTask_userIdentity === PAUSE TestAccBatchPool_startTask_userIdentity === RUN TestAccBatchPool_certificates === PAUSE TestAccBatchPool_certificates === RUN TestAccBatchPool_validateResourceFileWithoutSource === PAUSE TestAccBatchPool_validateResourceFileWithoutSource === RUN TestAccBatchPool_container === PAUSE TestAccBatchPool_container === RUN TestAccBatchPool_validateResourceFileWithMultipleSources === PAUSE TestAccBatchPool_validateResourceFileWithMultipleSources === RUN TestAccBatchPool_validateResourceFileBlobPrefixWithoutAutoStorageContainerUrl === PAUSE TestAccBatchPool_validateResourceFileBlobPrefixWithoutAutoStorageContainerUrl === RUN TestAccBatchPool_validateResourceFileHttpURLWithoutFilePath === PAUSE TestAccBatchPool_validateResourceFileHttpURLWithoutFilePath === RUN TestAccBatchPool_customImage === PAUSE TestAccBatchPool_customImage === RUN TestAccBatchPool_frontEndPortRanges === PAUSE TestAccBatchPool_frontEndPortRanges === RUN TestAccBatchPool_fixedScaleUpdate === PAUSE TestAccBatchPool_fixedScaleUpdate === CONT TestAccBatchPool_basic === CONT TestAccBatchPool_certificates === CONT TestAccBatchPool_validateResourceFileHttpURLWithoutFilePath === CONT TestAccBatchPool_frontEndPortRanges === CONT TestAccBatchPool_fixedScaleUpdate === CONT TestAccBatchPool_customImage === CONT TestAccBatchPool_validateResourceFileWithMultipleSources === CONT TestAccBatchPool_validateResourceFileBlobPrefixWithoutAutoStorageContainerUrl --- PASS: TestAccBatchPool_validateResourceFileHttpURLWithoutFilePath (219.16s) === CONT TestAccBatchPool_autoScale_complete --- PASS: TestAccBatchPool_validateResourceFileWithMultipleSources (221.89s) === CONT TestAccBatchPool_startTask_userIdentity === CONT TestAccBatchPool_basic === CONT TestAccBatchPool_customImage === CONT TestAccBatchPool_certificates
=== CONT TestAccBatchPool_validateResourceFileBlobPrefixWithoutAutoStorageContainerUrl --- PASS: TestAccBatchPool_certificates (436.67s) === CONT TestAccBatchPool_startTask_complete --- PASS: TestAccBatchPool_basic (447.15s) === CONT TestAccBatchPool_startTask_basic --- PASS: TestAccBatchPool_validateResourceFileBlobPrefixWithoutAutoStorageContainerUrl (454.41s) === CONT TestAccBatchPool_completeUpdated === CONT TestAccBatchPool_autoScale_complete --- PASS: TestAccBatchPool_customImage (589.06s) === CONT TestAccBatchPool_requiresImport === CONT TestAccBatchPool_startTask_complete === CONT TestAccBatchPool_startTask_basic --- PASS: TestAccBatchPool_autoScale_complete (507.33s) === CONT TestAccBatchPool_fixedScale_complete === CONT TestAccBatchPool_completeUpdated --- PASS: TestAccBatchPool_frontEndPortRanges (768.10s) === CONT TestAccBatchPool_identityUpdate --- PASS: TestAccBatchPool_startTask_basic (418.02s) === CONT TestAccBatchPool_identity === CONT TestAccBatchPool_requiresImport --- PASS: TestAccBatchPool_startTask_complete (431.41s) === CONT TestAccBatchPool_validateResourceFileWithoutSource --- PASS: TestAccBatchPool_fixedScaleUpdate (890.43s) === CONT TestAccBatchPool_container --- PASS: TestAccBatchPool_startTask_userIdentity (678.68s) --- PASS: TestAccBatchPool_completeUpdated (477.49s) --- PASS: TestAccBatchPool_requiresImport (418.28s) === CONT TestAccBatchPool_validateResourceFileWithoutSource === CONT TestAccBatchPool_container --- PASS: TestAccBatchPool_validateResourceFileWithoutSource (438.39s) --- PASS: TestAccBatchPool_container (442.15s) --- PASS: TestAccBatchPool_fixedScale_complete (664.35s) --- PASS: TestAccBatchPool_identity (546.88s) --- PASS: TestAccBatchPool_identityUpdate (930.95s) PASS PASS github.com/hashicorp/terraform-provider-azurerm/internal/services/batch 1700.857s

=== RUN TestAccBatchApplicationDataSource_basic === PAUSE TestAccBatchApplicationDataSource_basic === CONT TestAccBatchApplicationDataSource_basic --- PASS: TestAccBatchApplicationDataSource_basic (300.94s) PASS ok github.com/hashicorp/terraform-provider-azurerm/internal/services/batch 305.874s === RUN TestAccBatchPoolDataSource_complete === PAUSE TestAccBatchPoolDataSource_complete === CONT TestAccBatchPoolDataSource_complete --- PASS: TestAccBatchPoolDataSource_complete (747.06s) PASS ok github.com/hashicorp/terraform-provider-azurerm/internal/services/batch 748.850s === RUN TestAccBatchPoolDataSource_complete === PAUSE TestAccBatchPoolDataSource_complete === CONT TestAccBatchPoolDataSource_complete testcase.go:110: Step 1/1 error: Error running apply: exit status 1

    Error: creating Pool: (Name "testaccpoolikwmc" / Batch Account Name "testaccbatchikwmc" / Resource Group "testaccRG-batch-220610153940062207"): auto_user and user_name cannot be specified in the user_identity at the same time
    
      with azurerm_batch_pool.test,
      on terraform_plugin_test.tf line 42, in resource "azurerm_batch_pool" "test":
      42: resource "azurerm_batch_pool" "test" {

--- FAIL: TestAccBatchPoolDataSource_complete (632.04s) FAIL FAIL github.com/hashicorp/terraform-provider-azurerm/internal/services/batch 633.820s === RUN TestAccBatchPoolDataSource_complete === PAUSE TestAccBatchPoolDataSource_complete === CONT TestAccBatchPoolDataSource_complet
--- PASS: TestAccBatchPoolDataSource_complete (632.04s) PASS PASS github.com/hashicorp/terraform-provider-azurerm/internal/services/batch 633.820s

xuzhang3 avatar Jun 10 '22 10:06 xuzhang3

@katbyte Test cases has been update. And I changed the allowed_authentication_modes to compute=true, service will handle the default value instead of manage it within RM provider, this will help keep the compatibility with the old releases.

xuzhang3 avatar Jul 25 '22 07:07 xuzhang3

@katbyte thanks for review, issue has be resolved. This resources has quota limit per sub and some of them need specific configures, I only run some of the rests, not all of them.

xuzhang3 avatar Aug 11 '22 09:08 xuzhang3

This functionality has been released in v3.19.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

github-actions[bot] avatar Aug 23 '22 15:08 github-actions[bot]

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

github-actions[bot] avatar Sep 23 '22 02:09 github-actions[bot]