From 7cac13b292f1921cfa28599eb2a8e5d7d2f35e14 Mon Sep 17 00:00:00 2001 From: Mateusz Kowalski Date: Thu, 14 Mar 2019 17:04:54 +0100 Subject: [PATCH] Pass IDs for the FW sections and rules for update 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. --- nsxt/resource_nsxt_firewall_section.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nsxt/resource_nsxt_firewall_section.go b/nsxt/resource_nsxt_firewall_section.go index 297c48fbf..ee7d7351a 100644 --- a/nsxt/resource_nsxt_firewall_section.go +++ b/nsxt/resource_nsxt_firewall_section.go @@ -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), @@ -357,6 +358,7 @@ func resourceNsxtFirewallSectionUpdate(d *schema.ResourceData, m interface{}) er AppliedTos: appliedTos, SectionType: sectionType, Stateful: stateful, + Id: id, }, Rules: rules, }