Skip to content

fix(cos): [122540371] tencentcloud_cos_bucket_domain_certificate_attachment support cert_id params #3235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/3235.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_cos_bucket_domain_certificate_attachment: support `cert_id` params
```
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ require (
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/waf v1.0.1037
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/wedata v1.0.792
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/wss v1.0.199
github.com/tencentyun/cos-go-sdk-v5 v0.7.42-0.20230629101357-7edd77448a0f
github.com/tencentyun/cos-go-sdk-v5 v0.7.43-0.20250323165138-7caf1417f17b
github.com/yangwenmai/ratelimit v0.0.0-20180104140304-44221c2292e1
gopkg.in/yaml.v2 v2.4.0
)
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1063,6 +1063,10 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/wss v1.0.199 h1:hMBLtiJ
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/wss v1.0.199/go.mod h1:nnY91/H3j/Gu7V/oCA6Zeg8T5D3q36EUdBh4EjmHwqY=
github.com/tencentyun/cos-go-sdk-v5 v0.7.42-0.20230629101357-7edd77448a0f h1:yTMDoBvFuXjZat10d98DIKbPnN9FQG+drt1SbNfMW5U=
github.com/tencentyun/cos-go-sdk-v5 v0.7.42-0.20230629101357-7edd77448a0f/go.mod h1:LUFnaqRmGk6pEHOaRmdn2dCZR2j0cSsM5xowWFPTPao=
github.com/tencentyun/cos-go-sdk-v5 v0.7.42 h1:Up1704BJjI5orycXKjpVpvuOInt9GC5pqY4knyE9Uds=
github.com/tencentyun/cos-go-sdk-v5 v0.7.42/go.mod h1:LUFnaqRmGk6pEHOaRmdn2dCZR2j0cSsM5xowWFPTPao=
github.com/tencentyun/cos-go-sdk-v5 v0.7.43-0.20250323165138-7caf1417f17b h1:cyj7Mh5Df+I3YqFupRPgGKPyZGbhO6oCGVpKBuVWy+I=
github.com/tencentyun/cos-go-sdk-v5 v0.7.43-0.20250323165138-7caf1417f17b/go.mod h1:LUFnaqRmGk6pEHOaRmdn2dCZR2j0cSsM5xowWFPTPao=
github.com/tenntenn/modver v1.0.1 h1:2klLppGhDgzJrScMpkj9Ujy3rXPUspSjAcev9tSEBgA=
github.com/tenntenn/modver v1.0.1/go.mod h1:bePIyQPb7UeioSRkw3Q0XeMhYZSMx9B8ePqg6SAMGH0=
github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3 h1:f+jULpRQGxTSkNYKJ51yaw6ChIqO+Je8UqsTKN/cDag=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ func ResourceTencentCloudCosBucketDomainCertificateAttachment() *schema.Resource
Description: "Custom certificate.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"cert_id": {
Type: schema.TypeString,
Optional: true,
Description: "ID of certificate.",
},
"cert": {
Type: schema.TypeString,
Required: true,
Expand Down Expand Up @@ -112,6 +117,9 @@ func resourceTencentCloudCosBucketDomainCertificateAttachmentCreate(d *schema.Re
}
if CustomCertMap, ok := helper.InterfaceToMap(certMap, "custom_cert"); ok {
customCert := cos.BucketDomainCustomCert{}
if v, ok := CustomCertMap["cert_id"]; ok {
customCert.CertId = v.(string)
}
if v, ok := CustomCertMap["cert"]; ok {
customCert.Cert = v.(string)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,30 @@ Provides a resource to attach/detach the corresponding certificate for the domai
Example Usage

```hcl
data "tencentcloud_user_info" "info" {}

resource "tencentcloud_cos_bucket_domain_certificate_attachment" "foo" {
bucket = ""
locals {
app_id = data.tencentcloud_user_info.info.app_id
}

resource "tencentcloud_cos_bucket" "example" {
bucket = "private-bucket-${local.app_id}"
acl = "private"
force_clean = true
}

resource "tencentcloud_cos_bucket_domain_certificate_attachment" "example" {
bucket = tencentcloud_cos_bucket.example.id
domain_certificate {
domain = "domain_name"
domain = "www.example.com"
certificate {
cert_type = "CustomCert"
custom_cert {
cert = "===CERTIFICATE==="
private_key = "===PRIVATE_KEY==="
cert_id = "Mbx45wts"
cert = "-----BEGIN CERTIFICATE-----"
private_key = "-----BEGIN RSA PRIVATE_KEY-----"
}
}
}
}

```

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

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

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1358,7 +1358,7 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/wedata/v20210820
# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/wss v1.0.199
## explicit; go 1.14
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/wss/v20180426
# github.com/tencentyun/cos-go-sdk-v5 v0.7.42-0.20230629101357-7edd77448a0f
# github.com/tencentyun/cos-go-sdk-v5 v0.7.43-0.20250323165138-7caf1417f17b
## explicit; go 1.12
github.com/tencentyun/cos-go-sdk-v5
# github.com/tetafro/godot v1.4.11
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,28 @@ Provides a resource to attach/detach the corresponding certificate for the domai
## Example Usage

```hcl
resource "tencentcloud_cos_bucket_domain_certificate_attachment" "foo" {
bucket = ""
data "tencentcloud_user_info" "info" {}

locals {
app_id = data.tencentcloud_user_info.info.app_id
}

resource "tencentcloud_cos_bucket" "example" {
bucket = "private-bucket-${local.app_id}"
acl = "private"
force_clean = true
}

resource "tencentcloud_cos_bucket_domain_certificate_attachment" "example" {
bucket = tencentcloud_cos_bucket.example.id
domain_certificate {
domain = "domain_name"
domain = "www.example.com"
certificate {
cert_type = "CustomCert"
custom_cert {
cert = "===CERTIFICATE==="
private_key = "===PRIVATE_KEY==="
cert_id = "Mbx45wts"
cert = "-----BEGIN CERTIFICATE-----"
private_key = "-----BEGIN RSA PRIVATE_KEY-----"
}
}
}
Expand All @@ -47,6 +60,7 @@ The `custom_cert` object of `certificate` supports the following:

* `cert` - (Required, String) Public key of certificate.
* `private_key` - (Required, String) Private key of certificate.
* `cert_id` - (Optional, String) ID of certificate.

The `domain_certificate` object supports the following:

Expand Down
Loading