Skip to content

Commit e68108b

Browse files
authored
recreate deleted maintenance template (#248)
1 parent b0e99d0 commit e68108b

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

myrasec/resource_myrasec_maintenance_template.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,15 @@ func resourceMyrasecMaintenanceTemplateRead(ctx context.Context, d *schema.Resou
148148
}
149149

150150
template, diags := findMaintenanceTemplate(maintenanceTemplateID, meta, domainID)
151-
if diags.HasError() || template == nil {
151+
if diags.HasError() {
152152
return diags
153153
}
154154

155+
if template == nil {
156+
d.SetId("")
157+
return nil
158+
}
159+
155160
setMaintenanceTemplateData(d, template, domainID)
156161

157162
return diags
@@ -350,12 +355,6 @@ func findMaintenanceTemplate(maintenanceTemplateID int, meta any, domainID int)
350355
}
351356
page++
352357
}
353-
354-
diags = append(diags, diag.Diagnostic{
355-
Severity: diag.Warning,
356-
Summary: "Unable to find maintenance template",
357-
Detail: fmt.Sprintf("Unable to find maintenance template with ID = [%d]", maintenanceTemplateID),
358-
})
359358
return nil, diags
360359
}
361360

0 commit comments

Comments
 (0)