Skip to content

Commit 34ac262

Browse files
committed
2 parents 732e22f + 2cbb87d commit 34ac262

34 files changed

+4797
-137
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,26 @@
44
FEATURES:
55

66
* **New Resource**: `tencentcloud_kubernetes_node_pool` to support node management.
7+
* **New Resource**: `tencentcloud_ssl_pay_certificate` to support ssl pay certificate.
78

89
DEPRECATED:
910

1011
* Resource: `tencentcloud_kubernetes_as_scaling_group` replaced by `tencentcloud_kubernetes_node_pool`.
1112

13+
ENHANCEMENTS:
14+
15+
* Resource `tencentcloud_ccn` add `charge_type` to support billing mode setting.
16+
* Resource `tencentcloud_ccn` add `bandwidth_limit_type` to support the speed limit type setting.
17+
* Resource `tencentcloud_ccn_bandwidth_limit` add `dst_region` to support destination area restriction setting.
18+
* Resource `tencentcloud_cdn_domain` add `range_origin_switch` to support range back to source configuration.
19+
* Resource `tencentcloud_cdn_domain` add `rule_cache` to support advanced path cache configuration.
20+
* Resource `tencentcloud_cdn_domain` add `request_header` to support request header configuration.
21+
* Data Source `tencentcloud_ccn_instances` add `charge_type` to support billing mode.
22+
* Data Source `tencentcloud_ccn_instances` add `bandwidth_limit_type` to support the speed limit type.
23+
* Data Source `tencentcloud_ccn_bandwidth_limit` add `dst_region` to support destination area restriction.
24+
* Data Source `tencentcloud_cdn_domains` add `range_origin_switch` to support range back to source configuration.
25+
* Data Source `tencentcloud_cdn_domains` add `rule_cache` to support advanced path cache configuration.
26+
* Data Source `tencentcloud_cdn_domains` add `request_header` to support request header configuration.
1227

1328
## 1.51.1 (December 22, 2020)
1429

