fix: lifecycle bugs A+B (HasError guard, not_created hard error) + bump 5.0.72

This commit is contained in:
“Naeel”
2026-07-16 14:51:01 +04:00
parent f31bedfe05
commit 6929562fc9
5 changed files with 19 additions and 11 deletions
@@ -282,6 +282,11 @@ func (r *{{ToCamel .Name}}Resource) Create(ctx context.Context, req resource.Cre
{{- end }}
domainServiceIDs := []int{ {{- range .DomainServiceIDs }}{{.}}, {{- end }} }
resp.Diagnostics.Append(resources_core.CreateExistingResourceDiagnosticsWithDomainAndServices(ctx, r.client, {{.ServiceID}}, resourceName, data.AdoptExistingOnCreate.ValueBool(), desiredDomain, domainServiceIDs)...)
// ⛔ Проверяем HasError ДО create — при hard-error (running без adopt, suspend без adopt,
// not created, конфликт) сайд-эффект create не должен выполняться.
if resp.Diagnostics.HasError() {
return
}
params := map[int]string{
{{- range .CreateParams }}
@@ -607,4 +612,3 @@ func (r *{{ToCamel .Name}}Resource) Configure(_ context.Context, req resource.Co
r.client = client
}
`