Skip to content

azurerm_storage_queue - Support storage_account_id#28752

Merged
catriona-m merged 13 commits intohashicorp:mainfrom
magodo:storage_account_id_for_queue_and_table
Sep 23, 2025
Merged

azurerm_storage_queue - Support storage_account_id#28752
catriona-m merged 13 commits intohashicorp:mainfrom
magodo:storage_account_id_for_queue_and_table

Conversation

@magodo
Copy link
Collaborator

@magodo magodo commented Feb 12, 2025

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 introduces the storage_account_id to supersede the storage_account_name property into azurerm_storage_queue. This allows the provider to create and manage the resource via the Resource Manager API rather than the Data Plane.
Existing resources using the storage_account_name property cannot be migrated directly, but can be removed and re-imported using the Resource Manager ID type.

The storage_account_name property is now deprecated and will be removed in v5.0 of the provider.

The resource_manager_id property is now deprecated and will be removed in v5.0 of the provider, this value is available as id in resources using storage_account_id.

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)
$ TF_ACC=1 go test -v -timeout=20h -parallel=20 -run='(TestAccStorageQueue_|TestAccDataSourceStorageQueue_)' ./internal/services/storage
=== RUN   TestAccDataSourceStorageQueue_basic
=== PAUSE TestAccDataSourceStorageQueue_basic
=== RUN   TestAccDataSourceStorageQueue_basicDeprecated
=== PAUSE TestAccDataSourceStorageQueue_basicDeprecated
=== RUN   TestAccStorageQueue_basic
=== PAUSE TestAccStorageQueue_basic
=== RUN   TestAccStorageQueue_basicDeprecated
=== PAUSE TestAccStorageQueue_basicDeprecated
=== RUN   TestAccStorageQueue_basicAzureADAuth
=== PAUSE TestAccStorageQueue_basicAzureADAuth
=== RUN   TestAccStorageQueue_basicAzureADAuthDeprecated
=== PAUSE TestAccStorageQueue_basicAzureADAuthDeprecated
=== RUN   TestAccStorageQueue_requiresImport
=== PAUSE TestAccStorageQueue_requiresImport
=== RUN   TestAccStorageQueue_requiresImportDeprecated
=== PAUSE TestAccStorageQueue_requiresImportDeprecated
=== RUN   TestAccStorageQueue_metaData
=== PAUSE TestAccStorageQueue_metaData
=== RUN   TestAccStorageQueue_metaDataDeprecated
=== PAUSE TestAccStorageQueue_metaDataDeprecated
=== CONT  TestAccDataSourceStorageQueue_basic
=== CONT  TestAccStorageQueue_basicAzureADAuthDeprecated
=== CONT  TestAccStorageQueue_metaData
=== CONT  TestAccStorageQueue_requiresImportDeprecated
=== CONT  TestAccStorageQueue_requiresImport
=== CONT  TestAccStorageQueue_basicAzureADAuth
=== CONT  TestAccStorageQueue_metaDataDeprecated
=== CONT  TestAccDataSourceStorageQueue_basicDeprecated
=== CONT  TestAccStorageQueue_basicDeprecated
=== CONT  TestAccStorageQueue_basic
--- PASS: TestAccDataSourceStorageQueue_basic (184.06s)
--- PASS: TestAccDataSourceStorageQueue_basicDeprecated (185.39s)
--- PASS: TestAccStorageQueue_requiresImportDeprecated (194.65s)
--- PASS: TestAccStorageQueue_requiresImport (198.92s)
--- PASS: TestAccStorageQueue_basic (208.35s)
--- PASS: TestAccStorageQueue_basicDeprecated (211.60s)
--- PASS: TestAccStorageQueue_basicAzureADAuthDeprecated (214.12s)
--- PASS: TestAccStorageQueue_basicAzureADAuth (214.41s)
--- PASS: TestAccStorageQueue_metaData (275.78s)
--- PASS: TestAccStorageQueue_metaDataDeprecated (290.83s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/storage       290.867s

Change Log

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

  • azurerm_storage_queue - Support storage_account_id [GH-00000]

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)

