-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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_firewall_polcy - Added new property private_ip_ranges #12696
Conversation
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.
hey @catriona-m
Thanks for this PR.
I've taken a look through and left some comments inline but if we can fix those up then this otherwise LGTM 👍
Thanks!
if prop.Snat != nil { | ||
if err := d.Set("private_ip_ranges", utils.FlattenStringSlice(prop.Snat.PrivateRanges)); err != nil { | ||
return fmt.Errorf("Error setting `private_ip_ranges`: %+v", err) | ||
} | ||
} |
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 always need to be set to a value, else we can't track it in the state - so this'll need to become:
if prop.Snat != nil { | |
if err := d.Set("private_ip_ranges", utils.FlattenStringSlice(prop.Snat.PrivateRanges)); err != nil { | |
return fmt.Errorf("Error setting `private_ip_ranges`: %+v", err) | |
} | |
} | |
var privateIpRanges []string | |
if prop.Snat != nil { | |
privateIpRanges = utils.FlattenStringSlice(prop.Snat.PrivateRanges) | |
} | |
if err := d.Set("private_ip_ranges", privateIpRanges); err != nil { | |
return fmt.Errorf("Error setting `private_ip_ranges`: %+v", err) | |
} |
if len(*privateIpRanges) != 0 { | ||
props.FirewallPolicyPropertiesFormat.Snat = &network.FirewallPolicySNAT{PrivateRanges: privateIpRanges} | ||
} |
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.
if we do this it's not possible to remove this, so we'll need to make this:
if len(*privateIpRanges) != 0 { | |
props.FirewallPolicyPropertiesFormat.Snat = &network.FirewallPolicySNAT{PrivateRanges: privateIpRanges} | |
} | |
props.FirewallPolicyPropertiesFormat.Snat = &network.FirewallPolicySNAT{ | |
PrivateRanges: privateIpRanges | |
} |
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.
one minor comment for consistency but this otherwise LGTM 👍
if v, ok := d.GetOk("private_ip_ranges"); ok { | ||
privateIpRanges := utils.ExpandStringSlice(v.([]interface{})) | ||
props.FirewallPolicyPropertiesFormat.Snat = &network.FirewallPolicySNAT{ | ||
PrivateRanges: privateIpRanges} |
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.
minor can we clean this up:
PrivateRanges: privateIpRanges} | |
PrivateRanges: privateIpRanges, | |
} |
This functionality has been released in v2.70.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! |
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 #12311