Skip to content

Commit 71e7a62

Browse files
authored
Merge pull request #665 from tencentcloudstack/chore/set-appid-to-env
chore: env define and format code
2 parents e44dc0c + 8be2ca1 commit 71e7a62

14 files changed

+211
-184
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
## 1.59.1 (September 15, 2021)
2+
3+
BUGFIXES:
4+
5+
* Resource `tencentcloud/resource_tc_instance.go` remove last_update_status judge
6+
* Resource `tencentcloud/resource_tc_instance.go` fix DescribeInstanceById return LatestOperationState
7+
* Resource `tencentcloud/resource_tc_clb_attachment.go` clb_attachment check instances before unbind target groups
8+
9+
CHORE:
10+
11+
* Define `TENCENTCLOUD_APPID` Environment variable for testing appid.
12+
* Format code style
13+
114
## 1.58.5 (September 7, 2021)
215

316
ENHANCEMENTS:

README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,24 @@ log.Println("[DEBUG] the message and some import values: %v", importantValues)
8282
### Test
8383

8484
The quicker way for development and debug is writing test cases.
85-
How to trigger running the test cases, please refer the `test.sh` script.
86-
How to write test cases, check the `xxx_test.go` files.
85+
86+
Config environment variables:
87+
```
88+
export TF_ACC=true
89+
```
90+
91+
Config your appid for COS bucket testing
92+
```
93+
export TENCENTCLOUD_APPID=1234567890
94+
```
95+
96+
This example show how to test single test function:
97+
```
98+
cd tencentcloud
99+
go test -i; go test -test.run TestAccTencentCloudNatGateway_basic -v
100+
```
101+
102+
To write test cases, check the `xxx_test.go` files for more reference.
87103

88104
### Avoid ``terrafrom init``
89105

tencentcloud/basic_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
package tencentcloud
22

3+
import "os"
4+
35
/*
46
---------------------------------------------------
57
If you want to run through the test cases,
68
the following must be changed to your resource id.
79
---------------------------------------------------
810
*/
911

10-
const appid string = "1259649581"
12+
var appid string = os.Getenv("TENCENTCLOUD_APPID")
1113

1214
const (
1315
defaultRegion = "ap-guangzhou"

tencentcloud/data_source_tc_cos_buckets.go

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ func dataSourceTencentCloudCosBuckets() *schema.Resource {
169169
},
170170
},
171171
"origin_pull_rules": {
172-
Type: schema.TypeList,
173-
Computed: true,
172+
Type: schema.TypeList,
173+
Computed: true,
174174
Description: "Bucket Origin-Pull rules.",
175175
Elem: &schema.Resource{
176176
Schema: map[string]*schema.Schema{
@@ -180,38 +180,38 @@ func dataSourceTencentCloudCosBuckets() *schema.Resource {
180180
Description: "Priority of origin-pull rules, do not set the same value for multiple rules.",
181181
},
182182
"sync_back_to_source": {
183-
Type: schema.TypeBool,
184-
Optional: true,
185-
Default: false,
183+
Type: schema.TypeBool,
184+
Optional: true,
185+
Default: false,
186186
Description: "If `true`, COS will not return 3XX status code when pulling data from an origin server. Currently available zone: ap-beijing, ap-shanghai, ap-singapore, ap-mumbai.",
187187
},
188188
"prefix": {
189-
Type: schema.TypeString,
190-
Optional: true,
191-
Default: "",
189+
Type: schema.TypeString,
190+
Optional: true,
191+
Default: "",
192192
Description: "Triggers the origin-pull rule when the requested file name matches this prefix.",
193193
},
194194
"protocol": {
195-
Type: schema.TypeString,
196-
Optional: true,
197-
Default: "",
195+
Type: schema.TypeString,
196+
Optional: true,
197+
Default: "",
198198
Description: "the protocol used for COS to access the specified origin server. The available value include `HTTP`, `HTTPS` and `FOLLOW`.",
199199
},
200200
"host": {
201-
Type: schema.TypeString,
202-
Required: true,
201+
Type: schema.TypeString,
202+
Required: true,
203203
Description: "Allows only a domain name or IP address. You can optionally append a port number to the address.",
204204
},
205205
"follow_query_string": {
206-
Type: schema.TypeBool,
207-
Optional: true,
208-
Default: true,
206+
Type: schema.TypeBool,
207+
Optional: true,
208+
Default: true,
209209
Description: "Specifies whether to pass through COS request query string when accessing the origin server.",
210210
},
211211
"follow_redirection": {
212-
Type: schema.TypeBool,
213-
Optional: true,
214-
Default: true,
212+
Type: schema.TypeBool,
213+
Optional: true,
214+
Default: true,
215215
Description: "Specifies whether to follow 3XX redirect to another origin server to pull data from.",
216216
},
217217
//"copy_origin_data": {
@@ -221,13 +221,13 @@ func dataSourceTencentCloudCosBuckets() *schema.Resource {
221221
// Description: "",
222222
//},
223223
"follow_http_headers": {
224-
Type: schema.TypeList,
224+
Type: schema.TypeList,
225225
Optional: true,
226226
Description: "Specifies the pass through headers when accessing the origin server.",
227227
Elem: &schema.Schema{Type: schema.TypeString},
228228
},
229229
"custom_http_headers": {
230-
Type: schema.TypeMap,
230+
Type: schema.TypeMap,
231231
Optional: true,
232232
Description: "Specifies the custom headers that you can add for COS to access your origin server.",
233233
},
@@ -245,35 +245,35 @@ func dataSourceTencentCloudCosBuckets() *schema.Resource {
245245
},
246246
},
247247
"origin_domain_rules": {
248-
Type: schema.TypeList,
249-
Computed: true,
248+
Type: schema.TypeList,
249+
Computed: true,
250250
Description: "Bucket origin domain rules.",
251251
Elem: &schema.Resource{
252252
Schema: map[string]*schema.Schema{
253253
"domain": {
254-
Type: schema.TypeString,
255-
Required: true,
254+
Type: schema.TypeString,
255+
Required: true,
256256
Description: "Specify domain host.",
257257
},
258258
"type": {
259-
Type: schema.TypeString,
260-
Optional: true,
261-
Default: "REST",
259+
Type: schema.TypeString,
260+
Optional: true,
261+
Default: "REST",
262262
Description: "Specify origin domain type, available values: `REST`, `WEBSITE`, `ACCELERATE`, default: `REST`.",
263263
},
264264
"status": {
265-
Type: schema.TypeString,
266-
Optional: true,
267-
Default: "ENABLED",
268-
Description: "Domain status, default: `ENABLED`.",
265+
Type: schema.TypeString,
266+
Optional: true,
267+
Default: "ENABLED",
268+
Description: "Domain status, default: `ENABLED`.",
269269
ValidateFunc: validateAllowedStringValue([]string{"ENABLED", "DISABLED"}),
270270
},
271271
},
272272
},
273273
},
274274
"acl_body": {
275-
Type: schema.TypeString,
276-
Computed: true,
275+
Type: schema.TypeString,
276+
Computed: true,
277277
Description: "Bucket acl configurations.",
278278
},
279279
"tags": {

0 commit comments

Comments
 (0)