Skip to content

Commit

Permalink
Pass IDs for the FW sections and rules for update
Browse files Browse the repository at this point in the history
Currently when updating a firewall rules internally they get
deleted and the new ones are created (causing their IDs to change).
This is not always a desired behaviour, as the NSX-T API itself
allows changing the rules in place.

This patch adds the current firewall section and rule ID to the
payload in order to allow preserving the IDs.
  • Loading branch information
mkowalski committed Mar 14, 2019
1 parent bd048bc commit 84d20ad
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nsxt/resource_nsxt_firewall_section.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ func getRulesFromSchema(d *schema.ResourceData) []manager.FirewallRule {
data := rule.(map[string]interface{})
elem := manager.FirewallRule{
DisplayName: data["display_name"].(string),
Id: data["id"].(string),
RuleTag: data["rule_tag"].(string),
Notes: data["notes"].(string),
Description: data["description"].(string),
Expand Down Expand Up @@ -357,6 +358,7 @@ func resourceNsxtFirewallSectionUpdate(d *schema.ResourceData, m interface{}) er
AppliedTos: appliedTos,
SectionType: sectionType,
Stateful: stateful,
Id: id,
},
Rules: rules,
}
Expand Down

0 comments on commit 84d20ad

Please sign in to comment.