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_firewall_polcy - Added new property private_ip_ranges #12696

Merged
merged 3 commits into from
Jul 29, 2021

Conversation

catriona-m
Copy link
Member

fixes #12311

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a 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!

Comment on lines 311 to 315
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)
}
}
Copy link
Contributor

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:

Suggested change
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)
}

Comment on lines 229 to 231
if len(*privateIpRanges) != 0 {
props.FirewallPolicyPropertiesFormat.Snat = &network.FirewallPolicySNAT{PrivateRanges: privateIpRanges}
}
Copy link
Contributor

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:

Suggested change
if len(*privateIpRanges) != 0 {
props.FirewallPolicyPropertiesFormat.Snat = &network.FirewallPolicySNAT{PrivateRanges: privateIpRanges}
}
props.FirewallPolicyPropertiesFormat.Snat = &network.FirewallPolicySNAT{
PrivateRanges: privateIpRanges
}

@github-actions github-actions bot added size/S and removed size/XS labels Jul 26, 2021
Copy link
Contributor

@tombuildsstuff tombuildsstuff left a 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}
Copy link
Contributor

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:

Suggested change
PrivateRanges: privateIpRanges}
PrivateRanges: privateIpRanges,
}

@catriona-m catriona-m merged commit 9fb86ef into master Jul 29, 2021
catriona-m added a commit that referenced this pull request Jul 29, 2021
@catriona-m catriona-m deleted the cm/fwp_private_ips branch July 29, 2021 14:51
@github-actions
Copy link

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!

@github-actions
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 Aug 29, 2021
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.

Support for private_ip_ranges on azurerm_firewall_policy
2 participants