fix: modify only if hasServiceParamChanges (skip when git_revision only), bump TEST 5.1.16
This commit is contained in:
@@ -21,7 +21,7 @@ locals {
|
|||||||
pg_db_name = "db4crudpg"
|
pg_db_name = "db4crudpg"
|
||||||
|
|
||||||
# ─── Lucee ───────────────────────────────────────────────────────────────
|
# ─── Lucee ───────────────────────────────────────────────────────────────
|
||||||
lucee_git_revision = "94e14"
|
lucee_git_revision = "94d"
|
||||||
lucee_resource_name = "luceeresource"
|
lucee_resource_name = "luceeresource"
|
||||||
lucee_domain = "tflucee"
|
lucee_domain = "tflucee"
|
||||||
lucee_version = "5.4"
|
lucee_version = "5.4"
|
||||||
|
|||||||
@@ -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.13"
|
version = "5.1.15"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ NUBES_API_ENDPOINT="https://lk-api-gateway-test.ngcloud.ru/api/v1/svc"
|
|||||||
TOKEN_FILE="secrets/test.token"
|
TOKEN_FILE="secrets/test.token"
|
||||||
|
|
||||||
# Version
|
# Version
|
||||||
VERSION="5.1.15"
|
VERSION="5.1.16"
|
||||||
|
|
||||||
# Docs generation — ONLY from docs_gen/<stand>/ (never from docs/)
|
# Docs generation — ONLY from docs_gen/<stand>/ (never from docs/)
|
||||||
DOCS_GEN_DIR="provider/docs_gen/test"
|
DOCS_GEN_DIR="provider/docs_gen/test"
|
||||||
|
|||||||
@@ -547,6 +547,31 @@ func (r *{{ToCamel .Name}}Resource) Update(ctx context.Context, req resource.Upd
|
|||||||
|
|
||||||
{{- if .HasRedeploy }}
|
{{- if .HasRedeploy }}
|
||||||
// --- Redeploy support (ARCHITECTURE.md) ---
|
// --- Redeploy support (ARCHITECTURE.md) ---
|
||||||
|
// 1. Modify — только если изменились параметры сервиса
|
||||||
|
if hasServiceParamChanges {
|
||||||
|
{{- end }}
|
||||||
|
params := map[int]string{
|
||||||
|
{{- range .ModifyParams }}
|
||||||
|
{{- if not (IsNested .) }}
|
||||||
|
{{.ID}}: {{ParamFormat . (printf "plan.%s" (ToCamel .Code))}},
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
}
|
||||||
|
{{- range .ModifyParams }}
|
||||||
|
{{- if (IsNested .) }}
|
||||||
|
if plan.{{ToCamel .Code}} != nil {
|
||||||
|
params[{{.ID}}] = {{NestedJSONExpr . "plan"}}
|
||||||
|
}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
if err := resources_core.UpdateResourceWithTimeout(ctx, r.client, instanceID.ValueString(), params, operationTimeout); err != nil {
|
||||||
|
resp.Diagnostics.AddError("Ошибка клиента", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
{{- if .HasRedeploy }}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Redeploy — только если изменился git_revision
|
||||||
if redeployRequested {
|
if redeployRequested {
|
||||||
redeployParams := map[int]string{}
|
redeployParams := map[int]string{}
|
||||||
{{- range .RedeployParams }}
|
{{- range .RedeployParams }}
|
||||||
@@ -558,41 +583,10 @@ func (r *{{ToCamel .Name}}Resource) Update(ctx context.Context, req resource.Upd
|
|||||||
redeployParams[{{.ID}}] = {{ParamFormat . (printf "plan.%s" (ToCamel .Code))}}
|
redeployParams[{{.ID}}] = {{ParamFormat . (printf "plan.%s" (ToCamel .Code))}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
// Merge modify-params into redeploy to avoid state drift
|
|
||||||
{{- range .ModifyParams }}
|
|
||||||
{{- 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 {
|
if err := r.client.RunRedeployOperation(ctx, instanceID.ValueString(), operationTimeout, redeployParams); err != nil {
|
||||||
resp.Diagnostics.AddError("Ошибка клиента", err.Error())
|
resp.Diagnostics.AddError("Ошибка клиента", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
{{- end }}
|
|
||||||
params := map[int]string{
|
|
||||||
{{- range .ModifyParams }}
|
|
||||||
{{- if not (IsNested .) }}
|
|
||||||
{{.ID}}: {{ParamFormat . (printf "plan.%s" (ToCamel .Code))}},
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
}
|
|
||||||
{{- range .ModifyParams }}
|
|
||||||
{{- if (IsNested .) }}
|
|
||||||
if plan.{{ToCamel .Code}} != nil {
|
|
||||||
params[{{.ID}}] = {{NestedJSONExpr . "plan"}}
|
|
||||||
}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
if err := resources_core.UpdateResourceWithTimeout(ctx, r.client, instanceID.ValueString(), params, operationTimeout); err != nil {
|
|
||||||
resp.Diagnostics.AddError("Ошибка клиента", err.Error())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
{{- if .HasRedeploy }}
|
|
||||||
}
|
}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
|
|||||||
+1
-1
Submodule tfluceecrud updated: 7b6ab4c8b7...f5a2b23258
Reference in New Issue
Block a user