fix: redeploy template — handle empty params + nil for Dummy

This commit is contained in:
“Naeel”
2026-07-20 07:51:46 +04:00
parent 4aa1c83bea
commit 67ce3e4ab9
2 changed files with 13 additions and 12 deletions
@@ -549,19 +549,20 @@ func (r *{{ToCamel .Name}}Resource) Update(ctx context.Context, req resource.Upd
// --- Redeploy support (ARCHITECTURE.md) ---
if redeployRequested {
{{- if .RedeployParams }}
redeployParams := map[int]string{
{{- range .RedeployParams }}
{{- if (IsNested .) }}
if plan.{{ToCamel .Code}} != nil {
redeployParams[{{.ID}}] = {{NestedJSONExpr . "plan"}}
}
{{- else }}
{{.ID}}: {{ParamFormat . (printf "plan.%s" (ToCamel .Code))}},
{{- end }}
{{- end }}
redeployParams := map[int]string{}
{{- range .RedeployParams }}
{{- if (IsNested .) }}
if plan.{{ToCamel .Code}} != nil {
redeployParams[{{.ID}}] = {{NestedJSONExpr . "plan"}}
}
{{- else }}
redeployParams[{{.ID}}] = {{ParamFormat . (printf "plan.%s" (ToCamel .Code))}}
{{- end }}
{{- end }}
if err := r.client.RunRedeployOperation(ctx, instanceID.ValueString(), operationTimeout, redeployParams); err != nil {
{{- else }}
if err := r.client.RunRedeployOperation(ctx, instanceID.ValueString(), operationTimeout, nil); err != nil {
{{- end }}
if err := r.client.RunRedeployOperation(ctx, instanceID.ValueString(), operationTimeout{{if .RedeployParams}}, redeployParams{{end}}); err != nil {
resp.Diagnostics.AddError("Ошибка клиента", err.Error())
return
}