Skip to content

Commit ff68b6f

Browse files
authored
fix(teo): [125632219] tencentcloud_teo_acceleration_domain optmize host_header params (#3436)
* add * add
1 parent 39c72bf commit ff68b6f

File tree

4 files changed

+31
-14
lines changed

4 files changed

+31
-14
lines changed

.changelog/3436.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/tencentcloud_teo_acceleration_domain: optmize `host_header` params
3+
```

tencentcloud/services/teo/resource_tc_teo_acceleration_domain.go

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,27 +48,27 @@ func ResourceTencentCloudTeoAccelerationDomain() *schema.Resource {
4848
"origin_type": {
4949
Type: schema.TypeString,
5050
Required: true,
51-
Description: "The origin type. Values: `IP_DOMAIN`: IPv4/IPv6 address or domain name; `COS`: COS bucket address; `ORIGIN_GROUP`: Origin group; `AWS_S3`: AWS S3 bucket address; `SPACE`: EdgeOne Shield Space.",
51+
Description: "Origin server type, with values: IP_DOMAIN: IPv4, IPv6, or domain name type origin server; COS: Tencent Cloud COS origin server; AWS_S3: AWS S3 origin server; ORIGIN_GROUP: origin server group type origin server; VOD: Video on Demand; SPACE: origin server uninstallation. Currently only available to the allowlist; LB: load balancing. Currently only available to the allowlist.",
5252
},
5353
"origin": {
5454
Type: schema.TypeString,
5555
Required: true,
56-
Description: "The origin address. Enter the origin group ID if `OriginType=ORIGIN_GROUP`.",
56+
Description: "Origin server address, which varies according to the value of OriginType: When OriginType = IP_DOMAIN, fill in an IPv4 address, an IPv6 address, or a domain name; When OriginType = COS, fill in the access domain name of the COS bucket; When OriginType = AWS_S3, fill in the access domain name of the S3 bucket; When OriginType = ORIGIN_GROUP, fill in the origin server group ID; When OriginType = VOD, fill in the VOD application ID; When OriginType = LB, fill in the Cloud Load Balancer instance ID. This feature is currently only available to the allowlist; When OriginType = SPACE, fill in the origin server uninstallation space ID. This feature is currently only available to the allowlist.",
5757
},
5858
"backup_origin": {
5959
Type: schema.TypeString,
6060
Optional: true,
61-
Description: "ID of the secondary origin group (valid when `OriginType=ORIGIN_GROUP`). If it is not specified, it indicates that secondary origins are not used.",
61+
Description: "The ID of the secondary origin group. This parameter is valid only when OriginType is ORIGIN_GROUP. This field indicates the old version capability, which cannot be configured or modified on the control panel after being called. Please submit a ticket if required.",
6262
},
6363
"private_access": {
6464
Type: schema.TypeString,
6565
Optional: true,
66-
Description: "Whether to authenticate access to the private object storage origin (valid when `OriginType=COS/AWS_S3`). Values: `on`: Enable private authentication; `off`: Disable private authentication. If this field is not specified, the default value `off` is used.",
66+
Description: "Whether access to the private Cloud Object Storage origin server is allowed. This parameter is valid only when OriginType is COS or AWS_S3. Valid values: on: Enable private authentication; off: Disable private authentication. If it is not specified, the default value is off.",
6767
},
6868
"private_parameters": {
6969
Type: schema.TypeList,
7070
Optional: true,
71-
Description: "The private authentication parameters. This field is valid when `PrivateAccess=on`.",
71+
Description: "Private authentication parameter. This parameter is valid only when `private_access` is on.",
7272
Elem: &schema.Resource{
7373
Schema: map[string]*schema.Schema{
7474
"name": {
@@ -88,7 +88,7 @@ func ResourceTencentCloudTeoAccelerationDomain() *schema.Resource {
8888
Type: schema.TypeString,
8989
Optional: true,
9090
Computed: true,
91-
Description: "Customize the back-to-origin HOST header. This parameter is only valid when OriginType=IP_DOMAIN. If OriginType=COS or AWS_S3, the back-to-origin HOST header will be consistent with the origin server domain name. If OriginType=ORIGIN_GROUP, the back-to-origin HOST header follows the configuration in the origin server group. If no configuration is made, the default is the acceleration domain name. If OriginType=VOD or SPACE, there is no need to configure this header. It will take effect according to the corresponding back-to-origin domain name.",
91+
Description: "Custom origin server HOST header. this parameter is valid only when OriginType=IP_DOMAIN.If the OriginType is another type of origin, this parameter does not need to be passed in, otherwise an error will be reported. If OriginType is COS or AWS_S3, the HOST header for origin-pull will remain consistent with the origin server domain name. If OriginType is ORIGIN_GROUP, the HOST header follows the ORIGIN site GROUP configuration. if not configured, it defaults to the acceleration domain name. If OriginType is VOD or SPACE, no configuration is required for this header, and the domain name takes effect based on the corresponding origin.",
9292
},
9393
"vod_origin_scope": {
9494
Type: schema.TypeString,
@@ -174,8 +174,10 @@ func resourceTencentCloudTeoAccelerationDomainCreate(d *schema.ResourceData, met
174174

175175
if originInfoMap, ok := helper.InterfacesHeadMap(d, "origin_info"); ok {
176176
originInfo := teo.OriginInfo{}
177+
var originType string
177178
if v, ok := originInfoMap["origin_type"]; ok {
178179
originInfo.OriginType = helper.String(v.(string))
180+
originType = v.(string)
179181
}
180182

181183
if v, ok := originInfoMap["origin"]; ok {
@@ -207,7 +209,11 @@ func resourceTencentCloudTeoAccelerationDomainCreate(d *schema.ResourceData, met
207209
}
208210

209211
if v, ok := originInfoMap["host_header"].(string); ok && v != "" {
210-
originInfo.HostHeader = helper.String(v)
212+
if originType == "IP_DOMAIN" {
213+
originInfo.HostHeader = helper.String(v)
214+
} else {
215+
return fmt.Errorf("Only `origin_type` is `IP_DOMAIN` can set `host_header`.")
216+
}
211217
}
212218

213219
if v, ok := originInfoMap["vod_origin_scope"].(string); ok && v != "" {
@@ -458,8 +464,10 @@ func resourceTencentCloudTeoAccelerationDomainUpdate(d *schema.ResourceData, met
458464
request.DomainName = helper.String(domainName)
459465
if originInfoMap, ok := helper.InterfacesHeadMap(d, "origin_info"); ok {
460466
originInfo := teo.OriginInfo{}
467+
var originType string
461468
if v, ok := originInfoMap["origin_type"]; ok {
462469
originInfo.OriginType = helper.String(v.(string))
470+
originType = v.(string)
463471
}
464472

465473
if v, ok := originInfoMap["origin"]; ok {
@@ -491,7 +499,9 @@ func resourceTencentCloudTeoAccelerationDomainUpdate(d *schema.ResourceData, met
491499
}
492500

493501
if v, ok := originInfoMap["host_header"].(string); ok && v != "" {
494-
originInfo.HostHeader = helper.String(v)
502+
if originType == "IP_DOMAIN" {
503+
originInfo.HostHeader = helper.String(v)
504+
}
495505
}
496506

497507
if v, ok := originInfoMap["vod_origin_scope"].(string); ok && v != "" {

tencentcloud/services/teo/resource_tc_teo_acceleration_domain.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ Provides a resource to create a TEO acceleration domain
22

33
~> **NOTE:** Before modifying resource content, you need to ensure that the `status` is `online`.
44

5+
~> **NOTE:** Only `origin_type` is `IP_DOMAIN` can set `host_header`.
6+
57
Example Usage
68

79
```hcl

website/docs/r/teo_acceleration_domain.html.markdown

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Provides a resource to create a TEO acceleration domain
1313

1414
~> **NOTE:** Before modifying resource content, you need to ensure that the `status` is `online`.
1515

16+
~> **NOTE:** Only `origin_type` is `IP_DOMAIN` can set `host_header`.
17+
1618
## Example Usage
1719

1820
```hcl
@@ -48,12 +50,12 @@ The following arguments are supported:
4850

4951
The `origin_info` object supports the following:
5052

51-
* `origin_type` - (Required, String) The origin type. Values: `IP_DOMAIN`: IPv4/IPv6 address or domain name; `COS`: COS bucket address; `ORIGIN_GROUP`: Origin group; `AWS_S3`: AWS S3 bucket address; `SPACE`: EdgeOne Shield Space.
52-
* `origin` - (Required, String) The origin address. Enter the origin group ID if `OriginType=ORIGIN_GROUP`.
53-
* `backup_origin` - (Optional, String) ID of the secondary origin group (valid when `OriginType=ORIGIN_GROUP`). If it is not specified, it indicates that secondary origins are not used.
54-
* `host_header` - (Optional, String) Customize the back-to-origin HOST header. This parameter is only valid when OriginType=IP_DOMAIN. If OriginType=COS or AWS_S3, the back-to-origin HOST header will be consistent with the origin server domain name. If OriginType=ORIGIN_GROUP, the back-to-origin HOST header follows the configuration in the origin server group. If no configuration is made, the default is the acceleration domain name. If OriginType=VOD or SPACE, there is no need to configure this header. It will take effect according to the corresponding back-to-origin domain name.
55-
* `private_access` - (Optional, String) Whether to authenticate access to the private object storage origin (valid when `OriginType=COS/AWS_S3`). Values: `on`: Enable private authentication; `off`: Disable private authentication. If this field is not specified, the default value `off` is used.
56-
* `private_parameters` - (Optional, List) The private authentication parameters. This field is valid when `PrivateAccess=on`.
53+
* `origin_type` - (Required, String) Origin server type, with values: IP_DOMAIN: IPv4, IPv6, or domain name type origin server; COS: Tencent Cloud COS origin server; AWS_S3: AWS S3 origin server; ORIGIN_GROUP: origin server group type origin server; VOD: Video on Demand; SPACE: origin server uninstallation. Currently only available to the allowlist; LB: load balancing. Currently only available to the allowlist.
54+
* `origin` - (Required, String) Origin server address, which varies according to the value of OriginType: When OriginType = IP_DOMAIN, fill in an IPv4 address, an IPv6 address, or a domain name; When OriginType = COS, fill in the access domain name of the COS bucket; When OriginType = AWS_S3, fill in the access domain name of the S3 bucket; When OriginType = ORIGIN_GROUP, fill in the origin server group ID; When OriginType = VOD, fill in the VOD application ID; When OriginType = LB, fill in the Cloud Load Balancer instance ID. This feature is currently only available to the allowlist; When OriginType = SPACE, fill in the origin server uninstallation space ID. This feature is currently only available to the allowlist.
55+
* `backup_origin` - (Optional, String) The ID of the secondary origin group. This parameter is valid only when OriginType is ORIGIN_GROUP. This field indicates the old version capability, which cannot be configured or modified on the control panel after being called. Please submit a ticket if required.
56+
* `host_header` - (Optional, String) Custom origin server HOST header. this parameter is valid only when OriginType=IP_DOMAIN.If the OriginType is another type of origin, this parameter does not need to be passed in, otherwise an error will be reported. If OriginType is COS or AWS_S3, the HOST header for origin-pull will remain consistent with the origin server domain name. If OriginType is ORIGIN_GROUP, the HOST header follows the ORIGIN site GROUP configuration. if not configured, it defaults to the acceleration domain name. If OriginType is VOD or SPACE, no configuration is required for this header, and the domain name takes effect based on the corresponding origin.
57+
* `private_access` - (Optional, String) Whether access to the private Cloud Object Storage origin server is allowed. This parameter is valid only when OriginType is COS or AWS_S3. Valid values: on: Enable private authentication; off: Disable private authentication. If it is not specified, the default value is off.
58+
* `private_parameters` - (Optional, List) Private authentication parameter. This parameter is valid only when `private_access` is on.
5759
* `vod_bucket_id` - (Optional, String) VOD bucket ID. This parameter is required when OriginType = VOD and VodOriginScope = bucket. Data source: the storage ID of the bucket in the Cloud VOD Professional Edition application.
5860
* `vod_origin_scope` - (Optional, String) The scope of cloud on-demand back-to-source. This parameter is effective when OriginType = VOD. The possible values are: all: all files in the cloud on-demand application corresponding to the current origin station. The default value is all; bucket: files in a specified bucket under the cloud on-demand application corresponding to the current origin station. The bucket is specified by the parameter VodBucketId.
5961

0 commit comments

Comments
 (0)