diff --git a/.changelog/3701.txt b/.changelog/3701.txt new file mode 100644 index 0000000000..c84218df55 --- /dev/null +++ b/.changelog/3701.txt @@ -0,0 +1,7 @@ +```release-note:enhancement +resource/tencentcloud_teo_bind_security_template: support timeout. +``` + +```release-note:enhancement +resource/tencentcloud_teo_certificate_config: support timeout. +``` \ No newline at end of file diff --git a/tencentcloud/services/teo/resource_tc_teo_bind_security_template.go b/tencentcloud/services/teo/resource_tc_teo_bind_security_template.go index 9d1407ee77..2173b4eaef 100644 --- a/tencentcloud/services/teo/resource_tc_teo_bind_security_template.go +++ b/tencentcloud/services/teo/resource_tc_teo_bind_security_template.go @@ -22,6 +22,9 @@ func ResourceTencentCloudTeoBindSecurityTemplate() *schema.Resource { Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(3 * time.Minute), + }, Schema: map[string]*schema.Schema{ "zone_id": { Type: schema.TypeString, @@ -127,7 +130,7 @@ func resourceTencentCloudTeoBindSecurityTemplateCreate(d *schema.ResourceData, m Pending: []string{}, Refresh: resourceTeoBindSecurityTemplateCreateStateRefreshFunc_0_0(ctx, zoneId, templateId, entity), Target: []string{"online"}, - Timeout: 180 * time.Second, + Timeout: d.Timeout(schema.TimeoutCreate), }).WaitForStateContext(ctx); err != nil { return err } diff --git a/tencentcloud/services/teo/resource_tc_teo_certificate_config.go b/tencentcloud/services/teo/resource_tc_teo_certificate_config.go index 9f3a4a65f5..96ec3efde5 100644 --- a/tencentcloud/services/teo/resource_tc_teo_certificate_config.go +++ b/tencentcloud/services/teo/resource_tc_teo_certificate_config.go @@ -6,6 +6,7 @@ import ( "fmt" "log" "strings" + "time" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -19,7 +20,11 @@ func ResourceTencentCloudTeoCertificateConfig() *schema.Resource { Update: resourceTencentCloudTeoCertificateConfigUpdate, Delete: resourceTencentCloudTeoCertificateConfigDelete, Importer: &schema.ResourceImporter{ - State: schema.ImportStatePassthrough, + StateContext: schema.ImportStatePassthroughContext, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(20 * time.Minute), + Update: schema.DefaultTimeout(20 * time.Minute), }, Schema: map[string]*schema.Schema{ "zone_id": { diff --git a/tencentcloud/services/teo/service_tencentcloud_teo.go b/tencentcloud/services/teo/service_tencentcloud_teo.go index 99d48d91af..b1e1552907 100644 --- a/tencentcloud/services/teo/service_tencentcloud_teo.go +++ b/tencentcloud/services/teo/service_tencentcloud_teo.go @@ -10,6 +10,7 @@ import ( tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" teo "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220901" teov20220901 "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220901" @@ -921,7 +922,15 @@ func (me *TeoService) ModifyZoneStatus(ctx context.Context, zoneId string, pause } func (me *TeoService) CheckAccelerationDomainStatus(ctx context.Context, zoneId, domainName, operate string) error { - err := resource.Retry(6*tccommon.ReadRetryTimeout, func() *resource.RetryError { + d := tccommon.ResourceDataFromContext(ctx) + var timeout time.Duration + + if d.IsNewResource() { + timeout = d.Timeout(schema.TimeoutCreate) + } else { + timeout = d.Timeout(schema.TimeoutUpdate) + } + err := resource.Retry(timeout, func() *resource.RetryError { instance, errRet := me.DescribeTeoAccelerationDomainById(ctx, zoneId, domainName) if errRet != nil { return tccommon.RetryError(errRet, tccommon.InternalError) diff --git a/website/docs/r/teo_bind_security_template.html.markdown b/website/docs/r/teo_bind_security_template.html.markdown index ebd85d15b3..eb21145109 100644 --- a/website/docs/r/teo_bind_security_template.html.markdown +++ b/website/docs/r/teo_bind_security_template.html.markdown @@ -46,6 +46,11 @@ In addition to all arguments above, the following attributes are exported: * `id` - ID of the resource. * `status` - Instance configuration delivery status, the possible values are: `online`: the configuration has taken effect; `fail`: the configuration failed; `process`: the configuration is being delivered. +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://developer.hashicorp.com/terraform/language/resources/syntax#operation-timeouts) for certain actions: + +* `create` - (Defaults to `3m`) Used when creating the resource. ## Import diff --git a/website/docs/r/teo_certificate_config.html.markdown b/website/docs/r/teo_certificate_config.html.markdown index 35e199e99b..e1600044fe 100644 --- a/website/docs/r/teo_certificate_config.html.markdown +++ b/website/docs/r/teo_certificate_config.html.markdown @@ -76,6 +76,12 @@ In addition to all arguments above, the following attributes are exported: * `id` - ID of the resource. +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://developer.hashicorp.com/terraform/language/resources/syntax#operation-timeouts) for certain actions: + +* `create` - (Defaults to `20m`) Used when creating the resource. +* `update` - (Defaults to `20m`) Used when updating the resource. ## Import