From 429afe0332e782d109ff712eaf3ba15d123d9567 Mon Sep 17 00:00:00 2001 From: MegaportPhilipBrowne Date: Tue, 17 Sep 2024 12:46:05 -0400 Subject: [PATCH 1/9] feat: support updating partner config in vxc update --- internal/provider/vxc_resource.go | 363 ++++++++++++++++++++++++- internal/provider/vxc_resource_test.go | 109 ++++++++ 2 files changed, 464 insertions(+), 8 deletions(-) diff --git a/internal/provider/vxc_resource.go b/internal/provider/vxc_resource.go index 92edc45..7a06396 100644 --- a/internal/provider/vxc_resource.go +++ b/internal/provider/vxc_resource.go @@ -3245,26 +3245,48 @@ func (r *vxcResource) Update(ctx context.Context, req resource.UpdateRequest, re } var aEndPlan, bEndPlan, aEndState, bEndState *vxcEndConfigurationModel + var aEndPartnerPlan, bEndPartnerPlan, aEndPartnerState, bEndPartnerState *vxcPartnerConfigurationModel aEndPlanDiags := plan.AEndConfiguration.As(ctx, &aEndPlan, basetypes.ObjectAsOptions{}) - if aEndPlanDiags.HasError() { - resp.Diagnostics.Append(aEndPlanDiags...) + resp.Diagnostics.Append(aEndPlanDiags...) + if resp.Diagnostics.HasError() { return } bEndPlanDiags := plan.BEndConfiguration.As(ctx, &bEndPlan, basetypes.ObjectAsOptions{}) - if bEndPlanDiags.HasError() { - resp.Diagnostics.Append(bEndPlanDiags...) + resp.Diagnostics.Append(bEndPlanDiags...) + if resp.Diagnostics.HasError() { return } aEndStateDiags := state.AEndConfiguration.As(ctx, &aEndState, basetypes.ObjectAsOptions{}) - if aEndStateDiags.HasError() { - resp.Diagnostics.Append(aEndStateDiags...) + resp.Diagnostics.Append(aEndStateDiags...) + if resp.Diagnostics.HasError() { return } bEndStateDiags := state.BEndConfiguration.As(ctx, &bEndState, basetypes.ObjectAsOptions{}) - if bEndStateDiags.HasError() { - resp.Diagnostics.Append(bEndStateDiags...) + resp.Diagnostics.Append(bEndStateDiags...) + if resp.Diagnostics.HasError() { + return + } + + aEndPartnerPlanDiags := plan.AEndPartnerConfig.As(ctx, &aEndPartnerPlan, basetypes.ObjectAsOptions{}) + resp.Diagnostics.Append(aEndPartnerPlanDiags...) + if resp.Diagnostics.HasError() { + return + } + bEndPartnerPlanDiags := plan.BEndPartnerConfig.As(ctx, &bEndPartnerPlan, basetypes.ObjectAsOptions{}) + resp.Diagnostics.Append(bEndPartnerPlanDiags...) + if resp.Diagnostics.HasError() { + return + } + aEndPartnerStateDiags := state.AEndPartnerConfig.As(ctx, &aEndPartnerState, basetypes.ObjectAsOptions{}) + resp.Diagnostics.Append(aEndPartnerStateDiags...) + if resp.Diagnostics.HasError() { + return + } + bEndPartnerStateDiags := state.BEndPartnerConfig.As(ctx, &bEndPartnerState, basetypes.ObjectAsOptions{}) + resp.Diagnostics.Append(bEndPartnerStateDiags...) + if resp.Diagnostics.HasError() { return } @@ -3324,6 +3346,331 @@ func (r *vxcResource) Update(ctx context.Context, req resource.UpdateRequest, re bEndState.RequestedProductUID = bEndPlan.RequestedProductUID } + if !plan.AEndPartnerConfig.IsNull() && !plan.AEndPartnerConfig.Equal(state.AEndPartnerConfig) { + switch aEndPartnerPlan.Partner.ValueString() { + case "vrouter": + if aEndPartnerPlan.VrouterPartnerConfig.IsNull() { + resp.Diagnostics.AddError( + "Error creating VXC", + "Could not create VXC with name "+plan.Name.ValueString()+": Virtual router configuration is required", + ) + return + } + var partnerConfigAEnd vxcPartnerConfigVrouterModel + aEndDiags := aEndPartnerPlan.VrouterPartnerConfig.As(ctx, &partnerConfigAEnd, basetypes.ObjectAsOptions{}) + resp.Diagnostics.Append(aEndDiags...) + if resp.Diagnostics.HasError() { + return + } + prefixFilterListRes, err := r.client.MCRService.ListMCRPrefixFilterLists(ctx, aEndState.RequestedProductUID.ValueString()) + if err != nil { + resp.Diagnostics.AddError( + "Error creating VXC", + "Could not create VXC with name "+plan.Name.ValueString()+": "+err.Error(), + ) + return + } + + aEndMegaportConfig := &megaport.VXCOrderVrouterPartnerConfig{} + ifaceModels := []*vxcPartnerConfigInterfaceModel{} + ifaceDiags := partnerConfigAEnd.Interfaces.ElementsAs(ctx, &ifaceModels, false) + resp.Diagnostics = append(resp.Diagnostics, ifaceDiags...) + for _, iface := range ifaceModels { + toAppend := megaport.PartnerConfigInterface{} + if !iface.IPAddresses.IsNull() { + ipAddresses := []string{} + ipDiags := iface.IPAddresses.ElementsAs(ctx, &ipAddresses, true) + resp.Diagnostics = append(resp.Diagnostics, ipDiags...) + toAppend.IpAddresses = ipAddresses + } + if !iface.IPRoutes.IsNull() { + ipRoutes := []*ipRouteModel{} + ipRouteDiags := iface.IPRoutes.ElementsAs(ctx, &ipRoutes, true) + resp.Diagnostics = append(resp.Diagnostics, ipRouteDiags...) + for _, ipRoute := range ipRoutes { + toAppend.IpRoutes = append(toAppend.IpRoutes, megaport.IpRoute{ + Prefix: ipRoute.Prefix.ValueString(), + Description: ipRoute.Description.ValueString(), + NextHop: ipRoute.NextHop.ValueString(), + }) + } + } + if !iface.NatIPAddresses.IsNull() { + natIPAddresses := []string{} + natDiags := iface.NatIPAddresses.ElementsAs(ctx, &natIPAddresses, true) + resp.Diagnostics = append(resp.Diagnostics, natDiags...) + toAppend.NatIpAddresses = natIPAddresses + } + if !iface.Bfd.IsNull() { + bfd := &bfdConfigModel{} + bfdDiags := iface.Bfd.As(ctx, bfd, basetypes.ObjectAsOptions{}) + resp.Diagnostics = append(resp.Diagnostics, bfdDiags...) + toAppend.Bfd = megaport.BfdConfig{ + TxInterval: int(bfd.TxInterval.ValueInt64()), + RxInterval: int(bfd.RxInterval.ValueInt64()), + Multiplier: int(bfd.Multiplier.ValueInt64()), + } + } + if !iface.VLAN.IsNull() { + toAppend.VLAN = int(iface.VLAN.ValueInt64()) + } + if !iface.BgpConnections.IsNull() { + bgpConnections := []*bgpConnectionConfigModel{} + bgpDiags := iface.BgpConnections.ElementsAs(ctx, &bgpConnections, false) + resp.Diagnostics = append(resp.Diagnostics, bgpDiags...) + for _, bgpConnection := range bgpConnections { + bgpToAppend := megaport.BgpConnectionConfig{ + PeerAsn: int(bgpConnection.PeerAsn.ValueInt64()), + LocalIpAddress: bgpConnection.LocalIPAddress.ValueString(), + PeerIpAddress: bgpConnection.PeerIPAddress.ValueString(), + Password: bgpConnection.Password.ValueString(), + Shutdown: bgpConnection.Shutdown.ValueBool(), + Description: bgpConnection.Description.ValueString(), + MedIn: int(bgpConnection.MedIn.ValueInt64()), + MedOut: int(bgpConnection.MedOut.ValueInt64()), + BfdEnabled: bgpConnection.BfdEnabled.ValueBool(), + ExportPolicy: bgpConnection.ExportPolicy.ValueString(), + AsPathPrependCount: int(bgpConnection.AsPathPrependCount.ValueInt64()), + PeerType: bgpConnection.PeerType.ValueString(), + } + if !bgpConnection.ImportWhitelist.IsNull() { + for _, prefixFilterList := range prefixFilterListRes { + if prefixFilterList.Description == bgpConnection.ImportWhitelist.ValueString() { + bgpToAppend.ImportWhitelist = prefixFilterList.Id + } + } + } + if !bgpConnection.ImportBlacklist.IsNull() { + for _, prefixFilterList := range prefixFilterListRes { + if prefixFilterList.Description == bgpConnection.ImportBlacklist.ValueString() { + bgpToAppend.ImportBlacklist = prefixFilterList.Id + } + } + } + if !bgpConnection.ExportWhitelist.IsNull() { + for _, prefixFilterList := range prefixFilterListRes { + if prefixFilterList.Description == bgpConnection.ExportWhitelist.ValueString() { + bgpToAppend.ExportWhitelist = prefixFilterList.Id + } + } + } + if !bgpConnection.ExportBlacklist.IsNull() { + for _, prefixFilterList := range prefixFilterListRes { + if prefixFilterList.Description == bgpConnection.ExportBlacklist.ValueString() { + bgpToAppend.ExportBlacklist = prefixFilterList.Id + } + } + } + if !bgpConnection.PermitExportTo.IsNull() { + permitExportTo := []string{} + permitDiags := bgpConnection.PermitExportTo.ElementsAs(ctx, &permitExportTo, true) + resp.Diagnostics = append(resp.Diagnostics, permitDiags...) + bgpToAppend.PermitExportTo = permitExportTo + bgpToAppend.PermitExportTo = permitExportTo + } + if !bgpConnection.DenyExportTo.IsNull() { + denyExportTo := []string{} + denyDiags := bgpConnection.DenyExportTo.ElementsAs(ctx, &denyExportTo, true) + resp.Diagnostics = append(resp.Diagnostics, denyDiags...) + bgpToAppend.DenyExportTo = denyExportTo + } + toAppend.BgpConnections = append(toAppend.BgpConnections, bgpToAppend) + } + } + aEndMegaportConfig.Interfaces = append(aEndMegaportConfig.Interfaces, toAppend) + } + vRouterConfigObj, aEndDiags := types.ObjectValueFrom(ctx, vxcPartnerConfigVrouterAttrs, partnerConfigAEnd) + resp.Diagnostics.Append(aEndDiags...) + aws := types.ObjectNull(vxcPartnerConfigAWSAttrs) + azure := types.ObjectNull(vxcPartnerConfigAzureAttrs) + google := types.ObjectNull(vxcPartnerConfigGoogleAttrs) + oracle := types.ObjectNull(vxcPartnerConfigOracleAttrs) + aEndPartner := types.ObjectNull(vxcPartnerConfigAEndAttrs) + aEndPartnerConfigModel := &vxcPartnerConfigurationModel{ + Partner: aEndPartnerPlan.Partner, + AWSPartnerConfig: aws, + AzurePartnerConfig: azure, + GooglePartnerConfig: google, + OraclePartnerConfig: oracle, + VrouterPartnerConfig: vRouterConfigObj, + PartnerAEndConfig: aEndPartner, + } + aEndPartnerConfigObj, partnerDiags := types.ObjectValueFrom(ctx, vxcPartnerConfigAttrs, aEndPartnerConfigModel) + resp.Diagnostics.Append(partnerDiags...) + plan.AEndPartnerConfig = aEndPartnerConfigObj + updateReq.AEndPartnerConfig = aEndMegaportConfig + default: + resp.Diagnostics.AddError( + "Error Updating VXC", + "Could not update VXC with ID "+state.UID.ValueString()+": Partner configuration not supported", + ) + return + } + } + + if !plan.BEndPartnerConfig.IsNull() && !plan.BEndPartnerConfig.Equal(state.BEndPartnerConfig) { + switch bEndPartnerPlan.Partner.ValueString() { + case "vrouter": + if bEndPartnerPlan.VrouterPartnerConfig.IsNull() { + resp.Diagnostics.AddError( + "Error creating VXC", + "Could not create VXC with name "+plan.Name.ValueString()+": Virtual router configuration is required", + ) + return + } + var partnerConfigBEnd vxcPartnerConfigVrouterModel + bEndDiags := bEndPartnerPlan.VrouterPartnerConfig.As(ctx, &partnerConfigBEnd, basetypes.ObjectAsOptions{}) + resp.Diagnostics.Append(bEndDiags...) + if resp.Diagnostics.HasError() { + + return + } + prefixFilterListRes, err := r.client.MCRService.ListMCRPrefixFilterLists(ctx, bEndState.RequestedProductUID.ValueString()) + if err != nil { + resp.Diagnostics.AddError( + "Error updating VXC", + "Could not update VXC with name "+plan.Name.ValueString()+": "+err.Error(), + ) + return + } + + bEndMegaportConfig := &megaport.VXCOrderVrouterPartnerConfig{} + ifaceModels := []*vxcPartnerConfigInterfaceModel{} + ifaceDiags := partnerConfigBEnd.Interfaces.ElementsAs(ctx, &ifaceModels, false) + resp.Diagnostics = append(resp.Diagnostics, ifaceDiags...) + for _, iface := range ifaceModels { + toAppend := megaport.PartnerConfigInterface{} + if !iface.IPAddresses.IsNull() { + ipAddresses := []string{} + ipDiags := iface.IPAddresses.ElementsAs(ctx, &ipAddresses, true) + resp.Diagnostics = append(resp.Diagnostics, ipDiags...) + toAppend.IpAddresses = ipAddresses + } + if !iface.IPRoutes.IsNull() { + ipRoutes := []*ipRouteModel{} + ipRouteDiags := iface.IPRoutes.ElementsAs(ctx, &ipRoutes, true) + resp.Diagnostics = append(resp.Diagnostics, ipRouteDiags...) + for _, ipRoute := range ipRoutes { + toAppend.IpRoutes = append(toAppend.IpRoutes, megaport.IpRoute{ + Prefix: ipRoute.Prefix.ValueString(), + Description: ipRoute.Description.ValueString(), + NextHop: ipRoute.NextHop.ValueString(), + }) + } + } + if !iface.NatIPAddresses.IsNull() { + natIPAddresses := []string{} + natDiags := iface.NatIPAddresses.ElementsAs(ctx, &natIPAddresses, true) + resp.Diagnostics = append(resp.Diagnostics, natDiags...) + toAppend.NatIpAddresses = natIPAddresses + } + if !iface.Bfd.IsNull() { + bfd := &bfdConfigModel{} + bfdDiags := iface.Bfd.As(ctx, bfd, basetypes.ObjectAsOptions{}) + resp.Diagnostics = append(resp.Diagnostics, bfdDiags...) + toAppend.Bfd = megaport.BfdConfig{ + TxInterval: int(bfd.TxInterval.ValueInt64()), + RxInterval: int(bfd.RxInterval.ValueInt64()), + Multiplier: int(bfd.Multiplier.ValueInt64()), + } + } + if !iface.VLAN.IsNull() { + toAppend.VLAN = int(iface.VLAN.ValueInt64()) + } + if !iface.BgpConnections.IsNull() { + bgpConnections := []*bgpConnectionConfigModel{} + bgpDiags := iface.BgpConnections.ElementsAs(ctx, &bgpConnections, false) + resp.Diagnostics = append(resp.Diagnostics, bgpDiags...) + for _, bgpConnection := range bgpConnections { + bgpToAppend := megaport.BgpConnectionConfig{ + PeerAsn: int(bgpConnection.PeerAsn.ValueInt64()), + LocalIpAddress: bgpConnection.LocalIPAddress.ValueString(), + PeerIpAddress: bgpConnection.PeerIPAddress.ValueString(), + Password: bgpConnection.Password.ValueString(), + Shutdown: bgpConnection.Shutdown.ValueBool(), + Description: bgpConnection.Description.ValueString(), + MedIn: int(bgpConnection.MedIn.ValueInt64()), + MedOut: int(bgpConnection.MedOut.ValueInt64()), + BfdEnabled: bgpConnection.BfdEnabled.ValueBool(), + ExportPolicy: bgpConnection.ExportPolicy.ValueString(), + AsPathPrependCount: int(bgpConnection.AsPathPrependCount.ValueInt64()), + PeerType: bgpConnection.PeerType.ValueString(), + } + if !bgpConnection.ImportWhitelist.IsNull() { + for _, prefixFilterList := range prefixFilterListRes { + if prefixFilterList.Description == bgpConnection.ImportWhitelist.ValueString() { + bgpToAppend.ImportWhitelist = prefixFilterList.Id + } + } + } + if !bgpConnection.ImportBlacklist.IsNull() { + for _, prefixFilterList := range prefixFilterListRes { + if prefixFilterList.Description == bgpConnection.ImportBlacklist.ValueString() { + bgpToAppend.ImportBlacklist = prefixFilterList.Id + } + } + } + if !bgpConnection.ExportWhitelist.IsNull() { + for _, prefixFilterList := range prefixFilterListRes { + if prefixFilterList.Description == bgpConnection.ExportWhitelist.ValueString() { + bgpToAppend.ExportWhitelist = prefixFilterList.Id + } + } + } + if !bgpConnection.ExportBlacklist.IsNull() { + for _, prefixFilterList := range prefixFilterListRes { + if prefixFilterList.Description == bgpConnection.ExportBlacklist.ValueString() { + bgpToAppend.ExportBlacklist = prefixFilterList.Id + } + } + } + if !bgpConnection.PermitExportTo.IsNull() { + permitExportTo := []string{} + permitDiags := bgpConnection.PermitExportTo.ElementsAs(ctx, &permitExportTo, true) + resp.Diagnostics = append(resp.Diagnostics, permitDiags...) + bgpToAppend.PermitExportTo = permitExportTo + bgpToAppend.PermitExportTo = permitExportTo + } + if !bgpConnection.DenyExportTo.IsNull() { + denyExportTo := []string{} + denyDiags := bgpConnection.DenyExportTo.ElementsAs(ctx, &denyExportTo, true) + resp.Diagnostics = append(resp.Diagnostics, denyDiags...) + bgpToAppend.DenyExportTo = denyExportTo + } + toAppend.BgpConnections = append(toAppend.BgpConnections, bgpToAppend) + } + } + bEndMegaportConfig.Interfaces = append(bEndMegaportConfig.Interfaces, toAppend) + } + vrouterConfigObj, bEndDiags := types.ObjectValueFrom(ctx, vxcPartnerConfigVrouterAttrs, partnerConfigBEnd) + resp.Diagnostics.Append(bEndDiags...) + aws := types.ObjectNull(vxcPartnerConfigAWSAttrs) + azure := types.ObjectNull(vxcPartnerConfigAzureAttrs) + google := types.ObjectNull(vxcPartnerConfigGoogleAttrs) + oracle := types.ObjectNull(vxcPartnerConfigOracleAttrs) + aEndPartner := types.ObjectNull(vxcPartnerConfigAEndAttrs) + bEndPartnerConfigModel := &vxcPartnerConfigurationModel{ + Partner: bEndPartnerPlan.Partner, + AWSPartnerConfig: aws, + AzurePartnerConfig: azure, + GooglePartnerConfig: google, + OraclePartnerConfig: oracle, + VrouterPartnerConfig: vrouterConfigObj, + PartnerAEndConfig: aEndPartner, + } + bEndPartnerConfigObj, partnerDiags := types.ObjectValueFrom(ctx, vxcPartnerConfigAttrs, bEndPartnerConfigModel) + resp.Diagnostics.Append(partnerDiags...) + state.BEndPartnerConfig = bEndPartnerConfigObj + updateReq.BEndPartnerConfig = bEndMegaportConfig + default: + resp.Diagnostics.AddError( + "Error Updating VXC", + "Could not update VXC with ID "+state.UID.ValueString()+": Partner configuration not supported", + ) + return + } + } + _, err := r.client.VXCService.UpdateVXC(ctx, plan.UID.ValueString(), updateReq) if err != nil { diff --git a/internal/provider/vxc_resource_test.go b/internal/provider/vxc_resource_test.go index 97cd5fd..2d5cfbc 100644 --- a/internal/provider/vxc_resource_test.go +++ b/internal/provider/vxc_resource_test.go @@ -686,6 +686,115 @@ func (suite *VXCWithCSPsProviderTestSuite) TestAccMegaportMCRVXCWithBGP_Basic() resource.TestCheckResourceAttr("megaport_vxc.aws_vxc", "b_end_partner_config.aws_config.name", vxcName1), ), }, + // UPDATE Test - Change BGP Connection in Partner Config + { + Config: providerConfig + fmt.Sprintf(` + data "megaport_location" "bne_nxt1" { + name = "NextDC B1" + } + + data "megaport_location" "syd_ndc" { + name = "NextDC C1" + } + + data "megaport_partner" "aws_port" { + connect_type = "AWS" + company_name = "AWS" + product_name = "Asia Pacific (Sydney) (ap-southeast-2)" + location_id = data.megaport_location.syd_ndc.id + } + + resource "megaport_mcr" "mcr" { + product_name = "%s" + location_id = data.megaport_location.bne_nxt1.id + contract_term_months = 1 + port_speed = 5000 + asn = 64555 + + prefix_filter_lists = [{ + description = "%s" + address_family = "IPv4" + entries = [ + { + action = "permit" + prefix = "10.0.1.0/24" + ge = 24 + le = 24 + }, + { + action = "deny" + prefix = "10.0.2.0/24" + ge = 24 + le = 24 + } + ] + }] + } + + resource "megaport_vxc" "aws_vxc" { + product_name = "%s" + rate_limit = 1000 + contract_term_months = 1 + + a_end = { + requested_product_uid = megaport_mcr.mcr.product_uid + ordered_vlan = 0 + } + + a_end_partner_config = { + partner = "vrouter" + vrouter_config = { + interfaces = [{ + ip_addresses = ["10.0.0.1/30"] + nat_ip_addresses = ["10.0.0.1"] + bfd = { + tx_interval = 500 + rx_interval = 400 + multiplier = 5 + } + bgp_connections = [ + { + peer_asn = 64512 + local_ip_address = "10.0.0.1" + peer_ip_address = "10.0.0.2" + password = "notARealPassword" + shutdown = false + description = "BGP Connection 1 updated" + med_in = 100 + med_out = 100 + bfd_enabled = true + export_policy = "deny" + permit_export_to = ["10.0.1.2"] + import_whitelist = "%s" + as_path_prepend_count = 4 + } + ] + }] + } + } + + b_end = { + requested_product_uid = data.megaport_partner.aws_port.product_uid + } + + b_end_partner_config = { + partner = "aws" + aws_config = { + name = "%s" + asn = 64550 + type = "private" + connect_type = "AWSHC" + amazon_asn = 64551 + owner_account = "684021030471" + } + } + } + `, mcrName, prefixFilterListName, vxcName1, prefixFilterListName, vxcName1), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttrSet("megaport_vxc.aws_vxc", "product_uid"), + resource.TestCheckResourceAttr("megaport_vxc.aws_vxc", "b_end_partner_config.aws_config.name", vxcName1), + ), + }, }, }) } From 5613de8ef3b976816c1184a10fb391a3eda1c489 Mon Sep 17 00:00:00 2001 From: MegaportPhilipBrowne Date: Tue, 17 Sep 2024 12:54:09 -0400 Subject: [PATCH 2/9] fix: a-end partner config state on update --- internal/provider/vxc_resource.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/provider/vxc_resource.go b/internal/provider/vxc_resource.go index 7a06396..8506840 100644 --- a/internal/provider/vxc_resource.go +++ b/internal/provider/vxc_resource.go @@ -3497,7 +3497,7 @@ func (r *vxcResource) Update(ctx context.Context, req resource.UpdateRequest, re } aEndPartnerConfigObj, partnerDiags := types.ObjectValueFrom(ctx, vxcPartnerConfigAttrs, aEndPartnerConfigModel) resp.Diagnostics.Append(partnerDiags...) - plan.AEndPartnerConfig = aEndPartnerConfigObj + state.AEndPartnerConfig = aEndPartnerConfigObj updateReq.AEndPartnerConfig = aEndMegaportConfig default: resp.Diagnostics.AddError( From 6816083b5eccc4f680bdd5e41d53b74970793fdb Mon Sep 17 00:00:00 2001 From: MegaportPhilipBrowne Date: Fri, 20 Sep 2024 11:04:43 -0400 Subject: [PATCH 3/9] fix: support other partner configs for updating vxc --- go.sum | 59 +++ internal/provider/vxc_resource.go | 702 +++++++++++++++++++++++++++++- 2 files changed, 756 insertions(+), 5 deletions(-) diff --git a/go.sum b/go.sum index 8c161e3..0fa814e 100644 --- a/go.sum +++ b/go.sum @@ -14,8 +14,12 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/ProtonMail/go-crypto v1.1.0-alpha.2 h1:bkyFVUP+ROOARdgCiJzNQo2V2kiB97LyUpzH9P6Hrlg= github.com/ProtonMail/go-crypto v1.1.0-alpha.2/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= +github.com/ProtonMail/go-crypto v1.1.0-alpha.5-proton h1:KVBEgU3CJpmzLChnLiSuEyCuhGhcMt3eOST+7A+ckto= +github.com/ProtonMail/go-crypto v1.1.0-alpha.5-proton/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= +github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= +github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= @@ -29,6 +33,8 @@ github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZ github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= +github.com/cloudflare/circl v1.4.0 h1:BV7h5MgrktNzytKmWjpOtdYrf0lkkbF8YMlBGPhJQrY= +github.com/cloudflare/circl v1.4.0/go.mod h1:PDRU+oXvdD7KCtgKxW95M5Z8BpSCJXQORiZFnBQS5QU= github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -39,6 +45,8 @@ github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FM github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= +github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= +github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= @@ -56,6 +64,8 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= @@ -77,11 +87,17 @@ github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 h1:1/D3zfFHttUK github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs= github.com/hashicorp/go-hclog v1.6.2 h1:NOtoftovWkDheyUM/8JW3QMiXyxJK3uHRK7wV04nD2I= github.com/hashicorp/go-hclog v1.6.2/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= +github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/go-plugin v1.6.0 h1:wgd4KxHJTVGGqWBq4QPB1i5BZNEx9BR8+OFmHDmTk8A= github.com/hashicorp/go-plugin v1.6.0/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI= +github.com/hashicorp/go-plugin v1.6.1 h1:P7MR2UP6gNKGPp+y7EZw2kOiq4IR9WiqLvp0XOsVdwI= +github.com/hashicorp/go-plugin v1.6.1/go.mod h1:XPHFku2tFo3o3QKFgSYo+cghcUhw1NA1hZyMK0PWAw0= +github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU= +github.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= @@ -89,8 +105,12 @@ github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKe github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/hc-install v0.7.0 h1:Uu9edVqjKQxxuD28mR5TikkKDd/p55S8vzPC1659aBk= github.com/hashicorp/hc-install v0.7.0/go.mod h1:ELmmzZlGnEcqoUMKUuykHaPCIR1sYLYX+KSggWSKZuA= +github.com/hashicorp/hc-install v0.9.0 h1:2dIk8LcvANwtv3QZLckxcjyF5w8KVtiMxu6G6eLhghE= +github.com/hashicorp/hc-install v0.9.0/go.mod h1:+6vOP+mf3tuGgMApVYtmsnDoKWMDcFXeTxCACYZ8SFg= github.com/hashicorp/hcl/v2 v2.20.0 h1:l++cRs/5jQOiKVvqXZm/P1ZEfVXJmvLS9WSVxkaeTb4= github.com/hashicorp/hcl/v2 v2.20.0/go.mod h1:WmcD/Ym72MDOOx5F62Ly+leloeu6H7m0pG7VBiU6pQk= +github.com/hashicorp/hcl/v2 v2.22.0 h1:hkZ3nCtqeJsDhPRFz5EA9iwcG1hNWGePOTw6oyul12M= +github.com/hashicorp/hcl/v2 v2.22.0/go.mod h1:62ZYHrXgPoX8xBnzl8QzbWq4dyDsDtfCRgIq1rbJEvA= github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/terraform-exec v0.21.0 h1:uNkLAe95ey5Uux6KJdua6+cv8asgILFVWkd/RG0D2XQ= @@ -101,16 +121,26 @@ github.com/hashicorp/terraform-plugin-docs v0.19.4 h1:G3Bgo7J22OMtegIgn8Cd/CaSey github.com/hashicorp/terraform-plugin-docs v0.19.4/go.mod h1:4pLASsatTmRynVzsjEhbXZ6s7xBlUw/2Kt0zfrq8HxA= github.com/hashicorp/terraform-plugin-framework v1.7.0 h1:wOULbVmfONnJo9iq7/q+iBOBJul5vRovaYJIu2cY/Pw= github.com/hashicorp/terraform-plugin-framework v1.7.0/go.mod h1:jY9Id+3KbZ17OMpulgnWLSfwxNVYSoYBQFTgsx044CI= +github.com/hashicorp/terraform-plugin-framework v1.12.0 h1:7HKaueHPaikX5/7cbC1r9d1m12iYHY+FlNZEGxQ42CQ= +github.com/hashicorp/terraform-plugin-framework v1.12.0/go.mod h1:N/IOQ2uYjW60Jp39Cp3mw7I/OpC/GfZ0385R0YibmkE= github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 h1:HOjBuMbOEzl7snOdOoUfE2Jgeto6JOjLVQ39Ls2nksc= github.com/hashicorp/terraform-plugin-framework-validators v0.12.0/go.mod h1:jfHGE/gzjxYz6XoUwi/aYiiKrJDeutQNUtGQXkaHklg= +github.com/hashicorp/terraform-plugin-framework-validators v0.13.0 h1:bxZfGo9DIUoLLtHMElsu+zwqI4IsMZQBRRy4iLzZJ8E= +github.com/hashicorp/terraform-plugin-framework-validators v0.13.0/go.mod h1:wGeI02gEhj9nPANU62F2jCaHjXulejm/X+af4PdZaNo= github.com/hashicorp/terraform-plugin-go v0.22.1 h1:iTS7WHNVrn7uhe3cojtvWWn83cm2Z6ryIUDTRO0EV7w= github.com/hashicorp/terraform-plugin-go v0.22.1/go.mod h1:qrjnqRghvQ6KnDbB12XeZ4FluclYwptntoWCr9QaXTI= +github.com/hashicorp/terraform-plugin-go v0.24.0 h1:2WpHhginCdVhFIrWHxDEg6RBn3YaWzR2o6qUeIEat2U= +github.com/hashicorp/terraform-plugin-go v0.24.0/go.mod h1:tUQ53lAsOyYSckFGEefGC5C8BAaO0ENqzFd3bQeuYQg= github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0= github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow= github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 h1:qHprzXy/As0rxedphECBEQAh3R4yp6pKksKHcqZx5G8= github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0/go.mod h1:H+8tjs9TjV2w57QFVSMBQacf8k/E1XwLXGCARgViC6A= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0 h1:kJiWGx2kiQVo97Y5IOGR4EMcZ8DtMswHhUuFibsCQQE= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0/go.mod h1:sl/UoabMc37HA6ICVMmGO+/0wofkVIRxf+BMb/dnoIg= github.com/hashicorp/terraform-plugin-testing v1.7.0 h1:I6aeCyZ30z4NiI3tzyDoO6fS7YxP5xSL1ceOon3gTe8= github.com/hashicorp/terraform-plugin-testing v1.7.0/go.mod h1:sbAreCleJNOCz+y5vVHV8EJkIWZKi/t4ndKiUjM9vao= +github.com/hashicorp/terraform-plugin-testing v1.10.0 h1:2+tmRNhvnfE4Bs8rB6v58S/VpqzGC6RCh9Y8ujdn+aw= +github.com/hashicorp/terraform-plugin-testing v1.10.0/go.mod h1:iWRW3+loP33WMch2P/TEyCxxct/ZEcCGMquSLSCVsrc= github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI= github.com/hashicorp/terraform-registry-address v0.2.3/go.mod h1:lFHA76T8jfQteVfT7caREqguFrW3c4MFSPhZB7HHgUM= github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ= @@ -161,6 +191,8 @@ github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJ github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4= github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= +github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= +github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= @@ -168,6 +200,8 @@ github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zx github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= +github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -197,6 +231,8 @@ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1F github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI= github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= @@ -213,6 +249,8 @@ github.com/yuin/goldmark-meta v1.1.0 h1:pWw+JLHGZe8Rk0EGsMVssiNb/AaPMHfSRszZeUei github.com/yuin/goldmark-meta v1.1.0/go.mod h1:U4spWENafuA7Zyg+Lj5RqK/MF+ovMYtBvXi1lBb2VP0= github.com/zclconf/go-cty v1.14.4 h1:uXXczd9QDGsgu0i/QFR/hzI5NYCHLf6NQw/atrbnhq8= github.com/zclconf/go-cty v1.14.4/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= +github.com/zclconf/go-cty v1.15.0 h1:tTCRWxsexYUmtt/wVxgDClUe+uQusuI443uL6e+5sXQ= +github.com/zclconf/go-cty v1.15.0/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= go.abhg.dev/goldmark/frontmatter v0.2.0 h1:P8kPG0YkL12+aYk2yU3xHv4tcXzeVnN+gU0tJ5JnxRw= go.abhg.dev/goldmark/frontmatter v0.2.0/go.mod h1:XqrEkZuM57djk7zrlRUB02x8I5J0px76YjkOzhB4YlU= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -220,12 +258,16 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 h1:EDuYyU/MkFXllv9QF9819VlI9a4tzGuCbhG0ExK9o1U= golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= +golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= @@ -234,12 +276,16 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -256,12 +302,15 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= +golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -272,12 +321,16 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= +golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= @@ -285,12 +338,18 @@ google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAs google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 h1:AjyfHzEPEFp/NpvfN5g+KDla3EMojjhRVZc1i7cj+oM= google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/internal/provider/vxc_resource.go b/internal/provider/vxc_resource.go index 8506840..5a40b7f 100644 --- a/internal/provider/vxc_resource.go +++ b/internal/provider/vxc_resource.go @@ -3347,12 +3347,432 @@ func (r *vxcResource) Update(ctx context.Context, req resource.UpdateRequest, re } if !plan.AEndPartnerConfig.IsNull() && !plan.AEndPartnerConfig.Equal(state.AEndPartnerConfig) { + aPartnerConfig := aEndPartnerPlan switch aEndPartnerPlan.Partner.ValueString() { + case "aws": + if aPartnerConfig.AWSPartnerConfig.IsNull() { + resp.Diagnostics.AddError( + "Error updating VXC", + "Could not update VXC with name "+plan.Name.ValueString()+": AWS Partner configuration is required", + ) + return + } + var awsConfig vxcPartnerConfigAWSModel + awsDiags := aPartnerConfig.AWSPartnerConfig.As(ctx, &awsConfig, basetypes.ObjectAsOptions{}) + resp.Diagnostics.Append(awsDiags...) + if resp.Diagnostics.HasError() { + return + } + aEndPartnerConfig := megaport.VXCPartnerConfigAWS{ + ConnectType: awsConfig.ConnectType.ValueString(), + Type: awsConfig.Type.ValueString(), + OwnerAccount: awsConfig.OwnerAccount.ValueString(), + ASN: int(awsConfig.ASN.ValueInt64()), + AmazonASN: int(awsConfig.AmazonASN.ValueInt64()), + AuthKey: awsConfig.AuthKey.ValueString(), + Prefixes: awsConfig.Prefixes.ValueString(), + CustomerIPAddress: awsConfig.CustomerIPAddress.ValueString(), + AmazonIPAddress: awsConfig.AmazonIPAddress.ValueString(), + ConnectionName: awsConfig.ConnectionName.ValueString(), + } + awsConfigObj, awsDiags := types.ObjectValueFrom(ctx, vxcPartnerConfigAWSAttrs, awsConfig) + resp.Diagnostics.Append(awsDiags...) + + azure := types.ObjectNull(vxcPartnerConfigAzureAttrs) + google := types.ObjectNull(vxcPartnerConfigGoogleAttrs) + oracle := types.ObjectNull(vxcPartnerConfigOracleAttrs) + vrouter := types.ObjectNull(vxcPartnerConfigVrouterAttrs) + aEndPartner := types.ObjectNull(vxcPartnerConfigAEndAttrs) + aEndPartnerConfigModel := &vxcPartnerConfigurationModel{ + Partner: aPartnerConfig.Partner, + AWSPartnerConfig: awsConfigObj, + AzurePartnerConfig: azure, + GooglePartnerConfig: google, + OraclePartnerConfig: oracle, + VrouterPartnerConfig: vrouter, + PartnerAEndConfig: aEndPartner, + } + aEndPartnerConfigObj, partnerDiags := types.ObjectValueFrom(ctx, vxcPartnerConfigAttrs, aEndPartnerConfigModel) + resp.Diagnostics.Append(partnerDiags...) + state.AEndPartnerConfig = aEndPartnerConfigObj + updateReq.AEndPartnerConfig = aEndPartnerConfig + case "azure": + if aPartnerConfig.AzurePartnerConfig.IsNull() { + resp.Diagnostics.AddError( + "Error updating VXC", + "Could not update VXC with name "+plan.Name.ValueString()+": Azure Partner configuration is required", + ) + return + } + var azureConfig vxcPartnerConfigAzureModel + azureDiags := aPartnerConfig.AzurePartnerConfig.As(ctx, &azureConfig, basetypes.ObjectAsOptions{}) + resp.Diagnostics.Append(azureDiags...) + if resp.Diagnostics.HasError() { + return + } + partnerPortReq := &megaport.ListPartnerPortsRequest{ + Key: azureConfig.ServiceKey.ValueString(), + Partner: "AZURE", + } + partnerPortRes, err := r.client.VXCService.ListPartnerPorts(ctx, partnerPortReq) + if err != nil { + resp.Diagnostics.AddError( + "Error updating VXC", + fmt.Sprintf("Could not update %s, there was an error looking up partner ports: %s", plan.Name.ValueString(), err.Error()), + ) + return + } + // find primary or secondary port + for _, port := range partnerPortRes.Data.Megaports { + if port.Type == azureConfig.PortChoice.ValueString() { + updateReq.AEndProductUID = &port.ProductUID + } + } + if updateReq.AEndProductUID == nil { + resp.Diagnostics.AddError( + "Error updating VXC", + fmt.Sprintf("Could not find azure port with type: %s", azureConfig.PortChoice.ValueString()), + ) + return + } + + aEndPartnerConfig := megaport.VXCPartnerConfigAzure{ + ConnectType: "AZURE", + ServiceKey: azureConfig.ServiceKey.ValueString(), + } + + azurePeerModels := []partnerOrderAzurePeeringConfigModel{} + azurePeerDiags := azureConfig.Peers.ElementsAs(ctx, &azurePeerModels, false) + resp.Diagnostics.Append(azurePeerDiags...) + if len(azurePeerModels) > 0 { + aEndPartnerConfig.Peers = []megaport.PartnerOrderAzurePeeringConfig{} + for _, peer := range azurePeerModels { + peeringConfig := megaport.PartnerOrderAzurePeeringConfig{ + Type: peer.Type.ValueString(), + PeerASN: peer.PeerASN.ValueString(), + PrimarySubnet: peer.PrimarySubnet.ValueString(), + SecondarySubnet: peer.SecondarySubnet.ValueString(), + VLAN: int(peer.VLAN.ValueInt64()), + } + if !peer.Prefixes.IsNull() { + peeringConfig.Prefixes = peer.Prefixes.ValueString() + } + if !peer.SharedKey.IsNull() { + peeringConfig.SharedKey = peer.SharedKey.ValueString() + } + aEndPartnerConfig.Peers = append(aEndPartnerConfig.Peers, peeringConfig) + } + } + + azureConfigObj, azureDiags := types.ObjectValueFrom(ctx, vxcPartnerConfigAzureAttrs, azureConfig) + resp.Diagnostics.Append(azureDiags...) + + aws := types.ObjectNull(vxcPartnerConfigAWSAttrs) + google := types.ObjectNull(vxcPartnerConfigGoogleAttrs) + oracle := types.ObjectNull(vxcPartnerConfigOracleAttrs) + vrouter := types.ObjectNull(vxcPartnerConfigVrouterAttrs) + aEndPartner := types.ObjectNull(vxcPartnerConfigAEndAttrs) + aEndPartnerConfigModel := &vxcPartnerConfigurationModel{ + Partner: aPartnerConfig.Partner, + AWSPartnerConfig: aws, + AzurePartnerConfig: azureConfigObj, + GooglePartnerConfig: google, + OraclePartnerConfig: oracle, + VrouterPartnerConfig: vrouter, + PartnerAEndConfig: aEndPartner, + } + aEndPartnerConfigObj, partnerDiags := types.ObjectValueFrom(ctx, vxcPartnerConfigAttrs, aEndPartnerConfigModel) + resp.Diagnostics.Append(partnerDiags...) + state.AEndPartnerConfig = aEndPartnerConfigObj + updateReq.AEndPartnerConfig = aEndPartnerConfig + case "google": + if aPartnerConfig.GooglePartnerConfig.IsNull() { + resp.Diagnostics.AddError( + "Error updating VXC", + "Could not update VXC with name "+plan.Name.ValueString()+": Google Partner configuration is required", + ) + return + } + var googleConfig vxcPartnerConfigGoogleModel + googleDiags := aPartnerConfig.GooglePartnerConfig.As(ctx, &googleConfig, basetypes.ObjectAsOptions{}) + resp.Diagnostics.Append(googleDiags...) + if resp.Diagnostics.HasError() { + return + } + aEndPartnerConfig := megaport.VXCPartnerConfigGoogle{ + ConnectType: "GOOGLE", + PairingKey: googleConfig.PairingKey.ValueString(), + } + googleConfigObj, googleDiags := types.ObjectValueFrom(ctx, vxcPartnerConfigGoogleAttrs, googleConfig) + resp.Diagnostics.Append(googleDiags...) + + partnerPortReq := &megaport.LookupPartnerPortsRequest{ + Key: googleConfig.PairingKey.ValueString(), + PortSpeed: int(plan.RateLimit.ValueInt64()), + Partner: "GOOGLE", + } + partnerPortReq.ProductID = aEndPlan.RequestedProductUID.ValueString() + partnerPortRes, err := r.client.VXCService.LookupPartnerPorts(ctx, partnerPortReq) + if err != nil { + resp.Diagnostics.AddError( + "Error updating VXC", + fmt.Sprintf("Could not update %s, there was an error looking up partner ports: %s", plan.Name.ValueString(), err.Error()), + ) + return + } + updateReq.AEndProductUID = &partnerPortRes.ProductUID + + aws := types.ObjectNull(vxcPartnerConfigAWSAttrs) + azure := types.ObjectNull(vxcPartnerConfigAzureAttrs) + oracle := types.ObjectNull(vxcPartnerConfigOracleAttrs) + vrouter := types.ObjectNull(vxcPartnerConfigVrouterAttrs) + aEndPartner := types.ObjectNull(vxcPartnerConfigAEndAttrs) + aEndPartnerConfigModel := &vxcPartnerConfigurationModel{ + Partner: aPartnerConfig.Partner, + AWSPartnerConfig: aws, + AzurePartnerConfig: azure, + GooglePartnerConfig: googleConfigObj, + OraclePartnerConfig: oracle, + VrouterPartnerConfig: vrouter, + PartnerAEndConfig: aEndPartner, + } + aEndPartnerConfigObj, partnerDiags := types.ObjectValueFrom(ctx, vxcPartnerConfigAttrs, aEndPartnerConfigModel) + resp.Diagnostics.Append(partnerDiags...) + state.AEndPartnerConfig = aEndPartnerConfigObj + updateReq.AEndPartnerConfig = aEndPartnerConfig + case "oracle": + if aPartnerConfig.OraclePartnerConfig.IsNull() { + resp.Diagnostics.AddError( + "Error updating VXC", + "Could not update VXC with name "+plan.Name.ValueString()+": Oracle Partner configuration is required", + ) + return + } + var oracleConfig vxcPartnerConfigOracleModel + oracleDiags := aPartnerConfig.OraclePartnerConfig.As(ctx, &oracleConfig, basetypes.ObjectAsOptions{}) + resp.Diagnostics.Append(oracleDiags...) + if resp.Diagnostics.HasError() { + return + } + aEndPartnerConfig := &megaport.VXCPartnerConfigOracle{ + ConnectType: "ORACLE", + VirtualCircuitId: oracleConfig.VirtualCircuitId.ValueString(), + } + + partnerPortReq := &megaport.LookupPartnerPortsRequest{ + Key: oracleConfig.VirtualCircuitId.ValueString(), + PortSpeed: int(plan.RateLimit.ValueInt64()), + Partner: "ORACLE", + } + partnerPortReq.ProductID = aEndPlan.RequestedProductUID.ValueString() + + partnerPortRes, err := r.client.VXCService.LookupPartnerPorts(ctx, partnerPortReq) + if err != nil { + resp.Diagnostics.AddError( + "Error updating VXC", + fmt.Sprintf("Could not update %s, there was an error looking up partner ports: %s", plan.Name.ValueString(), err.Error()), + ) + return + } + updateReq.AEndProductUID = &partnerPortRes.ProductUID + + oracleConfigObj, oracleDiags := types.ObjectValueFrom(ctx, vxcPartnerConfigOracleAttrs, oracleConfig) + resp.Diagnostics.Append(oracleDiags...) + + aws := types.ObjectNull(vxcPartnerConfigAWSAttrs) + azure := types.ObjectNull(vxcPartnerConfigAzureAttrs) + google := types.ObjectNull(vxcPartnerConfigGoogleAttrs) + vrouter := types.ObjectNull(vxcPartnerConfigVrouterAttrs) + aEndPartner := types.ObjectNull(vxcPartnerConfigAEndAttrs) + aEndPartnerConfigModel := &vxcPartnerConfigurationModel{ + Partner: aPartnerConfig.Partner, + AWSPartnerConfig: aws, + AzurePartnerConfig: azure, + GooglePartnerConfig: google, + OraclePartnerConfig: oracleConfigObj, + VrouterPartnerConfig: vrouter, + PartnerAEndConfig: aEndPartner, + } + aEndPartnerConfigObj, partnerDiags := types.ObjectValueFrom(ctx, vxcPartnerConfigAttrs, aEndPartnerConfigModel) + resp.Diagnostics.Append(partnerDiags...) + state.AEndPartnerConfig = aEndPartnerConfigObj + updateReq.AEndPartnerConfig = aEndPartnerConfig + case "transit": + aEndPartnerConfig := &megaport.VXCPartnerConfigTransit{ + ConnectType: "TRANSIT", + } + aws := types.ObjectNull(vxcPartnerConfigAWSAttrs) + azure := types.ObjectNull(vxcPartnerConfigAzureAttrs) + google := types.ObjectNull(vxcPartnerConfigGoogleAttrs) + oracle := types.ObjectNull(vxcPartnerConfigOracleAttrs) + vrouter := types.ObjectNull(vxcPartnerConfigVrouterAttrs) + aEndPartner := types.ObjectNull(vxcPartnerConfigAEndAttrs) + aEndPartnerConfigModel := &vxcPartnerConfigurationModel{ + Partner: aPartnerConfig.Partner, + AWSPartnerConfig: aws, + AzurePartnerConfig: azure, + GooglePartnerConfig: google, + OraclePartnerConfig: oracle, + VrouterPartnerConfig: vrouter, + PartnerAEndConfig: aEndPartner, + } + + partnerConfigObj, partnerDiags := types.ObjectValueFrom(ctx, vxcPartnerConfigAttrs, aEndPartnerConfigModel) + resp.Diagnostics.Append(partnerDiags...) + state.AEndPartnerConfig = partnerConfigObj + updateReq.AEndPartnerConfig = aEndPartnerConfig + case "a-end": + if aPartnerConfig.PartnerAEndConfig.IsNull() { + resp.Diagnostics.AddError( + "Error updating VXC", + "Could not update VXC with name "+plan.Name.ValueString()+": A-End Partner configuration is required", + ) + return + } + var partnerConfigAEnd vxcPartnerConfigAEndModel + aEndDiags := aPartnerConfig.PartnerAEndConfig.As(ctx, &partnerConfigAEnd, basetypes.ObjectAsOptions{}) + resp.Diagnostics.Append(aEndDiags...) + if resp.Diagnostics.HasError() { + return + } + prefixFilterListRes, err := r.client.MCRService.ListMCRPrefixFilterLists(ctx, aEndPlan.RequestedProductUID.ValueString()) + if err != nil { + resp.Diagnostics.AddError( + "Error updating VXC", + "Could not update VXC with name "+plan.Name.ValueString()+": "+err.Error(), + ) + return + } + + aEndPartnerConfig := megaport.VXCOrderVrouterPartnerConfig{} + ifaceModels := []*vxcPartnerConfigInterfaceModel{} + ifaceDiags := partnerConfigAEnd.Interfaces.ElementsAs(ctx, &ifaceModels, true) + resp.Diagnostics = append(resp.Diagnostics, ifaceDiags...) + for _, iface := range ifaceModels { + toAppend := megaport.PartnerConfigInterface{} + if !iface.IPAddresses.IsNull() { + ipAddresses := []string{} + ipDiags := iface.IPAddresses.ElementsAs(ctx, &ipAddresses, true) + resp.Diagnostics = append(resp.Diagnostics, ipDiags...) + toAppend.IpAddresses = ipAddresses + } + if !iface.IPRoutes.IsNull() { + ipRoutes := []*ipRouteModel{} + ipRouteDiags := iface.IPRoutes.ElementsAs(ctx, &ipRoutes, true) + resp.Diagnostics = append(resp.Diagnostics, ipRouteDiags...) + for _, ipRoute := range ipRoutes { + toAppend.IpRoutes = append(toAppend.IpRoutes, megaport.IpRoute{ + Prefix: ipRoute.Prefix.ValueString(), + Description: ipRoute.Description.ValueString(), + NextHop: ipRoute.NextHop.ValueString(), + }) + } + } + if !iface.NatIPAddresses.IsNull() { + natIPAddresses := []string{} + natDiags := iface.NatIPAddresses.ElementsAs(ctx, &natIPAddresses, true) + resp.Diagnostics = append(resp.Diagnostics, natDiags...) + toAppend.NatIpAddresses = natIPAddresses + } + if !iface.Bfd.IsNull() { + bfd := &bfdConfigModel{} + bfdDiags := iface.Bfd.As(ctx, bfd, basetypes.ObjectAsOptions{}) + resp.Diagnostics = append(resp.Diagnostics, bfdDiags...) + toAppend.Bfd = megaport.BfdConfig{ + TxInterval: int(bfd.TxInterval.ValueInt64()), + RxInterval: int(bfd.RxInterval.ValueInt64()), + Multiplier: int(bfd.Multiplier.ValueInt64()), + } + } + if !iface.BgpConnections.IsNull() { + bgpConnections := []*bgpConnectionConfigModel{} + bgpDiags := iface.BgpConnections.ElementsAs(ctx, &bgpConnections, false) + resp.Diagnostics = append(resp.Diagnostics, bgpDiags...) + for _, bgpConnection := range bgpConnections { + bgpToAppend := megaport.BgpConnectionConfig{ + PeerAsn: int(bgpConnection.PeerAsn.ValueInt64()), + LocalIpAddress: bgpConnection.LocalIPAddress.ValueString(), + PeerIpAddress: bgpConnection.PeerIPAddress.ValueString(), + Password: bgpConnection.Password.ValueString(), + Shutdown: bgpConnection.Shutdown.ValueBool(), + Description: bgpConnection.Description.ValueString(), + MedIn: int(bgpConnection.MedIn.ValueInt64()), + MedOut: int(bgpConnection.MedOut.ValueInt64()), + BfdEnabled: bgpConnection.BfdEnabled.ValueBool(), + ExportPolicy: bgpConnection.ExportPolicy.ValueString(), + AsPathPrependCount: int(bgpConnection.AsPathPrependCount.ValueInt64()), + } + if !bgpConnection.ImportWhitelist.IsNull() { + for _, prefixFilterList := range prefixFilterListRes { + if prefixFilterList.Description == bgpConnection.ImportWhitelist.ValueString() { + bgpToAppend.ImportWhitelist = prefixFilterList.Id + } + } + } + if !bgpConnection.ImportBlacklist.IsNull() { + for _, prefixFilterList := range prefixFilterListRes { + if prefixFilterList.Description == bgpConnection.ImportBlacklist.ValueString() { + bgpToAppend.ImportBlacklist = prefixFilterList.Id + } + } + } + if !bgpConnection.ExportWhitelist.IsNull() { + for _, prefixFilterList := range prefixFilterListRes { + if prefixFilterList.Description == bgpConnection.ExportWhitelist.ValueString() { + bgpToAppend.ExportWhitelist = prefixFilterList.Id + } + } + } + if !bgpConnection.ExportBlacklist.IsNull() { + for _, prefixFilterList := range prefixFilterListRes { + if prefixFilterList.Description == bgpConnection.ExportBlacklist.ValueString() { + bgpToAppend.ExportBlacklist = prefixFilterList.Id + } + } + } + if !bgpConnection.PermitExportTo.IsNull() { + permitExportTo := []string{} + permitDiags := bgpConnection.PermitExportTo.ElementsAs(ctx, &permitExportTo, true) + resp.Diagnostics = append(resp.Diagnostics, permitDiags...) + bgpToAppend.PermitExportTo = permitExportTo + bgpToAppend.PermitExportTo = permitExportTo + } + if !bgpConnection.DenyExportTo.IsNull() { + denyExportTo := []string{} + denyDiags := bgpConnection.DenyExportTo.ElementsAs(ctx, &denyExportTo, true) + resp.Diagnostics = append(resp.Diagnostics, denyDiags...) + bgpToAppend.DenyExportTo = denyExportTo + } + toAppend.BgpConnections = append(toAppend.BgpConnections, bgpToAppend) + } + } + aEndPartnerConfig.Interfaces = append(aEndPartnerConfig.Interfaces, toAppend) + } + aEndConfigObj, aEndDiags := types.ObjectValueFrom(ctx, vxcPartnerConfigAEndAttrs, partnerConfigAEnd) + resp.Diagnostics.Append(aEndDiags...) + aws := types.ObjectNull(vxcPartnerConfigAWSAttrs) + azure := types.ObjectNull(vxcPartnerConfigAzureAttrs) + google := types.ObjectNull(vxcPartnerConfigGoogleAttrs) + oracle := types.ObjectNull(vxcPartnerConfigOracleAttrs) + vrouter := types.ObjectNull(vxcPartnerConfigVrouterAttrs) + aEndPartnerConfigModel := &vxcPartnerConfigurationModel{ + Partner: aPartnerConfig.Partner, + AWSPartnerConfig: aws, + AzurePartnerConfig: azure, + GooglePartnerConfig: google, + OraclePartnerConfig: oracle, + PartnerAEndConfig: aEndConfigObj, + VrouterPartnerConfig: vrouter, + } + aEndPartnerConfigObj, partnerDiags := types.ObjectValueFrom(ctx, vxcPartnerConfigAttrs, aEndPartnerConfigModel) + resp.Diagnostics.Append(partnerDiags...) + state.AEndPartnerConfig = aEndPartnerConfigObj + updateReq.AEndPartnerConfig = aEndPartnerConfig case "vrouter": if aEndPartnerPlan.VrouterPartnerConfig.IsNull() { resp.Diagnostics.AddError( - "Error creating VXC", - "Could not create VXC with name "+plan.Name.ValueString()+": Virtual router configuration is required", + "Error updating VXC", + "Could not update VXC with name "+plan.Name.ValueString()+": Virtual router configuration is required", ) return } @@ -3365,8 +3785,8 @@ func (r *vxcResource) Update(ctx context.Context, req resource.UpdateRequest, re prefixFilterListRes, err := r.client.MCRService.ListMCRPrefixFilterLists(ctx, aEndState.RequestedProductUID.ValueString()) if err != nil { resp.Diagnostics.AddError( - "Error creating VXC", - "Could not create VXC with name "+plan.Name.ValueString()+": "+err.Error(), + "Error updating VXC", + "Could not update VXC with name "+plan.Name.ValueString()+": "+err.Error(), ) return } @@ -3509,7 +3929,280 @@ func (r *vxcResource) Update(ctx context.Context, req resource.UpdateRequest, re } if !plan.BEndPartnerConfig.IsNull() && !plan.BEndPartnerConfig.Equal(state.BEndPartnerConfig) { + bPartnerConfig := bEndPartnerPlan switch bEndPartnerPlan.Partner.ValueString() { + case "aws": + if bPartnerConfig.AWSPartnerConfig.IsNull() { + resp.Diagnostics.AddError( + "Error updating VXC", + "Could not updating VXC with name "+plan.Name.ValueString()+": AWS Partner configuration is required", + ) + return + } + var awsConfig vxcPartnerConfigAWSModel + awsDiags := bPartnerConfig.AWSPartnerConfig.As(ctx, &awsConfig, basetypes.ObjectAsOptions{}) + resp.Diagnostics.Append(awsDiags...) + if resp.Diagnostics.HasError() { + return + } + bEndPartnerConfig := megaport.VXCPartnerConfigAWS{ + ConnectType: awsConfig.ConnectType.ValueString(), + Type: awsConfig.Type.ValueString(), + OwnerAccount: awsConfig.OwnerAccount.ValueString(), + ASN: int(awsConfig.ASN.ValueInt64()), + AmazonASN: int(awsConfig.AmazonASN.ValueInt64()), + AuthKey: awsConfig.AuthKey.ValueString(), + Prefixes: awsConfig.Prefixes.ValueString(), + CustomerIPAddress: awsConfig.CustomerIPAddress.ValueString(), + AmazonIPAddress: awsConfig.AmazonIPAddress.ValueString(), + ConnectionName: awsConfig.ConnectionName.ValueString(), + } + awsConfigObj, awsDiags := types.ObjectValueFrom(ctx, vxcPartnerConfigAWSAttrs, awsConfig) + resp.Diagnostics.Append(awsDiags...) + + azure := types.ObjectNull(vxcPartnerConfigAzureAttrs) + google := types.ObjectNull(vxcPartnerConfigGoogleAttrs) + oracle := types.ObjectNull(vxcPartnerConfigOracleAttrs) + vrouter := types.ObjectNull(vxcPartnerConfigVrouterAttrs) + aEndPartner := types.ObjectNull(vxcPartnerConfigAEndAttrs) + aEndPartnerConfigModel := &vxcPartnerConfigurationModel{ + Partner: bPartnerConfig.Partner, + AWSPartnerConfig: awsConfigObj, + AzurePartnerConfig: azure, + GooglePartnerConfig: google, + OraclePartnerConfig: oracle, + VrouterPartnerConfig: vrouter, + PartnerAEndConfig: aEndPartner, + } + bEndPartnerConfigObj, partnerDiags := types.ObjectValueFrom(ctx, vxcPartnerConfigAttrs, aEndPartnerConfigModel) + resp.Diagnostics.Append(partnerDiags...) + state.BEndPartnerConfig = bEndPartnerConfigObj + updateReq.BEndPartnerConfig = bEndPartnerConfig + case "azure": + if bPartnerConfig.AzurePartnerConfig.IsNull() { + resp.Diagnostics.AddError( + "Error updating VXC", + "Could not update VXC with name "+plan.Name.ValueString()+": Azure Partner configuration is required", + ) + return + } + var azureConfig vxcPartnerConfigAzureModel + azureDiags := bPartnerConfig.AzurePartnerConfig.As(ctx, &azureConfig, basetypes.ObjectAsOptions{}) + resp.Diagnostics.Append(azureDiags...) + if resp.Diagnostics.HasError() { + return + } + partnerPortReq := &megaport.ListPartnerPortsRequest{ + Key: azureConfig.ServiceKey.ValueString(), + Partner: "AZURE", + } + partnerPortRes, err := r.client.VXCService.ListPartnerPorts(ctx, partnerPortReq) + if err != nil { + resp.Diagnostics.AddError( + "Error updating VXC", + fmt.Sprintf("Could not update %s, there was an error looking up partner ports: %s", plan.Name.ValueString(), err.Error()), + ) + return + } + // find primary or secondary port + for _, port := range partnerPortRes.Data.Megaports { + if port.Type == azureConfig.PortChoice.ValueString() { + updateReq.BEndProductUID = &port.ProductUID + } + } + if updateReq.BEndProductUID == nil { + resp.Diagnostics.AddError( + "Error updating VXC", + fmt.Sprintf("Could not find azure port with type: %s", azureConfig.PortChoice.ValueString()), + ) + return + } + + bEndPartnerConfig := megaport.VXCPartnerConfigAzure{ + ConnectType: "AZURE", + ServiceKey: azureConfig.ServiceKey.ValueString(), + } + + azurePeerModels := []partnerOrderAzurePeeringConfigModel{} + azurePeerDiags := azureConfig.Peers.ElementsAs(ctx, &azurePeerModels, false) + resp.Diagnostics.Append(azurePeerDiags...) + if len(azurePeerModels) > 0 { + bEndPartnerConfig.Peers = []megaport.PartnerOrderAzurePeeringConfig{} + for _, peer := range azurePeerModels { + peeringConfig := megaport.PartnerOrderAzurePeeringConfig{ + Type: peer.Type.ValueString(), + PeerASN: peer.PeerASN.ValueString(), + PrimarySubnet: peer.PrimarySubnet.ValueString(), + SecondarySubnet: peer.SecondarySubnet.ValueString(), + VLAN: int(peer.VLAN.ValueInt64()), + } + if !peer.Prefixes.IsNull() { + peeringConfig.Prefixes = peer.Prefixes.ValueString() + } + if !peer.SharedKey.IsNull() { + peeringConfig.SharedKey = peer.SharedKey.ValueString() + } + bEndPartnerConfig.Peers = append(bEndPartnerConfig.Peers, peeringConfig) + } + } + + azureConfigObj, azureDiags := types.ObjectValueFrom(ctx, vxcPartnerConfigAzureAttrs, azureConfig) + resp.Diagnostics.Append(azureDiags...) + + aws := types.ObjectNull(vxcPartnerConfigAWSAttrs) + google := types.ObjectNull(vxcPartnerConfigGoogleAttrs) + oracle := types.ObjectNull(vxcPartnerConfigOracleAttrs) + vrouter := types.ObjectNull(vxcPartnerConfigVrouterAttrs) + aEndPartner := types.ObjectNull(vxcPartnerConfigAEndAttrs) + bEndPartnerConfigModel := &vxcPartnerConfigurationModel{ + Partner: bPartnerConfig.Partner, + AWSPartnerConfig: aws, + AzurePartnerConfig: azureConfigObj, + GooglePartnerConfig: google, + OraclePartnerConfig: oracle, + VrouterPartnerConfig: vrouter, + PartnerAEndConfig: aEndPartner, + } + bEndPartnerConfigObj, partnerDiags := types.ObjectValueFrom(ctx, vxcPartnerConfigAttrs, bEndPartnerConfigModel) + resp.Diagnostics.Append(partnerDiags...) + state.BEndPartnerConfig = bEndPartnerConfigObj + updateReq.BEndPartnerConfig = bEndPartnerConfig + case "google": + if bPartnerConfig.GooglePartnerConfig.IsNull() { + resp.Diagnostics.AddError( + "Error updating VXC", + "Could not update VXC with name "+plan.Name.ValueString()+": Google Partner configuration is required", + ) + return + } + var googleConfig vxcPartnerConfigGoogleModel + googleDiags := bPartnerConfig.GooglePartnerConfig.As(ctx, &googleConfig, basetypes.ObjectAsOptions{}) + resp.Diagnostics.Append(googleDiags...) + if resp.Diagnostics.HasError() { + return + } + bEndPartnerConfig := megaport.VXCPartnerConfigGoogle{ + ConnectType: "GOOGLE", + PairingKey: googleConfig.PairingKey.ValueString(), + } + googleConfigObj, googleDiags := types.ObjectValueFrom(ctx, vxcPartnerConfigGoogleAttrs, googleConfig) + resp.Diagnostics.Append(googleDiags...) + + partnerPortReq := &megaport.LookupPartnerPortsRequest{ + Key: googleConfig.PairingKey.ValueString(), + PortSpeed: int(plan.RateLimit.ValueInt64()), + Partner: "GOOGLE", + } + partnerPortReq.ProductID = bEndPlan.RequestedProductUID.ValueString() + partnerPortRes, err := r.client.VXCService.LookupPartnerPorts(ctx, partnerPortReq) + if err != nil { + resp.Diagnostics.AddError( + "Error updating VXC", + fmt.Sprintf("Could not update %s, there was an error looking up partner ports: %s", plan.Name.ValueString(), err.Error()), + ) + return + } + updateReq.BEndProductUID = &partnerPortRes.ProductUID + + aws := types.ObjectNull(vxcPartnerConfigAWSAttrs) + azure := types.ObjectNull(vxcPartnerConfigAzureAttrs) + oracle := types.ObjectNull(vxcPartnerConfigOracleAttrs) + vrouter := types.ObjectNull(vxcPartnerConfigVrouterAttrs) + aEndPartner := types.ObjectNull(vxcPartnerConfigAEndAttrs) + bEndPartnerConfigModel := &vxcPartnerConfigurationModel{ + Partner: bPartnerConfig.Partner, + AWSPartnerConfig: aws, + AzurePartnerConfig: azure, + GooglePartnerConfig: googleConfigObj, + OraclePartnerConfig: oracle, + VrouterPartnerConfig: vrouter, + PartnerAEndConfig: aEndPartner, + } + bEndPartnerConfigObj, partnerDiags := types.ObjectValueFrom(ctx, vxcPartnerConfigAttrs, bEndPartnerConfigModel) + resp.Diagnostics.Append(partnerDiags...) + state.BEndPartnerConfig = bEndPartnerConfigObj + updateReq.BEndPartnerConfig = bEndPartnerConfig + case "oracle": + if bPartnerConfig.OraclePartnerConfig.IsNull() { + resp.Diagnostics.AddError( + "Error updating VXC", + "Could not update VXC with name "+plan.Name.ValueString()+": Oracle Partner configuration is required", + ) + return + } + var oracleConfig vxcPartnerConfigOracleModel + oracleDiags := bPartnerConfig.OraclePartnerConfig.As(ctx, &oracleConfig, basetypes.ObjectAsOptions{}) + resp.Diagnostics.Append(oracleDiags...) + if resp.Diagnostics.HasError() { + return + } + bEndPartnerConfig := &megaport.VXCPartnerConfigOracle{ + ConnectType: "ORACLE", + VirtualCircuitId: oracleConfig.VirtualCircuitId.ValueString(), + } + + partnerPortReq := &megaport.LookupPartnerPortsRequest{ + Key: oracleConfig.VirtualCircuitId.ValueString(), + PortSpeed: int(plan.RateLimit.ValueInt64()), + Partner: "ORACLE", + } + partnerPortReq.ProductID = bEndPlan.RequestedProductUID.ValueString() + + partnerPortRes, err := r.client.VXCService.LookupPartnerPorts(ctx, partnerPortReq) + if err != nil { + resp.Diagnostics.AddError( + "Error updating VXC", + fmt.Sprintf("Could not update %s, there was an error looking up partner ports: %s", plan.Name.ValueString(), err.Error()), + ) + return + } + updateReq.BEndProductUID = &partnerPortRes.ProductUID + + oracleConfigObj, oracleDiags := types.ObjectValueFrom(ctx, vxcPartnerConfigOracleAttrs, oracleConfig) + resp.Diagnostics.Append(oracleDiags...) + + aws := types.ObjectNull(vxcPartnerConfigAWSAttrs) + azure := types.ObjectNull(vxcPartnerConfigAzureAttrs) + google := types.ObjectNull(vxcPartnerConfigGoogleAttrs) + vrouter := types.ObjectNull(vxcPartnerConfigVrouterAttrs) + aEndPartner := types.ObjectNull(vxcPartnerConfigAEndAttrs) + aEndPartnerConfigModel := &vxcPartnerConfigurationModel{ + Partner: bPartnerConfig.Partner, + AWSPartnerConfig: aws, + AzurePartnerConfig: azure, + GooglePartnerConfig: google, + OraclePartnerConfig: oracleConfigObj, + VrouterPartnerConfig: vrouter, + PartnerAEndConfig: aEndPartner, + } + bEndPartnerConfigObj, partnerDiags := types.ObjectValueFrom(ctx, vxcPartnerConfigAttrs, aEndPartnerConfigModel) + resp.Diagnostics.Append(partnerDiags...) + state.BEndPartnerConfig = bEndPartnerConfigObj + updateReq.BEndPartnerConfig = bEndPartnerConfig + case "transit": + bEndPartnerConfig := &megaport.VXCPartnerConfigTransit{ + ConnectType: "TRANSIT", + } + aws := types.ObjectNull(vxcPartnerConfigAWSAttrs) + azure := types.ObjectNull(vxcPartnerConfigAzureAttrs) + google := types.ObjectNull(vxcPartnerConfigGoogleAttrs) + oracle := types.ObjectNull(vxcPartnerConfigOracleAttrs) + vrouter := types.ObjectNull(vxcPartnerConfigVrouterAttrs) + aEndPartner := types.ObjectNull(vxcPartnerConfigAEndAttrs) + bEndPartnerConfigModel := &vxcPartnerConfigurationModel{ + Partner: bPartnerConfig.Partner, + AWSPartnerConfig: aws, + AzurePartnerConfig: azure, + GooglePartnerConfig: google, + OraclePartnerConfig: oracle, + VrouterPartnerConfig: vrouter, + PartnerAEndConfig: aEndPartner, + } + + partnerConfigObj, partnerDiags := types.ObjectValueFrom(ctx, vxcPartnerConfigAttrs, bEndPartnerConfigModel) + resp.Diagnostics.Append(partnerDiags...) + state.AEndPartnerConfig = partnerConfigObj + updateReq.AEndPartnerConfig = bEndPartnerConfig case "vrouter": if bEndPartnerPlan.VrouterPartnerConfig.IsNull() { resp.Diagnostics.AddError( @@ -3522,7 +4215,6 @@ func (r *vxcResource) Update(ctx context.Context, req resource.UpdateRequest, re bEndDiags := bEndPartnerPlan.VrouterPartnerConfig.As(ctx, &partnerConfigBEnd, basetypes.ObjectAsOptions{}) resp.Diagnostics.Append(bEndDiags...) if resp.Diagnostics.HasError() { - return } prefixFilterListRes, err := r.client.MCRService.ListMCRPrefixFilterLists(ctx, bEndState.RequestedProductUID.ValueString()) From 09ab10acc4888ec2a2d4e947f6d04e1e76d8a219 Mon Sep 17 00:00:00 2001 From: MegaportPhilipBrowne Date: Thu, 26 Sep 2024 11:11:07 -0400 Subject: [PATCH 4/9] fix: require replace if logic --- internal/provider/vxc_resource.go | 97 +++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/internal/provider/vxc_resource.go b/internal/provider/vxc_resource.go index 5a40b7f..f1382b5 100644 --- a/internal/provider/vxc_resource.go +++ b/internal/provider/vxc_resource.go @@ -18,6 +18,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource/schema/int64planmodifier" "github.com/hashicorp/terraform-plugin-framework/resource/schema/listplanmodifier" "github.com/hashicorp/terraform-plugin-framework/resource/schema/mapplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/objectplanmodifier" "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" "github.com/hashicorp/terraform-plugin-framework/schema/validator" @@ -1163,6 +1164,54 @@ func (r *vxcResource) Schema(_ context.Context, _ resource.SchemaRequest, resp * "a_end_partner_config": schema.SingleNestedAttribute{ Description: "The partner configuration of the A-End order configuration.", Optional: true, + PlanModifiers: []planmodifier.Object{ + objectplanmodifier.RequiresReplaceIf( + objectplanmodifier.RequiresReplaceIfFunc( + func(ctx context.Context, req planmodifier.ObjectRequest, resp *objectplanmodifier.RequiresReplaceIfFuncResponse) { + // Add your condition here + var plan, state vxcResourceModel + + // Decode the current and new configuration + diags := req.PlanValue.As(ctx, &plan, basetypes.ObjectAsOptions{}) + if diags.HasError() { + resp.Diagnostics.Append(diags...) + return + } + diags = req.StateValue.As(ctx, &state, basetypes.ObjectAsOptions{}) + if diags.HasError() { + resp.Diagnostics.Append(diags...) + return + } + + if plan.AEndPartnerConfig.Equal(state.AEndPartnerConfig) { + return + } + + var planPartnerConfigModel, statePartnerConfigModel vxcPartnerConfigurationModel + + // Decode the current and new partner configuration + diags = plan.AEndPartnerConfig.As(ctx, &planPartnerConfigModel, basetypes.ObjectAsOptions{}) + if diags.HasError() { + resp.Diagnostics.Append(diags...) + return + } + diags = state.AEndPartnerConfig.As(ctx, &statePartnerConfigModel, basetypes.ObjectAsOptions{}) + if diags.HasError() { + resp.Diagnostics.Append(diags...) + return + } + if planPartnerConfigModel.Partner != statePartnerConfigModel.Partner { + resp.RequiresReplace = true + } + if planPartnerConfigModel.Partner.ValueString() != "a-end" && planPartnerConfigModel.Partner.ValueString() != "vrouter" { + resp.RequiresReplace = true + } + }, + ), + "This modifier will replace the VXC if the plan a_end_partner_config partner is neither 'a-end' nor 'vrouter' and does not equal the a_end_partner_config of the state.", + "This modifier will replace the VXC if the plan a_end_partner_config partner is neither 'a-end' nor 'vrouter' and does not equal the a_end_partner_config of the state.", + ), + }, Attributes: map[string]schema.Attribute{ "partner": schema.StringAttribute{ Description: "The partner of the partner configuration.", @@ -1590,6 +1639,54 @@ func (r *vxcResource) Schema(_ context.Context, _ resource.SchemaRequest, resp * "b_end_partner_config": schema.SingleNestedAttribute{ Description: "The partner configuration of the B-End order configuration.", Optional: true, + PlanModifiers: []planmodifier.Object{ + objectplanmodifier.RequiresReplaceIf( + objectplanmodifier.RequiresReplaceIfFunc( + func(ctx context.Context, req planmodifier.ObjectRequest, resp *objectplanmodifier.RequiresReplaceIfFuncResponse) { + // Add your condition here + var plan, state vxcResourceModel + + // Decode the current and new configuration + diags := req.PlanValue.As(ctx, &plan, basetypes.ObjectAsOptions{}) + if diags.HasError() { + resp.Diagnostics.Append(diags...) + return + } + diags = req.StateValue.As(ctx, &state, basetypes.ObjectAsOptions{}) + if diags.HasError() { + resp.Diagnostics.Append(diags...) + return + } + + if plan.BEndPartnerConfig.Equal(state.BEndPartnerConfig) { + return + } + + var planPartnerConfigModel, statePartnerConfigModel vxcPartnerConfigurationModel + + // Decode the current and new partner configuration + diags = plan.BEndPartnerConfig.As(ctx, &planPartnerConfigModel, basetypes.ObjectAsOptions{}) + if diags.HasError() { + resp.Diagnostics.Append(diags...) + return + } + diags = state.BEndPartnerConfig.As(ctx, &statePartnerConfigModel, basetypes.ObjectAsOptions{}) + if diags.HasError() { + resp.Diagnostics.Append(diags...) + return + } + if planPartnerConfigModel.Partner != statePartnerConfigModel.Partner { + resp.RequiresReplace = true + } + if planPartnerConfigModel.Partner.ValueString() != "vrouter" { + resp.RequiresReplace = true + } + }, + ), + "This modifier will replace the VXC if the plan b_end_partner_config partner is not 'vrouter' and does not equal the b_end_partner_config of the state.", + "This modifier will replace the VXC if the plan b_end_partner_config partner is not 'vrouter' and does not equal the b_end_partner_config of the state.", + ), + }, Attributes: map[string]schema.Attribute{ "partner": schema.StringAttribute{ Description: "The partner of the partner configuration.", From 2f3edfc1f3b160ca72b5bf3b9d0b265d99198b87 Mon Sep 17 00:00:00 2001 From: MegaportPhilipBrowne Date: Thu, 26 Sep 2024 11:26:27 -0400 Subject: [PATCH 5/9] fix: require replace if logic, correct structs --- internal/provider/vxc_resource.go | 56 ++++++++----------------------- 1 file changed, 14 insertions(+), 42 deletions(-) diff --git a/internal/provider/vxc_resource.go b/internal/provider/vxc_resource.go index f1382b5..2e905a2 100644 --- a/internal/provider/vxc_resource.go +++ b/internal/provider/vxc_resource.go @@ -1168,8 +1168,12 @@ func (r *vxcResource) Schema(_ context.Context, _ resource.SchemaRequest, resp * objectplanmodifier.RequiresReplaceIf( objectplanmodifier.RequiresReplaceIfFunc( func(ctx context.Context, req planmodifier.ObjectRequest, resp *objectplanmodifier.RequiresReplaceIfFuncResponse) { + if req.PlanValue.Equal(req.StateValue) { + return + } + // Add your condition here - var plan, state vxcResourceModel + var plan, state vxcPartnerConfigurationModel // Decode the current and new configuration diags := req.PlanValue.As(ctx, &plan, basetypes.ObjectAsOptions{}) @@ -1182,28 +1186,10 @@ func (r *vxcResource) Schema(_ context.Context, _ resource.SchemaRequest, resp * resp.Diagnostics.Append(diags...) return } - - if plan.AEndPartnerConfig.Equal(state.AEndPartnerConfig) { - return - } - - var planPartnerConfigModel, statePartnerConfigModel vxcPartnerConfigurationModel - - // Decode the current and new partner configuration - diags = plan.AEndPartnerConfig.As(ctx, &planPartnerConfigModel, basetypes.ObjectAsOptions{}) - if diags.HasError() { - resp.Diagnostics.Append(diags...) - return - } - diags = state.AEndPartnerConfig.As(ctx, &statePartnerConfigModel, basetypes.ObjectAsOptions{}) - if diags.HasError() { - resp.Diagnostics.Append(diags...) - return - } - if planPartnerConfigModel.Partner != statePartnerConfigModel.Partner { + if plan.Partner != state.Partner { resp.RequiresReplace = true } - if planPartnerConfigModel.Partner.ValueString() != "a-end" && planPartnerConfigModel.Partner.ValueString() != "vrouter" { + if plan.Partner.ValueString() != "a-end" && plan.Partner.ValueString() != "vrouter" { resp.RequiresReplace = true } }, @@ -1643,8 +1629,12 @@ func (r *vxcResource) Schema(_ context.Context, _ resource.SchemaRequest, resp * objectplanmodifier.RequiresReplaceIf( objectplanmodifier.RequiresReplaceIfFunc( func(ctx context.Context, req planmodifier.ObjectRequest, resp *objectplanmodifier.RequiresReplaceIfFuncResponse) { + if req.PlanValue.Equal(req.StateValue) { + return + } + // Add your condition here - var plan, state vxcResourceModel + var plan, state vxcPartnerConfigurationModel // Decode the current and new configuration diags := req.PlanValue.As(ctx, &plan, basetypes.ObjectAsOptions{}) @@ -1657,28 +1647,10 @@ func (r *vxcResource) Schema(_ context.Context, _ resource.SchemaRequest, resp * resp.Diagnostics.Append(diags...) return } - - if plan.BEndPartnerConfig.Equal(state.BEndPartnerConfig) { - return - } - - var planPartnerConfigModel, statePartnerConfigModel vxcPartnerConfigurationModel - - // Decode the current and new partner configuration - diags = plan.BEndPartnerConfig.As(ctx, &planPartnerConfigModel, basetypes.ObjectAsOptions{}) - if diags.HasError() { - resp.Diagnostics.Append(diags...) - return - } - diags = state.BEndPartnerConfig.As(ctx, &statePartnerConfigModel, basetypes.ObjectAsOptions{}) - if diags.HasError() { - resp.Diagnostics.Append(diags...) - return - } - if planPartnerConfigModel.Partner != statePartnerConfigModel.Partner { + if plan.Partner != state.Partner { resp.RequiresReplace = true } - if planPartnerConfigModel.Partner.ValueString() != "vrouter" { + if plan.Partner.ValueString() != "vrouter" { resp.RequiresReplace = true } }, From 510234c2f7e0bc0c5704964b19615d73ccaded96 Mon Sep 17 00:00:00 2001 From: MegaportPhilipBrowne Date: Tue, 8 Oct 2024 13:10:55 -0400 Subject: [PATCH 6/9] chore: bump mpgo version --- go.mod | 2 +- go.sum | 65 ++-------------------------------------------------------- 2 files changed, 3 insertions(+), 64 deletions(-) diff --git a/go.mod b/go.mod index e99cebe..6ead287 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 github.com/hashicorp/terraform-plugin-go v0.22.1 github.com/hashicorp/terraform-plugin-log v0.9.0 - github.com/megaport/megaportgo v1.2.2 + github.com/megaport/megaportgo v1.2.3 ) require ( diff --git a/go.sum b/go.sum index 0fa814e..6cb69a8 100644 --- a/go.sum +++ b/go.sum @@ -14,12 +14,8 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/ProtonMail/go-crypto v1.1.0-alpha.2 h1:bkyFVUP+ROOARdgCiJzNQo2V2kiB97LyUpzH9P6Hrlg= github.com/ProtonMail/go-crypto v1.1.0-alpha.2/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= -github.com/ProtonMail/go-crypto v1.1.0-alpha.5-proton h1:KVBEgU3CJpmzLChnLiSuEyCuhGhcMt3eOST+7A+ckto= -github.com/ProtonMail/go-crypto v1.1.0-alpha.5-proton/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= -github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= -github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= @@ -33,8 +29,6 @@ github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZ github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= -github.com/cloudflare/circl v1.4.0 h1:BV7h5MgrktNzytKmWjpOtdYrf0lkkbF8YMlBGPhJQrY= -github.com/cloudflare/circl v1.4.0/go.mod h1:PDRU+oXvdD7KCtgKxW95M5Z8BpSCJXQORiZFnBQS5QU= github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -45,8 +39,6 @@ github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FM github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= -github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= -github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= @@ -64,8 +56,6 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= -github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= @@ -87,17 +77,11 @@ github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 h1:1/D3zfFHttUK github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs= github.com/hashicorp/go-hclog v1.6.2 h1:NOtoftovWkDheyUM/8JW3QMiXyxJK3uHRK7wV04nD2I= github.com/hashicorp/go-hclog v1.6.2/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= -github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= -github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/go-plugin v1.6.0 h1:wgd4KxHJTVGGqWBq4QPB1i5BZNEx9BR8+OFmHDmTk8A= github.com/hashicorp/go-plugin v1.6.0/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI= -github.com/hashicorp/go-plugin v1.6.1 h1:P7MR2UP6gNKGPp+y7EZw2kOiq4IR9WiqLvp0XOsVdwI= -github.com/hashicorp/go-plugin v1.6.1/go.mod h1:XPHFku2tFo3o3QKFgSYo+cghcUhw1NA1hZyMK0PWAw0= -github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU= -github.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= @@ -105,12 +89,8 @@ github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKe github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/hc-install v0.7.0 h1:Uu9edVqjKQxxuD28mR5TikkKDd/p55S8vzPC1659aBk= github.com/hashicorp/hc-install v0.7.0/go.mod h1:ELmmzZlGnEcqoUMKUuykHaPCIR1sYLYX+KSggWSKZuA= -github.com/hashicorp/hc-install v0.9.0 h1:2dIk8LcvANwtv3QZLckxcjyF5w8KVtiMxu6G6eLhghE= -github.com/hashicorp/hc-install v0.9.0/go.mod h1:+6vOP+mf3tuGgMApVYtmsnDoKWMDcFXeTxCACYZ8SFg= github.com/hashicorp/hcl/v2 v2.20.0 h1:l++cRs/5jQOiKVvqXZm/P1ZEfVXJmvLS9WSVxkaeTb4= github.com/hashicorp/hcl/v2 v2.20.0/go.mod h1:WmcD/Ym72MDOOx5F62Ly+leloeu6H7m0pG7VBiU6pQk= -github.com/hashicorp/hcl/v2 v2.22.0 h1:hkZ3nCtqeJsDhPRFz5EA9iwcG1hNWGePOTw6oyul12M= -github.com/hashicorp/hcl/v2 v2.22.0/go.mod h1:62ZYHrXgPoX8xBnzl8QzbWq4dyDsDtfCRgIq1rbJEvA= github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/terraform-exec v0.21.0 h1:uNkLAe95ey5Uux6KJdua6+cv8asgILFVWkd/RG0D2XQ= @@ -121,26 +101,16 @@ github.com/hashicorp/terraform-plugin-docs v0.19.4 h1:G3Bgo7J22OMtegIgn8Cd/CaSey github.com/hashicorp/terraform-plugin-docs v0.19.4/go.mod h1:4pLASsatTmRynVzsjEhbXZ6s7xBlUw/2Kt0zfrq8HxA= github.com/hashicorp/terraform-plugin-framework v1.7.0 h1:wOULbVmfONnJo9iq7/q+iBOBJul5vRovaYJIu2cY/Pw= github.com/hashicorp/terraform-plugin-framework v1.7.0/go.mod h1:jY9Id+3KbZ17OMpulgnWLSfwxNVYSoYBQFTgsx044CI= -github.com/hashicorp/terraform-plugin-framework v1.12.0 h1:7HKaueHPaikX5/7cbC1r9d1m12iYHY+FlNZEGxQ42CQ= -github.com/hashicorp/terraform-plugin-framework v1.12.0/go.mod h1:N/IOQ2uYjW60Jp39Cp3mw7I/OpC/GfZ0385R0YibmkE= github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 h1:HOjBuMbOEzl7snOdOoUfE2Jgeto6JOjLVQ39Ls2nksc= github.com/hashicorp/terraform-plugin-framework-validators v0.12.0/go.mod h1:jfHGE/gzjxYz6XoUwi/aYiiKrJDeutQNUtGQXkaHklg= -github.com/hashicorp/terraform-plugin-framework-validators v0.13.0 h1:bxZfGo9DIUoLLtHMElsu+zwqI4IsMZQBRRy4iLzZJ8E= -github.com/hashicorp/terraform-plugin-framework-validators v0.13.0/go.mod h1:wGeI02gEhj9nPANU62F2jCaHjXulejm/X+af4PdZaNo= github.com/hashicorp/terraform-plugin-go v0.22.1 h1:iTS7WHNVrn7uhe3cojtvWWn83cm2Z6ryIUDTRO0EV7w= github.com/hashicorp/terraform-plugin-go v0.22.1/go.mod h1:qrjnqRghvQ6KnDbB12XeZ4FluclYwptntoWCr9QaXTI= -github.com/hashicorp/terraform-plugin-go v0.24.0 h1:2WpHhginCdVhFIrWHxDEg6RBn3YaWzR2o6qUeIEat2U= -github.com/hashicorp/terraform-plugin-go v0.24.0/go.mod h1:tUQ53lAsOyYSckFGEefGC5C8BAaO0ENqzFd3bQeuYQg= github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0= github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow= github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 h1:qHprzXy/As0rxedphECBEQAh3R4yp6pKksKHcqZx5G8= github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0/go.mod h1:H+8tjs9TjV2w57QFVSMBQacf8k/E1XwLXGCARgViC6A= -github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0 h1:kJiWGx2kiQVo97Y5IOGR4EMcZ8DtMswHhUuFibsCQQE= -github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0/go.mod h1:sl/UoabMc37HA6ICVMmGO+/0wofkVIRxf+BMb/dnoIg= github.com/hashicorp/terraform-plugin-testing v1.7.0 h1:I6aeCyZ30z4NiI3tzyDoO6fS7YxP5xSL1ceOon3gTe8= github.com/hashicorp/terraform-plugin-testing v1.7.0/go.mod h1:sbAreCleJNOCz+y5vVHV8EJkIWZKi/t4ndKiUjM9vao= -github.com/hashicorp/terraform-plugin-testing v1.10.0 h1:2+tmRNhvnfE4Bs8rB6v58S/VpqzGC6RCh9Y8ujdn+aw= -github.com/hashicorp/terraform-plugin-testing v1.10.0/go.mod h1:iWRW3+loP33WMch2P/TEyCxxct/ZEcCGMquSLSCVsrc= github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI= github.com/hashicorp/terraform-registry-address v0.2.3/go.mod h1:lFHA76T8jfQteVfT7caREqguFrW3c4MFSPhZB7HHgUM= github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ= @@ -180,10 +150,8 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/megaport/megaportgo v1.2.0 h1:LLI+3OaK4BzUMazuQm1TAptRaQbGrTp+wDxEjkARCNE= -github.com/megaport/megaportgo v1.2.0/go.mod h1:I+8jJioFFsF+55sxFYCgcKNUENaOpqzwlsIu6NGA7qk= -github.com/megaport/megaportgo v1.2.2 h1:exF0cLFk5Bug9SAThvJDBmwpVf7TCc0XFv7UjRS6x5Y= -github.com/megaport/megaportgo v1.2.2/go.mod h1:I+8jJioFFsF+55sxFYCgcKNUENaOpqzwlsIu6NGA7qk= +github.com/megaport/megaportgo v1.2.3 h1:1yBEFiHsvcPWl7vppmfMx1+MfAbxhZwpZAFnqvBnzJc= +github.com/megaport/megaportgo v1.2.3/go.mod h1:I+8jJioFFsF+55sxFYCgcKNUENaOpqzwlsIu6NGA7qk= github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= @@ -191,8 +159,6 @@ github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJ github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4= github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= -github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= -github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= @@ -200,8 +166,6 @@ github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zx github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= -github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= -github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -231,8 +195,6 @@ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1F github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI= github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= @@ -249,8 +211,6 @@ github.com/yuin/goldmark-meta v1.1.0 h1:pWw+JLHGZe8Rk0EGsMVssiNb/AaPMHfSRszZeUei github.com/yuin/goldmark-meta v1.1.0/go.mod h1:U4spWENafuA7Zyg+Lj5RqK/MF+ovMYtBvXi1lBb2VP0= github.com/zclconf/go-cty v1.14.4 h1:uXXczd9QDGsgu0i/QFR/hzI5NYCHLf6NQw/atrbnhq8= github.com/zclconf/go-cty v1.14.4/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= -github.com/zclconf/go-cty v1.15.0 h1:tTCRWxsexYUmtt/wVxgDClUe+uQusuI443uL6e+5sXQ= -github.com/zclconf/go-cty v1.15.0/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= go.abhg.dev/goldmark/frontmatter v0.2.0 h1:P8kPG0YkL12+aYk2yU3xHv4tcXzeVnN+gU0tJ5JnxRw= go.abhg.dev/goldmark/frontmatter v0.2.0/go.mod h1:XqrEkZuM57djk7zrlRUB02x8I5J0px76YjkOzhB4YlU= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -258,16 +218,12 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= -golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= -golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 h1:EDuYyU/MkFXllv9QF9819VlI9a4tzGuCbhG0ExK9o1U= golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= -golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= @@ -276,16 +232,12 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= -golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= -golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -302,15 +254,12 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= -golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -321,16 +270,12 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= @@ -338,18 +283,12 @@ google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAs google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 h1:AjyfHzEPEFp/NpvfN5g+KDla3EMojjhRVZc1i7cj+oM= google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= -google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= -google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 7a616dc2d9734d981a343da5d16365d26f8dec51 Mon Sep 17 00:00:00 2001 From: MegaportPhilipBrowne Date: Tue, 8 Oct 2024 13:18:34 -0400 Subject: [PATCH 7/9] fix: try changing loop variables for linter --- internal/provider/vxc_resource.go | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/internal/provider/vxc_resource.go b/internal/provider/vxc_resource.go index 2e905a2..aeed719 100644 --- a/internal/provider/vxc_resource.go +++ b/internal/provider/vxc_resource.go @@ -2229,8 +2229,9 @@ func (r *vxcResource) Create(ctx context.Context, req resource.CreateRequest, re } // find primary or secondary port for _, port := range partnerPortRes.Data.Megaports { - if port.Type == azureConfig.PortChoice.ValueString() { - aEndConfig.ProductUID = port.ProductUID + p := &port + if p.Type == azureConfig.PortChoice.ValueString() { + aEndConfig.ProductUID = p.ProductUID } } if aEndConfig.ProductUID == "" { @@ -2877,8 +2878,9 @@ func (r *vxcResource) Create(ctx context.Context, req resource.CreateRequest, re } // find primary or secondary port for _, port := range partnerPortRes.Data.Megaports { - if port.Type == azureConfig.PortChoice.ValueString() { - bEndConfig.ProductUID = port.ProductUID + p := &port + if p.Type == azureConfig.PortChoice.ValueString() { + bEndConfig.ProductUID = p.ProductUID } } if bEndConfig.ProductUID == "" { @@ -3493,8 +3495,9 @@ func (r *vxcResource) Update(ctx context.Context, req resource.UpdateRequest, re } // find primary or secondary port for _, port := range partnerPortRes.Data.Megaports { - if port.Type == azureConfig.PortChoice.ValueString() { - updateReq.AEndProductUID = &port.ProductUID + p := &port + if p.Type == azureConfig.PortChoice.ValueString() { + updateReq.AEndProductUID = &p.ProductUID } } if updateReq.AEndProductUID == nil { @@ -4075,8 +4078,9 @@ func (r *vxcResource) Update(ctx context.Context, req resource.UpdateRequest, re } // find primary or secondary port for _, port := range partnerPortRes.Data.Megaports { - if port.Type == azureConfig.PortChoice.ValueString() { - updateReq.BEndProductUID = &port.ProductUID + p := &port + if p.Type == azureConfig.PortChoice.ValueString() { + updateReq.BEndProductUID = &p.ProductUID } } if updateReq.BEndProductUID == nil { From 2528b3662794fbc698cef292aced3b393794b64d Mon Sep 17 00:00:00 2001 From: MegaportPhilipBrowne Date: Mon, 14 Oct 2024 16:40:18 -0400 Subject: [PATCH 8/9] chore: bump megaportgo version --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 6ead287..2592e69 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 github.com/hashicorp/terraform-plugin-go v0.22.1 github.com/hashicorp/terraform-plugin-log v0.9.0 - github.com/megaport/megaportgo v1.2.3 + github.com/megaport/megaportgo v1.2.4 ) require ( diff --git a/go.sum b/go.sum index 6cb69a8..0a17103 100644 --- a/go.sum +++ b/go.sum @@ -150,8 +150,8 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/megaport/megaportgo v1.2.3 h1:1yBEFiHsvcPWl7vppmfMx1+MfAbxhZwpZAFnqvBnzJc= -github.com/megaport/megaportgo v1.2.3/go.mod h1:I+8jJioFFsF+55sxFYCgcKNUENaOpqzwlsIu6NGA7qk= +github.com/megaport/megaportgo v1.2.4 h1:O1LbknD74ktMDMoV75WUGb1A/s/vLfhwFVGU9871Dmg= +github.com/megaport/megaportgo v1.2.4/go.mod h1:I+8jJioFFsF+55sxFYCgcKNUENaOpqzwlsIu6NGA7qk= github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= From 0fe5d0ce0077d410221626f28f268bcd23287b06 Mon Sep 17 00:00:00 2001 From: Alex Godwin Date: Wed, 6 Nov 2024 15:25:20 -0500 Subject: [PATCH 9/9] deps: bumps megaportgo to latest --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 2592e69..cfcdead 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 github.com/hashicorp/terraform-plugin-go v0.22.1 github.com/hashicorp/terraform-plugin-log v0.9.0 - github.com/megaport/megaportgo v1.2.4 + github.com/megaport/megaportgo v1.2.6 ) require ( diff --git a/go.sum b/go.sum index 0a17103..9b79436 100644 --- a/go.sum +++ b/go.sum @@ -150,8 +150,8 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/megaport/megaportgo v1.2.4 h1:O1LbknD74ktMDMoV75WUGb1A/s/vLfhwFVGU9871Dmg= -github.com/megaport/megaportgo v1.2.4/go.mod h1:I+8jJioFFsF+55sxFYCgcKNUENaOpqzwlsIu6NGA7qk= +github.com/megaport/megaportgo v1.2.6 h1:gm8D5MT6ZKZ065PN3qsSn6dQ02258RugV1XWltU634Q= +github.com/megaport/megaportgo v1.2.6/go.mod h1:I+8jJioFFsF+55sxFYCgcKNUENaOpqzwlsIu6NGA7qk= github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=