fix: redeploy template — handle empty params + nil for Dummy
This commit is contained in:
@@ -2,7 +2,7 @@ terraform {
|
|||||||
required_providers {
|
required_providers {
|
||||||
nubes = {
|
nubes = {
|
||||||
source = "registry.kube5s.ru/nubes-test/nubes"
|
source = "registry.kube5s.ru/nubes-test/nubes"
|
||||||
version = "5.1.12"
|
version = "5.1.13"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -549,19 +549,20 @@ func (r *{{ToCamel .Name}}Resource) Update(ctx context.Context, req resource.Upd
|
|||||||
// --- Redeploy support (ARCHITECTURE.md) ---
|
// --- Redeploy support (ARCHITECTURE.md) ---
|
||||||
if redeployRequested {
|
if redeployRequested {
|
||||||
{{- if .RedeployParams }}
|
{{- if .RedeployParams }}
|
||||||
redeployParams := map[int]string{
|
redeployParams := map[int]string{}
|
||||||
{{- range .RedeployParams }}
|
{{- range .RedeployParams }}
|
||||||
{{- if (IsNested .) }}
|
{{- if (IsNested .) }}
|
||||||
if plan.{{ToCamel .Code}} != nil {
|
if plan.{{ToCamel .Code}} != nil {
|
||||||
redeployParams[{{.ID}}] = {{NestedJSONExpr . "plan"}}
|
redeployParams[{{.ID}}] = {{NestedJSONExpr . "plan"}}
|
||||||
}
|
|
||||||
{{- else }}
|
|
||||||
{{.ID}}: {{ParamFormat . (printf "plan.%s" (ToCamel .Code))}},
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
}
|
}
|
||||||
|
{{- 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 }}
|
{{- end }}
|
||||||
if err := r.client.RunRedeployOperation(ctx, instanceID.ValueString(), operationTimeout{{if .RedeployParams}}, redeployParams{{end}}); err != nil {
|
|
||||||
resp.Diagnostics.AddError("Ошибка клиента", err.Error())
|
resp.Diagnostics.AddError("Ошибка клиента", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user