Skip to content

Commit 8041a68

Browse files
authored
fix(tem): protect read dmarc (#2960)
* fix(tem): protect read dmarc * fix lint
1 parent 339c8f2 commit 8041a68

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

internal/services/tem/domain.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,15 @@ func ResourceDomainRead(ctx context.Context, d *schema.ResourceData, m interface
242242
_ = d.Set("last_error", domain.LastError) //nolint:staticcheck
243243
_ = d.Set("spf_config", domain.SpfConfig)
244244
_ = d.Set("dkim_config", domain.DkimConfig)
245-
_ = d.Set("dmarc_name", domain.Records.Dmarc.Name)
246-
_ = d.Set("dmarc_config", domain.Records.Dmarc.Value)
245+
246+
if domain.Records != nil && domain.Records.Dmarc != nil {
247+
_ = d.Set("dmarc_name", domain.Records.Dmarc.Name)
248+
_ = d.Set("dmarc_config", domain.Records.Dmarc.Value)
249+
} else {
250+
_ = d.Set("dmarc_name", "")
251+
_ = d.Set("dmarc_config", "")
252+
}
253+
247254
_ = d.Set("smtp_host", tem.SMTPHost)
248255
_ = d.Set("smtp_port_unsecure", tem.SMTPPortUnsecure)
249256
_ = d.Set("smtp_port", tem.SMTPPort)

0 commit comments

Comments
 (0)