Skip to content

Commit 807db87

Browse files
committed
fix(instance): EoS warning only displays the 5 most relevant types
1 parent ac2139c commit 807db87

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

internal/services/instance/server.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,11 +785,20 @@ func ResourceInstanceServerRead(ctx context.Context, d *schema.ResourceData, m i
785785
return diag.FromErr(err)
786786
}
787787

788+
mostRelevantTypes := compatibleTypes.CompatibleTypes[:5]
789+
788790
return diag.Diagnostics{diag.Diagnostic{
789791
Severity: diag.Warning,
790792
Detail: fmt.Sprintf("Instance type %q will soon reach End of Service", server.CommercialType),
791793
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.
792-
Here are the best options for %q, ordered by relevance: [%s]`, server.CommercialType, strings.Join(compatibleTypes.CompatibleTypes, ", ")),
794+
Here are the %d best options for %q, ordered by relevance: [%s]
795+
You can check the full list of compatible server types using the CLI command 'scw instance server get-compatible-types %s zone=%s'`,
796+
len(mostRelevantTypes),
797+
server.CommercialType,
798+
strings.Join(mostRelevantTypes, ", "),
799+
server.ID,
800+
server.Zone,
801+
),
793802
AttributePath: cty.GetAttrPath("type"),
794803
}}
795804
}

0 commit comments

Comments
 (0)