You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use nsxt_policy_predefined_gateway_policy to change the default rule action from ALLOW to Drop in all gateway Firewalls.
For every Route Based VPN the NSX Manager creates a default rule. So I use the same ressource to set those rules to DROP as well.
Unfortunately I run into an issue in case there are multiple Route Based VPNs in the Same T1 or T0.
The TF Providers tries to change the order of those default rules. That is how the Change looks like with 4 Route Based VPNs:
I can apply those changes without an error message but during the next tf plan the same change is detected again.
I would sort the input for my for_each statement into the same order as the NSX Manager is sorting the VTI Default Rules, but I don't know what the correct order is.
Or do you have the possibility to fix that somehow in the nsx tf provider?
Hi @benzander, thanks for raising this. The order of rules has significance in NSX, and therefore in provider (looks like in this particular use case the order is not important, however we have to respect the general use case). You can check the actual order on NSX via API or UI - I expect it to be consistent given that the order of creation of VPN tunnels is consistent. Hopefully this could be a workaround for short term?
One idea to solve this more elegantly could be to create a separate nsxt_policy_predefined_gateway_policy_rule resource. We'll discuss this and potential other solutions.
Hi @annakhm,
thanks for the fast response.
I agree that the order of firewall rules have significance. For the default rules the NSX manager doesn't provide the option to change the order.
In played around a bit and the order is indeed based on the creation of the tunnel. So a rule for a new tunnel is added over the existing default rules.
I tried to work around by using one nsxt_policy_predefined_gateway_policy per default rule, but that doesn't work either. The TF Provider wants to change the order here too. I also saw other site effects. When deleting tunnels it left the first default rule on the default action (allow). Another tf apply was required to change it back zo drop. So doesn't seem to be a good idea to use this resource multiple times for the same gateway.
I have another question - do you create VPN tunnels using terraform as well? You might not be able to predict the order of creation if those are parallelized by terraform.
Indeed, creating multiple nsxt_policy_predefined_gateway_policy resources for the same policy is not a good idea since all those instances would try to update the same object.
Yes, we are using Terraform to create the VPN Tunnels. We are doing the creation of the VPN Tunnels in a Terraform Module which also makes sure that the default firewall rule will be changed from allow to drop.
I also tried to predict the order and noticed that this is not possible.
We are running scheduled terraform plans for all customers to make sure the desired config matches the configured config. And that causes "config drift notifications". It would be very helpful if you could improved that in the TF Provider.
Describe the bug
I use nsxt_policy_predefined_gateway_policy to change the default rule action from ALLOW to Drop in all gateway Firewalls.
For every Route Based VPN the NSX Manager creates a default rule. So I use the same ressource to set those rules to DROP as well.
Unfortunately I run into an issue in case there are multiple Route Based VPNs in the Same T1 or T0.
The TF Providers tries to change the order of those default rules. That is how the Change looks like with 4 Route Based VPNs:
That is how the TF Code looks like:
I can apply those changes without an error message but during the next tf plan the same change is detected again.
I would sort the input for my for_each statement into the same order as the NSX Manager is sorting the VTI Default Rules, but I don't know what the correct order is.
Or do you have the possibility to fix that somehow in the nsx tf provider?
Reproduction steps
See description
Expected behavior
See description
Additional context
Terraform Version: 1.8.5
NSX TF Provider: v3.8.0
NSX Manager: 4.1.2.4.0.23786742
The text was updated successfully, but these errors were encountered: