Skip to content

Commit d72fa8a

Browse files
committed
fix: zone id assignment
1 parent 564d792 commit d72fa8a

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

cf/record.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ func (o *DNSRecord) Read(ctx context.Context, meta interface{}) error {
3535
cli := pctx.CloudflareClient()
3636
zoneID := o.ZoneID.Any()
3737

38+
if zoneID == "" {
39+
o.MarkAsNew()
40+
41+
return nil
42+
}
43+
3844
records, err := pctx.FuncCache(fmt.Sprintf("DNSRecords:list:%s", zoneID), func() (interface{}, error) {
3945
return cli.DNSRecords(ctx, zoneID, cloudflare.DNSRecord{})
4046
})
@@ -67,7 +73,7 @@ func (o *DNSRecord) Read(ctx context.Context, meta interface{}) error {
6773
}
6874

6975
o.MarkAsExisting()
70-
o.ZoneID.SetCurrent(rec.ZoneID)
76+
o.ZoneID.SetCurrent(zoneID)
7177
o.ID.SetCurrent(rec.ID)
7278
o.Name.SetCurrent(rec.Name)
7379
o.Type.SetCurrent(rec.Type)

0 commit comments

Comments
 (0)