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_management_policy - Add existance check #22966

Merged
merged 4 commits into from
Aug 17, 2023

Conversation

magodo
Copy link
Collaborator

@magodo magodo commented Aug 16, 2023

The concern is whether the lock here is necessary, as if that is the case, then I believe almost all of the existing resources should add that. But at least, it is needed for the use case in #18583.

Fix #18583

Test

💤  TF_ACC=1 go test -v -timeout=20h -run='TestAccStorageManagementPolicy_requiersImport' ./internal/services/storage
=== RUN   TestAccStorageManagementPolicy_requiersImport
=== PAUSE TestAccStorageManagementPolicy_requiersImport
=== CONT  TestAccStorageManagementPolicy_requiersImport
--- PASS: TestAccStorageManagementPolicy_requiersImport (152.71s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/storage       152.721s

Copy link
Member

@mbfrahry mbfrahry left a comment

Choose a reason for hiding this comment

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

Hey @magodo, this change looks good minus what you called out with the locks. We should do a separate PR for that so we can get this in quicker

// TODO: support Requires Import
if d.IsNewResource() {
// This lock is to protect the existence checking when two storage mgmt policies are being created at the same time.
locks.ByID(mgmtPolicyId.ID())
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure we should go this route quite yet. We should do a separate PR with it's own test to confirm that this will fix that issue.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I've removed the locks.

Copy link
Member

@stephybun stephybun 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 👍

@stephybun stephybun merged commit b1de359 into hashicorp:main Aug 17, 2023
stephybun added a commit that referenced this pull request Aug 17, 2023
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 17, 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.

azurerm_storage_management_policy overwrites the rules
3 participants