@@ -477,6 +477,13 @@ func ResourceTencentCloudCosBucket() *schema.Resource {
477477 Optional : true ,
478478 Description : "An absolute path to the document to return in case of a 4XX error." ,
479479 },
480+ "redirect_all_requests_to" : {
481+ Type : schema .TypeString ,
482+ Optional : true ,
483+ Computed : true ,
484+ ValidateFunc : tccommon .ValidateAllowedStringValue ([]string {"http" , "https" }),
485+ Description : "Redirects all request configurations. Valid values: http, https. Default is `http`." ,
486+ },
480487 "endpoint" : {
481488 Type : schema .TypeString ,
482489 Computed : true ,
@@ -1406,19 +1413,28 @@ func resourceTencentCloudCosBucketWebsiteUpdate(ctx context.Context, meta interf
14061413 log .Printf ("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n " ,
14071414 logId , "delete bucket website" , request .String (), response .String ())
14081415 } else {
1416+ if cdcId != "" {
1417+ return fmt .Errorf ("cdc cos not support set website.\n " )
1418+ }
1419+
14091420 var w map [string ]interface {}
14101421 if website [0 ] != nil {
14111422 w = website [0 ].(map [string ]interface {})
14121423 } else {
14131424 w = make (map [string ]interface {})
14141425 }
14151426 var indexDocument , errorDocument string
1427+ var redirectAllRequestsTo = "http"
14161428 if v , ok := w ["index_document" ]; ok {
14171429 indexDocument = v .(string )
14181430 }
14191431 if v , ok := w ["error_document" ]; ok {
14201432 errorDocument = v .(string )
14211433 }
1434+ if v , ok := w ["redirect_all_requests_to" ]; ok && v != "" {
1435+ redirectAllRequestsTo = v .(string )
1436+ }
1437+ endPointUrl := fmt .Sprintf ("%s.cos-website.%s.myqcloud.com" , d .Id (), meta .(tccommon.ProviderMeta ).GetAPIV3Conn ().Region )
14221438 request := s3.PutBucketWebsiteInput {
14231439 Bucket : aws .String (bucket ),
14241440 WebsiteConfiguration : & s3.WebsiteConfiguration {
@@ -1428,6 +1444,10 @@ func resourceTencentCloudCosBucketWebsiteUpdate(ctx context.Context, meta interf
14281444 ErrorDocument : & s3.ErrorDocument {
14291445 Key : aws .String (errorDocument ),
14301446 },
1447+ RedirectAllRequestsTo : & s3.RedirectAllRequestsTo {
1448+ HostName : aws .String (endPointUrl ),
1449+ Protocol : aws .String (redirectAllRequestsTo ),
1450+ },
14311451 },
14321452 }
14331453 response , err := meta .(tccommon.ProviderMeta ).GetAPIV3Conn ().UseCosClientNew (cdcId ).PutBucketWebsite (& request )
0 commit comments