Skip to content

Commit 8a737a7

Browse files
authored
Merge pull request #122 from vmware/bugfix/ip-pool
Respect IP Pool configuration for NSX subresource
2 parents 069da0e + 29ab166 commit 8a737a7

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

internal/provider/resource_vcf_instance_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,17 @@ func testAccCheckVcfSddcConfigBasic() string {
145145
vip_fqdn = "vip-nsx-mgmt"
146146
license = %q
147147
transport_vlan_id = 0
148+
ip_address_pool {
149+
name = "static-pool-1"
150+
subnet {
151+
cidr = "10.0.8.4/24"
152+
gateway = "10.0.8.253"
153+
ip_address_pool_range {
154+
start = "10.0.8.4"
155+
end = "10.0.8.16"
156+
}
157+
}
158+
}
148159
}
149160
vsan {
150161
license = %q

internal/sddc/sddc_nsx_subresource.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,14 @@ func GetNsxSpecFromSchema(rawData []interface{}) *models.SDDCNSXTSpec {
158158
if overLayTransportZoneData := getTransportZoneFromSchema(data["overlay_transport_zone"].([]interface{})); overLayTransportZoneData != nil {
159159
nsxtSpecBinding.OverLayTransportZone = overLayTransportZoneData
160160
}
161+
162+
if ipAddressPoolRaw, ok := data["ip_address_pool"]; ok && !validation_utils.IsEmpty(ipAddressPoolRaw) {
163+
ipAddressPoolList := ipAddressPoolRaw.([]interface{})
164+
// Only one IP Address pool spec is allowed in the resource
165+
if ipAddressPoolSpec, err := network.GetIpAddressPoolSpecFromSchema(ipAddressPoolList[0].(map[string]interface{})); err == nil {
166+
nsxtSpecBinding.IPAddressPoolSpec = ipAddressPoolSpec
167+
}
168+
}
161169
return nsxtSpecBinding
162170
}
163171

0 commit comments

Comments
 (0)