Skip to content

Commit d581a97

Browse files
authored
Merge branch 'master' into master
2 parents 8b242ff + 066ff6d commit d581a97

File tree

62 files changed

+7403
-3219
lines changed

Some content is hidden

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

62 files changed

+7403
-3219
lines changed

.goreleaser.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Visit https://goreleaser.com for documentation on how to customize this
2+
# behavior.
3+
before:
4+
hooks:
5+
- go mod tidy
6+
builds:
7+
- env:
8+
- CGO_ENABLED=0
9+
mod_timestamp: '{{ .CommitTimestamp }}'
10+
flags:
11+
- -trimpath
12+
ldflags:
13+
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
14+
goos:
15+
- freebsd
16+
- windows
17+
- linux
18+
- darwin
19+
goarch:
20+
- amd64
21+
- '386'
22+
- arm
23+
- arm64
24+
ignore:
25+
- goos: darwin
26+
goarch: '386'
27+
binary: '{{ .ProjectName }}_v{{ .Version }}'
28+
archives:
29+
- format: zip
30+
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
31+
checksum:
32+
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
33+
algorithm: sha256
34+
signs:
35+
- artifacts: checksum
36+
args:
37+
# if you are using this is a GitHub action or some other automated pipeline, you
38+
# need to pass the batch flag to indicate its not interactive.
39+
- "--batch"
40+
- "--local-user"
41+
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
42+
- "--output"
43+
- "${signature}"
44+
- "--detach-sign"
45+
- "${artifact}"
46+
release:
47+
# Visit your project's GitHub Releases page to publish this release.
48+
draft: true
49+
changelog:
50+
skip: true

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,6 @@ matrix:
2929
- go: tip
3030

3131
env:
32-
global: GOFLAGS=-mod=vendor
32+
global:
33+
- GOFLAGS=-mod=vendor
34+
- GO111MODULE=on

CHANGELOG.md

Lines changed: 1094 additions & 1093 deletions
Large diffs are not rendered by default.

GNUmakefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO)))
131131
echo "$(WEBSITE_REPO) not found in your GOPATH (necessary for layouts and assets), getting..."
132132
git clone https://$(WEBSITE_REPO) $(GOPATH)/src/$(WEBSITE_REPO)
133133
endif
134+
ln -sf ../../../../ext/providers/tencentcloud/website/docs $(GOPATH)/src/github.com/hashicorp/terraform-website/content/source/docs/providers/tencentcloud
135+
ln -sf ../../../ext/providers/tencentcloud/website/tencentcloud.erb $(GOPATH)/src/github.com/hashicorp/terraform-website/content/source/layouts/tencentcloud.erb
134136
@$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME)
135137

136138
website-lint:
@@ -155,6 +157,8 @@ ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO)))
155157
echo "$(WEBSITE_REPO) not found in your GOPATH (necessary for layouts and assets), getting..."
156158
git clone https://$(WEBSITE_REPO) $(GOPATH)/src/$(WEBSITE_REPO)
157159
endif
160+
ln -sf ../../../../ext/providers/tencentcloud/website/docs $(GOPATH)/src/github.com/hashicorp/terraform-website/content/source/docs/providers/tencentcloud
161+
ln -sf ../../../ext/providers/tencentcloud/website/tencentcloud.erb $(GOPATH)/src/github.com/hashicorp/terraform-website/content/source/layouts/tencentcloud.erb
158162
@$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider-test PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME)
159163

160164
.PHONY: build sweep test testacc fmt fmtcheck lint tools test-compile doc hooks website website-lint website-test

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
## Requirements
44

