Skip to content

For azurerm_storage_container - argument "storage_account_name" is deprecated in favour of "storage_account_id" but forcing replacement #28124

Closed
@MartinBoge

Description

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment and review the contribution guide to help.

Terraform Version

1.9.8

AzureRM Provider Version

4.11.0

Affected Resource(s)/Data Source(s)

azurerm_storage_container

Terraform Configuration Files

From this:

resource "azurerm_storage_container" "st_media" {
  name                  = "media"
  storage_account_name  = azurerm_storage_account.st.name
  container_access_type = "private"
}

To this:

resource "azurerm_storage_container" "st_media" {
  name                  = "media"
  storage_account_id    = azurerm_storage_account.st.id
  container_access_type = "private"
}

Debug Output/Panic Output

# azurerm_storage_container.st_media must be replaced
-/+ resource "azurerm_storage_container" "st_media" {
      ~ default_encryption_scope          = "$account-encryption-key" -> (known after apply)
      ~ has_immutability_policy           = false -> (known after apply)
      ~ has_legal_hold                    = false -> (known after apply)
      ~ id                                = "https://xxx.blob.core.windows.net/media" -> (known after apply)
      ~ metadata                          = {} -> (known after apply)
        name                              = "media"
      ~ resource_manager_id               = "/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Storage/storageAccounts/xxx/blobServices/default/containers/media" -> (known after apply)
      + storage_account_id                = "/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Storage/storageAccounts/xxx" # forces replacement
      - storage_account_name              = "xxx" -> null # forces replacement
        # (2 unchanged attributes hidden)
    }

Expected Behaviour

I would expect that if the argument storage_account_name is being deprecated in favour of storage_account_id then i would not be forced to replace a production resource.

I have tried removing my container from the state and importing it back in after setting the id - but the issue remains.

Actual Behaviour

No response

Steps to Reproduce

Have a storage container be created by using argument storage_account_name, then reconfigure to use storage_account_id.

Important Factoids

No response

References

No response

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions