Skip to content

Commit 664e668

Browse files
committed
add cam_role_name with TKE and encrypt with CVM
1 parent 4171c7f commit 664e668

File tree

14 files changed

+473
-14
lines changed

14 files changed

+473
-14
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
## 1.43.1 (Unreleased)
2+
3+
* Resource: `tencentcloud_instance` add new argument `encrypt` to support data disk with encrypt
4+
* Resource: `tencentcloud_kubernetes_cluster` add new argument `cam_role_name` to support authorization with instances
5+
26
## 1.43.0 (September 18, 2020)
37

48
FEATURES:

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ require (
1515
github.com/mattn/go-colorable v0.1.6 // indirect
1616
github.com/mitchellh/go-homedir v1.1.0
1717
github.com/pkg/errors v0.9.1
18-
github.com/tencentcloud/tencentcloud-sdk-go v1.0.15
18+
github.com/tencentcloud/tencentcloud-sdk-go v1.0.25
1919
github.com/yangwenmai/ratelimit v0.0.0-20180104140304-44221c2292e1
2020
github.com/zclconf/go-cty v1.4.2 // indirect
2121
golang.org/x/sys v0.0.0-20200523222454-059865788121 // indirect

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 v1.0.15 h1:tH8E3LWSRu4g0egqRNDWzHp6MRqRaNMOnxrgAnQfvYU=
462-
github.com/tencentcloud/tencentcloud-sdk-go v1.0.15/go.mod h1:asUz5BPXxgoPGaRgZaVm1iGcUAuHyYUo1nXqKa83cvI=
461+
github.com/tencentcloud/tencentcloud-sdk-go v1.0.25 h1:tLExcllerEwYTIx/58PA9r5v69uPfpc2yf6DLtDggTo=
462+
github.com/tencentcloud/tencentcloud-sdk-go v1.0.25/go.mod h1:asUz5BPXxgoPGaRgZaVm1iGcUAuHyYUo1nXqKa83cvI=
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/resource_tc_instance.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ resource "tencentcloud_instance" "my_awesome_app" {
5757
data_disks {
5858
data_disk_type = "CLOUD_PREMIUM"
5959
data_disk_size = 50
60+
encrypt = false
6061
}
6162
6263
tags = {
@@ -301,6 +302,13 @@ func resourceTencentCloudInstance() *schema.Resource {
301302
ForceNew: true,
302303
Description: "Decides whether the disk is deleted with instance(only applied to `CLOUD_BASIC`, `CLOUD_SSD` and `CLOUD_PREMIUM` disk with `POSTPAID_BY_HOUR` instance), default is true.",
303304
},
305+
"encrypt": {
306+
Type: schema.TypeBool,
307+
Optional: true,
308+
Default: false,
309+
ForceNew: true,
310+
Description: "Decides whether the disk is encrypted. Default is `false`.",
311+
},
304312
},
305313
},
306314
},
@@ -515,6 +523,10 @@ func resourceTencentCloudInstanceCreate(d *schema.ResourceData, meta interface{}
515523
dataDisk.DeleteWithInstance = &deleteWithInstanceBool
516524
}
517525

526+
if encrypt, ok := value["encrypt"]; ok {
527+
encryptBool := encrypt.(bool)
528+
dataDisk.Encrypt = &encryptBool
529+
}
518530
request.DataDisks = append(request.DataDisks, &dataDisk)
519531
}
520532
}
@@ -719,6 +731,7 @@ func resourceTencentCloudInstanceRead(d *schema.ResourceData, meta interface{})
719731
var (
720732
snapshotId, diskId string
721733
deleteWithInstanceBool bool
734+
encryptBool bool
722735
)
723736
diskType := value["data_disk_type"].(string)
724737
diskSize := int64(value["data_disk_size"].(int))
@@ -728,7 +741,9 @@ func resourceTencentCloudInstanceRead(d *schema.ResourceData, meta interface{})
728741
if deleteWithInstance, ok := value["delete_with_instance"]; ok {
729742
deleteWithInstanceBool = deleteWithInstance.(bool)
730743
}
731-
744+
if encrypt, ok := value["encrypt"]; ok {
745+
encryptBool = encrypt.(bool)
746+
}
732747
// find the disk id value
733748
for _, disk := range instance.DataDisks {
734749
if diskType == *disk.DiskType && diskSize == *disk.DiskSize &&
@@ -746,6 +761,7 @@ func resourceTencentCloudInstanceRead(d *schema.ResourceData, meta interface{})
746761
dataDisk["data_disk_size"] = diskSize
747762
dataDisk["data_disk_id"] = diskId
748763
dataDisk["delete_with_instance"] = deleteWithInstanceBool
764+
dataDisk["encrypt"] = encryptBool
749765
dataDiskList = append(dataDiskList, dataDisk)
750766
}
751767
}

tencentcloud/resource_tc_instance_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,7 @@ resource "tencentcloud_instance" "foo" {
570570
data_disk_type = "CLOUD_PREMIUM"
571571
data_disk_size = 100
572572
delete_with_instance = true
573+
encrypt = true
573574
}
574575
575576
data_disks {

tencentcloud/resource_tc_kubernetes_cluster.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ resource "tencentcloud_kubernetes_cluster" "managed_cluster" {
8383
enhanced_monitor_service = false
8484
user_data = "dGVzdA=="
8585
password = "ZZXXccvv1212"
86+
cam_role_name = "CVM_QcsRole"
8687
}
8788
8889
labels = {
@@ -348,6 +349,12 @@ func TkeCvmCreateInfo() map[string]*schema.Schema {
348349
Optional: true,
349350
Description: "ase64-encoded User Data text, the length limit is 16KB.",
350351
},
352+
"cam_role_name": {
353+
Type: schema.TypeString,
354+
ForceNew: true,
355+
Optional: true,
356+
Description: "CAM role name authorized to access.",
357+
},
351358
}
352359
}
353360

@@ -791,6 +798,10 @@ func tkeGetCvmRunInstancesPara(dMap map[string]interface{}, meta interface{},
791798

792799
}
793800

801+
if v, ok := dMap["cam_role_name"]; ok {
802+
request.CamRoleName = helper.String(v.(string))
803+
}
804+
794805
if v, ok := dMap["data_disk"]; ok {
795806

796807
dataDisks := v.([]interface{})

tencentcloud/resource_tc_kubernetes_cluster_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ resource "tencentcloud_kubernetes_cluster" "managed_cluster" {
181181
enhanced_monitor_service = false
182182
user_data = "dGVzdA=="
183183
password = "ZZXXccvv1212"
184+
cam_role_name = "CVM_QcsRole"
184185
}
185186
186187
cluster_deploy_type = "MANAGED_CLUSTER"

vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312/client.go

Lines changed: 75 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)