Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion tencentcloud/resource_tc_kubernetes_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,16 @@ func TkeCvmCreateInfo() map[string]*schema.Schema {
Optional: true,
Description: "Data disk snapshot ID.",
},
"encrypt": {
Type: schema.TypeBool,
Optional: true,
Description: "Indicates whether to encrypt data disk, default `false`.",
},
"kms_key_id": {
Type: schema.TypeString,
Optional: true,
Description: "ID of the custom CMK in the format of UUID or `kms-abcd1234`. This parameter is used to encrypt cloud disks.",
},
"file_system": {
Type: schema.TypeString,
ForceNew: true,
Expand Down Expand Up @@ -1503,14 +1513,24 @@ func tkeGetCvmRunInstancesPara(dMap map[string]interface{}, meta interface{},
diskType = value["disk_type"].(string)
diskSize = int64(value["disk_size"].(int))
snapshotId = value["snapshot_id"].(string)
encrypt = value["encrypt"].(bool)
kmsKeyId = value["kms_key_id"].(string)
dataDisk = cvm.DataDisk{
DiskType: &diskType,
DiskSize: &diskSize,
}
)
if diskSize > 0 {
dataDisk.DiskSize = &diskSize
}
if snapshotId != "" {
dataDisk.SnapshotId = &snapshotId
}
if encrypt {
dataDisk.Encrypt = &encrypt
}
if kmsKeyId != "" {
dataDisk.KmsKeyId = &kmsKeyId
}
request.DataDisks = append(request.DataDisks, &dataDisk)
}
}
Expand Down
4 changes: 3 additions & 1 deletion tencentcloud/resource_tc_kubernetes_cluster_attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,13 +325,15 @@ func tkeGetInstanceAdvancedPara(dMap map[string]interface{}, meta interface{}) (
diskPartition = value["disk_partition"].(string)
dataDisk = tke.DataDisk{
DiskType: &diskType,
DiskSize: &diskSize,
FileSystem: &fileSystem,
AutoFormatAndMount: &autoFormatAndMount,
MountTarget: &mountTarget,
DiskPartition: &diskPartition,
}
)
if diskSize > 0 {
dataDisk.DiskSize = &diskSize
}
setting.DataDisks = append(setting.DataDisks, &dataDisk)
}
}
Expand Down
22 changes: 8 additions & 14 deletions tencentcloud/resource_tc_kubernetes_node_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,9 @@ func composedKubernetesAsScalingConfigParaSerial(dMap map[string]interface{}, me
deleteWithInstance, dOk := value["delete_with_instance"].(bool)
dataDisk := as.DataDisk{
DiskType: &diskType,
DiskSize: &diskSize,
}
if diskSize > 0 {
dataDisk.DiskSize = &diskSize
}
if snapshotId != "" {
dataDisk.SnapshotId = &snapshotId
Expand Down Expand Up @@ -796,7 +798,9 @@ func composeAsLaunchConfigModifyRequest(d *schema.ResourceData, launchConfigId s
deleteWithInstance, dOk := value["delete_with_instance"].(bool)
dataDisk := as.DataDisk{
DiskType: &diskType,
DiskSize: &diskSize,
}
if diskSize > 0 {
dataDisk.DiskSize = &diskSize
}
if snapshotId != "" {
dataDisk.SnapshotId = &snapshotId
Expand Down Expand Up @@ -1127,7 +1131,6 @@ func resourceKubernetesNodePoolCreate(d *schema.ResourceData, meta interface{})
logId = getLogId(contextNil)
ctx = context.WithValue(context.TODO(), logIdKey, logId)
clusterId = d.Get("cluster_id").(string)
nodeConfig = d.Get("node_config").([]interface{})
enableAutoScale = d.Get("enable_auto_scale").(bool)
configParas = d.Get("auto_scaling_config").([]interface{})
name = d.Get("name").(string)
Expand All @@ -1137,10 +1140,6 @@ func resourceKubernetesNodePoolCreate(d *schema.ResourceData, meta interface{})
return fmt.Errorf("need only one auto_scaling_config")
}

if len(nodeConfig) > 1 {
return fmt.Errorf("need only one node_config")
}

groupParaStr, err := composeParameterToAsScalingGroupParaSerial(d)
if err != nil {
return err
Expand All @@ -1155,13 +1154,8 @@ func resourceKubernetesNodePoolCreate(d *schema.ResourceData, meta interface{})
taints := GetTkeTaints(d, "taints")

//compose InstanceAdvancedSettings
if workConfig, ok := d.GetOk("node_config"); ok {
workConfigList := workConfig.([]interface{})
if len(workConfigList) == 1 {
workConfigPara := workConfigList[0].(map[string]interface{})
setting := tkeGetInstanceAdvancedPara(workConfigPara, meta)
iAdvanced = setting
}
if workConfig, ok := helper.InterfacesHeadMap(d, "node_config"); ok {
iAdvanced = tkeGetInstanceAdvancedPara(workConfig, meta)
}

if temp, ok := d.GetOk("extra_args"); ok {
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/kubernetes_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,9 @@ The `data_disk` object supports the following:
* `disk_partition` - (Optional, ForceNew) The name of the device or partition to mount.
* `disk_size` - (Optional, ForceNew) Volume of disk in GB. Default is `0`.
* `disk_type` - (Optional, ForceNew) Types of disk, available values: `CLOUD_PREMIUM` and `CLOUD_SSD` and `CLOUD_HSSD` and `CLOUD_TSSD`.
* `encrypt` - (Optional) Indicates whether to encrypt data disk, default `false`.
* `file_system` - (Optional, ForceNew) File system, e.g. `ext3/ext4/xfs`.
* `kms_key_id` - (Optional) ID of the custom CMK in the format of UUID or `kms-abcd1234`. This parameter is used to encrypt cloud disks.
* `mount_target` - (Optional, ForceNew) Mount target.
* `snapshot_id` - (Optional, ForceNew) Data disk snapshot ID.

Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/kubernetes_scale_worker.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ The `data_disk` object supports the following:
* `disk_partition` - (Optional, ForceNew) The name of the device or partition to mount.
* `disk_size` - (Optional, ForceNew) Volume of disk in GB. Default is `0`.
* `disk_type` - (Optional, ForceNew) Types of disk, available values: `CLOUD_PREMIUM` and `CLOUD_SSD` and `CLOUD_HSSD` and `CLOUD_TSSD`.
* `encrypt` - (Optional) Indicates whether to encrypt data disk, default `false`.
* `file_system` - (Optional, ForceNew) File system, e.g. `ext3/ext4/xfs`.
* `kms_key_id` - (Optional) ID of the custom CMK in the format of UUID or `kms-abcd1234`. This parameter is used to encrypt cloud disks.
* `mount_target` - (Optional, ForceNew) Mount target.
* `snapshot_id` - (Optional, ForceNew) Data disk snapshot ID.

Expand Down