Skip to content

Commit

Permalink
Fix read in separate security policy rule resource
Browse files Browse the repository at this point in the history
Before the fix, the code did not respect empty lists for certain
attributes, which resulted in non-empty plan.

Signed-off-by: Anna Khmelnitsky <[email protected]>
  • Loading branch information
annakhm committed Jun 3, 2024
1 parent 09cd1f2 commit 924fa89
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nsxt/policy_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,11 @@ func getPathListFromSchema(d *schema.ResourceData, schemaAttrName string) []stri
}

func setPathListInSchema(d *schema.ResourceData, attrName string, pathList []string) {
if !(len(pathList) == 1 && pathList[0] == "ANY") {
d.Set(attrName, pathList)
if len(pathList) == 1 && pathList[0] == "ANY" {
d.Set(attrName, nil)
return
}
d.Set(attrName, pathList)
}

func getDomainFromResourcePath(rPath string) string {
Expand Down

0 comments on commit 924fa89

Please sign in to comment.