@@ -264,6 +264,95 @@ func DataSourceTencentCloudDnspodRecordList() *schema.Resource {
264
264
},
265
265
},
266
266
},
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
+ },
267
356
268
357
"result_output_file" : {
269
358
Type : schema .TypeString ,
@@ -281,10 +370,11 @@ func dataSourceTencentCloudDnspodRecordListRead(d *schema.ResourceData, meta int
281
370
logId := tccommon .GetLogId (tccommon .ContextNil )
282
371
283
372
ctx := context .WithValue (context .TODO (), tccommon .LogIdKey , logId )
284
-
373
+ var domain string
285
374
paramMap := make (map [string ]interface {})
286
375
if v , ok := d .GetOk ("domain" ); ok {
287
- paramMap ["Domain" ] = helper .String (v .(string ))
376
+ domain = v .(string )
377
+ paramMap ["Domain" ] = helper .String (domain )
288
378
}
289
379
290
380
if v , ok := d .GetOkExists ("domain_id" ); ok {
@@ -396,71 +486,90 @@ func dataSourceTencentCloudDnspodRecordListRead(d *schema.ResourceData, meta int
396
486
397
487
ids := make ([]string , 0 , len (recordList ))
398
488
tmpList := make ([]map [string ]interface {}, 0 , len (recordList ))
489
+ instanceList := make ([]map [string ]interface {}, 0 , len (recordList ))
399
490
if recordList != nil {
400
491
for _ , recordListItem := range recordList {
401
492
recordListItemMap := map [string ]interface {}{}
402
-
493
+ instanceListItemMap := map [string ]interface {}{}
494
+ instanceListItemMap ["domain" ] = domain
403
495
if recordListItem .RecordId != nil {
404
496
recordListItemMap ["record_id" ] = recordListItem .RecordId
497
+ instanceListItemMap ["record_id" ] = recordListItem .RecordId
498
+ instanceListItemMap ["id" ] = domain + tccommon .FILED_SP + helper .UInt64ToStr (* recordListItem .RecordId )
405
499
}
406
500
407
501
if recordListItem .Value != nil {
408
502
recordListItemMap ["value" ] = recordListItem .Value
503
+ instanceListItemMap ["value" ] = recordListItem .Value
409
504
}
410
505
411
506
if recordListItem .Status != nil {
412
507
recordListItemMap ["status" ] = recordListItem .Status
508
+ instanceListItemMap ["status" ] = recordListItem .Status
413
509
}
414
510
415
511
if recordListItem .UpdatedOn != nil {
416
512
recordListItemMap ["updated_on" ] = recordListItem .UpdatedOn
513
+ instanceListItemMap ["updated_on" ] = recordListItem .UpdatedOn
417
514
}
418
515
419
516
if recordListItem .Name != nil {
420
517
recordListItemMap ["name" ] = recordListItem .Name
518
+ instanceListItemMap ["sub_domain" ] = recordListItem .Name
421
519
}
422
520
423
521
if recordListItem .Line != nil {
424
522
recordListItemMap ["line" ] = recordListItem .Line
523
+ instanceListItemMap ["record_line" ] = recordListItem .Line
425
524
}
426
525
427
526
if recordListItem .LineId != nil {
428
527
recordListItemMap ["line_id" ] = recordListItem .LineId
528
+ instanceListItemMap ["line_id" ] = recordListItem .LineId
429
529
}
430
530
431
531
if recordListItem .Type != nil {
432
532
recordListItemMap ["type" ] = recordListItem .Type
533
+ instanceListItemMap ["record_type" ] = recordListItem .Type
433
534
}
434
535
435
536
if recordListItem .Weight != nil {
436
537
recordListItemMap ["weight" ] = recordListItem .Weight
538
+ instanceListItemMap ["weight" ] = recordListItem .Weight
437
539
}
438
540
439
541
if recordListItem .MonitorStatus != nil {
440
542
recordListItemMap ["monitor_status" ] = recordListItem .MonitorStatus
543
+ instanceListItemMap ["monitor_status" ] = recordListItem .MonitorStatus
441
544
}
442
545
443
546
if recordListItem .Remark != nil {
444
547
recordListItemMap ["remark" ] = recordListItem .Remark
548
+ instanceListItemMap ["remark" ] = recordListItem .Remark
445
549
}
446
550
447
551
if recordListItem .TTL != nil {
448
552
recordListItemMap ["ttl" ] = recordListItem .TTL
553
+ instanceListItemMap ["ttl" ] = recordListItem .TTL
449
554
}
450
555
451
556
if recordListItem .MX != nil {
452
557
recordListItemMap ["mx" ] = recordListItem .MX
558
+ instanceListItemMap ["mx" ] = recordListItem .MX
453
559
}
454
560
455
561
if recordListItem .DefaultNS != nil {
456
562
recordListItemMap ["default_ns" ] = recordListItem .DefaultNS
563
+ instanceListItemMap ["default_ns" ] = recordListItem .DefaultNS
457
564
}
458
565
459
566
ids = append (ids , helper .UInt64ToStr (* recordListItem .RecordId ))
460
567
tmpList = append (tmpList , recordListItemMap )
568
+ instanceList = append (instanceList , instanceListItemMap )
461
569
}
462
570
463
571
_ = d .Set ("record_list" , tmpList )
572
+ _ = d .Set ("instance_list" , instanceList )
464
573
}
465
574
466
575
d .SetId (helper .DataResourceIdsHash (ids ))
0 commit comments