Skip to content

Commit

Permalink
Merge pull request #1093 from ksamoray/ipv6_paths_multitenancy
Browse files Browse the repository at this point in the history
Handle IPv6 paths correctly with multitenancy
  • Loading branch information
ksamoray authored Feb 1, 2024
2 parents 6816f38 + b402a60 commit 387a188
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions nsxt/gateway_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,19 @@ func getIpv6ProfilePathsFromSchema(d *schema.ResourceData) []string {
func setIpv6ProfilePathsInSchema(d *schema.ResourceData, paths []string) error {
for _, path := range paths {
tokens := strings.Split(path, "/")
// First token is empty, second is infra or global-infra, third is profile type
// First token is empty, second is infra, global-infra or orgs, third is profile type
if len(tokens) < 4 {
return fmt.Errorf("Unexpected ipv6 profile path: %s", path)
}
if tokens[2] == "ipv6-ndra-profiles" {
tokenOffset := 2
if tokens[1] == "orgs" && tokens[3] == "projects" {
// It's a multitenancy environment
tokenOffset = 6
}
if tokens[tokenOffset] == "ipv6-ndra-profiles" {
d.Set("ipv6_ndra_profile_path", path)
}
if tokens[2] == "ipv6-dad-profiles" {
if tokens[tokenOffset] == "ipv6-dad-profiles" {
d.Set("ipv6_dad_profile_path", path)
}
}
Expand Down

0 comments on commit 387a188

Please sign in to comment.