Skip to content

Commit c4f244b

Browse files
authored
Merge pull request #667 from tencentcloudstack/feat/cdn-ipv6-access
feat: cdn - support ipv6 access switch
2 parents 71e7a62 + fdb09a2 commit c4f244b

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

tencentcloud/resource_tc_cdn_domain.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,13 @@ func resourceTencentCloudCdnDomain() *schema.Resource {
408408
ValidateFunc: validateAllowedStringValue(CDN_SWITCH),
409409
Description: "Sharding back to source configuration switch. Valid values are `on` and `off`. Default value is `on`.",
410410
},
411+
"ipv6_access_switch": {
412+
Type: schema.TypeString,
413+
Optional: true,
414+
Default: CDN_SWITCH_OFF,
415+
ValidateFunc: validateAllowedStringValue(CDN_SWITCH),
416+
Description: "ipv6 access configuration switch. Only available when area set to `mainland`. Valid values are `on` and `off`. Default value is `off`.",
417+
},
411418
"rule_cache": {
412419
Type: schema.TypeList,
413420
Optional: true,
@@ -602,6 +609,12 @@ func resourceTencentCloudCdnDomainCreate(d *schema.ResourceData, meta interface{
602609
request.RangeOriginPull = &cdn.RangeOriginPull{}
603610
request.RangeOriginPull.Switch = helper.String(d.Get("range_origin_switch").(string))
604611

612+
if v, ok := d.GetOk("ipv6_access_switch"); ok {
613+
request.Ipv6Access = &cdn.Ipv6Access{
614+
Switch: helper.String(v.(string)),
615+
}
616+
}
617+
605618
// rule_cache
606619
if v, ok := d.GetOk("rule_cache"); ok {
607620
ruleCache := v.([]interface{})
@@ -863,6 +876,10 @@ func resourceTencentCloudCdnDomainRead(d *schema.ResourceData, meta interface{})
863876
_ = d.Set("create_time", domainConfig.CreateTime)
864877
_ = d.Set("cname", domainConfig.Cname)
865878
_ = d.Set("range_origin_switch", domainConfig.RangeOriginPull.Switch)
879+
880+
if domainConfig.Ipv6Access != nil {
881+
_ = d.Set("ipv6_access_switch", domainConfig.Ipv6Access.Switch)
882+
}
866883
if *domainConfig.CacheKey.FullUrlCache == CDN_SWITCH_OFF {
867884
_ = d.Set("full_url_cache", false)
868885
} else {
@@ -1041,6 +1058,11 @@ func resourceTencentCloudCdnDomainUpdate(d *schema.ResourceData, meta interface{
10411058
request.RangeOriginPull.Switch = helper.String(d.Get("range_origin_switch").(string))
10421059
updateAttrs = append(updateAttrs, "range_origin_switch")
10431060
}
1061+
if d.HasChange("ipv6_access_switch") {
1062+
request.Ipv6Access = &cdn.Ipv6Access{}
1063+
request.Ipv6Access.Switch = helper.String(d.Get("ipv6_access_switch").(string))
1064+
updateAttrs = append(updateAttrs, "ipv6_access_switch")
1065+
}
10441066
if d.HasChange("origin") {
10451067
updateAttrs = append(updateAttrs, "origin")
10461068
origins := d.Get("origin").([]interface{})

website/docs/r/cdn_domain.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ The following arguments are supported:
144144
* `area` - (Optional) Domain name acceleration region. `mainland`: acceleration inside mainland China, `overseas`: acceleration outside mainland China, `global`: global acceleration. Overseas acceleration service must be enabled to use overseas acceleration and global acceleration.
145145
* `full_url_cache` - (Optional) Whether to enable full-path cache. Default value is `true`.
146146
* `https_config` - (Optional) HTTPS acceleration configuration. It's a list and consist of at most one item.
147+
* `ipv6_access_switch` - (Optional) ipv6 access configuration switch. Only available when area set to `mainland`. Valid values are `on` and `off`. Default value is `off`.
147148
* `project_id` - (Optional) The project CDN belongs to, default to 0.
148149
* `range_origin_switch` - (Optional) Sharding back to source configuration switch. Valid values are `on` and `off`. Default value is `on`.
149150
* `request_header` - (Optional) Request header configuration. It's a list and consist of at most one item.

0 commit comments

Comments
 (0)