Skip to content

Commit 1662413

Browse files
authored
Added a check for the d_from_port and d_to_port when saving the state as it was not previously saving the correct state. related issue: #164 (#165)
1 parent f6b5bf4 commit 1662413

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

aci/resource_aci_vzbrcp.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,8 +565,16 @@ func setFilterEntryAttributesFromContract(vzentry *models.FilterEntry, d *schema
565565
eMap["s_to_port"] = vzEntryMap["sToPort"]
566566
eMap["stateful"] = vzEntryMap["stateful"]
567567
eMap["tcp_rules"] = vzEntryMap["tcpRules"]
568-
eMap["d_from_port"] = constantPortMapping[vzEntryMap["dFromPort"]]
569-
eMap["d_to_port"] = constantPortMapping[vzEntryMap["dToPort"]]
568+
if v, found := constantPortMapping[vzEntryMap["dFromPort"]]; found {
569+
eMap["d_from_port"] = v
570+
} else {
571+
eMap["d_from_port"] = vzEntryMap["dFromPort"]
572+
}
573+
if v, found := constantPortMapping[vzEntryMap["dToPort"]]; found {
574+
eMap["d_to_port"] = v
575+
} else {
576+
eMap["d_to_port"] = vzEntryMap["dToPort"]
577+
}
570578
return eMap
571579
}
572580

0 commit comments

Comments
 (0)