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_palo_alto_next_generation_firewall_virtual_network_local_rulestack: add lock of ruleStackID in creating #23601

Merged
merged 4 commits into from
Oct 26, 2023

Conversation

wuxu92
Copy link
Contributor

@wuxu92 wuxu92 commented Oct 18, 2023

fixes #23472.

Firewall Creating should be sequentialized with other rule create operation, so we should add a lock for it (also extend timeout value).

image

@wuxu92 wuxu92 marked this pull request as ready for review October 20, 2023 04:14
@@ -276,6 +280,12 @@ func (r NextGenerationFirewallVHubLocalRuleStackResource) Update() sdk.ResourceF
firewall.Tags = tags.Expand(model.Tags)
}

if metadata.ResourceData.HasChange("rulestack_id") {
ruleStackID, _ := localrulestacks.ParseLocalRulestackID(model.RuleStackId)
Copy link
Member

Choose a reason for hiding this comment

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

should we be checking the error here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The Line 252 above has checked this error already.

Copy link
Member

Choose a reason for hiding this comment

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

it will only get checked there if there is the rulestack_id has been updated. I think we should check it here and in next_generation_firewall_vnet_local_rulestack_resource.go line 280 as well just to be on the safe side.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

error check added.

@@ -276,6 +280,15 @@ func (r NextGenerationFirewallVHubLocalRuleStackResource) Update() sdk.ResourceF
firewall.Tags = tags.Expand(model.Tags)
}

if metadata.ResourceData.HasChange("rulestack_id") {
Copy link
Member

Choose a reason for hiding this comment

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

should we be locking when rulestack_id has not changed too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TBH I'm not sure about this because it seems to be related to the API implementation. But intuitively, we only need lock when rulestack_id changes as it's only a reference to the rulestack resource.

Copy link
Member

Choose a reason for hiding this comment

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

we could add the locks after line 251 then to avoid checking if it's changed and parsing it twice

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have ever thought about it before, but now moved the locks after L251.

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 @wuxu92 LGTM!

@catriona-m catriona-m merged commit eb01a5e into hashicorp:main Oct 26, 2023
24 checks passed
@github-actions github-actions bot added this to the v3.78.0 milestone Oct 26, 2023
catriona-m added a commit that referenced this pull request Oct 26, 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 10, 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.

Firewall creation failure during initial attempt
2 participants