Skip to content

Commit 1478aa1

Browse files
committed
feat/apigw
2 parents 929c56d + 21c7072 commit 1478aa1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3615
-712
lines changed

.changelog/2075.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
```release-note:enhancement
2+
data_source/tencentcloud_ssm_secrets: Support `secret_type`, `product_name`, Update return value
3+
```
4+
5+
```release-note:enhancement
6+
resource/tencentcloud_ssm_product_secret: Support `tags`, Update return value
7+
```
8+
9+
```release-note:enhancement
10+
resource/tencentcloud_ssm_secret: Support `tags`
11+
```
12+
13+
```release-note:enhancement
14+
resource/tencentcloud_ssm_ssh_key_pair_secret: Support `tags`
15+
```

.changelog/2087.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
resource/tencentcloud_tdmq_rocketmq_group: Fix the issue of inconsistent return values.
3+
```

.changelog/2093.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:new-data-source
2+
tencentcloud_kms_public_key
3+
```

.changelog/2101.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_private_dns_zone: support input 'cname_speedup_status'.
3+
```

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ require (
6767
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mps v1.0.584
6868
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/organization v1.0.540
6969
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres v1.0.676
70-
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/privatedns v1.0.290
70+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/privatedns v1.0.736
7171
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/pts v1.0.533
7272
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/redis v1.0.657
7373
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/rum v1.0.542

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres v1.0.676 h1:KD
931931
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres v1.0.676/go.mod h1:mXbqv53QFAhvyYqainXSAMdoCui5GudorFhKufJxITc=
932932
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/privatedns v1.0.290 h1:osYZxh9ApEc8UpvIMwjAUfdl7ytRcWUpcnnqLIpiJ/U=
933933
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/privatedns v1.0.290/go.mod h1:En+pdagcHkAASorHT1l8R6tUtieRNNxaQ7nfyqWPefk=
934+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/privatedns v1.0.736 h1:HxilF8QU6rguue0eusDPSo2ygvcA7BPgG2AdVa8YRfs=
935+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/privatedns v1.0.736/go.mod h1:C0aHvKZahgErjMQ5zlLEfCO+M3qj1YSBc+Otf/vwTEI=
934936
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/pts v1.0.533 h1:BJDJlHkuoPsSUJ/ZHnmtX3gmA2PVfmKyhB7uV2d9QlE=
935937
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/pts v1.0.533/go.mod h1:SHeExU5ggWrG8hsc4BMmxdhhw6WpoiWSu1Jw8CXs/Dg=
936938
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/redis v1.0.657 h1:9p/4/qXtnBIYkz5b5mYAhp1XhnIn5jUkxxfllF8hMMM=

tencentcloud/data_source_tc_cynosdb_resource_package_list_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ func TestAccTencentCloudCynosdbResourcePackageListDataSource_basic(t *testing.T)
1111
t.Parallel()
1212
resource.Test(t, resource.TestCase{
1313
PreCheck: func() {
14-
testAccPreCheckCommon(t, ACCOUNT_TYPE_PREPAY)
14+
testAccPreCheck(t)
1515
},
1616
Providers: testAccProviders,
1717
Steps: []resource.TestStep{
1818
{
19-
Config: testAccCynosdbResourcePackageListDataSource,
19+
PreConfig: func() { testAccPreCheckCommon(t, ACCOUNT_TYPE_PREPAY) },
20+
Config: testAccCynosdbResourcePackageListDataSource,
2021
Check: resource.ComposeTestCheckFunc(
2122
testAccCheckTencentCloudDataSourceID("data.tencentcloud_cynosdb_resource_package_list.resource_package_list"),
2223
resource.TestCheckResourceAttrSet("data.tencentcloud_cynosdb_resource_package_list.resource_package_list", "resource_package_list.#"),
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
/*
2+
Use this data source to query detailed information of kms public_key
3+
4+
Example Usage
5+
6+
```hcl
7+
data "tencentcloud_kms_public_key" "example" {
8+
key_id = tencentcloud_kms_key.example.id
9+
}
10+
11+
resource "tencentcloud_kms_key" "example" {
12+
alias = "tf-example-kms-key"
13+
description = "example of kms key"
14+
key_usage = "ASYMMETRIC_DECRYPT_RSA_2048"
15+
is_enabled = true
16+
pending_delete_window_in_days = 7
17+
}
18+
```
19+
*/
20+
package tencentcloud
21+
22+
import (
23+
"context"
24+
25+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
26+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
27+
kms "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/kms/v20190118"
28+
"github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper"
29+
)
30+
31+
func dataSourceTencentCloudKmsPublicKey() *schema.Resource {
32+
return &schema.Resource{
33+
Read: dataSourceTencentCloudKmsPublicKeyRead,
34+
Schema: map[string]*schema.Schema{
35+
"key_id": {
36+
Required: true,
37+
Type: schema.TypeString,
38+
Description: "CMK unique identifier.",
39+
},
40+
"public_key": {
41+
Computed: true,
42+
Type: schema.TypeString,
43+
Description: "Base64-encoded public key content.",
44+
},
45+
"public_key_pem": {
46+
Computed: true,
47+
Type: schema.TypeString,
48+
Description: "Public key content in PEM format.",
49+
},
50+
"result_output_file": {
51+
Type: schema.TypeString,
52+
Optional: true,
53+
Description: "Used to save results.",
54+
},
55+
},
56+
}
57+
}
58+
59+
func dataSourceTencentCloudKmsPublicKeyRead(d *schema.ResourceData, meta interface{}) error {
60+
defer logElapsed("data_source.tencentcloud_kms_public_key.read")()
61+
defer inconsistentCheck(d, meta)()
62+
63+
var (
64+
logId = getLogId(contextNil)
65+
ctx = context.WithValue(context.TODO(), logIdKey, logId)
66+
service = KmsService{client: meta.(*TencentCloudClient).apiV3Conn}
67+
publicKey *kms.GetPublicKeyResponseParams
68+
keyId string
69+
)
70+
71+
paramMap := make(map[string]interface{})
72+
if v, ok := d.GetOk("key_id"); ok {
73+
paramMap["KeyId"] = helper.String(v.(string))
74+
keyId = v.(string)
75+
}
76+
77+
err := resource.Retry(readRetryTimeout, func() *resource.RetryError {
78+
result, e := service.DescribeKmsPublicKeyByFilter(ctx, paramMap)
79+
if e != nil {
80+
return retryError(e)
81+
}
82+
83+
publicKey = result
84+
return nil
85+
})
86+
87+
if err != nil {
88+
return err
89+
}
90+
91+
if publicKey.KeyId != nil {
92+
_ = d.Set("key_id", publicKey.KeyId)
93+
}
94+
95+
if publicKey.PublicKey != nil {
96+
_ = d.Set("public_key", publicKey.PublicKey)
97+
}
98+
99+
if publicKey.PublicKeyPem != nil {
100+
_ = d.Set("public_key_pem", publicKey.PublicKeyPem)
101+
}
102+
103+
d.SetId(keyId)
104+
output, ok := d.GetOk("result_output_file")
105+
if ok && output.(string) != "" {
106+
if e := writeToFile(output.(string), d); e != nil {
107+
return e
108+
}
109+
}
110+
111+
return nil
112+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package tencentcloud
2+
3+
import (
4+
"fmt"
5+
"testing"
6+
7+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
8+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
9+
)
10+
11+
// go test -i; go test -test.run TestAccTencentCloudKmsPublicKeyDataSource_basic -v
12+
func TestAccTencentCloudKmsPublicKeyDataSource_basic(t *testing.T) {
13+
t.Parallel()
14+
rName := fmt.Sprintf("tf-testacc-kms-key-%s", acctest.RandString(13))
15+
resource.Test(t, resource.TestCase{
16+
PreCheck: func() {
17+
testAccPreCheck(t)
18+
},
19+
Providers: testAccProviders,
20+
Steps: []resource.TestStep{
21+
{
22+
Config: fmt.Sprintf(testAccKmsPublicKeyDataSource, rName),
23+
Check: resource.ComposeTestCheckFunc(
24+
testAccCheckTencentCloudDataSourceID("data.tencentcloud_kms_public_key.example"),
25+
),
26+
},
27+
},
28+
})
29+
}
30+
31+
const testAccKmsPublicKeyDataSource = `
32+
data "tencentcloud_kms_public_key" "example" {
33+
key_id = tencentcloud_kms_key.example.id
34+
}
35+
36+
resource "tencentcloud_kms_key" "example" {
37+
alias = "%s"
38+
description = "example of kms key"
39+
key_usage = "ASYMMETRIC_DECRYPT_RSA_2048"
40+
is_enabled = true
41+
}
42+
`

tencentcloud/data_source_tc_ssm_products.go

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,11 @@ func dataSourceTencentCloudSsmProducts() *schema.Resource {
2222
Read: dataSourceTencentCloudSsmProductsRead,
2323
Schema: map[string]*schema.Schema{
2424
"products": {
25-
Computed: true,
26-
Type: schema.TypeSet,
27-
Elem: &schema.Schema{
28-
Type: schema.TypeString,
29-
},
25+
Computed: true,
26+
Type: schema.TypeSet,
27+
Elem: &schema.Schema{Type: schema.TypeString},
3028
Description: "List of supported services.",
3129
},
32-
3330
"result_output_file": {
3431
Type: schema.TypeString,
3532
Optional: true,
@@ -43,37 +40,38 @@ func dataSourceTencentCloudSsmProductsRead(d *schema.ResourceData, meta interfac
4340
defer logElapsed("data_source.tencentcloud_ssm_products.read")()
4441
defer inconsistentCheck(d, meta)()
4542

46-
logId := getLogId(contextNil)
47-
48-
ctx := context.WithValue(context.TODO(), logIdKey, logId)
49-
50-
service := SsmService{client: meta.(*TencentCloudClient).apiV3Conn}
51-
52-
var products []*string
43+
var (
44+
logId = getLogId(contextNil)
45+
ctx = context.WithValue(context.TODO(), logIdKey, logId)
46+
service = SsmService{client: meta.(*TencentCloudClient).apiV3Conn}
47+
products []*string
48+
)
5349

5450
err := resource.Retry(readRetryTimeout, func() *resource.RetryError {
5551
result, e := service.DescribeSsmProductsByFilter(ctx)
5652
if e != nil {
5753
return retryError(e)
5854
}
55+
5956
products = result
6057
return nil
6158
})
59+
6260
if err != nil {
6361
return err
6462
}
6563

6664
if products != nil {
6765
_ = d.Set("products", products)
6866
}
69-
ids := helper.StrListToStr(products)
7067

71-
d.SetId(ids)
68+
d.SetId(helper.StrListToStr(products))
7269
output, ok := d.GetOk("result_output_file")
7370
if ok && output.(string) != "" {
7471
if e := writeToFile(output.(string), products); e != nil {
7572
return e
7673
}
7774
}
75+
7876
return nil
7977
}

0 commit comments

Comments
 (0)