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_storage_object_replication - Use storage account id as properties.sourceAccount and properties.destinationAccount #20132

Merged

Conversation

magodo
Copy link
Collaborator

@magodo magodo commented Jan 20, 2023

Detailed context of this change can be found at: #19457 (comment). Quoted below:

Per: https://learn.microsoft.com/en-us/azure/storage/blobs/object-replication-overview#specify-full-resource-ids-for-the-source-and-destination-accounts

The policy definition file previously required only the account name, instead of the full resource ID for the storage account. With the introduction of the AllowCrossTenantReplication security property in version 2021-02-01 of the Azure Storage resource provider REST API, you must now provide the full resource ID for any object replication policies that are created when cross-tenant replication is disallowed for a storage account that participates in the replication policy. Azure Storage uses the full resource ID to verify whether the source and destination accounts reside within the same tenant.

The ARM API-endpoint docs have also been updated: https://learn.microsoft.com/en-us/rest/api/storagerp/object-replication-policies/get?tabs=HTTP#objectreplicationpolicy

properties.destinationAccount - Required. Destination account name. It should be full resource id if allowCrossTenantReplication set to false.
properties.sourceAccount - Required. Source account name. It should be full resource id if allowCrossTenantReplication set to false.

Fix #19457

Note that since the terraform schema is always using the storage account id before and after this PR, which means there would be no impact to existing users. As we are not reading the properties.sourceAccount and properties.destinationAccount to construct our TF state, but only used for import check (hence the change).

Test

>  TF_ACC=1 go test -v -timeout=20h ./internal/services/storage -run=TestAccStorageObjectReplication_
=== RUN   TestAccStorageObjectReplication_basic
=== PAUSE TestAccStorageObjectReplication_basic
=== RUN   TestAccStorageObjectReplication_requiresImport
=== PAUSE TestAccStorageObjectReplication_requiresImport
=== RUN   TestAccStorageObjectReplication_complete
=== PAUSE TestAccStorageObjectReplication_complete
=== RUN   TestAccStorageObjectReplication_update
=== PAUSE TestAccStorageObjectReplication_update
=== RUN   TestAccStorageObjectReplication_crossTenantDisabled
=== PAUSE TestAccStorageObjectReplication_crossTenantDisabled
=== RUN   TestAccStorageObjectReplication_crossSubscription
=== PAUSE TestAccStorageObjectReplication_crossSubscription
=== CONT  TestAccStorageObjectReplication_crossSubscription
=== CONT  TestAccStorageObjectReplication_basic
=== CONT  TestAccStorageObjectReplication_update
=== CONT  TestAccStorageObjectReplication_crossTenantDisabled
=== CONT  TestAccStorageObjectReplication_complete
=== CONT  TestAccStorageObjectReplication_requiresImport
--- PASS: TestAccStorageObjectReplication_crossTenantDisabled (180.06s)
--- PASS: TestAccStorageObjectReplication_complete (181.58s)
--- PASS: TestAccStorageObjectReplication_basic (183.65s)
--- PASS: TestAccStorageObjectReplication_requiresImport (187.35s)
--- PASS: TestAccStorageObjectReplication_crossSubscription (206.38s)
--- PASS: TestAccStorageObjectReplication_update (371.12s)
PASS

…perties.sourceAccount` and `properties.destinationAccount``
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.

@magodo - can we fix the conflic and build?

@jackofallops jackofallops self-assigned this Feb 6, 2023
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 @magodo - LGTM 🥤

@katbyte katbyte merged commit 9fdf464 into hashicorp:main Feb 27, 2023
@github-actions github-actions bot added this to the v3.46.0 milestone Feb 27, 2023
katbyte added a commit that referenced this pull request Feb 27, 2023
@github-actions
Copy link

github-actions bot commented Mar 6, 2023

This functionality has been released in v3.46.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
Copy link

github-actions bot commented Apr 6, 2023

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 Apr 6, 2023
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.

azurerm_storage_object_replication cant create replication
3 participants