@@ -264,6 +264,95 @@ func DataSourceTencentCloudDnspodRecordList() *schema.Resource {
264264 },
265265 },
266266 },
267+ "instance_list" : {
268+ Computed : true ,
269+ Type : schema .TypeList ,
270+ Description : "List of records." ,
271+ Elem : & schema.Resource {
272+ Schema : map [string ]* schema.Schema {
273+ "id" : {
274+ Computed : true ,
275+ Type : schema .TypeString ,
276+ Description : "ID." ,
277+ },
278+ "domain" : {
279+ Computed : true ,
280+ Type : schema .TypeString ,
281+ Description : "Domain." ,
282+ },
283+ "record_id" : {
284+ Type : schema .TypeInt ,
285+ Computed : true ,
286+ Description : "Record ID." ,
287+ },
288+ "value" : {
289+ Type : schema .TypeString ,
290+ Computed : true ,
291+ Description : "Record value." ,
292+ },
293+ "status" : {
294+ Type : schema .TypeString ,
295+ Computed : true ,
296+ Description : "Record status, enabled: ENABLE, paused: DISABLE." ,
297+ },
298+ "updated_on" : {
299+ Type : schema .TypeString ,
300+ Computed : true ,
301+ Description : "Update time." ,
302+ },
303+ "sub_domain" : {
304+ Type : schema .TypeString ,
305+ Computed : true ,
306+ Description : "Host header." ,
307+ },
308+ "record_line" : {
309+ Type : schema .TypeString ,
310+ Computed : true ,
311+ Description : "Record line." ,
312+ },
313+ "line_id" : {
314+ Type : schema .TypeString ,
315+ Computed : true ,
316+ Description : "Line ID." ,
317+ },
318+ "record_type" : {
319+ Type : schema .TypeString ,
320+ Computed : true ,
321+ Description : "Record type." ,
322+ },
323+ "weight" : {
324+ Type : schema .TypeInt ,
325+ Computed : true ,
326+ Description : "Record weight, used for load balancing records. Note: This field may return null, indicating that no valid value can be obtained." ,
327+ },
328+ "monitor_status" : {
329+ Type : schema .TypeString ,
330+ Computed : true ,
331+ Description : "Record monitoring status, normal: OK, alarm: WARN, downtime: DOWN, empty if monitoring is not set or paused." ,
332+ },
333+ "remark" : {
334+ Type : schema .TypeString ,
335+ Computed : true ,
336+ Description : "Record remark description." ,
337+ },
338+ "ttl" : {
339+ Type : schema .TypeInt ,
340+ Computed : true ,
341+ Description : "Record cache time." ,
342+ },
343+ "mx" : {
344+ Type : schema .TypeInt ,
345+ Computed : true ,
346+ Description : "MX value, only available for MX records Note: This field may return null, indicating that no valid value can be obtained." ,
347+ },
348+ "default_ns" : {
349+ Type : schema .TypeBool ,
350+ Computed : true ,
351+ Description : "Whether it is the default NS record." ,
352+ },
353+ },
354+ },
355+ },
267356
268357 "result_output_file" : {
269358 Type : schema .TypeString ,
@@ -281,10 +370,11 @@ func dataSourceTencentCloudDnspodRecordListRead(d *schema.ResourceData, meta int
281370 logId := tccommon .GetLogId (tccommon .ContextNil )
282371
283372 ctx := context .WithValue (context .TODO (), tccommon .LogIdKey , logId )
284-
373+ var domain string
285374 paramMap := make (map [string ]interface {})
286375 if v , ok := d .GetOk ("domain" ); ok {
287- paramMap ["Domain" ] = helper .String (v .(string ))
376+ domain = v .(string )
377+ paramMap ["Domain" ] = helper .String (domain )
288378 }
289379
290380 if v , ok := d .GetOkExists ("domain_id" ); ok {
@@ -396,71 +486,90 @@ func dataSourceTencentCloudDnspodRecordListRead(d *schema.ResourceData, meta int
396486
397487 ids := make ([]string , 0 , len (recordList ))
398488 tmpList := make ([]map [string ]interface {}, 0 , len (recordList ))
489+ instanceList := make ([]map [string ]interface {}, 0 , len (recordList ))
399490 if recordList != nil {
400491 for _ , recordListItem := range recordList {
401492 recordListItemMap := map [string ]interface {}{}
402-
493+ instanceListItemMap := map [string ]interface {}{}
494+ instanceListItemMap ["domain" ] = domain
403495 if recordListItem .RecordId != nil {
404496 recordListItemMap ["record_id" ] = recordListItem .RecordId
497+ instanceListItemMap ["record_id" ] = recordListItem .RecordId
498+ instanceListItemMap ["id" ] = domain + tccommon .FILED_SP + helper .UInt64ToStr (* recordListItem .RecordId )
405499 }
406500
407501 if recordListItem .Value != nil {
408502 recordListItemMap ["value" ] = recordListItem .Value
503+ instanceListItemMap ["value" ] = recordListItem .Value
409504 }
410505
411506 if recordListItem .Status != nil {
412507 recordListItemMap ["status" ] = recordListItem .Status
508+ instanceListItemMap ["status" ] = recordListItem .Status
413509 }
414510
415511 if recordListItem .UpdatedOn != nil {
416512 recordListItemMap ["updated_on" ] = recordListItem .UpdatedOn
513+ instanceListItemMap ["updated_on" ] = recordListItem .UpdatedOn
417514 }
418515
419516 if recordListItem .Name != nil {
420517 recordListItemMap ["name" ] = recordListItem .Name
518+ instanceListItemMap ["sub_domain" ] = recordListItem .Name
421519 }
422520
423521 if recordListItem .Line != nil {
424522 recordListItemMap ["line" ] = recordListItem .Line
523+ instanceListItemMap ["record_line" ] = recordListItem .Line
425524 }
426525
427526 if recordListItem .LineId != nil {
428527 recordListItemMap ["line_id" ] = recordListItem .LineId
528+ instanceListItemMap ["line_id" ] = recordListItem .LineId
429529 }
430530
431531 if recordListItem .Type != nil {
432532 recordListItemMap ["type" ] = recordListItem .Type
533+ instanceListItemMap ["record_type" ] = recordListItem .Type
433534 }
434535
435536 if recordListItem .Weight != nil {
436537 recordListItemMap ["weight" ] = recordListItem .Weight
538+ instanceListItemMap ["weight" ] = recordListItem .Weight
437539 }
438540
439541 if recordListItem .MonitorStatus != nil {
440542 recordListItemMap ["monitor_status" ] = recordListItem .MonitorStatus
543+ instanceListItemMap ["monitor_status" ] = recordListItem .MonitorStatus
441544 }
442545
443546 if recordListItem .Remark != nil {
444547 recordListItemMap ["remark" ] = recordListItem .Remark
548+ instanceListItemMap ["remark" ] = recordListItem .Remark
445549 }
446550
447551 if recordListItem .TTL != nil {
448552 recordListItemMap ["ttl" ] = recordListItem .TTL
553+ instanceListItemMap ["ttl" ] = recordListItem .TTL
449554 }
450555
451556 if recordListItem .MX != nil {
452557 recordListItemMap ["mx" ] = recordListItem .MX
558+ instanceListItemMap ["mx" ] = recordListItem .MX
453559 }
454560
455561 if recordListItem .DefaultNS != nil {
456562 recordListItemMap ["default_ns" ] = recordListItem .DefaultNS
563+ instanceListItemMap ["default_ns" ] = recordListItem .DefaultNS
457564 }
458565
459566 ids = append (ids , helper .UInt64ToStr (* recordListItem .RecordId ))
460567 tmpList = append (tmpList , recordListItemMap )
568+ instanceList = append (instanceList , instanceListItemMap )
461569 }
462570
463571 _ = d .Set ("record_list" , tmpList )
572+ _ = d .Set ("instance_list" , instanceList )
464573 }
465574
466575 d .SetId (helper .DataResourceIdsHash (ids ))
0 commit comments