5-
* [Terraform](https://www.terraform.io/downloads.html) 0.12.x
5+
* [Terraform](https://www.terraform.io/downloads.html) 0.13.x
66
* [Go](https://golang.org/doc/install) 1.13.x (to build the provider plugin)
77

88
## Usage
99

1010
### Build from source code
1111

12-
Clone repository to: `$GOPATH/src/github.com/terraform-providers/terraform-provider-tencentcloud`
12+
Clone repository to: `$GOPATH/src/github.com/tencentcloudstack/terraform-provider-tencentcloud`
1313

1414
```sh
15-
$ mkdir -p $GOPATH/src/github.com/terraform-providers
16-
$ cd $GOPATH/src/github.com/terraform-providers
17-
$ git clone https://github.com/terraform-providers/terraform-provider-tencentcloud
15+
$ mkdir -p $GOPATH/src/github.com/tencentcloudstack
16+
$ cd $GOPATH/src/github.com/tencentcloudstack
17+
$ git clone https://github.com/tencentcloudstack/terraform-provider-tencentcloud.git
1818
$ cd terraform-provider-tencentcloud
1919
$ go build .
2020
```

examples/tencentcloud-mongodb/main.tf

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
1+
provider "tencentcloud" {
2+
region = "ap-guangzhou"
3+
}
4+
5+
provider "tencentcloud" {
6+
alias = "shanghai"
7+
region = "ap-shanghai"
8+
}
9+
110
resource "tencentcloud_mongodb_instance" "mongodb" {
211
instance_name = "tf-mongodb-test"
312
memory = 4
413
volume = 100
5-
engine_version = "MONGO_36_WT"
6-
machine_type = "GIO"
14+
engine_version = "MONGO_40_WT"
15+
machine_type = "HIO10G"
716
available_zone = var.availability_zone
817
project_id = 0
918
password = "test1234"
1019

1120
tags = {
12-
"test" = "test"
21+
test = "test"
1322
}
1423
}
1524

@@ -26,14 +35,31 @@ resource "tencentcloud_mongodb_sharding_instance" "mongodb_sharding" {
2635
password = "test1234"
2736

2837
tags = {
29-
"test" = "test"
38+
test = "test"
3039
}
3140
}
3241

3342
data "tencentcloud_mongodb_instances" "mongodb_instances" {
3443
instance_id = tencentcloud_mongodb_instance.mongodb.id
3544

3645
tags = {
37-
"test" = "test"
46+
test = "test"
3847
}
3948
}
49+
50+
resource "tencentcloud_mongodb_standby_instance" "mongodb" {
51+
provider = tencentcloud.shanghai
52+
instance_name = "tf-mongodb-standby-test"
53+
memory = 4
54+
volume = 100
55+
available_zone = "ap-shanghai-2"
56+
project_id = 0
57+
father_instance_id = tencentcloud_mongodb_instance.mongodb.id
58+
father_instance_region = "ap-guangzhou"
59+
charge_type = "PREPAID"
60+
prepaid_period = 1
61+
62+
tags = {
63+
test = "test"
64+
}
65+
}

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,8 +458,8 @@ github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s
458458
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
459459
github.com/tdakkota/asciicheck v0.0.0-20200416190851-d7f85be797a2 h1:Xr9gkxfOP0KQWXKNqmwe8vEeSUiUj4Rlee9CMVX2ZUQ=
460460
github.com/tdakkota/asciicheck v0.0.0-20200416190851-d7f85be797a2/go.mod h1:yHp0ai0Z9gUljN3o0xMhYJnH/IcvkdTBOX2fmJ93JEM=
461-
github.com/tencentcloud/tencentcloud-sdk-go v3.0.221+incompatible h1:KfLv0pH+sYexx2FcvvPhek5kfiI14JB9JCTMkEWrNVE=
462-
github.com/tencentcloud/tencentcloud-sdk-go v3.0.221+incompatible/go.mod h1:0PfYow01SHPMhKY31xa+EFz2RStxIqj6JFAJS+IkCi4=
461+
github.com/tencentcloud/tencentcloud-sdk-go v3.0.217+incompatible h1:c0N5XTxnRv3e6lgIEw3Ml0RdIV0fA8qDRuVEhQnDViE=
462+
github.com/tencentcloud/tencentcloud-sdk-go v3.0.217+incompatible/go.mod h1:0PfYow01SHPMhKY31xa+EFz2RStxIqj6JFAJS+IkCi4=
463463
github.com/tetafro/godot v0.3.7 h1:+mecr7RKrUKB5UQ1gwqEMn13sDKTyDR8KNIquB9mm+8=
464464
github.com/tetafro/godot v0.3.7/go.mod h1:/7NLHhv08H1+8DNj0MElpAACw1ajsCuf3TKNQxA5S+0=
465465
github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e h1:RumXZ56IrCj4CL+g1b9OL/oH0QnsF976bC8xQFYUD5Q=

tencentcloud/connectivity/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
dc "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dc/v20180410"
2323
es "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/es/v20180416"
2424
gaap "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gaap/v20180529"
25-
mongodb "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mongodb/v20180408"
25+
mongodb "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mongodb/v20190725"
2626
monitor "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/monitor/v20180724"
2727
postgre "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres/v20170312"
2828
redis "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/redis/v20180412"

tencentcloud/data_source_tc_mongodb_instances.go

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,17 @@ func dataSourceTencentCloudMongodbInstances() *schema.Resource {
152152
Computed: true,
153153
Description: "Tags of the Mongodb instance.",
154154
},
155+
// payment
156+
"charge_type": {
157+
Type: schema.TypeString,
158+
Computed: true,
159+
Description: "The charge type of instance.",
160+
},
161+
"auto_renew_flag": {
162+
Type: schema.TypeInt,
163+
Computed: true,
164+
Description: "Auto renew flag.",
165+
},
155166
},
156167
},
157168
},
@@ -241,11 +252,11 @@ instancesLoop:
241252
}
242253

243254
switch *mongo.MachineType {
244-
case "HIO10G":
245-
*mongo.MachineType = MONGODB_MACHINE_TYPE_TGIO
255+
case MONGODB_MACHINE_TYPE_TGIO:
256+
*mongo.MachineType = MONGODB_MACHINE_TYPE_HIO10G
246257

247-
case "HIO":
248-
*mongo.MachineType = MONGODB_MACHINE_TYPE_GIO
258+
case MONGODB_MACHINE_TYPE_GIO:
259+
*mongo.MachineType = MONGODB_MACHINE_TYPE_HIO
249260
}
250261

251262
clusterType := MONGODB_CLUSTER_TYPE_REPLSET
@@ -272,6 +283,10 @@ instancesLoop:
272283
"machine_type": mongo.MachineType,
273284
"shard_quantity": mongo.ReplicationSetNum,
274285
"tags": respTags,
286+
"charge_type": MONGODB_CHARGE_TYPE[*mongo.PayMode],
287+
}
288+
if MONGODB_CHARGE_TYPE[*mongo.PayMode] == MONGODB_CHARGE_TYPE_PREPAID {
289+
_ = d.Set("auto_renew_flag", *mongo.AutoRenewFlag)
275290
}
276291
instanceList = append(instanceList, instance)
277292
ids = append(ids, *mongo.InstanceId)

tencentcloud/data_source_tc_mongodb_instances_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ func TestAccTencentCloudMongodbInstancesDataSource(t *testing.T) {
3232
resource.TestCheckResourceAttrSet("data.tencentcloud_mongodb_instances.mongodb_instances", "instance_list.0.cpu"),
3333
resource.TestCheckResourceAttr("data.tencentcloud_mongodb_instances.mongodb_instances", "instance_list.0.memory", "4"),
3434
resource.TestCheckResourceAttr("data.tencentcloud_mongodb_instances.mongodb_instances", "instance_list.0.volume", "100"),
35-
resource.TestCheckResourceAttr("data.tencentcloud_mongodb_instances.mongodb_instances", "instance_list.0.machine_type", "TGIO"),
35+
resource.TestCheckResourceAttr("data.tencentcloud_mongodb_instances.mongodb_instances", "instance_list.0.machine_type", MONGODB_MACHINE_TYPE_HIO10G),
3636
resource.TestCheckResourceAttrSet("data.tencentcloud_mongodb_instances.mongodb_instances", "instance_list.0.shard_quantity"),
3737
resource.TestCheckResourceAttr("data.tencentcloud_mongodb_instances.mongodb_instances", "instance_list.0.tags.test", "test"),
38+
resource.TestCheckResourceAttr("data.tencentcloud_mongodb_instances.mongodb_instances", "instance_list.0.charge_type", "POSTPAID"),
3839
),
3940
},
4041
},

0 commit comments

Comments
 (0)