Bugfix SKE downgrade replace in place (#315)
* add requireif to schema, extend acc testing * fix acceptance test * improve testing
This commit is contained in:
parent
394d5bf8d6
commit
6e61caee19
2 changed files with 23 additions and 1 deletions
|
|
@ -269,6 +269,17 @@ func (r *clusterResource) Schema(_ context.Context, _ resource.SchemaRequest, re
|
|||
"kubernetes_version": schema.StringAttribute{
|
||||
Description: "Kubernetes version. Must only contain major and minor version (e.g. 1.22)",
|
||||
Required: true,
|
||||
PlanModifiers: []planmodifier.String{
|
||||
stringplanmodifier.RequiresReplaceIf(stringplanmodifier.RequiresReplaceIfFunc(func(ctx context.Context, sr planmodifier.StringRequest, rrifr *stringplanmodifier.RequiresReplaceIfFuncResponse) {
|
||||
if sr.StateValue.IsNull() || sr.PlanValue.IsNull() {
|
||||
return
|
||||
}
|
||||
planVersion := fmt.Sprintf("v%s", sr.PlanValue.ValueString())
|
||||
stateVersion := fmt.Sprintf("v%s", sr.StateValue.ValueString())
|
||||
|
||||
rrifr.RequiresReplace = semver.Compare(planVersion, stateVersion) < 0
|
||||
}), "Kubernetes version", "If the Kubernetes version is a downgrade, the cluster will be replaced"),
|
||||
},
|
||||
Validators: []validator.String{
|
||||
validate.MinorVersionNumber(),
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue