fix: lifecycle bugs A+B (HasError guard, not_created hard error) + bump 5.0.72
This commit is contained in:
@@ -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
|
||||
}
|
||||
`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user