examples/tencentcloud-cdn/main.tf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,25 @@ resource "tencentcloud_cdn_domain" "foo" {
22
domain = "xxxx.com"
33
service_type = "web"
44
area = "mainland"
5+
range_origin_switch = "off"
6+
7+
rule_cache{
8+
cache_time = 10000
9+
no_cache_switch="on"
10+
re_validate="on"
11+
}
12+
13+
request_header{
14+
switch = "on"
15+
16+
header_rules {
17+
header_mode = "add"
18+
header_name = "tf-header-name"
19+
header_value = "tf-header-value"
20+
rule_type = "all"
21+
rule_paths = ["*"]
22+
}
23+
}
524

625
origin {
726
origin_type = "ip"

tencentcloud/connectivity/client.go

Lines changed: 46 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
redis "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/redis/v20180412"
3333
scf "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf/v20180416"
3434
sqlserver "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sqlserver/v20180328"
35+
sslCertificate "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssl/v20191205"
3536
sts "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sts/v20180813"
3637
tag "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tag/v20180813"
3738
tcaplusdb "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcaplusdb/v20190823"
@@ -49,37 +50,38 @@ type TencentCloudClient struct {
4950
Protocol string
5051
Domain string
5152

52-
cosConn *s3.S3
53-
mysqlConn *cdb.Client
54-
redisConn *redis.Client
55-
asConn *as.Client
56-
vpcConn *vpc.Client
57-
cbsConn *cbs.Client
58-
cvmConn *cvm.Client
59-
clbConn *clb.Client
60-
dayuConn *dayu.Client
61-
dcConn *dc.Client
62-
tagConn *tag.Client
63-
mongodbConn *mongodb.Client
64-
tkeConn *tke.Client
65-
tcrConn *tcr.Client
66-
camConn *cam.Client
67-
stsConn *sts.Client
68-
gaapConn *gaap.Client
69-
sslConn *ssl.Client
70-
cfsConn *cfs.Client
71-
scfConn *scf.Client
72-
tcaplusConn *tcaplusdb.Client
73-
cdnConn *cdn.Client
74-
monitorConn *monitor.Client
75-
esConn *es.Client
76-
sqlserverConn *sqlserver.Client
77-
postgreConn *postgre.Client
78-
ckafkaConn *ckafka.Client
79-
auditConn *audit.Client
80-
cynosConn *cynosdb.Client
81-
vodConn *vod.Client
82-
apiGatewayConn *apigateway.Client
53+
cosConn *s3.S3
54+
mysqlConn *cdb.Client
55+
redisConn *redis.Client
56+
asConn *as.Client
57+
vpcConn *vpc.Client
58+
cbsConn *cbs.Client
59+
cvmConn *cvm.Client
60+
clbConn *clb.Client
61+
dayuConn *dayu.Client
62+
dcConn *dc.Client
63+
tagConn *tag.Client
64+
mongodbConn *mongodb.Client
65+
tkeConn *tke.Client
66+
tcrConn *tcr.Client
67+
camConn *cam.Client
68+
stsConn *sts.Client
69+
gaapConn *gaap.Client
70+
sslConn *ssl.Client
71+
cfsConn *cfs.Client
72+
scfConn *scf.Client
73+
tcaplusConn *tcaplusdb.Client
74+
cdnConn *cdn.Client
75+
monitorConn *monitor.Client
76+
esConn *es.Client
77+
sqlserverConn *sqlserver.Client
78+
postgreConn *postgre.Client
79+
ckafkaConn *ckafka.Client
80+
auditConn *audit.Client
81+
cynosConn *cynosdb.Client
82+
vodConn *vod.Client
83+
apiGatewayConn *apigateway.Client
84+
sslCertificateConn *sslCertificate.Client
8385
}
8486

8587
// NewClientProfile returns a new ClientProfile
@@ -518,3 +520,16 @@ func (me *TencentCloudClient) UseTCRClient() *tcr.Client {
518520

519521
return me.tcrConn
520522
}
523+
524+
// UseSSLCertificateClient returns SSL Certificate client for service
525+
func (me *TencentCloudClient) UseSSLCertificateClient() *sslCertificate.Client {
526+
if me.sslCertificateConn != nil {
527+
return me.sslCertificateConn
528+
}
529+
530+
cpf := me.NewClientProfile(300)
531+
me.sslCertificateConn, _ = sslCertificate.NewClient(me.Credential, me.Region, cpf)
532+
me.sslCertificateConn.WithHttpTransport(&LogRoundTripper{})
533+
534+
return me.sslCertificateConn
535+
}

tencentcloud/data_source_tc_ccn_bandwidth_limits.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ func dataSourceTencentCloudCcnBandwidthLimits() *schema.Resource {
6666
Computed: true,
6767
Description: "Limitation of bandwidth.",
6868
},
69+
"dst_region": {
70+
Type: schema.TypeString,
71+
Computed: true,
72+
Description: "Destination area restriction.",
73+
},
6974
},
7075
},
7176
},
@@ -85,7 +90,7 @@ func dataSourceTencentCloudCcnBandwidthLimitsRead(d *schema.ResourceData, meta i
8590
ccnId = d.Get("ccn_id").(string)
8691
)
8792

