From 757aa2de98e60777e7c82a7def57c11e079b01a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Mon, 20 Jul 2026 10:30:19 +0400 Subject: [PATCH] fix: modify only if hasServiceParamChanges (skip when git_revision only), bump TEST 5.1.16 --- TEST_STAND/LUCEE/locals.tf | 2 +- TEST_STAND/LUCEE/main.tf | 2 +- TOOLS/config/test/profile.env | 2 +- .../internal/templates/instance.go | 56 +++++++++---------- tfluceecrud | 2 +- 5 files changed, 29 insertions(+), 35 deletions(-) diff --git a/TEST_STAND/LUCEE/locals.tf b/TEST_STAND/LUCEE/locals.tf index 0c93bae..627ed64 100644 --- a/TEST_STAND/LUCEE/locals.tf +++ b/TEST_STAND/LUCEE/locals.tf @@ -21,7 +21,7 @@ locals { pg_db_name = "db4crudpg" # ─── Lucee ─────────────────────────────────────────────────────────────── - lucee_git_revision = "94e14" + lucee_git_revision = "94d" lucee_resource_name = "luceeresource" lucee_domain = "tflucee" lucee_version = "5.4" diff --git a/TEST_STAND/LUCEE/main.tf b/TEST_STAND/LUCEE/main.tf index 6c0328c..c0e4bad 100644 --- a/TEST_STAND/LUCEE/main.tf +++ b/TEST_STAND/LUCEE/main.tf @@ -2,7 +2,7 @@ terraform { required_providers { nubes = { source = "registry.kube5s.ru/nubes-test/nubes" - version = "5.1.13" + version = "5.1.15" } } } diff --git a/TOOLS/config/test/profile.env b/TOOLS/config/test/profile.env index c4fea6f..ecc1987 100644 --- a/TOOLS/config/test/profile.env +++ b/TOOLS/config/test/profile.env @@ -3,7 +3,7 @@ NUBES_API_ENDPOINT="https://lk-api-gateway-test.ngcloud.ru/api/v1/svc" TOKEN_FILE="secrets/test.token" # Version -VERSION="5.1.15" +VERSION="5.1.16" # Docs generation — ONLY from docs_gen// (never from docs/) DOCS_GEN_DIR="provider/docs_gen/test" diff --git a/TOOLS/resource-generator/internal/templates/instance.go b/TOOLS/resource-generator/internal/templates/instance.go index ef22a03..39f22e2 100644 --- a/TOOLS/resource-generator/internal/templates/instance.go +++ b/TOOLS/resource-generator/internal/templates/instance.go @@ -547,6 +547,31 @@ func (r *{{ToCamel .Name}}Resource) Update(ctx context.Context, req resource.Upd {{- if .HasRedeploy }} // --- 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 { redeployParams := map[int]string{} {{- 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))}} {{- 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 { resp.Diagnostics.AddError("Ошибка клиента", err.Error()) 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 }} diff --git a/tfluceecrud b/tfluceecrud index 7b6ab4c..f5a2b23 160000 --- a/tfluceecrud +++ b/tfluceecrud @@ -1 +1 @@ -Subproject commit 7b6ab4c8b735ca7858c083f4e72a14a263c83f8f +Subproject commit f5a2b232586d6dc950474b7f12a07c52930542cf