-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Conversation
@@ -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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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") { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @wuxu92 LGTM!
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. |
fixes #23472.
Firewall Creating should be sequentialized with other rule create operation, so we should add a lock for it (also extend timeout value).