Skip to content

Commit

Permalink
Merge pull request #1337 from vmware/adjust-service-profile
Browse files Browse the repository at this point in the history
Adjust VPC service profile to NSX changes
  • Loading branch information
salv-orlando authored Aug 30, 2024
2 parents 2c2c42d + e64cf73 commit 9eb0556
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 22 deletions.
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
21 changes: 10 additions & 11 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand Down
33 changes: 30 additions & 3 deletions nsxt/resource_nsxt_vpc_service_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions nsxt/resource_nsxt_vpc_service_profile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion nsxt/resource_nsxt_vpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
Expand Down

0 comments on commit 9eb0556

Please sign in to comment.