Skip to content

Commit 819af0b

Browse files
committed
Set last_cname only if we have some CNAME resolved
1 parent e877da6 commit 819af0b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

internal/provider/data_dns_recursive_cname_record_set.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ func (d *dnsCNAMERecursiveRecordSetDataSource) Read(ctx context.Context, req dat
7474
}
7575

7676
config.CNAMES, _ = types.ListValueFrom(ctx, types.StringType, cnames)
77-
config.LastCNAME = types.StringValue(cnames[len(cnames)-1])
77+
if len(cnames) > 0 {
78+
config.LastCNAME = types.StringValue(cnames[len(cnames)-1])
79+
}
7880
config.ID = config.Host
7981
resp.Diagnostics.Append(resp.State.Set(ctx, config)...)
8082
}

0 commit comments

Comments
 (0)