Relating to #27733

Fixes #28562

Note

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

@magodo
Copy link
Collaborator Author

magodo commented Feb 13, 2025

There probably wants a new url attribute as the azurerm_storage_share, to be used by any downstream resources that referencing the old form of ID (the data plane URL).

For this reason, I want to use the function GetAccount() introduced in #28617 for getting the account detail to get its data plane endpoint. Appreciate someone can take a look at #28617 and get it merged, then I'll add the url attribute here.

@magodo
Copy link
Collaborator Author

magodo commented Mar 10, 2025

#28617 has been merged, I've merge this PR with main and exported the url.

Test

💤  TF_ACC=1 go test -v -timeout=20h -parallel=20 -run='(TestAccStorageQueue_basic|TestAccDataSourceStorageQueue_basic)' ./internal/services/storage
=== RUN   TestAccDataSourceStorageQueue_basic
=== PAUSE TestAccDataSourceStorageQueue_basic
=== RUN   TestAccDataSourceStorageQueue_basicDeprecated
=== PAUSE TestAccDataSourceStorageQueue_basicDeprecated
=== RUN   TestAccStorageQueue_basic
=== PAUSE TestAccStorageQueue_basic
=== RUN   TestAccStorageQueue_basicDeprecated
=== PAUSE TestAccStorageQueue_basicDeprecated
=== RUN   TestAccStorageQueue_basicAzureADAuth
=== PAUSE TestAccStorageQueue_basicAzureADAuth
=== RUN   TestAccStorageQueue_basicAzureADAuthDeprecated
=== PAUSE TestAccStorageQueue_basicAzureADAuthDeprecated
=== CONT  TestAccDataSourceStorageQueue_basic
=== CONT  TestAccStorageQueue_basicDeprecated
=== CONT  TestAccStorageQueue_basic
=== CONT  TestAccDataSourceStorageQueue_basicDeprecated
=== CONT  TestAccStorageQueue_basicAzureADAuthDeprecated
=== CONT  TestAccStorageQueue_basicAzureADAuth
--- PASS: TestAccDataSourceStorageQueue_basicDeprecated (140.99s)
--- PASS: TestAccDataSourceStorageQueue_basic (149.40s)
--- PASS: TestAccStorageQueue_basicDeprecated (157.24s)
--- PASS: TestAccStorageQueue_basicAzureADAuth (158.77s)
--- PASS: TestAccStorageQueue_basic (161.06s)
--- PASS: TestAccStorageQueue_basicAzureADAuthDeprecated (170.97s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/storage       171.016s

Copy link
Member

@catriona-m catriona-m left a comment

Choose a reason for hiding this comment

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

Hi @magodo thanks for submitting this. I had a look trough this and left a couple of comments inline. Since this is a deprecation, this will also need to be documented in the 5.0 guide. Also, I ran the tests with the 5.0 flag set to true and it looks like there are a couple of failures that will need investigating:

------- Stdout: -------
=== RUN   TestAccStorageQueue_basic
=== PAUSE TestAccStorageQueue_basic
=== CONT  TestAccStorageQueue_basic
    testcase.go:173: Step 3/3 error running import: exit status 1
        Error: parsing account "/subscriptions/*******/resourceGroups/acctestRG-250904123723260355/providers/Microsoft.Storage/storageAccounts/acctestaccj0iei/queueServices/default/queues/mysamplequeue-250904123723260355": expected the account "" to use a domain suffix of "core.windows.net"
--- FAIL: TestAccStorageQueue_basic (123.86s)
FAIL

Comment on lines +43 to +44
_, err := queues.ParseQueueID(id, storageDomainSuffix)
return err
Copy link
Member

Choose a reason for hiding this comment

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

can this be removed since this will happen anyway on line 47 if the conditions aren't met?

Copy link
Collaborator Author

@magodo magodo Sep 5, 2025

Choose a reason for hiding this comment

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

This is actually a bug that the L47 meant to parse the id as an ARM id. This is why the v5.0 enabled test cases are failing. Thanks for pointing this out!

r.Schema["resource_manager_id"] = &pluginsdk.Schema{
Type: pluginsdk.TypeString,
Computed: true,
Deprecated: "this property has been deprecated in favour of `id` and will be removed in version 5.0 of the Provider.",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Deprecated: "this property has been deprecated in favour of `id` and will be removed in version 5.0 of the Provider.",
Deprecated: "the `resource_manager_id` property has been deprecated in favour of `id` and will be removed in version 5.0 of the Provider.",

Copy link
Collaborator Author

@magodo magodo Sep 5, 2025

Choose a reason for hiding this comment

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

Done (for both managed resource and data source).

}

resource "azurerm_storage_queue" "test" {
name = "queuedstest-%[1]s"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
name = "queuedstest-%[1]s"
name = "acctestqueuedstest-%[1]s"

@magodo
Copy link
Collaborator Author

magodo commented Sep 5, 2025

@catriona-m Thank you for your review! I've merged from main and passed all the tests (w/wo 5.0 enabled):

5.0 Enabled
terraform-provider-azurerm on  storage_account_id_for_queue_and_table via 🐹 v1.25.0 took 2m29s
💤  ARM_FIVEPOINTZERO_BETA=true TF_ACC=1 go test -v -run='TestAccStorageQueue_|TestAccDataSourceStorageQueue_' ./internal/services/storage
=== RUN   TestAccDataSourceStorageQueue_basic
=== PAUSE TestAccDataSourceStorageQueue_basic
=== RUN   TestAccDataSourceStorageQueue_basicDeprecated
    storage_queue_data_source_test.go:35: skipping as not valid in 5.0
--- SKIP: TestAccDataSourceStorageQueue_basicDeprecated (0.00s)
=== RUN   TestAccStorageQueue_basic
=== PAUSE TestAccStorageQueue_basic
=== RUN   TestAccStorageQueue_basicDeprecated
    storage_queue_resource_test.go:43: skipping as not valid in 5.0
--- SKIP: TestAccStorageQueue_basicDeprecated (0.00s)
=== RUN   TestAccStorageQueue_basicAzureADAuth
=== PAUSE TestAccStorageQueue_basicAzureADAuth
=== RUN   TestAccStorageQueue_basicAzureADAuthDeprecated
    storage_queue_resource_test.go:78: skipping as not valid in 5.0
--- SKIP: TestAccStorageQueue_basicAzureADAuthDeprecated (0.00s)
=== RUN   TestAccStorageQueue_requiresImport
=== PAUSE TestAccStorageQueue_requiresImport
=== RUN   TestAccStorageQueue_requiresImportDeprecated
    storage_queue_resource_test.go:112: skipping as not valid in 5.0
--- SKIP: TestAccStorageQueue_requiresImportDeprecated (0.00s)
=== RUN   TestAccStorageQueue_metaData
=== PAUSE TestAccStorageQueue_metaData
=== RUN   TestAccStorageQueue_metaDataDeprecated
    storage_queue_resource_test.go:153: skipping as not valid in 5.0
--- SKIP: TestAccStorageQueue_metaDataDeprecated (0.00s)
=== CONT  TestAccDataSourceStorageQueue_basic
=== CONT  TestAccStorageQueue_requiresImport
=== CONT  TestAccStorageQueue_metaData
=== CONT  TestAccStorageQueue_basicAzureADAuth
=== CONT  TestAccStorageQueue_basic
--- PASS: TestAccDataSourceStorageQueue_basic (86.36s)
--- PASS: TestAccStorageQueue_requiresImport (95.65s)
--- PASS: TestAccStorageQueue_basic (102.32s)
--- PASS: TestAccStorageQueue_basicAzureADAuth (107.03s)
--- PASS: TestAccStorageQueue_metaData (131.09s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/storage       131.197s
5.0 Disabled
terraform-provider-azurerm on  storage_account_id_for_queue_and_table via 🐹 v1.25.0 took 3m35s
💤  TF_ACC=1 go test -v -run='TestAccStorageQueue_|TestAccDataSourceStorageQueue_' ./internal/services/storage
=== RUN   TestAccDataSourceStorageQueue_basic
=== PAUSE TestAccDataSourceStorageQueue_basic
=== RUN   TestAccDataSourceStorageQueue_basicDeprecated
=== PAUSE TestAccDataSourceStorageQueue_basicDeprecated
=== RUN   TestAccStorageQueue_basic
=== PAUSE TestAccStorageQueue_basic
=== RUN   TestAccStorageQueue_basicDeprecated
=== PAUSE TestAccStorageQueue_basicDeprecated
=== RUN   TestAccStorageQueue_basicAzureADAuth
=== PAUSE TestAccStorageQueue_basicAzureADAuth
=== RUN   TestAccStorageQueue_basicAzureADAuthDeprecated
=== PAUSE TestAccStorageQueue_basicAzureADAuthDeprecated
=== RUN   TestAccStorageQueue_requiresImport
=== PAUSE TestAccStorageQueue_requiresImport
=== RUN   TestAccStorageQueue_requiresImportDeprecated
=== PAUSE TestAccStorageQueue_requiresImportDeprecated
=== RUN   TestAccStorageQueue_metaData
=== PAUSE TestAccStorageQueue_metaData
=== RUN   TestAccStorageQueue_metaDataDeprecated
=== PAUSE TestAccStorageQueue_metaDataDeprecated
=== CONT  TestAccDataSourceStorageQueue_basic
=== CONT  TestAccStorageQueue_basicAzureADAuthDeprecated
=== CONT  TestAccStorageQueue_basicDeprecated
=== CONT  TestAccStorageQueue_basic
=== CONT  TestAccStorageQueue_metaData
=== CONT  TestAccStorageQueue_metaDataDeprecated
=== CONT  TestAccStorageQueue_basicAzureADAuth
=== CONT  TestAccStorageQueue_requiresImportDeprecated
=== CONT  TestAccDataSourceStorageQueue_basicDeprecated
=== CONT  TestAccStorageQueue_requiresImport
--- PASS: TestAccDataSourceStorageQueue_basic (128.15s)
--- PASS: TestAccDataSourceStorageQueue_basicDeprecated (136.80s)
--- PASS: TestAccStorageQueue_requiresImport (143.45s)
--- PASS: TestAccStorageQueue_requiresImportDeprecated (146.10s)
--- PASS: TestAccStorageQueue_basicAzureADAuth (146.38s)
--- PASS: TestAccStorageQueue_basicDeprecated (146.89s)
--- PASS: TestAccStorageQueue_basic (150.56s)
--- PASS: TestAccStorageQueue_basicAzureADAuthDeprecated (157.17s)
--- PASS: TestAccStorageQueue_metaDataDeprecated (197.80s)
--- PASS: TestAccStorageQueue_metaData (202.20s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/storage       202.336s

The upgrade document is also updated to mention the deprecations.

Copy link
Member

@catriona-m catriona-m left a comment

Choose a reason for hiding this comment

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

Thanks @magodo I spotted a couple of minor things on having another look through but once those are addressed this should be good. Thanks!

magodo and others added 2 commits September 19, 2025 10:51
Co-authored-by: catriona-m <86247157+catriona-m@users.noreply.github.com>
Co-authored-by: catriona-m <86247157+catriona-m@users.noreply.github.com>
Co-authored-by: catriona-m <86247157+catriona-m@users.noreply.github.com>
@magodo
Copy link
Collaborator Author

magodo commented Sep 19, 2025

@catriona-m Thank you for taking another look! I've applied all the suggested commits!

Copy link
Member

@catriona-m catriona-m 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 fixing this up @magodo - LGTM!

@catriona-m catriona-m merged commit 2c64669 into hashicorp:main Sep 23, 2025
33 checks passed
@github-actions github-actions bot added this to the v4.46.0 milestone Sep 23, 2025
catriona-m added a commit that referenced this pull request Sep 23, 2025
sreallymatt pushed a commit that referenced this pull request Sep 24, 2025
mbfrahry pushed a commit that referenced this pull request Sep 25, 2025
@github-actions
Copy link
Contributor

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 Oct 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

2 participants