Skip to content

Commit 5ad5c7c

Browse files
committed
add domain id
1 parent a558bc4 commit 5ad5c7c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tencentcloud/data_source_tc_cdn_domains.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
2323
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
2424
cdn "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdn/v20180606"
25+
"github.com/terraform-providers/terraform-provider-tencentcloud/tencentcloud/internal/helper"
2526
)
2627

2728
func dataSourceTencentCloudCdnDomains() *schema.Resource {
@@ -266,6 +267,7 @@ func dataSourceTencentCloudCdnDomainsRead(d *schema.ResourceData, meta interface
266267
}
267268

268269
cdnDomainList := make([]map[string]interface{}, 0, len(domainConfigs))
270+
ids := make([]string, 0, len(domainConfigs))
269271
for _, detailDomain := range domainConfigs {
270272
var fullUrlCache bool
271273
if detailDomain.CacheKey != nil && *detailDomain.CacheKey.FullUrlCache == CDN_SWITCH_ON {
@@ -317,8 +319,10 @@ func dataSourceTencentCloudCdnDomainsRead(d *schema.ResourceData, meta interface
317319
}
318320

319321
cdnDomainList = append(cdnDomainList, mapping)
322+
ids = append(ids, *detailDomain.ResourceId)
320323
}
321324

325+
d.SetId(helper.DataResourceIdsHash(ids))
322326
err = d.Set("domain_list", cdnDomainList)
323327
if err != nil {
324328
log.Printf("[CRITAL]%s provider set cdn domain list fail, reason:%s\n ", logId, err.Error())

0 commit comments

Comments
 (0)