Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions tencentcloud/resource_tc_cdn_domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,13 @@ func resourceTencentCloudCdnDomain() *schema.Resource {
ValidateFunc: validateAllowedStringValue(CDN_SWITCH),
Description: "Sharding back to source configuration switch. Valid values are `on` and `off`. Default value is `on`.",
},
"ipv6_access_switch": {
Type: schema.TypeString,
Optional: true,
Default: CDN_SWITCH_OFF,
ValidateFunc: validateAllowedStringValue(CDN_SWITCH),
Description: "ipv6 access configuration switch. Only available when area set to `mainland`. Valid values are `on` and `off`. Default value is `off`.",
},
"rule_cache": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -602,6 +609,12 @@ func resourceTencentCloudCdnDomainCreate(d *schema.ResourceData, meta interface{
request.RangeOriginPull = &cdn.RangeOriginPull{}
request.RangeOriginPull.Switch = helper.String(d.Get("range_origin_switch").(string))

if v, ok := d.GetOk("ipv6_access_switch"); ok {
request.Ipv6Access = &cdn.Ipv6Access{
Switch: helper.String(v.(string)),
}
}

// rule_cache
if v, ok := d.GetOk("rule_cache"); ok {
ruleCache := v.([]interface{})
Expand Down Expand Up @@ -863,6 +876,10 @@ func resourceTencentCloudCdnDomainRead(d *schema.ResourceData, meta interface{})
_ = d.Set("create_time", domainConfig.CreateTime)
_ = d.Set("cname", domainConfig.Cname)
_ = d.Set("range_origin_switch", domainConfig.RangeOriginPull.Switch)

if domainConfig.Ipv6Access != nil {
_ = d.Set("ipv6_access_switch", domainConfig.Ipv6Access.Switch)
}
if *domainConfig.CacheKey.FullUrlCache == CDN_SWITCH_OFF {
_ = d.Set("full_url_cache", false)
} else {
Expand Down Expand Up @@ -1041,6 +1058,11 @@ func resourceTencentCloudCdnDomainUpdate(d *schema.ResourceData, meta interface{
request.RangeOriginPull.Switch = helper.String(d.Get("range_origin_switch").(string))
updateAttrs = append(updateAttrs, "range_origin_switch")
}
if d.HasChange("ipv6_access_switch") {
request.Ipv6Access = &cdn.Ipv6Access{}
request.Ipv6Access.Switch = helper.String(d.Get("ipv6_access_switch").(string))
updateAttrs = append(updateAttrs, "ipv6_access_switch")
}
if d.HasChange("origin") {
updateAttrs = append(updateAttrs, "origin")
origins := d.Get("origin").([]interface{})
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/cdn_domain.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ The following arguments are supported:
* `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.
* `full_url_cache` - (Optional) Whether to enable full-path cache. Default value is `true`.
* `https_config` - (Optional) HTTPS acceleration configuration. It's a list and consist of at most one item.
* `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`.
* `project_id` - (Optional) The project CDN belongs to, default to 0.
* `range_origin_switch` - (Optional) Sharding back to source configuration switch. Valid values are `on` and `off`. Default value is `on`.
* `request_header` - (Optional) Request header configuration. It's a list and consist of at most one item.
Expand Down