Skip to content

Commit a558bc4

Browse files
committed
add cdn domain result fileds.
1 parent 2ffd81a commit a558bc4

File tree

2 files changed

+44
-7
lines changed

2 files changed

+44
-7
lines changed

tencentcloud/data_source_tc_cdn_domains.go

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,36 @@ func dataSourceTencentCloudCdnDomains() *schema.Resource {
6767
Description: "An information list of cdn domain. Each element contains the following attributes:",
6868
Elem: &schema.Resource{
6969
Schema: map[string]*schema.Schema{
70+
"resource_id": {
71+
Type: schema.TypeString,
72+
Computed: true,
73+
Description: "Domain name ID.",
74+
},
7075
"domain": {
7176
Type: schema.TypeString,
7277
Computed: true,
7378
Description: "Acceleration domain name.",
7479
},
80+
"cname": {
81+
Type: schema.TypeString,
82+
Computed: true,
83+
Description: "CNAME address of domain name.",
84+
},
85+
"status": {
86+
Type: schema.TypeString,
87+
Computed: true,
88+
Description: "Acceleration service status.",
89+
},
90+
"create_time": {
91+
Type: schema.TypeString,
92+
Computed: true,
93+
Description: "Domain name creation time.",
94+
},
95+
"update_time": {
96+
Type: schema.TypeString,
97+
Computed: true,
98+
Description: "Last modified time of domain name.",
99+
},
75100
"service_type": {
76101
Type: schema.TypeString,
77102
Computed: true,
@@ -260,21 +285,28 @@ func dataSourceTencentCloudCdnDomainsRead(d *schema.ResourceData, meta interface
260285
origins = append(origins, origin)
261286

262287
httpsconfigs := make([]map[string]interface{}, 0, 1)
263-
httpsConfig := make(map[string]interface{}, 7)
264-
httpsConfig["https_switch"] = detailDomain.Https.Switch
265-
httpsConfig["http2_switch"] = detailDomain.Https.Http2
266-
httpsConfig["ocsp_stapling_switch"] = detailDomain.Https.OcspStapling
267-
httpsConfig["spdy_switch"] = detailDomain.Https.Spdy
268-
httpsConfig["verify_client"] = detailDomain.Https.VerifyClient
269-
httpsconfigs = append(httpsconfigs, httpsConfig)
288+
if detailDomain.Https != nil {
289+
httpsConfig := make(map[string]interface{}, 7)
290+
httpsConfig["https_switch"] = detailDomain.Https.Switch
291+
httpsConfig["http2_switch"] = detailDomain.Https.Http2
292+
httpsConfig["ocsp_stapling_switch"] = detailDomain.Https.OcspStapling
293+
httpsConfig["spdy_switch"] = detailDomain.Https.Spdy
294+
httpsConfig["verify_client"] = detailDomain.Https.VerifyClient
295+
httpsconfigs = append(httpsconfigs, httpsConfig)
296+
}
270297

271298
tags, errRet := tagService.DescribeResourceTags(ctx, CDN_SERVICE_NAME, CDN_RESOURCE_NAME_DOMAIN, region, *detailDomain.Domain)
272299
if errRet != nil {
273300
return errRet
274301
}
275302

276303
mapping := map[string]interface{}{
304+
"resource_id": detailDomain.ResourceId,
277305
"domain": detailDomain.Domain,
306+
"cname": detailDomain.Cname,
307+
"status": detailDomain.Status,
308+
"create_time": detailDomain.CreateTime,
309+
"update_time": detailDomain.UpdateTime,
278310
"service_type": detailDomain.ServiceType,
279311
"area": detailDomain.Area,
280312
"project_id": detailDomain.ProjectId,

website/docs/d/cdn_domains.html.markdown

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ In addition to all arguments above, the following attributes are exported:
3939

4040
* `domain_list` - An information list of cdn domain. Each element contains the following attributes:
4141
* `area` - Acceleration region.
42+
* `cname` - CNAME address of domain name.
43+
* `create_time` - Domain name creation time.
4244
* `domain` - Acceleration domain name.
4345
* `full_url_cache` - Whether to enable full-path cache.
4446
* `https_config` - HTTPS acceleration configuration. It's a list and consist of at most one item.
@@ -57,7 +59,10 @@ In addition to all arguments above, the following attributes are exported:
5759
* `origin_type` - Master origin server type.
5860
* `server_name` - Host header used when accessing the master origin server. If left empty, the acceleration domain name will be used by default.
5961
* `project_id` - The project CDN belongs to.
62+
* `resource_id` - Domain name ID.
6063
* `service_type` - Service type of acceleration domain name.
64+
* `status` - Acceleration service status.
6165
* `tags` - Tags of cdn domain.
66+
* `update_time` - Last modified time of domain name.
6267

6368

0 commit comments

Comments
 (0)