Skip to content

Commit e633949

Browse files
authored
fix(instance): EoS warning only displays the 5 most relevant types (#3059)
1 parent 26871ec commit e633949

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

internal/services/instance/server.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,11 +785,23 @@ 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+
796+
You can check the full list of compatible server types:
797+
- on the Scaleway console
798+
- using the CLI command 'scw instance server get-compatible-types %s zone=%s'`,
799+
len(mostRelevantTypes),
800+
server.CommercialType,
801+
strings.Join(mostRelevantTypes, ", "),
802+
server.ID,
803+
server.Zone,
804+
),
793805
AttributePath: cty.GetAttrPath("type"),
794806
}}
795807
}

0 commit comments

Comments
 (0)