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_account - allow versionless keys for CMK #21677

Merged
merged 2 commits into from
May 17, 2023

Conversation

alfpark
Copy link
Contributor

@alfpark alfpark commented May 5, 2023

Batch accounts can have an optionally specified encryption key. This fix allows Batch accounts to have encryption enabled with a Key Vault versionless key (to allow for autorotation scenarios).

@alfpark alfpark force-pushed the alfpark/batch-enc-versionlesskey branch from 19e438a to b15a068 Compare May 5, 2023 18:40
@alfpark alfpark force-pushed the alfpark/batch-enc-versionlesskey branch from b15a068 to f471808 Compare May 8, 2023 20:16
@alfpark alfpark marked this pull request as draft May 9, 2023 04:43
@alfpark alfpark force-pushed the alfpark/batch-enc-versionlesskey branch from f471808 to 6882862 Compare May 9, 2023 15:40
@github-actions github-actions bot added size/L and removed size/M labels May 9, 2023
@alfpark alfpark marked this pull request as ready for review May 9, 2023 15:44
@alfpark
Copy link
Contributor Author

alfpark commented May 9, 2023

Acceptance tests:

==> Checking that code complies with gofmt requirements...
==> Checking that Custom Timeouts are used...
==> Checking that acceptance test packages are used...
TF_ACC=1 go test -v ./internal/services/batch -run=TestAccBatchAccountDataSource_cmk* -timeout 60m -ldflags="-X=github.com/hashicorp/terraform-provider-azurerm/version.ProviderVersion=acc"
=== RUN   TestAccBatchAccountDataSource_cmkVersionedKey
=== PAUSE TestAccBatchAccountDataSource_cmkVersionedKey
=== RUN   TestAccBatchAccountDataSource_cmkVersionlessKey
=== PAUSE TestAccBatchAccountDataSource_cmkVersionlessKey
=== CONT  TestAccBatchAccountDataSource_cmkVersionedKey
=== CONT  TestAccBatchAccountDataSource_cmkVersionlessKey
--- PASS: TestAccBatchAccountDataSource_cmkVersionedKey (412.25s)
--- PASS: TestAccBatchAccountDataSource_cmkVersionlessKey (412.25s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/batch 412.297s


==> Checking that code complies with gofmt requirements...
==> Checking that Custom Timeouts are used...
==> Checking that acceptance test packages are used...
TF_ACC=1 go test -v ./internal/services/batch -run=TestAccBatchAccount_cmk* -timeout 60m -ldflags="-X=github.com/hashicorp/terraform-provider-azurerm/version.ProviderVersion=acc"
=== RUN   TestAccBatchAccount_cmkVersionedKey
=== PAUSE TestAccBatchAccount_cmkVersionedKey
=== RUN   TestAccBatchAccount_cmkVersionlessKey
=== PAUSE TestAccBatchAccount_cmkVersionlessKey
=== CONT  TestAccBatchAccount_cmkVersionedKey
=== CONT  TestAccBatchAccount_cmkVersionlessKey
--- PASS: TestAccBatchAccount_cmkVersionlessKey (397.23s)
--- PASS: TestAccBatchAccount_cmkVersionedKey (410.01s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/batch 410.058s

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

hey @alfpark

Thanks for this PR.

I've taken a look through and left some comments inline, and on the whole this is looking pretty good. If we can fix up the comments (and the tests pass) then this should otherwise be good to go 👍

Thanks!

website/docs/d/batch_account.html.markdown Outdated Show resolved Hide resolved
website/docs/d/batch_account.html.markdown Outdated Show resolved Hide resolved
internal/services/batch/batch_account_data_source_test.go Outdated Show resolved Hide resolved
internal/services/batch/batch_account_data_source_test.go Outdated Show resolved Hide resolved
internal/services/batch/batch_account_data_source_test.go Outdated Show resolved Hide resolved
internal/services/batch/batch_account_data_source_test.go Outdated Show resolved Hide resolved
internal/services/batch/batch_account_resource_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

Accidentally hit "approve" rather than "request changes" 🤦 (see previous comment)

@alfpark alfpark force-pushed the alfpark/batch-enc-versionlesskey branch from e983c4a to 8ef94aa Compare May 10, 2023 21:18
@alfpark
Copy link
Contributor Author

alfpark commented May 10, 2023

Acceptance test for 8ef94aa:

==> Checking that code complies with gofmt requirements...
==> Checking that Custom Timeouts are used...
==> Checking that acceptance test packages are used...
TF_ACC=1 go test -v ./internal/services/batch -run=TestAccBatchAccountDataSource_cmk* -timeout 60m -ldflags="-X=github.com/hashicorp/terraform-provider-azurerm/version.ProviderVersion=acc"
=== RUN   TestAccBatchAccountDataSource_cmkVersionedKey
=== PAUSE TestAccBatchAccountDataSource_cmkVersionedKey
=== RUN   TestAccBatchAccountDataSource_cmkVersionlessKey
=== PAUSE TestAccBatchAccountDataSource_cmkVersionlessKey
=== CONT  TestAccBatchAccountDataSource_cmkVersionedKey
=== CONT  TestAccBatchAccountDataSource_cmkVersionlessKey
--- PASS: TestAccBatchAccountDataSource_cmkVersionedKey (400.98s)
--- PASS: TestAccBatchAccountDataSource_cmkVersionlessKey (401.34s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/batch 401.375s
==> Checking that code complies with gofmt requirements...
==> Checking that Custom Timeouts are used...
==> Checking that acceptance test packages are used...
TF_ACC=1 go test -v ./internal/services/batch -run=TestAccBatchAccount_cmk* -timeout 60m -ldflags="-X=github.com/hashicorp/terraform-provider-azurerm/version.ProviderVersion=acc"
=== RUN   TestAccBatchAccount_cmkVersionedKey
=== PAUSE TestAccBatchAccount_cmkVersionedKey
=== RUN   TestAccBatchAccount_cmkVersionlessKey
=== PAUSE TestAccBatchAccount_cmkVersionlessKey
=== CONT  TestAccBatchAccount_cmkVersionedKey
=== CONT  TestAccBatchAccount_cmkVersionlessKey
--- PASS: TestAccBatchAccount_cmkVersionedKey (342.32s)
--- PASS: TestAccBatchAccount_cmkVersionlessKey (402.17s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/batch 402.216s

- Remove unnecessary ${}
- Use `versionless_id` proeprty instead of manual key URL construction
- Use numbered string formats
- Applied these fixes to the prior "versioned key" test cases as well
@alfpark alfpark force-pushed the alfpark/batch-enc-versionlesskey branch from 8ef94aa to 74d276d Compare May 11, 2023 16:03
@alfpark
Copy link
Contributor Author

alfpark commented May 11, 2023

Acceptance tests for 74d276d:

==> Checking that code complies with gofmt requirements...
==> Checking that Custom Timeouts are used...
==> Checking that acceptance test packages are used...
TF_ACC=1 go test -v ./internal/services/batch -run=TestAccBatchAccountDataSource_cmk* -timeout 60m -ldflags="-X=github.com/hashicorp/terraform-provider-azurerm/version.ProviderVersion=acc"
=== RUN   TestAccBatchAccountDataSource_cmkVersionedKey
=== PAUSE TestAccBatchAccountDataSource_cmkVersionedKey
=== RUN   TestAccBatchAccountDataSource_cmkVersionlessKey
=== PAUSE TestAccBatchAccountDataSource_cmkVersionlessKey
=== CONT  TestAccBatchAccountDataSource_cmkVersionedKey
=== CONT  TestAccBatchAccountDataSource_cmkVersionlessKey
--- PASS: TestAccBatchAccountDataSource_cmkVersionedKey (349.69s)
--- PASS: TestAccBatchAccountDataSource_cmkVersionlessKey (423.23s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/batch 423.268s
==> Checking that code complies with gofmt requirements...
==> Checking that Custom Timeouts are used...
==> Checking that acceptance test packages are used...
TF_ACC=1 go test -v ./internal/services/batch -run=TestAccBatchAccount_cmk* -timeout 60m -ldflags="-X=github.com/hashicorp/terraform-provider-azurerm/version.ProviderVersion=acc"
=== RUN   TestAccBatchAccount_cmkVersionedKey
=== PAUSE TestAccBatchAccount_cmkVersionedKey
=== RUN   TestAccBatchAccount_cmkVersionlessKey
=== PAUSE TestAccBatchAccount_cmkVersionlessKey
=== CONT  TestAccBatchAccount_cmkVersionedKey
=== CONT  TestAccBatchAccount_cmkVersionlessKey
--- PASS: TestAccBatchAccount_cmkVersionlessKey (411.38s)
--- PASS: TestAccBatchAccount_cmkVersionedKey (417.91s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/batch 417.962s

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 @alfpark - LGTM 🌵

@katbyte katbyte merged commit c3c4ce8 into hashicorp:main May 17, 2023
@github-actions github-actions bot added this to the v3.57.0 milestone May 17, 2023
katbyte added a commit that referenced this pull request May 17, 2023
@github-actions
Copy link

This functionality has been released in v3.57.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!

Copy link

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 github-actions bot locked as resolved and limited conversation to collaborators May 30, 2024
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