88-
var infos, err = service.DescribeCcnRegionBandwidthLimits(ctx, ccnId)
93+
var infos, err = service.GetCcnRegionBandwidthLimits(ctx, ccnId)
8994
if err != nil {
9095
return err
9196
}
@@ -94,8 +99,9 @@ func dataSourceTencentCloudCcnBandwidthLimitsRead(d *schema.ResourceData, meta i
9499

95100
for _, item := range infos {
96101
var infoMap = make(map[string]interface{})
97-
infoMap["region"] = item.region
98-
infoMap["bandwidth_limit"] = item.limit
102+
infoMap["region"] = item.Region
103+
infoMap["bandwidth_limit"] = item.BandwidthLimit
104+
infoMap["dst_region"] = item.DstRegion
99105
infoList = append(infoList, infoMap)
100106
}
101107
if err := d.Set("limits", infoList); err != nil {

tencentcloud/data_source_tc_ccn_bandwidth_limits_test.go

Lines changed: 56 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,50 @@ import (
66
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
77
)
88

9-
func TestAccDataSourceTencentCloudCcnV3BandwidthLimitsBasic(t *testing.T) {
9+
func TestAccDataSourceTencentCloudCcnV3BandwidthLimitsOuter(t *testing.T) {
1010
keyName := "data.tencentcloud_ccn_bandwidth_limits.limit"
1111
resource.Test(t, resource.TestCase{
1212
PreCheck: func() { testAccPreCheck(t) },
1313
Providers: testAccProviders,
1414
Steps: []resource.TestStep{
1515
{
16-
Config: TestAccDataSourceTencentCloudCcnBandwidthLimits,
16+
Config: TestAccDataSourceTencentCloudCcnOuterBandwidthLimits,
1717

1818
Check: resource.ComposeTestCheckFunc(
1919
testAccCheckTencentCloudDataSourceID(keyName),
2020
resource.TestCheckResourceAttrSet(keyName, "ccn_id"),
21-
resource.TestCheckResourceAttrSet(keyName, "limits.#"),
21+
resource.TestCheckResourceAttr(keyName, "limits.#", "1"),
22+
resource.TestCheckResourceAttr(keyName, "limits.0.region", "ap-shanghai"),
23+
resource.TestCheckResourceAttr(keyName, "limits.0.bandwidth_limit", "500"),
2224
),
2325
},
2426
},
2527
})
2628
}
2729

28-
const TestAccDataSourceTencentCloudCcnBandwidthLimits = `
30+
func TestAccDataSourceTencentCloudCcnV3BandwidthLimitsInter(t *testing.T) {
31+
keyName := "data.tencentcloud_ccn_bandwidth_limits.limit"
32+
resource.Test(t, resource.TestCase{
33+
PreCheck: func() { testAccPreCheck(t) },
34+
Providers: testAccProviders,
35+
Steps: []resource.TestStep{
36+
{
37+
Config: TestAccDataSourceTencentCloudCcnInterBandwidthLimits,
2938

39+
Check: resource.ComposeTestCheckFunc(
40+
testAccCheckTencentCloudDataSourceID(keyName),
41+
resource.TestCheckResourceAttrSet(keyName, "ccn_id"),
42+
resource.TestCheckResourceAttr(keyName, "limits.#", "1"),
43+
resource.TestCheckResourceAttr(keyName, "limits.0.region", "ap-shanghai"),
44+
resource.TestCheckResourceAttr(keyName, "limits.0.dst_region", "ap-beijing"),
45+
resource.TestCheckResourceAttr(keyName, "limits.0.bandwidth_limit", "500"),
46+
),
47+
},
48+
},
49+
})
50+
}
51+
52+
const TestAccDataSourceTencentCloudCcnOuterBandwidthLimits = `
3053
variable "other_region1" {
3154
default = "ap-shanghai"
3255
}
@@ -37,13 +60,41 @@ resource tencentcloud_ccn main {
3760
qos = "AG"
3861
}
3962
63+
resource tencentcloud_ccn_bandwidth_limit limit1 {
64+
ccn_id = tencentcloud_ccn.main.id
65+
region = var.other_region1
66+
bandwidth_limit = 500
67+
}
68+
4069
data tencentcloud_ccn_bandwidth_limits limit {
41-
ccn_id = tencentcloud_ccn.main.id
70+
ccn_id = tencentcloud_ccn_bandwidth_limit.limit1.ccn_id
71+
}
72+
`
73+
74+
const TestAccDataSourceTencentCloudCcnInterBandwidthLimits = `
75+
variable "other_region1" {
76+
default = "ap-shanghai"
77+
}
78+
79+
variable "other_region2" {
80+
default = "ap-beijing"
81+
}
82+
83+
resource tencentcloud_ccn main {
84+
name = "ci-temp-test-ccn"
85+
description = "ci-temp-test-ccn-des"
86+
qos = "AG"
87+
bandwidth_limit_type = "INTER_REGION_LIMIT"
4288
}
4389
4490
resource tencentcloud_ccn_bandwidth_limit limit1 {
4591
ccn_id = tencentcloud_ccn.main.id
4692
region = var.other_region1
93+
dst_region = var.other_region2
4794
bandwidth_limit = 500
4895
}
96+
97+
data tencentcloud_ccn_bandwidth_limits limit {
98+
ccn_id = tencentcloud_ccn_bandwidth_limit.limit1.ccn_id
99+
}
49100
`

tencentcloud/data_source_tc_ccn_instances.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,16 @@ func dataSourceTencentCloudCcnInstances() *schema.Resource {
8484
Computed: true,
8585
Description: "States of instance. The available value include 'ISOLATED'(arrears) and 'AVAILABLE'.",
8686
},
87+
"charge_type": {
88+
Type: schema.TypeString,
89+
Computed: true,
90+
Description: "Billing mode.",
91+
},
92+
"bandwidth_limit_type": {
93+
Type: schema.TypeString,
94+
Computed: true,
95+
Description: "The speed limit type.",
96+
},
8797
"attachment_list": {
8898
Type: schema.TypeList,
8999
Computed: true,
@@ -178,6 +188,8 @@ func dataSourceTencentCloudCcnInstancesRead(d *schema.ResourceData, meta interfa
178188
infoMap["qos"] = item.qos
179189
infoMap["state"] = strings.ToUpper(item.state)
180190
infoMap["create_time"] = item.createTime
191+
infoMap["charge_type"] = item.chargeType
192+
infoMap["bandwidth_limit_type"] = item.bandWithLimitType
181193
infoList = append(infoList, infoMap)
182194

183195
instances, err := service.DescribeCcnAttachedInstances(ctx, item.ccnId)

tencentcloud/data_source_tc_ccn_instances_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ func TestAccDataSourceTencentCloudCcnV3InstancesBasic(t *testing.T) {
2525
resource.TestCheckResourceAttrSet(keyId, "instance_list.0.ccn_id"),
2626
resource.TestCheckResourceAttrSet(keyId, "instance_list.0.qos"),
2727
resource.TestCheckResourceAttrSet(keyId, "instance_list.0.state"),
28+
resource.TestCheckResourceAttrSet(keyId, "instance_list.0.charge_type"),
29+
resource.TestCheckResourceAttrSet(keyId, "instance_list.0.bandwidth_limit_type"),
2830
resource.TestCheckResourceAttrSet(keyId, "instance_list.0.attachment_list.#"),
2931
resource.TestCheckResourceAttrSet(keyId, "instance_list.0.create_time"),
3032

@@ -36,6 +38,8 @@ func TestAccDataSourceTencentCloudCcnV3InstancesBasic(t *testing.T) {
3638
resource.TestCheckResourceAttrSet(keyName, "instance_list.0.ccn_id"),
3739
resource.TestCheckResourceAttrSet(keyName, "instance_list.0.qos"),
3840
resource.TestCheckResourceAttrSet(keyName, "instance_list.0.state"),
41+
resource.TestCheckResourceAttrSet(keyId, "instance_list.0.charge_type"),
42+
resource.TestCheckResourceAttrSet(keyId, "instance_list.0.bandwidth_limit_type"),
3943
resource.TestCheckResourceAttrSet(keyName, "instance_list.0.attachment_list.#"),
4044
resource.TestCheckResourceAttrSet(keyName, "instance_list.0.create_time"),
4145
),

0 commit comments

Comments
 (0)