Skip to content

Commit e231186

Browse files
tongyimingmikatong
andauthored
Fix/free ssl (#1371)
* fix: support dv_auths * fix: update doc * update * add changelog Co-authored-by: mikatong <mikatong@tencent.com>
1 parent b2460ec commit e231186

File tree

4 files changed

+54
-0
lines changed

4 files changed

+54
-0
lines changed

.changelog/1371.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/tencentcloud_ssl_free_certificate: support computed param dv_auths
3+
```

tencentcloud/resource_tc_ssl_free_certificate.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,30 @@ func resourceTencentCloudSSLFreeCertificate() *schema.Resource {
174174
Computed: true,
175175
Description: "Indicates whether the certificate deployable.",
176176
},
177+
"dv_auths": {
178+
Type: schema.TypeList,
179+
Computed: true,
180+
Description: "DV certification information.",
181+
Elem: &schema.Resource{
182+
Schema: map[string]*schema.Schema{
183+
"dv_auth_key": {
184+
Type: schema.TypeString,
185+
Computed: true,
186+
Description: "DV authentication key.",
187+
},
188+
"dv_auth_value": {
189+
Type: schema.TypeString,
190+
Computed: true,
191+
Description: "DV authentication value.",
192+
},
193+
"dv_auth_verify_type": {
194+
Type: schema.TypeString,
195+
Computed: true,
196+
Description: "DV authentication type.",
197+
},
198+
},
199+
},
200+
},
177201
},
178202
}
179203
}
@@ -263,6 +287,18 @@ func resourceTencentCloudFreeCertificateRead(d *schema.ResourceData, meta interf
263287
}
264288
_ = d.Set("project_id", pid)
265289
}
290+
if detail.DvAuthDetail != nil && len(detail.DvAuthDetail.DvAuths) != 0 {
291+
dvAuths := make([]map[string]string, 0)
292+
for _, item := range detail.DvAuthDetail.DvAuths {
293+
dvAuth := make(map[string]string)
294+
dvAuth["dv_auth_key"] = *item.DvAuthKey
295+
dvAuth["dv_auth_value"] = *item.DvAuthValue
296+
dvAuth["dv_auth_verify_type"] = *item.DvAuthVerifyType
297+
dvAuths = append(dvAuths, dvAuth)
298+
}
299+
300+
_ = d.Set("dv_auths", dvAuths)
301+
}
266302

267303
return nil
268304
}

tencentcloud/resource_tc_ssl_free_certificate_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,14 @@ resource "tencentcloud_ssl_free_certificate" "foo" {
9797
alias = "my_free_cert"
9898
}
9999
`
100+
101+
/* Free certificate application cannot be deleted within 1 hour
102+
resource "tencentcloud_ssl_free_certificate" "ssl_free_certificate_dns" {
103+
dv_auth_method = "DNS"
104+
domain = "tencentiac.com"
105+
package_type = "2"
106+
contact_email = "foo@tencent.com"
107+
validity_period = 12
108+
alias = "my_free_cert_dns"
109+
}
110+
*/

website/docs/r/ssl_free_certificate.html.markdown

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ In addition to all arguments above, the following attributes are exported:
5757
* `certificate_private_key` - Certificate private key.
5858
* `certificate_public_key` - Certificate public key.
5959
* `deployable` - Indicates whether the certificate deployable.
60+
* `dv_auths` - DV certification information.
61+
* `dv_auth_key` - DV authentication key.
62+
* `dv_auth_value` - DV authentication value.
63+
* `dv_auth_verify_type` - DV authentication type.
6064
* `insert_time` - Certificate insert time.
6165
* `product_zh_name` - Product zh name.
6266
* `renewable` - Indicates whether the certificate renewable.

0 commit comments

Comments
 (0)