-
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_ip_group
: parse and normalize firewall/policy id in read
#24031
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -183,8 +183,25 @@ func resourceIpGroupRead(d *pluginsdk.ResourceData, meta interface{}) error { | |||||
} | ||||||
} | ||||||
|
||||||
d.Set("firewall_ids", getIds(resp.Firewalls)) | ||||||
d.Set("firewall_policy_ids", getIds(resp.FirewallPolicies)) | ||||||
var firewallIDs []string | ||||||
for _, idStr := range getIds(resp.Firewalls) { | ||||||
firewallID, err := azurefirewalls.ParseAzureFirewallIDInsensitively(idStr) | ||||||
if err != nil { | ||||||
return fmt.Errorf("parsing Azure Firewall ID %q: %+v", idStr, err) | ||||||
} | ||||||
firewallIDs = append(firewallIDs, firewallID.ID()) | ||||||
} | ||||||
d.Set("firewall_ids", firewallIDs) | ||||||
|
||||||
var firewallPolicyIDs []string | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this'll default to
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated! I'm just wondering if the SDK treats nil and empty slices differently. Should we always provide a non-nil value when calling |
||||||
for _, idStr := range getIds(resp.FirewallPolicies) { | ||||||
policyID, err := firewallpolicies.ParseFirewallPolicyIDInsensitively(idStr) | ||||||
if err != nil { | ||||||
return fmt.Errorf("parsing Azure Firewall Policy ID %q: %+v", idStr, err) | ||||||
} | ||||||
firewallPolicyIDs = append(firewallPolicyIDs, policyID.ID()) | ||||||
} | ||||||
d.Set("firewall_policy_ids", firewallPolicyIDs) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This issue still exists however - particularly in the Delete but also if the validation is wrong in the Create/Update/if refresh is disabled:
As such, can we update this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks and Updated! |
||||||
|
||||||
return tags.FlattenAndSet(d, resp.Tags) | ||||||
} | ||||||
|
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.
this'll default to
nil
rather than[]string
fwiw, so we want to make this: