From c214cb1301bb2cbd2033b7a00624855c97d8a371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=C3=AFla=20Marabese?= Date: Fri, 25 Apr 2025 15:50:03 +0200 Subject: [PATCH 1/3] feat(instance): add warning for deprecated instance types --- go.mod | 6 +++--- go.sum | 14 ++++++++------ internal/services/instance/server.go | 24 +++++++++++++++++++++++- 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index a13a7aa74e..0f05979801 100644 --- a/go.mod +++ b/go.mod @@ -27,7 +27,7 @@ require ( github.com/nats-io/jwt/v2 v2.7.3 github.com/nats-io/nats.go v1.38.0 github.com/robfig/cron/v3 v3.0.1 - github.com/scaleway/scaleway-sdk-go v1.0.0-beta.33.0.20250407124844-38ab1ca8e81d + github.com/scaleway/scaleway-sdk-go v1.0.0-beta.33.0.20250424152954-b4babe8f214c github.com/stretchr/testify v1.10.0 golang.org/x/crypto v0.36.0 gopkg.in/dnaeon/go-vcr.v3 v3.2.0 @@ -135,9 +135,9 @@ require ( golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect golang.org/x/mod v0.23.0 // indirect golang.org/x/net v0.38.0 // indirect - golang.org/x/sync v0.12.0 // indirect + golang.org/x/sync v0.13.0 // indirect golang.org/x/sys v0.31.0 // indirect - golang.org/x/text v0.23.0 // indirect + golang.org/x/text v0.24.0 // indirect golang.org/x/time v0.3.0 // indirect golang.org/x/tools v0.30.0 // indirect google.golang.org/appengine v1.6.8 // indirect diff --git a/go.sum b/go.sum index 65b644c5d9..a6e11dd494 100644 --- a/go.sum +++ b/go.sum @@ -298,8 +298,8 @@ github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= -github.com/scaleway/scaleway-sdk-go v1.0.0-beta.33.0.20250407124844-38ab1ca8e81d h1:EjD1RHPgsTomVw0lKgZu6YHK4ZMSBkSjeFrirnvWBcw= -github.com/scaleway/scaleway-sdk-go v1.0.0-beta.33.0.20250407124844-38ab1ca8e81d/go.mod h1:792k1RTU+5JeMXm35/e2Wgp71qPH/DmDoZrRc+EFZDk= +github.com/scaleway/scaleway-sdk-go v1.0.0-beta.33.0.20250424152954-b4babe8f214c h1:sjbNFhI3o5ecQuxLZv54Gm/YlqP55Ot5l7ShneWeNg8= +github.com/scaleway/scaleway-sdk-go v1.0.0-beta.33.0.20250424152954-b4babe8f214c/go.mod h1:w4o02EHpO0CBGy2nehzWRaFQKd62G9HIf+Q07PDaUcE= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= @@ -391,6 +391,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= 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.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -399,8 +401,8 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/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.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw= -golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sync v0.13.0 h1:AauUjRAJ9OSnvULf/ARrrVywoJDy0YS2AwQ98I37610= +golang.org/x/sync v0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -437,8 +439,8 @@ golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= 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.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= -golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= +golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0= +golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/internal/services/instance/server.go b/internal/services/instance/server.go index e664fc646e..9016dd2b8b 100644 --- a/internal/services/instance/server.go +++ b/internal/services/instance/server.go @@ -600,10 +600,10 @@ func ResourceInstanceServerRead(ctx context.Context, d *schema.ResourceData, m i return diag.FromErr(err) } + //// // Read Server //// - state, err := serverStateFlatten(server.State) if err != nil { return diag.FromErr(err) @@ -737,6 +737,7 @@ func ResourceInstanceServerRead(ctx context.Context, d *schema.ResourceData, m i if len(additionalVolumesIDs) > 0 { _ = d.Set("additional_volume_ids", additionalVolumesIDs) } + //// // Read server user data //// @@ -772,6 +773,27 @@ func ResourceInstanceServerRead(ctx context.Context, d *schema.ResourceData, m i return diag.FromErr(err) } + //// + // Display warning if server will soon reach End of Service + //// + if server.EndOfService { + compatibleTypes, err := api.GetServerCompatibleTypes(&instanceSDK.GetServerCompatibleTypesRequest{ + Zone: zone, + ServerID: id, + }, scw.WithContext(ctx)) + if err != nil { + return diag.FromErr(err) + } + + return diag.Diagnostics{diag.Diagnostic{ + Severity: diag.Warning, + Detail: fmt.Sprintf("Instance type %q will soon reach End of Service", server.CommercialType), + Summary: fmt.Sprintf(`Your Instance will soon reach End of Service. You can check the exact date on the Scaleway console. We recommend that you migrate your Instance before that. +Here are the best options for %q, ordered by relevance: [%s]`, server.CommercialType, strings.Join(compatibleTypes.CompatibleTypes, ", ")), + AttributePath: cty.GetAttrPath("type"), + }} + } + return nil } From 2cc6e2709947ccb945a777f07f5dcf9ccbe89418 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=C3=AFla=20Marabese?= Date: Fri, 25 Apr 2025 17:49:31 +0200 Subject: [PATCH 2/3] exclude vpcgw files from staticcheck linter to allow sdk bump --- .golangci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.golangci.yml b/.golangci.yml index 74daa9c348..276fbdba65 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -125,6 +125,9 @@ linters: linters: - stylecheck - gosec + - path: internal/services/vpcgw + linters: + - staticcheck issues: max-issues-per-linter: 0 From b744f067eb6f67be1a02c6e2042c58ea30b03d0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=C3=AFla=20Marabese?= Date: Mon, 28 Apr 2025 15:01:21 +0200 Subject: [PATCH 3/3] fix golangci-lint: add nolintlint on mnq --- internal/services/mnq/helpers_mnq_queue.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/services/mnq/helpers_mnq_queue.go b/internal/services/mnq/helpers_mnq_queue.go index c08cf30308..c97ae5ac8a 100644 --- a/internal/services/mnq/helpers_mnq_queue.go +++ b/internal/services/mnq/helpers_mnq_queue.go @@ -104,7 +104,7 @@ func NATSClientWithRegion( //nolint:ireturn,nolintlint return js, region, err } -func newNATSJetStreamClient( //nolint:ireturn +func newNATSJetStreamClient( //nolint:ireturn,nolintlint region string, endpoint string, credentials string,