diff --git a/pkg/types/vsphere/validation/platform.go b/pkg/types/vsphere/validation/platform.go index 75209d8bc0..8e66de87ae 100644 --- a/pkg/types/vsphere/validation/platform.go +++ b/pkg/types/vsphere/validation/platform.go @@ -165,6 +165,7 @@ func validateFailureDomains(p *vsphere.Platform, platformFldPath *field.Path, fl zoneNames := make(map[string]string) for index, failureDomain := range p.FailureDomains { + associatedVCenter = nil if regionName, ok := zoneNames[failureDomain.Zone]; !ok { zoneNames[failureDomain.Zone] = failureDomain.Region } else if regionName == failureDomain.Region { diff --git a/pkg/types/vsphere/validation/platform_test.go b/pkg/types/vsphere/validation/platform_test.go index 099188dd99..cc317ef290 100644 --- a/pkg/types/vsphere/validation/platform_test.go +++ b/pkg/types/vsphere/validation/platform_test.go @@ -484,6 +484,15 @@ func TestValidatePlatform(t *testing.T) { }(), expectedError: `^test-path\.failureDomains\.server: Invalid value: "bad-vcenter": server does not exist in vcenters`, }, + { + name: "Multi-zone platform wrong vCenter name in second failureDomain", + platform: func() *vsphere.Platform { + p := validPlatform() + p.FailureDomains[1].Server = "bad-vcenter" + return p + }(), + expectedError: `^test-path\.failureDomains\.server: Invalid value: "bad-vcenter": server does not exist in vcenters`, + }, { name: "Multi-zone platform datacenter not in vCenter datacenters list", platform: func() *vsphere.Platform {