Skip to content

Commit

Permalink
feat(ssl): [119948410] Add SSL Check Certificate Domain Verification (#…
Browse files Browse the repository at this point in the history
…2871)

* add

* add

* add

* add

* add
  • Loading branch information
SevenEarth authored Oct 10, 2024
1 parent 3773bdc commit 3f57a48
Show file tree
Hide file tree
Showing 17 changed files with 2,309 additions and 1,400 deletions.
3 changes: 3 additions & 0 deletions .changelog/2871.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-resource
tencentcloud_ssl_check_certificate_domain_verification_operation
```
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ require (
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.984
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.544
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.970
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1014
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1015
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.1014
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cwp v1.0.762
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cynosdb v1.0.692
Expand Down Expand Up @@ -79,7 +79,7 @@ require (
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ses v1.0.748
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sms v1.0.486
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sqlserver v1.0.816
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssl v1.0.822
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssl v1.0.1015
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssm v1.0.691
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sts v1.0.524
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tag v1.0.860
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1012/go.mod
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1013/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1014 h1:SlXGy7ymuiMTmkXGT3YYUEcF0EJDGxirwQWy+u0QiHI=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1014/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1015 h1:O60uxxfWztVPVUBQjlJaop2Dw/J7CXGK9fSErMdWw+Y=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1015/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter v1.0.993 h1:WlPgXldQCxt7qi5Xrc6j6zTrsXWzN5BcOGs7Irq7fwQ=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter v1.0.993/go.mod h1:Z9U8zNtyuyKhjS0698wqsrG/kLx1TQ5CEixXBwVe7xY=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/csip v1.0.860 h1:F3esKBIT3HW9+7Gt8cVgf8X06VdGIczpgLBUECzSEzU=
Expand Down Expand Up @@ -1003,6 +1005,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sqlserver v1.0.816 h1:E
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sqlserver v1.0.816/go.mod h1:J9Ce9D/ewpqzUsBAwINc+59qpDqYT9egjwyUsMHpDwA=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssl v1.0.822 h1:Hbtl5PDb3LnYGkQ26PUXYdqRMVw4YemkvFKVklFSkfU=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssl v1.0.822/go.mod h1:ld+y2FwgxEjaY5MJrp4rgEGxM8FRfxxfPZalVD3eOEU=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssl v1.0.1015 h1:4fTbXtkXwleuDu/xYVELGpkuBLPgW+raED6y7Ni63sA=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssl v1.0.1015/go.mod h1:0ZWI4Rd0p6LnXEvEaj/DbUza8B2s74AllJr1WXrsLtY=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssm v1.0.691 h1:UE55TqueOP889MDcJ+cBW+MBjtzvWUw5fuOBWGCBIjs=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssm v1.0.691/go.mod h1:IRaYO5mSpBMPX8ydImTcL3jyuEkALEu/55Myb0a+GMs=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sts v1.0.524 h1:Hda8mBEoQVwkRAaZqztUAWn/n4HCYHZYEwzFBwYKaaM=
Expand Down
14 changes: 14 additions & 0 deletions tencentcloud/connectivity/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ type TencentCloudClient struct {
omitNilConn *common.Client
emrv20190103Conn *emr.Client
teov20220901Conn *teo.Client
sslv20191205Conn *sslCertificate.Client
}

// NewClientProfile returns a new ClientProfile
Expand Down Expand Up @@ -1844,3 +1845,16 @@ func (me *TencentCloudClient) UseTeoV20220901Client() *teo.Client {

return me.teov20220901Conn
}

// UseSslV20191205Client return SSL client for service
func (me *TencentCloudClient) UseSslV20191205Client() *sslCertificate.Client {
if me.sslv20191205Conn != nil {
return me.sslv20191205Conn
}
cpf := me.NewClientProfile(300)
cpf.Language = "zh-CN"
me.sslv20191205Conn, _ = sslCertificate.NewClient(me.Credential, me.Region, cpf)
me.sslv20191205Conn.WithHttpTransport(&LogRoundTripper{})

return me.sslv20191205Conn
}
1 change: 1 addition & 0 deletions tencentcloud/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -2113,6 +2113,7 @@ func Provider() *schema.Provider {
"tencentcloud_ssl_deploy_certificate_record_retry_operation": ssl.ResourceTencentCloudSslDeployCertificateRecordRetryOperation(),
"tencentcloud_ssl_deploy_certificate_record_rollback_operation": ssl.ResourceTencentCloudSslDeployCertificateRecordRollbackOperation(),
"tencentcloud_ssl_download_certificate_operation": ssl.ResourceTencentCloudSslDownloadCertificateOperation(),
"tencentcloud_ssl_check_certificate_domain_verification_operation": ssl.ResourceTencentCloudSslCheckCertificateDomainVerificationOperation(),
"tencentcloud_cwp_license_order": cwp.ResourceTencentCloudCwpLicenseOrder(),
"tencentcloud_cwp_license_bind_attachment": cwp.ResourceTencentCloudCwpLicenseBindAttachment(),
"tencentcloud_ssl_replace_certificate_operation": ssl.ResourceTencentCloudSslReplaceCertificateOperation(),
Expand Down
1 change: 1 addition & 0 deletions tencentcloud/provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,7 @@ SSL Certificates(ssl)
tencentcloud_ssl_deploy_certificate_record_retry_operation
tencentcloud_ssl_deploy_certificate_record_rollback_operation
tencentcloud_ssl_download_certificate_operation
tencentcloud_ssl_check_certificate_domain_verification_operation

Secrets Manager(SSM)
Data Source
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Provides a resource to create a ssl Check Certificate Domain Verification

Example Usage

```hcl
resource "tencentcloud_ssl_check_certificate_domain_verification_operation" "example" {
certificate_id = "6BE701Jx"
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package ssl

import (
"context"

tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common"

sslv20191205 "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssl/v20191205"
)

func resourceTencentCloudSslCheckCertificateDomainVerificationOperationCreatePreHandleResponse0(ctx context.Context, resp *sslv20191205.CheckCertificateDomainVerificationResponse) error {
d := tccommon.ResourceDataFromContext(ctx)

response := resp.Response.VerificationResults
tmpList := make([]map[string]interface{}, 0, len(response))
for _, item := range response {
tmpObject := make(map[string]interface{})
if item.Domain != nil {
tmpObject["domain"] = item.Domain
}

if item.VerifyType != nil {
tmpObject["verify_type"] = item.VerifyType
}

if item.LocalCheck != nil {
tmpObject["local_check"] = item.LocalCheck
}

if item.CaCheck != nil {
tmpObject["ca_check"] = item.CaCheck
}

if item.LocalCheckFailReason != nil {
tmpObject["local_check_fail_reason"] = item.LocalCheckFailReason
}

if item.CheckValue != nil {
tmpValueList := make([]string, 0, len(item.CheckValue))
for _, v := range item.CheckValue {
tmpValueList = append(tmpValueList, *v)
}

tmpObject["check_value"] = tmpValueList
}

if item.Frequently != nil {
tmpObject["frequently"] = item.Frequently
}

if item.Issued != nil {
tmpObject["issued"] = item.Issued
}

tmpList = append(tmpList, tmpObject)
}

_ = d.Set("verification_results", tmpList)

return nil
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package ssl_test

import (
"testing"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"

tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest"
)

// go test -i; go test -test.run TestAccTencentCloudNeedFixSslCheckCertificateDomainVerificationOperationResource_basic -v
func TestAccTencentCloudNeedFixSslCheckCertificateDomainVerificationOperationResource_basic(t *testing.T) {
t.Parallel()
resource.Test(t, resource.TestCase{
PreCheck: func() {
tcacctest.AccPreCheck(t)
},
Providers: tcacctest.AccProviders,
Steps: []resource.TestStep{
{
Config: testAccSslCheckCertificateDomainVerificationOperation,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet("tencentcloud_ssl_check_certificate_domain_verification_operation.example", "id"),
resource.TestCheckResourceAttrSet("tencentcloud_ssl_check_certificate_domain_verification_operation.example", "certificate_id"),
),
},
},
})
}

const testAccSslCheckCertificateDomainVerificationOperation = `
resource "tencentcloud_ssl_check_certificate_domain_verification_operation" "example" {
certificate_id = "6BE701Jx"
}
`

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3f57a48

Please sign in to comment.