fix: redeploy template — handle empty params + nil for Dummy
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user