Skip to content

Commit ffb92db

Browse files
committed
add
1 parent 5db3b73 commit ffb92db

14 files changed

+2266
-1400
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ require (
4646
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.984
4747
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.544
4848
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.970
49-
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1014
49+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1015
5050
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.1014
5151
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cwp v1.0.762
5252
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cynosdb v1.0.692
@@ -79,7 +79,7 @@ require (
7979
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ses v1.0.748
8080
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sms v1.0.486
8181
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sqlserver v1.0.816
82-
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssl v1.0.822
82+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssl v1.0.1015
8383
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssm v1.0.691
8484
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sts v1.0.524
8585
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tag v1.0.860

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1012/go.mod
927927
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1013/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
928928
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1014 h1:SlXGy7ymuiMTmkXGT3YYUEcF0EJDGxirwQWy+u0QiHI=
929929
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1014/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
930+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1015 h1:O60uxxfWztVPVUBQjlJaop2Dw/J7CXGK9fSErMdWw+Y=
931+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1015/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
930932
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter v1.0.993 h1:WlPgXldQCxt7qi5Xrc6j6zTrsXWzN5BcOGs7Irq7fwQ=
931933
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter v1.0.993/go.mod h1:Z9U8zNtyuyKhjS0698wqsrG/kLx1TQ5CEixXBwVe7xY=
932934
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/csip v1.0.860 h1:F3esKBIT3HW9+7Gt8cVgf8X06VdGIczpgLBUECzSEzU=
@@ -1003,6 +1005,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sqlserver v1.0.816 h1:E
10031005
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sqlserver v1.0.816/go.mod h1:J9Ce9D/ewpqzUsBAwINc+59qpDqYT9egjwyUsMHpDwA=
10041006
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssl v1.0.822 h1:Hbtl5PDb3LnYGkQ26PUXYdqRMVw4YemkvFKVklFSkfU=
10051007
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssl v1.0.822/go.mod h1:ld+y2FwgxEjaY5MJrp4rgEGxM8FRfxxfPZalVD3eOEU=
1008+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssl v1.0.1015 h1:4fTbXtkXwleuDu/xYVELGpkuBLPgW+raED6y7Ni63sA=
1009+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssl v1.0.1015/go.mod h1:0ZWI4Rd0p6LnXEvEaj/DbUza8B2s74AllJr1WXrsLtY=
10061010
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssm v1.0.691 h1:UE55TqueOP889MDcJ+cBW+MBjtzvWUw5fuOBWGCBIjs=
10071011
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssm v1.0.691/go.mod h1:IRaYO5mSpBMPX8ydImTcL3jyuEkALEu/55Myb0a+GMs=
10081012
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sts v1.0.524 h1:Hda8mBEoQVwkRAaZqztUAWn/n4HCYHZYEwzFBwYKaaM=

tencentcloud/provider.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2113,6 +2113,7 @@ func Provider() *schema.Provider {
21132113
"tencentcloud_ssl_deploy_certificate_record_retry_operation": ssl.ResourceTencentCloudSslDeployCertificateRecordRetryOperation(),
21142114
"tencentcloud_ssl_deploy_certificate_record_rollback_operation": ssl.ResourceTencentCloudSslDeployCertificateRecordRollbackOperation(),
21152115
"tencentcloud_ssl_download_certificate_operation": ssl.ResourceTencentCloudSslDownloadCertificateOperation(),
2116+
"tencentcloud_ssl_check_certificate_domain_verification_operation": ssl.ResourceTencentCloudSslCheckCertificateDomainVerificationOperation(),
21162117
"tencentcloud_cwp_license_order": cwp.ResourceTencentCloudCwpLicenseOrder(),
21172118
"tencentcloud_cwp_license_bind_attachment": cwp.ResourceTencentCloudCwpLicenseBindAttachment(),
21182119
"tencentcloud_ssl_replace_certificate_operation": ssl.ResourceTencentCloudSslReplaceCertificateOperation(),

tencentcloud/provider.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,6 +1069,7 @@ SSL Certificates(ssl)
10691069
tencentcloud_ssl_deploy_certificate_record_retry_operation
10701070
tencentcloud_ssl_deploy_certificate_record_rollback_operation
10711071
tencentcloud_ssl_download_certificate_operation
1072+
tencentcloud_ssl_check_certificate_domain_verification_operation
10721073

10731074
Secrets Manager(SSM)
10741075
Data Source
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
package ssl
2+
3+
import (
4+
"fmt"
5+
"log"
6+
7+
tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common"
8+
9+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
10+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
11+
ssl "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssl/v20191205"
12+
13+
"github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper"
14+
)
15+
16+
func ResourceTencentCloudSslCheckCertificateDomainVerificationOperation() *schema.Resource {
17+
return &schema.Resource{
18+
Create: resourceTencentCloudSslCheckCertificateDomainVerificationCreate,
19+
Read: resourceTencentCloudSslCheckCertificateDomainVerificationRead,
20+
Delete: resourceTencentCloudSslCheckCertificateDomainVerificationDelete,
21+
22+
Schema: map[string]*schema.Schema{
23+
"certificate_id": {
24+
Required: true,
25+
ForceNew: true,
26+
Type: schema.TypeString,
27+
Description: "The certificate ID.",
28+
},
29+
// computed
30+
"verification_results": {
31+
Computed: true,
32+
Type: schema.TypeList,
33+
Description: "Domain name verification results.",
34+
Elem: &schema.Resource{
35+
Schema: map[string]*schema.Schema{
36+
"domain": {
37+
Type: schema.TypeString,
38+
Computed: true,
39+
Description: "Domain name.",
40+
},
41+
"verify_type": {
42+
Type: schema.TypeString,
43+
Computed: true,
44+
Description: "Domain Verify Type.",
45+
},
46+
"local_check": {
47+
Type: schema.TypeInt,
48+
Computed: true,
49+
Description: "Local inspection results.",
50+
},
51+
"ca_check": {
52+
Type: schema.TypeInt,
53+
Computed: true,
54+
Description: "CA inspection results.",
55+
},
56+
"local_check_fail_reason": {
57+
Type: schema.TypeString,
58+
Computed: true,
59+
Description: "Check the reason for the failure.",
60+
},
61+
"check_value": {
62+
Type: schema.TypeList,
63+
Computed: true,
64+
Description: "Detected values.",
65+
Elem: &schema.Schema{Type: schema.TypeString},
66+
},
67+
"frequently": {
68+
Type: schema.TypeBool,
69+
Computed: true,
70+
Description: "Whether frequent requests.",
71+
},
72+
"issued": {
73+
Type: schema.TypeBool,
74+
Computed: true,
75+
Description: "Whether issued.",
76+
},
77+
},
78+
},
79+
},
80+
},
81+
}
82+
}
83+
84+
func resourceTencentCloudSslCheckCertificateDomainVerificationCreate(d *schema.ResourceData, meta interface{}) error {
85+
defer tccommon.LogElapsed("resource.tencentcloud_ssl_check_certificate_domain_verification_operation.create")()
86+
defer tccommon.InconsistentCheck(d, meta)()
87+
88+
var (
89+
logId = tccommon.GetLogId(tccommon.ContextNil)
90+
request = ssl.NewCheckCertificateDomainVerificationRequest()
91+
response = []*ssl.DomainValidationResult{}
92+
certificateId string
93+
)
94+
95+
if v, ok := d.GetOk("certificate_id"); ok {
96+
request.CertificateId = helper.String(v.(string))
97+
certificateId = v.(string)
98+
}
99+
100+
err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError {
101+
result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseSSLCertificateClient().CheckCertificateDomainVerification(request)
102+
if e != nil {
103+
return tccommon.RetryError(e)
104+
}
105+
106+
if result == nil || result.Response == nil {
107+
err := fmt.Errorf("[DEBUG]%s Check certificate domain verification failed.\n", logId)
108+
return tccommon.RetryError(err)
109+
}
110+
111+
response = result.Response.VerificationResults
112+
log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString())
113+
return nil
114+
})
115+
116+
if err != nil {
117+
log.Printf("[CRITAL]%s Check certificate domain verification failed, reason: %+v", logId, err)
118+
return err
119+
}
120+
121+
tmpList := make([]map[string]interface{}, 0, len(response))
122+
for _, item := range response {
123+
tmpObject := make(map[string]interface{})
124+
if item.Domain != nil {
125+
tmpObject["domain"] = item.Domain
126+
}
127+
128+
if item.VerifyType != nil {
129+
tmpObject["verify_type"] = item.VerifyType
130+
}
131+
132+
if item.LocalCheck != nil {
133+
tmpObject["local_check"] = item.LocalCheck
134+
}
135+
136+
if item.CaCheck != nil {
137+
tmpObject["ca_check"] = item.CaCheck
138+
}
139+
140+
if item.LocalCheckFailReason != nil {
141+
tmpObject["local_check_fail_reason"] = item.LocalCheckFailReason
142+
}
143+
144+
if item.CheckValue != nil {
145+
tmpValueList := make([]string, 0, len(item.CheckValue))
146+
for _, v := range item.CheckValue {
147+
tmpValueList = append(tmpValueList, *v)
148+
}
149+
150+
tmpObject["check_value"] = tmpValueList
151+
}
152+
153+
if item.Frequently != nil {
154+
tmpObject["frequently"] = item.Frequently
155+
}
156+
157+
if item.Issued != nil {
158+
tmpObject["issued"] = item.Issued
159+
}
160+
161+
tmpList = append(tmpList, tmpObject)
162+
}
163+
164+
_ = d.Set("verification_results", tmpList)
165+
166+
d.SetId(certificateId)
167+
168+
return resourceTencentCloudSslCheckCertificateDomainVerificationRead(d, meta)
169+
}
170+
171+
func resourceTencentCloudSslCheckCertificateDomainVerificationRead(d *schema.ResourceData, meta interface{}) error {
172+
defer tccommon.LogElapsed("resource.tencentcloud_ssl_check_certificate_domain_verification_operation.read")()
173+
defer tccommon.InconsistentCheck(d, meta)()
174+
175+
return nil
176+
}
177+
178+
func resourceTencentCloudSslCheckCertificateDomainVerificationDelete(d *schema.ResourceData, meta interface{}) error {
179+
defer tccommon.LogElapsed("resource.tencentcloud_ssl_check_certificate_domain_verification_operation.delete")()
180+
defer tccommon.InconsistentCheck(d, meta)()
181+
182+
return nil
183+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Provides a resource to create a ssl Check Certificate Domain Verification
2+
3+
Example Usage
4+
5+
```hcl
6+
resource "tencentcloud_ssl_check_certificate_domain_verification_operation" "example" {
7+
certificate_id = "6BE701Jx"
8+
}
9+
```
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package ssl_test
2+
3+
import (
4+
"testing"
5+
6+
tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest"
7+
8+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
9+
)
10+
11+
// go test -i; go test -test.run TestAccTencentCloudSslCheckCertificateDomainVerificationOperationResource_basic -v
12+
func TestAccTencentCloudSslCheckCertificateDomainVerificationOperationResource_basic(t *testing.T) {
13+
t.Parallel()
14+
resource.Test(t, resource.TestCase{
15+
PreCheck: func() {
16+
tcacctest.AccPreCheck(t)
17+
},
18+
Providers: tcacctest.AccProviders,
19+
Steps: []resource.TestStep{
20+
{
21+
Config: testAccSslCheckCertificateDomainVerification,
22+
Check: resource.ComposeTestCheckFunc(
23+
resource.TestCheckResourceAttrSet("tencentcloud_ssl_check_certificate_domain_verification_operation.example", "id"),
24+
resource.TestCheckResourceAttrSet("tencentcloud_ssl_check_certificate_domain_verification_operation.example", "certificate_id"),
25+
),
26+
},
27+
},
28+
})
29+
}
30+
31+
const testAccSslCheckCertificateDomainVerification = `
32+
resource "tencentcloud_ssl_check_certificate_domain_verification_operation" "example" {
33+
certificate_id = "6BE701Jx"
34+
}
35+
`

vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)