Skip to content

Commit 0381c02

Browse files
author
WeiMengXS
committed
fix: cr
1 parent 28b4791 commit 0381c02

File tree

1 file changed

+51
-56
lines changed

1 file changed

+51
-56
lines changed

tencentcloud/resource_tc_ssl_pay_certificate.go

Lines changed: 51 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -9,42 +9,44 @@ as `Review Cancel`, and then you can click `Request a refund` to refund the fee,
99
times, you need to use the wait_commit_flag field. Please refer to the field remarks for usage. Otherwise, it will be considered
1010
as a one-time submission and no further modifications will be provided.
1111
12-
Example Usage
12+
# Example Usage
1313
1414
```hcl
15-
resource "tencentcloud_ssl_pay_certificate" "example" {
16-
product_id = 33
17-
domain_num = 1
18-
alias = "ssl desc."
19-
project_id = 0
20-
information {
21-
csr_type = "online"
22-
certificate_domain = "www.example.com"
23-
organization_name = "Tencent"
24-
organization_division = "Qcloud"
25-
organization_address = "广东省深圳市南山区腾讯大厦1000号"
26-
organization_country = "CN"
27-
organization_city = "深圳市"
28-
organization_region = "广东省"
29-
postal_code = "0755"
30-
phone_area_code = "0755"
31-
phone_number = "86013388"
32-
verify_type = "DNS"
33-
admin_first_name = "test"
34-
admin_last_name = "test"
35-
admin_phone_num = "12345678901"
36-
admin_email = "test@tencent.com"
37-
admin_position = "developer"
38-
contact_first_name = "test"
39-
contact_last_name = "test"
40-
contact_email = "test@tencent.com"
41-
contact_number = "12345678901"
42-
contact_position = "developer"
43-
}
44-
}
15+
16+
resource "tencentcloud_ssl_pay_certificate" "example" {
17+
product_id = 33
18+
domain_num = 1
19+
alias = "ssl desc."
20+
project_id = 0
21+
information {
22+
csr_type = "online"
23+
certificate_domain = "www.example.com"
24+
organization_name = "Tencent"
25+
organization_division = "Qcloud"
26+
organization_address = "广东省深圳市南山区腾讯大厦1000号"
27+
organization_country = "CN"
28+
organization_city = "深圳市"
29+
organization_region = "广东省"
30+
postal_code = "0755"
31+
phone_area_code = "0755"
32+
phone_number = "86013388"
33+
verify_type = "DNS"
34+
admin_first_name = "test"
35+
admin_last_name = "test"
36+
admin_phone_num = "12345678901"
37+
admin_email = "test@tencent.com"
38+
admin_position = "developer"
39+
contact_first_name = "test"
40+
contact_last_name = "test"
41+
contact_email = "test@tencent.com"
42+
contact_number = "12345678901"
43+
contact_position = "developer"
44+
}
45+
}
46+
4547
```
4648
47-
Import
49+
# Import
4850
4951
payment SSL instance can be imported, e.g.
5052
@@ -620,34 +622,27 @@ func resourceTencentCloudSSLInstanceUpdate(d *schema.ResourceData, meta interfac
620622

621623
}
622624
if d.HasChange("information") {
623-
//查询证书是否提交
624625
describeRequest := ssl.NewDescribeCertificateDetailRequest()
625626
describeRequest.CertificateId = &ids[0]
626-
outErr := resource.Retry(readRetryTimeout, func() *resource.RetryError {
627-
describeResponse, inErr := sslService.DescribeCertificateDetail(ctx, describeRequest)
628-
if inErr != nil {
629-
return retryError(inErr)
630-
}
631-
if describeResponse == nil || describeResponse.Response == nil {
632-
err := fmt.Errorf("TencentCloud SDK %s return empty response", describeRequest.GetAction())
633-
return retryError(err)
634-
}
635-
if describeResponse.Response.Status == nil {
636-
err := fmt.Errorf("api[%s] certificate status is nil", describeRequest.GetAction())
637-
return resource.NonRetryableError(err)
638-
}
639627

640-
if *describeResponse.Response.Status != SSL_STATUS_TO_BE_COMMIT {
641-
err := fmt.Errorf("the certificate cannot be modified, status is %d", *describeResponse.Response.Status)
642-
return resource.RetryableError(err)
643-
}
644-
return nil
645-
})
646-
if outErr != nil {
647-
return outErr
628+
describeResponse, err := sslService.DescribeCertificateDetail(ctx, describeRequest)
629+
if err != nil {
630+
return err
631+
}
632+
if describeResponse == nil || describeResponse.Response == nil {
633+
err := fmt.Errorf("TencentCloud SDK %s return empty response", describeRequest.GetAction())
634+
return err
635+
}
636+
if describeResponse.Response.Status == nil {
637+
err := fmt.Errorf("api[%s] certificate status is nil", describeRequest.GetAction())
638+
return err
648639
}
649-
//证书为待提交状态
650-
//修改信息
640+
641+
if *describeResponse.Response.Status != SSL_STATUS_TO_BE_COMMIT {
642+
err := fmt.Errorf("the certificate cannot be modified, status is %d", *describeResponse.Response.Status)
643+
return err
644+
}
645+
651646
infoRequest := getSubmitInfoRequest(d)
652647
infoRequest.CertificateId = helper.String(ids[0])
653648
if err := resource.Retry(writeRetryTimeout, func() *resource.RetryError {

0 commit comments

Comments
 (0)