diff --git a/go.mod b/go.mod index dd02f5a8b..4f8e868a8 100644 --- a/go.mod +++ b/go.mod @@ -3,11 +3,11 @@ module github.com/vmware/terraform-provider-nsxt go 1.19 replace ( - github.com/vmware/vsphere-automation-sdk-go/lib => github.com/annakhm/vsphere-automation-sdk-go/lib v0.0.0-20240814000345-a7d05abf8e8a - github.com/vmware/vsphere-automation-sdk-go/runtime => github.com/annakhm/vsphere-automation-sdk-go/runtime v0.0.0-20240813234819-2d81f2fb5899 - github.com/vmware/vsphere-automation-sdk-go/services/nsxt => github.com/annakhm/vsphere-automation-sdk-go/services/nsxt v0.0.0-20240814000345-a7d05abf8e8a - github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm => github.com/annakhm/vsphere-automation-sdk-go/services/nsxt-gm v0.0.0-20240814000345-a7d05abf8e8a - github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp => github.com/annakhm/vsphere-automation-sdk-go/services/nsxt-mp v0.0.0-20240814000345-a7d05abf8e8a + github.com/vmware/vsphere-automation-sdk-go/lib => github.com/annakhm/vsphere-automation-sdk-go/lib v0.0.0-20240829205651-501d8b74a2f2 + github.com/vmware/vsphere-automation-sdk-go/runtime => github.com/annakhm/vsphere-automation-sdk-go/runtime v0.0.0-20240829205651-501d8b74a2f2 + github.com/vmware/vsphere-automation-sdk-go/services/nsxt => github.com/annakhm/vsphere-automation-sdk-go/services/nsxt v0.0.0-20240829205651-501d8b74a2f2 + github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm => github.com/annakhm/vsphere-automation-sdk-go/services/nsxt-gm v0.0.0-20240829205651-501d8b74a2f2 + github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp => github.com/annakhm/vsphere-automation-sdk-go/services/nsxt-mp v0.0.0-20240829205651-501d8b74a2f2 ) require ( diff --git a/go.sum b/go.sum index 72fe18b57..9ca9a17af 100644 --- a/go.sum +++ b/go.sum @@ -6,16 +6,16 @@ github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95/go.mod h1:EjA github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ= github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= -github.com/annakhm/vsphere-automation-sdk-go/lib v0.0.0-20240814000345-a7d05abf8e8a h1:vxciEg2xDvpsh4us7Hnm3payuQ3sTrTQOPYIj7AcfrY= -github.com/annakhm/vsphere-automation-sdk-go/lib v0.0.0-20240814000345-a7d05abf8e8a/go.mod h1:ADkX8BkdnvT1Kc9ZfqHaV4qzaaD+9L8Ok2+pxK4xoD8= -github.com/annakhm/vsphere-automation-sdk-go/runtime v0.0.0-20240813234819-2d81f2fb5899 h1:coq3Z8DDSYt+6RlJvc9BgqbQoTuWy+MLYwkx61YUaE0= -github.com/annakhm/vsphere-automation-sdk-go/runtime v0.0.0-20240813234819-2d81f2fb5899/go.mod h1:DzLetYAmw1+vj7bqElRWEpuy40WYE/woL3alsymYa/c= -github.com/annakhm/vsphere-automation-sdk-go/services/nsxt v0.0.0-20240814000345-a7d05abf8e8a h1:5N0EzmM8hsOCosRc4/X4bEzgQsRb0TZIfWyahgftkQM= -github.com/annakhm/vsphere-automation-sdk-go/services/nsxt v0.0.0-20240814000345-a7d05abf8e8a/go.mod h1:upLH9b9zpG86P0wwO4+gREf0lBXr8gYcs7P1FRZ9n30= -github.com/annakhm/vsphere-automation-sdk-go/services/nsxt-gm v0.0.0-20240814000345-a7d05abf8e8a h1:3hEqHzC9+9ZhcgUqLv/GzTqijCKAFcOBr5yHpoz9d88= -github.com/annakhm/vsphere-automation-sdk-go/services/nsxt-gm v0.0.0-20240814000345-a7d05abf8e8a/go.mod h1:gcEvyczWPFMZX2gkBiBVpOwvUGSNXSpxU19Sx9aiouY= -github.com/annakhm/vsphere-automation-sdk-go/services/nsxt-mp v0.0.0-20240814000345-a7d05abf8e8a h1:NOl9tNEaMJzqnIx4XpX6udXFLlx4JRmA3bXMz8hQwKs= -github.com/annakhm/vsphere-automation-sdk-go/services/nsxt-mp v0.0.0-20240814000345-a7d05abf8e8a/go.mod h1:ugk9I4YM62SSAox57l5NAVBCRIkPQ1RNLb3URxyTADc= +github.com/annakhm/vsphere-automation-sdk-go/lib v0.0.0-20240829205651-501d8b74a2f2 h1:g/LOjqOLwM3/zkMDqxcWiPo9f4cD2TARKpNodisecDw= +github.com/annakhm/vsphere-automation-sdk-go/lib v0.0.0-20240829205651-501d8b74a2f2/go.mod h1:ADkX8BkdnvT1Kc9ZfqHaV4qzaaD+9L8Ok2+pxK4xoD8= +github.com/annakhm/vsphere-automation-sdk-go/runtime v0.0.0-20240829205651-501d8b74a2f2 h1:jZasoSshbh7jFHHNXDhJ06SNSu7DRWu72IlwGpp/eV4= +github.com/annakhm/vsphere-automation-sdk-go/runtime v0.0.0-20240829205651-501d8b74a2f2/go.mod h1:DzLetYAmw1+vj7bqElRWEpuy40WYE/woL3alsymYa/c= +github.com/annakhm/vsphere-automation-sdk-go/services/nsxt v0.0.0-20240829205651-501d8b74a2f2 h1:PWqW/+aaPewj39/nmvER8ZGF4OwS7AFVCd4tg7FZgH0= +github.com/annakhm/vsphere-automation-sdk-go/services/nsxt v0.0.0-20240829205651-501d8b74a2f2/go.mod h1:upLH9b9zpG86P0wwO4+gREf0lBXr8gYcs7P1FRZ9n30= +github.com/annakhm/vsphere-automation-sdk-go/services/nsxt-gm v0.0.0-20240829205651-501d8b74a2f2 h1:06nwNUgwFfRBf6tytT9UHPYmmPKYPEyo4KmatvfPZLE= +github.com/annakhm/vsphere-automation-sdk-go/services/nsxt-gm v0.0.0-20240829205651-501d8b74a2f2/go.mod h1:gcEvyczWPFMZX2gkBiBVpOwvUGSNXSpxU19Sx9aiouY= +github.com/annakhm/vsphere-automation-sdk-go/services/nsxt-mp v0.0.0-20240829205651-501d8b74a2f2 h1:mlyh0vvF9Zwb6ZvGNfdP3KfFJ/J1ioAciz6CTkY2g4k= +github.com/annakhm/vsphere-automation-sdk-go/services/nsxt-mp v0.0.0-20240829205651-501d8b74a2f2/go.mod h1:ugk9I4YM62SSAox57l5NAVBCRIkPQ1RNLb3URxyTADc= github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= @@ -142,7 +142,6 @@ github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAh github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= github.com/vmware/go-vmware-nsxt v0.0.0-20220328155605-f49a14c1ef5f h1:NbC9yOr5At92seXK+kOr2TzU3mIWzcJOVzZasGSuwoU= github.com/vmware/go-vmware-nsxt v0.0.0-20220328155605-f49a14c1ef5f/go.mod h1:VEqcmf4Sp7gPB7z05QGyKVmn6xWppr7Nz8cVNvyC80o= -github.com/vmware/vsphere-automation-sdk-go/services/nsxt v0.12.0/go.mod h1:upLH9b9zpG86P0wwO4+gREf0lBXr8gYcs7P1FRZ9n30= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zclconf/go-cty v1.14.0 h1:/Xrd39K7DXbHzlisFP9c4pHao4yyf+/Ug9LEz+Y/yhc= diff --git a/nsxt/resource_nsxt_vpc_service_profile.go b/nsxt/resource_nsxt_vpc_service_profile.go index 9f98037a5..63a3e000e 100644 --- a/nsxt/resource_nsxt_vpc_service_profile.go +++ b/nsxt/resource_nsxt_vpc_service_profile.go @@ -19,8 +19,7 @@ import ( ) var vpcServiceProfileModeValues = []string{ - model.VpcProfileDhcpConfig_MODE_IP_ALLOCATION_BY_PORT, - model.VpcProfileDhcpConfig_MODE_IP_ALLOCATION_BY_MAC, + model.VpcProfileDhcpConfig_MODE_SERVER, model.VpcProfileDhcpConfig_MODE_RELAY, model.VpcProfileDhcpConfig_MODE_DEACTIVATED, } @@ -139,13 +138,41 @@ var vpcServiceProfileSchema = map[string]*metadata.ExtendedSchema{ Type: schema.TypeString, ValidateFunc: validation.StringInSlice(vpcServiceProfileModeValues, false), Optional: true, - Default: model.VpcProfileDhcpConfig_MODE_IP_ALLOCATION_BY_PORT, + Default: model.VpcProfileDhcpConfig_MODE_SERVER, }, Metadata: metadata.Metadata{ SchemaType: "string", SdkFieldName: "Mode", }, }, + "advanced_config": { + Schema: schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Elem: &metadata.ExtendedResource{ + Schema: map[string]*metadata.ExtendedSchema{ + "is_distributed_dhcp": { + Schema: schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + Metadata: metadata.Metadata{ + SchemaType: "bool", + SdkFieldName: "IsDistributedDhcp", + }, + }, + }, + }, + Optional: true, + Computed: true, + }, + Metadata: metadata.Metadata{ + SchemaType: "struct", + SdkFieldName: "AdvancedConfig", + ReflectType: reflect.TypeOf(model.VpcDhcpAdvancedConfig{}), + }, + }, "dhcp_relay_config": { Schema: schema.Schema{ Type: schema.TypeList, diff --git a/nsxt/resource_nsxt_vpc_service_profile_test.go b/nsxt/resource_nsxt_vpc_service_profile_test.go index ab14661e3..27da1756c 100644 --- a/nsxt/resource_nsxt_vpc_service_profile_test.go +++ b/nsxt/resource_nsxt_vpc_service_profile_test.go @@ -16,7 +16,7 @@ var accTestPolicyVpcServiceProfileCreateAttributes = map[string]string{ "description": "terraform created", "ntp_servers": "5.5.5.5", "lease_time": "50840", - "mode": "DHCP_IP_ALLOCATION_BY_PORT", + "mode": "DHCP_SERVER", "dns_server_ips": "7.7.7.7", "server_addresses": "11.11.11.11", "cache_size": "2048", @@ -28,7 +28,7 @@ var accTestPolicyVpcServiceProfileUpdateAttributes = map[string]string{ "description": "terraform updated", "ntp_servers": "5.5.5.7", "lease_time": "148000", - "mode": "DHCP_IP_ALLOCATION_BY_MAC", + "mode": "DHCP_SERVER", "dns_server_ips": "7.7.7.2", "server_addresses": "11.11.11.111", "cache_size": "1024", diff --git a/nsxt/resource_nsxt_vpc_test.go b/nsxt/resource_nsxt_vpc_test.go index d8ac4cb6c..27bde821a 100644 --- a/nsxt/resource_nsxt_vpc_test.go +++ b/nsxt/resource_nsxt_vpc_test.go @@ -190,7 +190,7 @@ resource "nsxt_vpc_service_profile" "test" { %s display_name = "%s" dhcp_config { - mode = "DHCP_IP_ALLOCATION_BY_PORT" + mode = "DHCP_SERVER" } }