diff --git a/.changelog/3418.txt b/.changelog/3418.txt new file mode 100644 index 0000000000..41bb7141c9 --- /dev/null +++ b/.changelog/3418.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/tencentcloud_teo_acceleration_domain: add new params +``` diff --git a/tencentcloud/services/teo/resource_tc_teo_acceleration_domain.go b/tencentcloud/services/teo/resource_tc_teo_acceleration_domain.go index 7a241d6c95..12835d0a46 100644 --- a/tencentcloud/services/teo/resource_tc_teo_acceleration_domain.go +++ b/tencentcloud/services/teo/resource_tc_teo_acceleration_domain.go @@ -1,4 +1,3 @@ -// Code generated by iacg; DO NOT EDIT. package teo import ( @@ -75,7 +74,7 @@ func ResourceTencentCloudTeoAccelerationDomain() *schema.Resource { "name": { Type: schema.TypeString, Required: true, - Description: "The parameter name. Valid values: `AccessKeyId`: Access Key ID; `SecretAccessKey`: Secret Access Key.", + Description: "The parameter name. Valid values: `AccessKeyId`: Access Key ID; `SecretAccessKey`: Secret Access Key; `SignatureVersion`: authentication version, v2 or v4; `Region`: bucket region.", }, "value": { Type: schema.TypeString, @@ -85,20 +84,32 @@ func ResourceTencentCloudTeoAccelerationDomain() *schema.Resource { }, }, }, + "host_header": { + Type: schema.TypeString, + Optional: true, + Computed: true, + 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.", + }, + "vod_origin_scope": { + Type: schema.TypeString, + Optional: true, + Description: "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.", + }, + "vod_bucket_id": { + Type: schema.TypeString, + Optional: true, + Description: "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.", + }, }, }, }, "status": { - Type: schema.TypeString, - Optional: true, - Description: "Accelerated domain name status, the values are: `online`: enabled; `offline`: disabled.", - }, - - "cname": { - Type: schema.TypeString, - Computed: true, - Description: "CNAME address.", + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: tccommon.ValidateAllowedStringValue([]string{"online", "offline"}), + Description: "Accelerated domain name status, the values are: `online`: enabled; `offline`: disabled. Default is `online`.", }, "origin_protocol": { @@ -128,6 +139,12 @@ func ResourceTencentCloudTeoAccelerationDomain() *schema.Resource { Computed: true, Description: "IPv6 status, the value is: `follow`: follow the site IPv6 configuration; `on`: on; `off`: off. If not filled in, the default is: `follow`.", }, + + "cname": { + Type: schema.TypeString, + Computed: true, + Description: "CNAME address.", + }, }, } } @@ -136,32 +153,23 @@ func resourceTencentCloudTeoAccelerationDomainCreate(d *schema.ResourceData, met defer tccommon.LogElapsed("resource.tencentcloud_teo_acceleration_domain.create")() defer tccommon.InconsistentCheck(d, meta)() - logId := tccommon.GetLogId(tccommon.ContextNil) - - ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) - var ( + logId = tccommon.GetLogId(tccommon.ContextNil) + ctx = tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + request = teo.NewCreateAccelerationDomainRequest() + response = teo.NewCreateAccelerationDomainResponse() zoneId string domainName string ) - var ( - request = teo.NewCreateAccelerationDomainRequest() - response = teo.NewCreateAccelerationDomainResponse() - ) - - if v, ok := d.GetOk("zone_id"); ok { - zoneId = v.(string) - } - if v, ok := d.GetOk("domain_name"); ok { - domainName = v.(string) - } if v, ok := d.GetOk("zone_id"); ok { request.ZoneId = helper.String(v.(string)) + zoneId = v.(string) } if v, ok := d.GetOk("domain_name"); ok { request.DomainName = helper.String(v.(string)) + domainName = v.(string) } if originInfoMap, ok := helper.InterfacesHeadMap(d, "origin_info"); ok { @@ -169,15 +177,19 @@ func resourceTencentCloudTeoAccelerationDomainCreate(d *schema.ResourceData, met if v, ok := originInfoMap["origin_type"]; ok { originInfo.OriginType = helper.String(v.(string)) } + if v, ok := originInfoMap["origin"]; ok { originInfo.Origin = helper.String(v.(string)) } + if v, ok := originInfoMap["backup_origin"]; ok { originInfo.BackupOrigin = helper.String(v.(string)) } + if v, ok := originInfoMap["private_access"]; ok { originInfo.PrivateAccess = helper.String(v.(string)) } + if v, ok := originInfoMap["private_parameters"]; ok { for _, item := range v.([]interface{}) { privateParametersMap := item.(map[string]interface{}) @@ -185,12 +197,27 @@ func resourceTencentCloudTeoAccelerationDomainCreate(d *schema.ResourceData, met if v, ok := privateParametersMap["name"]; ok { privateParameter.Name = helper.String(v.(string)) } + if v, ok := privateParametersMap["value"]; ok { privateParameter.Value = helper.String(v.(string)) } + originInfo.PrivateParameters = append(originInfo.PrivateParameters, &privateParameter) } } + + if v, ok := originInfoMap["host_header"].(string); ok && v != "" { + originInfo.HostHeader = helper.String(v) + } + + if v, ok := originInfoMap["vod_origin_scope"].(string); ok && v != "" { + originInfo.VodOriginScope = helper.String(v) + } + + if v, ok := originInfoMap["vod_bucket_id"].(string); ok && v != "" { + originInfo.VodBucketId = helper.String(v) + } + request.OriginInfo = &originInfo } @@ -198,11 +225,11 @@ func resourceTencentCloudTeoAccelerationDomainCreate(d *schema.ResourceData, met request.OriginProtocol = helper.String(v.(string)) } - if v, ok := d.GetOk("http_origin_port"); ok { + if v, ok := d.GetOkExists("http_origin_port"); ok { request.HttpOriginPort = helper.IntUint64(v.(int)) } - if v, ok := d.GetOk("https_origin_port"); ok { + if v, ok := d.GetOkExists("https_origin_port"); ok { request.HttpsOriginPort = helper.IntUint64(v.(int)) } @@ -217,22 +244,60 @@ func resourceTencentCloudTeoAccelerationDomainCreate(d *schema.ResourceData, met } else { log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) } + + if result == nil || result.Response == nil { + return resource.NonRetryableError(fmt.Errorf("Create teo acceleration domain failed, Response is nil.")) + } + response = result return nil }) + if err != nil { log.Printf("[CRITAL]%s create teo acceleration domain failed, reason:%+v", logId, err) return err } - _ = response - + // wait if err := resourceTencentCloudTeoAccelerationDomainCreatePostHandleResponse0(ctx, response); err != nil { return err } d.SetId(strings.Join([]string{zoneId, domainName}, tccommon.FILED_SP)) + // offline + if v, ok := d.GetOk("status"); ok { + if v.(string) == "offline" { + request := teo.NewModifyAccelerationDomainStatusesRequest() + request.ZoneId = helper.String(zoneId) + request.DomainNames = []*string{helper.String(domainName)} + if v, ok := d.GetOk("status"); ok { + request.Status = helper.String(v.(string)) + } + + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseTeoClient().ModifyAccelerationDomainStatusesWithContext(ctx, request) + if e != nil { + return tccommon.RetryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + + return nil + }) + + if err != nil { + log.Printf("[CRITAL]%s update teo acceleration domain status failed, reason:%+v", logId, err) + return err + } + + // wait + if err = resourceTencentCloudTeoAccelerationDomainUpdateOnExit(ctx); err != nil { + return err + } + } + } + return resourceTencentCloudTeoAccelerationDomainRead(d, meta) } @@ -240,21 +305,21 @@ func resourceTencentCloudTeoAccelerationDomainRead(d *schema.ResourceData, meta defer tccommon.LogElapsed("resource.tencentcloud_teo_acceleration_domain.read")() defer tccommon.InconsistentCheck(d, meta)() - logId := tccommon.GetLogId(tccommon.ContextNil) - - ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) - - service := TeoService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()} + var ( + logId = tccommon.GetLogId(tccommon.ContextNil) + ctx = tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + service = TeoService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()} + ) idSplit := strings.Split(d.Id(), tccommon.FILED_SP) if len(idSplit) != 2 { return fmt.Errorf("id is broken,%s", d.Id()) } + zoneId := idSplit[0] domainName := idSplit[1] _ = d.Set("zone_id", zoneId) - _ = d.Set("domain_name", domainName) respData, err := service.DescribeTeoAccelerationDomainById(ctx, zoneId, domainName) @@ -263,10 +328,11 @@ func resourceTencentCloudTeoAccelerationDomainRead(d *schema.ResourceData, meta } if respData == nil { - d.SetId("") log.Printf("[WARN]%s resource `teo_acceleration_domain` [%s] not found, please check if it has been deleted.\n", logId, d.Id()) + d.SetId("") return nil } + if respData.ZoneId != nil { _ = d.Set("zone_id", respData.ZoneId) } @@ -275,13 +341,8 @@ func resourceTencentCloudTeoAccelerationDomainRead(d *schema.ResourceData, meta _ = d.Set("domain_name", respData.DomainName) } - if respData.Cname != nil { - _ = d.Set("cname", respData.Cname) - } - - originDetailMap := map[string]interface{}{} - if respData.OriginDetail != nil { + originDetailMap := map[string]interface{}{} if respData.OriginDetail.OriginType != nil { originDetailMap["origin_type"] = respData.OriginDetail.OriginType } @@ -298,11 +359,10 @@ func resourceTencentCloudTeoAccelerationDomainRead(d *schema.ResourceData, meta originDetailMap["private_access"] = respData.OriginDetail.PrivateAccess } - privateParametersList := make([]map[string]interface{}, 0, len(respData.OriginDetail.PrivateParameters)) if respData.OriginDetail.PrivateParameters != nil { + privateParametersList := make([]map[string]interface{}, 0, len(respData.OriginDetail.PrivateParameters)) for _, privateParameters := range respData.OriginDetail.PrivateParameters { privateParametersMap := map[string]interface{}{} - if privateParameters.Name != nil { privateParametersMap["name"] = privateParameters.Name } @@ -316,9 +376,26 @@ func resourceTencentCloudTeoAccelerationDomainRead(d *schema.ResourceData, meta originDetailMap["private_parameters"] = privateParametersList } + + if respData.OriginDetail.HostHeader != nil { + originDetailMap["host_header"] = respData.OriginDetail.HostHeader + } + + if respData.OriginDetail.VodOriginScope != nil { + originDetailMap["vod_origin_scope"] = respData.OriginDetail.VodOriginScope + } + + if respData.OriginDetail.VodBucketId != nil { + originDetailMap["vod_bucket_id"] = respData.OriginDetail.VodBucketId + } + _ = d.Set("origin_info", []interface{}{originDetailMap}) } + if respData.DomainStatus != nil { + _ = d.Set("status", respData.DomainStatus) + } + if respData.OriginProtocol != nil { _ = d.Set("origin_protocol", respData.OriginProtocol) } @@ -335,6 +412,10 @@ func resourceTencentCloudTeoAccelerationDomainRead(d *schema.ResourceData, meta _ = d.Set("ipv6_status", respData.IPv6Status) } + if respData.Cname != nil { + _ = d.Set("cname", respData.Cname) + } + return nil } @@ -342,9 +423,10 @@ func resourceTencentCloudTeoAccelerationDomainUpdate(d *schema.ResourceData, met defer tccommon.LogElapsed("resource.tencentcloud_teo_acceleration_domain.update")() defer tccommon.InconsistentCheck(d, meta)() - logId := tccommon.GetLogId(tccommon.ContextNil) - - ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + var ( + logId = tccommon.GetLogId(tccommon.ContextNil) + ctx = tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + ) immutableArgs := []string{"https_origin_port"} for _, v := range immutableArgs { @@ -352,10 +434,12 @@ func resourceTencentCloudTeoAccelerationDomainUpdate(d *schema.ResourceData, met return fmt.Errorf("argument `%s` cannot be changed", v) } } + idSplit := strings.Split(d.Id(), tccommon.FILED_SP) if len(idSplit) != 2 { return fmt.Errorf("id is broken,%s", d.Id()) } + zoneId := idSplit[0] domainName := idSplit[1] @@ -370,25 +454,26 @@ func resourceTencentCloudTeoAccelerationDomainUpdate(d *schema.ResourceData, met if needChange { request := teo.NewModifyAccelerationDomainRequest() - request.ZoneId = helper.String(zoneId) - request.DomainName = helper.String(domainName) - if originInfoMap, ok := helper.InterfacesHeadMap(d, "origin_info"); ok { originInfo := teo.OriginInfo{} if v, ok := originInfoMap["origin_type"]; ok { originInfo.OriginType = helper.String(v.(string)) } + if v, ok := originInfoMap["origin"]; ok { originInfo.Origin = helper.String(v.(string)) } + if v, ok := originInfoMap["backup_origin"]; ok { originInfo.BackupOrigin = helper.String(v.(string)) } + if v, ok := originInfoMap["private_access"]; ok { originInfo.PrivateAccess = helper.String(v.(string)) } + if v, ok := originInfoMap["private_parameters"]; ok { for _, item := range v.([]interface{}) { privateParametersMap := item.(map[string]interface{}) @@ -396,12 +481,27 @@ func resourceTencentCloudTeoAccelerationDomainUpdate(d *schema.ResourceData, met if v, ok := privateParametersMap["name"]; ok { privateParameter.Name = helper.String(v.(string)) } + if v, ok := privateParametersMap["value"]; ok { privateParameter.Value = helper.String(v.(string)) } + originInfo.PrivateParameters = append(originInfo.PrivateParameters, &privateParameter) } } + + if v, ok := originInfoMap["host_header"].(string); ok && v != "" { + originInfo.HostHeader = helper.String(v) + } + + if v, ok := originInfoMap["vod_origin_scope"].(string); ok && v != "" { + originInfo.VodOriginScope = helper.String(v) + } + + if v, ok := originInfoMap["vod_bucket_id"].(string); ok && v != "" { + originInfo.VodBucketId = helper.String(v) + } + request.OriginInfo = &originInfo } @@ -428,51 +528,49 @@ func resourceTencentCloudTeoAccelerationDomainUpdate(d *schema.ResourceData, met } else { log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) } + return nil }) + if err != nil { log.Printf("[CRITAL]%s update teo acceleration domain failed, reason:%+v", logId, err) return err } - } - needChange1 := false - mutableArgs1 := []string{"status"} - for _, v := range mutableArgs1 { - if d.HasChange(v) { - needChange1 = true - break + // wait + if err := resourceTencentCloudTeoAccelerationDomainUpdateOnExit(ctx); err != nil { + return err } } - if needChange1 { - request1 := teo.NewModifyAccelerationDomainStatusesRequest() - - request1.ZoneId = helper.String(zoneId) - - request1.DomainNames = []*string{helper.String(domainName)} - + if d.HasChange("status") { + request := teo.NewModifyAccelerationDomainStatusesRequest() + request.ZoneId = helper.String(zoneId) + request.DomainNames = []*string{helper.String(domainName)} if v, ok := d.GetOk("status"); ok { - request1.Status = helper.String(v.(string)) + request.Status = helper.String(v.(string)) } err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { - result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseTeoClient().ModifyAccelerationDomainStatusesWithContext(ctx, request1) + result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseTeoClient().ModifyAccelerationDomainStatusesWithContext(ctx, request) if e != nil { return tccommon.RetryError(e) } else { - log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request1.GetAction(), request1.ToJsonString(), result.ToJsonString()) + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) } + return nil }) + if err != nil { - log.Printf("[CRITAL]%s update teo acceleration domain failed, reason:%+v", logId, err) + log.Printf("[CRITAL]%s update teo acceleration domain status failed, reason:%+v", logId, err) return err } - } - if err := resourceTencentCloudTeoAccelerationDomainUpdateOnExit(ctx); err != nil { - return err + // wait + if err := resourceTencentCloudTeoAccelerationDomainUpdateOnExit(ctx); err != nil { + return err + } } return resourceTencentCloudTeoAccelerationDomainRead(d, meta) @@ -482,72 +580,78 @@ func resourceTencentCloudTeoAccelerationDomainDelete(d *schema.ResourceData, met defer tccommon.LogElapsed("resource.tencentcloud_teo_acceleration_domain.delete")() defer tccommon.InconsistentCheck(d, meta)() - logId := tccommon.GetLogId(tccommon.ContextNil) - ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + var ( + logId = tccommon.GetLogId(tccommon.ContextNil) + ctx = tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + request = teo.NewModifyAccelerationDomainStatusesRequest() + response = teo.NewModifyAccelerationDomainStatusesResponse() + ) idSplit := strings.Split(d.Id(), tccommon.FILED_SP) if len(idSplit) != 2 { return fmt.Errorf("id is broken,%s", d.Id()) } + zoneId := idSplit[0] domainName := idSplit[1] - var ( - request = teo.NewModifyAccelerationDomainStatusesRequest() - response = teo.NewModifyAccelerationDomainStatusesResponse() - ) + // check offline first + if v, ok := d.GetOk("status"); ok { + if v.(string) == "online" { + request.ZoneId = helper.String(zoneId) + request.DomainNames = []*string{helper.String(domainName)} + request.Status = helper.String("offline") + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseTeoClient().ModifyAccelerationDomainStatusesWithContext(ctx, request) + if e != nil { + return tccommon.RetryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } - request.ZoneId = helper.String(zoneId) + if result == nil || result.Response == nil { + return resource.NonRetryableError(fmt.Errorf("Modify teo acceleration domain status failed, Response is nil.")) + } - request.DomainNames = []*string{helper.String(domainName)} + response = result + return nil + }) - status := "offline" - request.Status = &status + if err != nil { + log.Printf("[CRITAL]%s modify teo acceleration domain status failed, reason:%+v", logId, err) + return err + } - err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { - result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseTeoClient().ModifyAccelerationDomainStatusesWithContext(ctx, request) - if e != nil { - return tccommon.RetryError(e) - } else { - log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + // wait + if err := resourceTencentCloudTeoAccelerationDomainDeletePostHandleResponse0(ctx, response); err != nil { + return err + } } - response = result - return nil - }) - if err != nil { - log.Printf("[CRITAL]%s delete teo acceleration domain failed, reason:%+v", logId, err) - return err - } - - _ = response - if err := resourceTencentCloudTeoAccelerationDomainDeletePostHandleResponse0(ctx, response); err != nil { - return err } - var ( - request1 = teo.NewDeleteAccelerationDomainsRequest() - response1 = teo.NewDeleteAccelerationDomainsResponse() - ) - - request1.ZoneId = helper.String(zoneId) - - request1.DomainNames = []*string{helper.String(domainName)} - - err = resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { - result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseTeoClient().DeleteAccelerationDomainsWithContext(ctx, request1) + // delete + delRequest := teo.NewDeleteAccelerationDomainsRequest() + delRequest.ZoneId = helper.String(zoneId) + delRequest.DomainNames = []*string{helper.String(domainName)} + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseTeoClient().DeleteAccelerationDomainsWithContext(ctx, delRequest) if e != nil { return tccommon.RetryError(e) } else { - log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request1.GetAction(), request1.ToJsonString(), result.ToJsonString()) + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, delRequest.GetAction(), delRequest.ToJsonString(), result.ToJsonString()) + } + + if result == nil || result.Response == nil { + return resource.NonRetryableError(fmt.Errorf("Delete teo acceleration domain failed, Response is nil.")) } - response1 = result + return nil }) + if err != nil { log.Printf("[CRITAL]%s delete teo acceleration domain failed, reason:%+v", logId, err) return err } - _ = response1 return nil } diff --git a/tencentcloud/services/teo/resource_tc_teo_acceleration_domain.md b/tencentcloud/services/teo/resource_tc_teo_acceleration_domain.md index 3f7ad9472a..a9632f96fc 100644 --- a/tencentcloud/services/teo/resource_tc_teo_acceleration_domain.md +++ b/tencentcloud/services/teo/resource_tc_teo_acceleration_domain.md @@ -1,23 +1,31 @@ -Provides a resource to create a teo acceleration_domain +Provides a resource to create a TEO acceleration domain + +~> **NOTE:** Before modifying resource content, you need to ensure that the `status` is `online`. Example Usage ```hcl -resource "tencentcloud_teo_acceleration_domain" "acceleration_domain" { - zone_id = "zone-2o0i41pv2h8c" - domain_name = "aaa.makn.cn" - - origin_info { - origin = "150.109.8.1" - origin_type = "IP_DOMAIN" - } +resource "tencentcloud_teo_acceleration_domain" "example" { + zone_id = "zone-39quuimqg8r6" + domain_name = "www.demo.com" + + origin_info { + origin = "150.109.8.1" + origin_type = "IP_DOMAIN" + } + + status = "online" + origin_protocol = "FOLLOW" + http_origin_port = 80 + https_origin_port = 443 + ipv6_status = "follow" } ``` Import -teo acceleration_domain can be imported using the id, e.g. +TEO acceleration domain can be imported using the id, e.g. ``` -terraform import tencentcloud_teo_acceleration_domain.acceleration_domain zone_id#domain_name -``` \ No newline at end of file +terraform import tencentcloud_teo_acceleration_domain.example zone-39quuimqg8r6#www.demo.com +``` diff --git a/website/docs/r/teo_acceleration_domain.html.markdown b/website/docs/r/teo_acceleration_domain.html.markdown index c0071b96ae..0523e405a9 100644 --- a/website/docs/r/teo_acceleration_domain.html.markdown +++ b/website/docs/r/teo_acceleration_domain.html.markdown @@ -4,24 +4,32 @@ layout: "tencentcloud" page_title: "TencentCloud: tencentcloud_teo_acceleration_domain" sidebar_current: "docs-tencentcloud-resource-teo_acceleration_domain" description: |- - Provides a resource to create a teo acceleration_domain + Provides a resource to create a TEO acceleration domain --- # tencentcloud_teo_acceleration_domain -Provides a resource to create a teo acceleration_domain +Provides a resource to create a TEO acceleration domain + +~> **NOTE:** Before modifying resource content, you need to ensure that the `status` is `online`. ## Example Usage ```hcl -resource "tencentcloud_teo_acceleration_domain" "acceleration_domain" { - zone_id = "zone-2o0i41pv2h8c" - domain_name = "aaa.makn.cn" +resource "tencentcloud_teo_acceleration_domain" "example" { + zone_id = "zone-39quuimqg8r6" + domain_name = "www.demo.com" origin_info { origin = "150.109.8.1" origin_type = "IP_DOMAIN" } + + status = "online" + origin_protocol = "FOLLOW" + http_origin_port = 80 + https_origin_port = 443 + ipv6_status = "follow" } ``` @@ -36,19 +44,22 @@ The following arguments are supported: * `https_origin_port` - (Optional, Int) HTTPS back-to-origin port. The value range is 1-65535. It takes effect when OriginProtocol=FOLLOW/HTTPS. If it is not filled in, the default value is 443. * `ipv6_status` - (Optional, String) IPv6 status, the value is: `follow`: follow the site IPv6 configuration; `on`: on; `off`: off. If not filled in, the default is: `follow`. * `origin_protocol` - (Optional, String) Origin return protocol, possible values are: `FOLLOW`: protocol follow; `HTTP`: HTTP protocol back to source; `HTTPS`: HTTPS protocol back to source. If not filled in, the default is: `FOLLOW`. -* `status` - (Optional, String) Accelerated domain name status, the values are: `online`: enabled; `offline`: disabled. +* `status` - (Optional, String) Accelerated domain name status, the values are: `online`: enabled; `offline`: disabled. Default is `online`. The `origin_info` object supports the following: * `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. * `origin` - (Required, String) The origin address. Enter the origin group ID if `OriginType=ORIGIN_GROUP`. * `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. +* `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. * `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. * `private_parameters` - (Optional, List) The private authentication parameters. This field is valid when `PrivateAccess=on`. +* `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. +* `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. The `private_parameters` object of `origin_info` supports the following: -* `name` - (Required, String) The parameter name. Valid values: `AccessKeyId`: Access Key ID; `SecretAccessKey`: Secret Access Key. +* `name` - (Required, String) The parameter name. Valid values: `AccessKeyId`: Access Key ID; `SecretAccessKey`: Secret Access Key; `SignatureVersion`: authentication version, v2 or v4; `Region`: bucket region. * `value` - (Required, String) The parameter value. ## Attributes Reference @@ -61,9 +72,9 @@ In addition to all arguments above, the following attributes are exported: ## Import -teo acceleration_domain can be imported using the id, e.g. +TEO acceleration domain can be imported using the id, e.g. ``` -terraform import tencentcloud_teo_acceleration_domain.acceleration_domain zone_id#domain_name +terraform import tencentcloud_teo_acceleration_domain.example zone-39quuimqg8r6#www.demo.com ```