diff --git a/tencentcloud/extension_cvm.go b/tencentcloud/extension_cvm.go index 1f189151bf..a537d405ed 100644 --- a/tencentcloud/extension_cvm.go +++ b/tencentcloud/extension_cvm.go @@ -51,6 +51,9 @@ const ( CVM_ZONE_NOT_SUPPORT_ERROR = "InvalidParameterValue.ZoneNotSupported" CVM_CLOUD_DISK_SOLD_OUT_ERROR = "ResourceInsufficient.CloudDiskSoldOut" + + CVM_STOP_MODE_KEEP_CHARGING = "KEEP_CHARGING" + CVM_STOP_MODE_STOP_CHARGING = "STOP_CHARGING" ) var CVM_CHARGE_TYPE = []string{ diff --git a/tencentcloud/resource_tc_instance.go b/tencentcloud/resource_tc_instance.go index 1d7c0e8950..b1427b3ef0 100644 --- a/tencentcloud/resource_tc_instance.go +++ b/tencentcloud/resource_tc_instance.go @@ -78,14 +78,14 @@ resource "tencentcloud_cdh_instance" "foo" { host_type = "HM50" charge_type = "PREPAID" instance_charge_type_prepaid_period = 1 - host_name = "test" + hostname = "test" prepaid_renew_flag = "DISABLE_NOTIFY_AND_MANUAL_RENEW" } data "tencentcloud_cdh_instances" "list" { availability_zone = var.availability_zone host_id = tencentcloud_cdh_instance.foo.id - host_name = "test" + hostname = "test" host_state = "RUNNING" } @@ -167,8 +167,7 @@ func resourceTencentCloudInstance() *schema.Resource { "image_id": { Type: schema.TypeString, Required: true, - ForceNew: true, - Description: "The image to use for the instance. Changing `image_id` will cause the instance to be destroyed and re-created.", + Description: "The image to use for the instance. Changing `image_id` will cause the instance reset.", }, "availability_zone": { Type: schema.TypeString, @@ -180,6 +179,7 @@ func resourceTencentCloudInstance() *schema.Resource { Type: schema.TypeInt, Optional: true, Default: 1, + Deprecated: "It has been deprecated from version 1.59.17. Use built-in `count` instead.", ValidateFunc: validateIntegerInRange(1, 100), Description: "The number of instances to be purchased. Value range:[1,100]; default value: 1.", }, @@ -200,8 +200,7 @@ func resourceTencentCloudInstance() *schema.Resource { "hostname": { Type: schema.TypeString, Optional: true, - ForceNew: true, - Description: "The hostname of the instance. Windows instance: The name should be a combination of 2 to 15 characters comprised of letters (case insensitive), numbers, and hyphens (-). Period (.) is not supported, and the name cannot be a string of pure numbers. Other types (such as Linux) of instances: The name should be a combination of 2 to 60 characters, supporting multiple periods (.). The piece between two periods is composed of letters (case insensitive), numbers, and hyphens (-).", + Description: "The hostname of the instance. Windows instance: The name should be a combination of 2 to 15 characters comprised of letters (case insensitive), numbers, and hyphens (-). Period (.) is not supported, and the name cannot be a string of pure numbers. Other types (such as Linux) of instances: The name should be a combination of 2 to 60 characters, supporting multiple periods (.). The piece between two periods is composed of letters (case insensitive), numbers, and hyphens (-). Modifying will cause the instance reset.", }, "project_id": { Type: schema.TypeInt, @@ -215,6 +214,15 @@ func resourceTencentCloudInstance() *schema.Resource { Default: true, Description: "Set instance to running or stop. Default value is true, the instance will shutdown when this flag is false.", }, + "stopped_mode": { + Type: schema.TypeString, + Optional: true, + Description: "Billing method of a pay-as-you-go instance after shutdown. Available values: `KEEP_CHARGING`,`STOP_CHARGING`. Default `KEEP_CHARGING`.", + ValidateFunc: validateAllowedStringValue([]string{ + CVM_STOP_MODE_KEEP_CHARGING, + CVM_STOP_MODE_STOP_CHARGING, + }), + }, "placement_group_id": { Type: schema.TypeString, Optional: true, @@ -234,14 +242,14 @@ func resourceTencentCloudInstance() *schema.Resource { Type: schema.TypeInt, Optional: true, ValidateFunc: validateAllowedIntValue(CVM_PREPAID_PERIOD), - Description: "The tenancy (time unit is month) of the prepaid instance, NOTE: it only works when instance_charge_type is set to `PREPAID`. Valid values are `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, `12`, `24`, `36`.", + Description: "The tenancy (time unit is month) of the prepaid instance, NOTE: it only works when instance_charge_type is set to `PREPAID`. Valid values are `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, `12`, `24`, `36`. Modifying will cause the instance reset.", }, "instance_charge_type_prepaid_renew_flag": { Type: schema.TypeString, Optional: true, Computed: true, ValidateFunc: validateAllowedStringValue(CVM_PREPAID_RENEW_FLAG), - Description: "Auto renewal flag. Valid values: `NOTIFY_AND_AUTO_RENEW`: notify upon expiration and renew automatically, `NOTIFY_AND_MANUAL_RENEW`: notify upon expiration but do not renew automatically, `DISABLE_NOTIFY_AND_MANUAL_RENEW`: neither notify upon expiration nor renew automatically. Default value: `NOTIFY_AND_MANUAL_RENEW`. If this parameter is specified as `NOTIFY_AND_AUTO_RENEW`, the instance will be automatically renewed on a monthly basis if the account balance is sufficient. NOTE: it only works when instance_charge_type is set to `PREPAID`.", + Description: "Auto renewal flag. Valid values: `NOTIFY_AND_AUTO_RENEW`: notify upon expiration and renew automatically, `NOTIFY_AND_MANUAL_RENEW`: notify upon expiration but do not renew automatically, `DISABLE_NOTIFY_AND_MANUAL_RENEW`: neither notify upon expiration nor renew automatically. Default value: `NOTIFY_AND_MANUAL_RENEW`. If this parameter is specified as `NOTIFY_AND_AUTO_RENEW`, the instance will be automatically renewed on a monthly basis if the account balance is sufficient. NOTE: it only works when instance_charge_type is set to `PREPAID`. Modifying will cause the instance reset.", }, "spot_instance_type": { Type: schema.TypeString, @@ -439,9 +447,8 @@ func resourceTencentCloudInstance() *schema.Resource { return old == new } }, - ForceNew: true, ConflictsWith: []string{"key_name", "password"}, - Description: "Whether to keep image login or not, default is `false`. When the image type is private or shared or imported, this parameter can be set `true`.", + Description: "Whether to keep image login or not, default is `false`. When the image type is private or shared or imported, this parameter can be set `true`. Modifying will cause the instance reset.", }, "user_data": { Type: schema.TypeString, @@ -797,7 +804,8 @@ func resourceTencentCloudInstanceCreate(d *schema.ResourceData, meta interface{} } if !(d.Get("running_flag").(bool)) { - err = cvmService.StopInstance(ctx, instanceId) + stoppedMode := d.Get("stopped_mode").(string) + err = cvmService.StopInstance(ctx, instanceId, stoppedMode) if err != nil { return err } @@ -838,9 +846,6 @@ func resourceTencentCloudInstanceRead(d *schema.ResourceData, meta interface{}) cvmService := CvmService{ client: client, } - tkeService := TkeService{ - client: client, - } var instance *cvm.Instance var errRet error err := resource.Retry(readRetryTimeout, func() *resource.RetryError { @@ -858,9 +863,17 @@ func resourceTencentCloudInstanceRead(d *schema.ResourceData, meta interface{}) return nil } - var tkeImages []string + var cvmImages []string + var response *cvm.DescribeImagesResponse err = resource.Retry(readRetryTimeout, func() *resource.RetryError { - tkeImages, errRet = tkeService.DescribeImages(ctx) + request := cvm.NewDescribeImagesRequest() + response, errRet = client.UseCvmClient().DescribeImages(request) + if *response.Response.TotalCount > 0 { + for i := range response.Response.ImageSet { + image := response.Response.ImageSet[i] + cvmImages = append(cvmImages, *image.ImageId) + } + } if errRet != nil { return retryError(errRet, InternalError) } @@ -871,7 +884,7 @@ func resourceTencentCloudInstanceRead(d *schema.ResourceData, meta interface{}) return err } - if d.Get("image_id").(string) == "" || !IsContains(tkeImages, *instance.ImageId) { + if d.Get("image_id").(string) == "" || !IsContains(cvmImages, *instance.ImageId) { _ = d.Set("image_id", instance.ImageId) } @@ -1038,6 +1051,152 @@ func resourceTencentCloudInstanceUpdate(d *schema.ResourceData, meta interface{} d.SetPartial("project_id") } + // Reset Instance + // Keep Login Info + if d.HasChange("image_id") || + d.HasChange("host_name") || + d.HasChange("disable_security_service") || + d.HasChange("disable_monitor_service") || + d.HasChange("keep_image_login") { + + var updateAttr []string + + request := cvm.NewResetInstanceRequest() + request.InstanceId = helper.String(d.Id()) + + if v, ok := d.GetOk("image_id"); ok { + updateAttr = append(updateAttr, "image_id") + request.ImageId = helper.String(v.(string)) + } + if v, ok := d.GetOk("hostname"); ok { + updateAttr = append(updateAttr, "hostname") + request.HostName = helper.String(v.(string)) + } + + // enhanced service + request.EnhancedService = &cvm.EnhancedService{} + if d.HasChange("disable_security_service") { + updateAttr = append(updateAttr, "disable_security_service") + v := d.Get("disable_security_service") + securityService := v.(bool) + request.EnhancedService.SecurityService = &cvm.RunSecurityServiceEnabled{ + Enabled: &securityService, + } + } + + if d.HasChange("disable_monitor_service") { + updateAttr = append(updateAttr, "disable_monitor_service") + v := d.Get("disable_monitor_service") + monitorService := !(v.(bool)) + request.EnhancedService.MonitorService = &cvm.RunMonitorServiceEnabled{ + Enabled: &monitorService, + } + } + + // Modify or keep login info when instance reset + request.LoginSettings = &cvm.LoginSettings{} + + if v, ok := d.GetOk("password"); ok { + updateAttr = append(updateAttr, "password") + request.LoginSettings.Password = helper.String(v.(string)) + } + + if v, ok := d.GetOk("key_name"); ok { + updateAttr = append(updateAttr, "key_name") + request.LoginSettings.KeyIds = []*string{helper.String(v.(string))} + } + + if d.HasChange("keep_image_login") { + updateAttr = append(updateAttr, "keep_image_login") + } + + if v := d.Get("keep_image_login").(bool); v { + request.LoginSettings.KeepImageLogin = helper.String(CVM_IMAGE_LOGIN) + } else { + request.LoginSettings.KeepImageLogin = helper.String(CVM_IMAGE_LOGIN_NOT) + } + + if err := cvmService.ResetInstance(ctx, request); err != nil { + return err + } + + for _, attr := range updateAttr { + d.SetPartial(attr) + } + + // Modify Login Info Directly + } else { + if d.HasChange("password") { + err := cvmService.ModifyPassword(ctx, instanceId, d.Get("password").(string)) + if err != nil { + return err + } + d.SetPartial("password") + time.Sleep(10 * time.Second) + err = resource.Retry(2*readRetryTimeout, func() *resource.RetryError { + instance, errRet := cvmService.DescribeInstanceById(ctx, instanceId) + if errRet != nil { + return retryError(errRet, InternalError) + } + if instance != nil && *instance.LatestOperationState == CVM_LATEST_OPERATION_STATE_OPERATING { + return resource.RetryableError(fmt.Errorf("cvm instance latest operetion status is %s, retry...", *instance.LatestOperationState)) + } + return nil + }) + if err != nil { + return err + } + } + + if d.HasChange("key_name") { + old, new := d.GetChange("key_name") + oldKeyId := old.(string) + keyId := new.(string) + if oldKeyId != "" { + err := cvmService.UnbindKeyPair(ctx, oldKeyId, []*string{&instanceId}) + if err != nil { + return err + } + time.Sleep(10 * time.Second) + err = resource.Retry(2*readRetryTimeout, func() *resource.RetryError { + instance, errRet := cvmService.DescribeInstanceById(ctx, instanceId) + if errRet != nil { + return retryError(errRet, InternalError) + } + if instance != nil && *instance.LatestOperationState == CVM_LATEST_OPERATION_STATE_OPERATING { + return resource.RetryableError(fmt.Errorf("cvm instance latest operetion status is %s, retry...", *instance.LatestOperationState)) + } + return nil + }) + if err != nil { + return err + } + } + + if keyId != "" { + err = cvmService.BindKeyPair(ctx, keyId, instanceId) + if err != nil { + return err + } + time.Sleep(10 * time.Second) + err = resource.Retry(2*readRetryTimeout, func() *resource.RetryError { + instance, errRet := cvmService.DescribeInstanceById(ctx, instanceId) + if errRet != nil { + return retryError(errRet, InternalError) + } + if instance != nil && *instance.LatestOperationState == CVM_LATEST_OPERATION_STATE_OPERATING { + return resource.RetryableError(fmt.Errorf("cvm instance latest operetion status is %s, retry...", *instance.LatestOperationState)) + } + return nil + }) + if err != nil { + return err + } + } + d.SetPartial("key_name") + } + } + var flag bool if d.HasChange("running_flag") { flag = d.Get("running_flag").(bool) @@ -1060,7 +1219,8 @@ func resourceTencentCloudInstanceUpdate(d *schema.ResourceData, meta interface{} return err } } else { - err = cvmService.StopInstance(ctx, instanceId) + stoppedMode := d.Get("stopped_mode").(string) + err = cvmService.StopInstance(ctx, instanceId, stoppedMode) if err != nil { return err } @@ -1133,76 +1293,6 @@ func resourceTencentCloudInstanceUpdate(d *schema.ResourceData, meta interface{} } } - if d.HasChange("password") { - err := cvmService.ModifyPassword(ctx, instanceId, d.Get("password").(string)) - if err != nil { - return err - } - d.SetPartial("password") - time.Sleep(10 * time.Second) - err = resource.Retry(2*readRetryTimeout, func() *resource.RetryError { - instance, errRet := cvmService.DescribeInstanceById(ctx, instanceId) - if errRet != nil { - return retryError(errRet, InternalError) - } - if instance != nil && *instance.LatestOperationState == CVM_LATEST_OPERATION_STATE_OPERATING { - return resource.RetryableError(fmt.Errorf("cvm instance latest operetion status is %s, retry...", *instance.LatestOperationState)) - } - return nil - }) - if err != nil { - return err - } - } - - if d.HasChange("key_name") { - old, new := d.GetChange("key_name") - oldKeyId := old.(string) - keyId := new.(string) - if oldKeyId != "" { - err := cvmService.UnbindKeyPair(ctx, oldKeyId, []*string{&instanceId}) - if err != nil { - return err - } - time.Sleep(10 * time.Second) - err = resource.Retry(2*readRetryTimeout, func() *resource.RetryError { - instance, errRet := cvmService.DescribeInstanceById(ctx, instanceId) - if errRet != nil { - return retryError(errRet, InternalError) - } - if instance != nil && *instance.LatestOperationState == CVM_LATEST_OPERATION_STATE_OPERATING { - return resource.RetryableError(fmt.Errorf("cvm instance latest operetion status is %s, retry...", *instance.LatestOperationState)) - } - return nil - }) - if err != nil { - return err - } - } - - if keyId != "" { - err = cvmService.BindKeyPair(ctx, keyId, instanceId) - if err != nil { - return err - } - time.Sleep(10 * time.Second) - err = resource.Retry(2*readRetryTimeout, func() *resource.RetryError { - instance, errRet := cvmService.DescribeInstanceById(ctx, instanceId) - if errRet != nil { - return retryError(errRet, InternalError) - } - if instance != nil && *instance.LatestOperationState == CVM_LATEST_OPERATION_STATE_OPERATING { - return resource.RetryableError(fmt.Errorf("cvm instance latest operetion status is %s, retry...", *instance.LatestOperationState)) - } - return nil - }) - if err != nil { - return err - } - } - d.SetPartial("key_name") - } - if d.HasChange("vpc_id") || d.HasChange("subnet_id") || d.HasChange("private_ip") { vpcId := d.Get("vpc_id").(string) subnetId := d.Get("subnet_id").(string) diff --git a/tencentcloud/service_tencentcloud_cvm.go b/tencentcloud/service_tencentcloud_cvm.go index c121ff3e7b..2972d1551e 100644 --- a/tencentcloud/service_tencentcloud_cvm.go +++ b/tencentcloud/service_tencentcloud_cvm.go @@ -225,10 +225,13 @@ func (me *CvmService) ModifyVpc(ctx context.Context, instanceId, vpcId, subnetId return nil } -func (me *CvmService) StopInstance(ctx context.Context, instanceId string) error { +func (me *CvmService) StopInstance(ctx context.Context, instanceId string, stoppedMode string) error { logId := getLogId(ctx) request := cvm.NewStopInstancesRequest() request.InstanceIds = []*string{&instanceId} + if stoppedMode != "" { + request.StoppedMode = &stoppedMode + } ratelimit.Check(request.GetAction()) response, err := me.client.UseCvmClient().StopInstances(request) @@ -279,6 +282,23 @@ func (me *CvmService) DeleteInstance(ctx context.Context, instanceId string) err return nil } +func (me *CvmService) ResetInstance(ctx context.Context, request *cvm.ResetInstanceRequest) (errRet error) { + logId := getLogId(ctx) + ratelimit.Check(request.GetAction()) + + response, err := me.client.UseCvmClient().ResetInstance(request) + + if err != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, request.GetAction(), request.ToJsonString(), err.Error()) + return err + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + + return nil +} + func (me *CvmService) DescribeInstanceTypes(ctx context.Context, zone string) (instanceTypes []*cvm.InstanceTypeConfig, errRet error) { logId := getLogId(ctx) request := cvm.NewDescribeInstanceTypeConfigsRequest() diff --git a/website/docs/r/eks_cluster.html.markdown b/website/docs/r/eks_cluster.html.markdown index 1538d50345..4067982686 100644 --- a/website/docs/r/eks_cluster.html.markdown +++ b/website/docs/r/eks_cluster.html.markdown @@ -58,17 +58,17 @@ resource "tencentcloud_eks_cluster" "foo" { The following arguments are supported: +* `cluster_name` - (Required) Name of EKS cluster. +* `k8s_version` - (Required, ForceNew) Kubernetes version of EKS cluster. +* `subnet_ids` - (Required) Subnet Ids for EKS cluster. +* `vpc_id` - (Required, ForceNew) Vpc Id of EKS cluster. * `cluster_desc` - (Optional) Description of EKS cluster. -* `cluster_name` - (Optional) Name of EKS cluster. * `dns_servers` - (Optional) List of cluster custom DNS Server info. * `enable_vpc_core_dns` - (Optional, ForceNew) Indicates whether to enable dns in user cluster, default value is `true`. * `extra_param` - (Optional, ForceNew) Extend parameters. -* `k8s_version` - (Optional, ForceNew) Kubernetes version of EKS cluster. * `need_delete_cbs` - (Optional) Delete CBS after EKS cluster remove. * `service_subnet_id` - (Optional) Subnet id of service. -* `subnet_ids` - (Optional) Subnet Ids for EKS cluster. * `tags` - (Optional) Tags of EKS cluster. -* `vpc_id` - (Optional, ForceNew) Vpc Id of EKS cluster. The `dns_servers` object supports the following: diff --git a/website/docs/r/instance.html.markdown b/website/docs/r/instance.html.markdown index 61cf6f6c52..a546c9289f 100644 --- a/website/docs/r/instance.html.markdown +++ b/website/docs/r/instance.html.markdown @@ -89,14 +89,14 @@ resource "tencentcloud_cdh_instance" "foo" { host_type = "HM50" charge_type = "PREPAID" instance_charge_type_prepaid_period = 1 - host_name = "test" + hostname = "test" prepaid_renew_flag = "DISABLE_NOTIFY_AND_MANUAL_RENEW" } data "tencentcloud_cdh_instances" "list" { availability_zone = var.availability_zone host_id = tencentcloud_cdh_instance.foo.id - host_name = "test" + hostname = "test" host_state = "RUNNING" } @@ -142,7 +142,7 @@ resource "tencentcloud_instance" "foo" { The following arguments are supported: * `availability_zone` - (Required, ForceNew) The available zone for the CVM instance. -* `image_id` - (Required, ForceNew) The image to use for the instance. Changing `image_id` will cause the instance to be destroyed and re-created. +* `image_id` - (Required) The image to use for the instance. Changing `image_id` will cause the instance reset. * `allocate_public_ip` - (Optional, ForceNew) Associate a public IP address with an instance in a VPC or Classic. Boolean value, Default is false. * `bandwidth_package_id` - (Optional) bandwidth package id. if user is standard user, then the bandwidth_package_id is needed, or default has bandwidth_package_id. * `cam_role_name` - (Optional, ForceNew) CAM role name authorized to access. @@ -152,16 +152,16 @@ The following arguments are supported: * `disable_monitor_service` - (Optional) Disable enhance service for monitor, it is enabled by default. When this options is set, monitor agent won't be installed. * `disable_security_service` - (Optional) Disable enhance service for security, it is enabled by default. When this options is set, security agent won't be installed. * `force_delete` - (Optional) Indicate whether to force delete the instance. Default is `false`. If set true, the instance will be permanently deleted instead of being moved into the recycle bin. Note: only works for `PREPAID` instance. -* `hostname` - (Optional, ForceNew) The hostname of the instance. Windows instance: The name should be a combination of 2 to 15 characters comprised of letters (case insensitive), numbers, and hyphens (-). Period (.) is not supported, and the name cannot be a string of pure numbers. Other types (such as Linux) of instances: The name should be a combination of 2 to 60 characters, supporting multiple periods (.). The piece between two periods is composed of letters (case insensitive), numbers, and hyphens (-). -* `instance_charge_type_prepaid_period` - (Optional) The tenancy (time unit is month) of the prepaid instance, NOTE: it only works when instance_charge_type is set to `PREPAID`. Valid values are `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, `12`, `24`, `36`. -* `instance_charge_type_prepaid_renew_flag` - (Optional) Auto renewal flag. Valid values: `NOTIFY_AND_AUTO_RENEW`: notify upon expiration and renew automatically, `NOTIFY_AND_MANUAL_RENEW`: notify upon expiration but do not renew automatically, `DISABLE_NOTIFY_AND_MANUAL_RENEW`: neither notify upon expiration nor renew automatically. Default value: `NOTIFY_AND_MANUAL_RENEW`. If this parameter is specified as `NOTIFY_AND_AUTO_RENEW`, the instance will be automatically renewed on a monthly basis if the account balance is sufficient. NOTE: it only works when instance_charge_type is set to `PREPAID`. +* `hostname` - (Optional) The hostname of the instance. Windows instance: The name should be a combination of 2 to 15 characters comprised of letters (case insensitive), numbers, and hyphens (-). Period (.) is not supported, and the name cannot be a string of pure numbers. Other types (such as Linux) of instances: The name should be a combination of 2 to 60 characters, supporting multiple periods (.). The piece between two periods is composed of letters (case insensitive), numbers, and hyphens (-). Modifying will cause the instance reset. +* `instance_charge_type_prepaid_period` - (Optional) The tenancy (time unit is month) of the prepaid instance, NOTE: it only works when instance_charge_type is set to `PREPAID`. Valid values are `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, `12`, `24`, `36`. Modifying will cause the instance reset. +* `instance_charge_type_prepaid_renew_flag` - (Optional) Auto renewal flag. Valid values: `NOTIFY_AND_AUTO_RENEW`: notify upon expiration and renew automatically, `NOTIFY_AND_MANUAL_RENEW`: notify upon expiration but do not renew automatically, `DISABLE_NOTIFY_AND_MANUAL_RENEW`: neither notify upon expiration nor renew automatically. Default value: `NOTIFY_AND_MANUAL_RENEW`. If this parameter is specified as `NOTIFY_AND_AUTO_RENEW`, the instance will be automatically renewed on a monthly basis if the account balance is sufficient. NOTE: it only works when instance_charge_type is set to `PREPAID`. Modifying will cause the instance reset. * `instance_charge_type` - (Optional, ForceNew) The charge type of instance. Valid values are `PREPAID`, `POSTPAID_BY_HOUR`, `SPOTPAID` and `CDHPAID`. The default is `POSTPAID_BY_HOUR`. Note: TencentCloud International only supports `POSTPAID_BY_HOUR` and `CDHPAID`. `PREPAID` instance may not allow to delete before expired. `SPOTPAID` instance must set `spot_instance_type` and `spot_max_price` at the same time. `CDHPAID` instance must set `cdh_instance_type` and `cdh_host_id`. -* `instance_count` - (Optional) The number of instances to be purchased. Value range:[1,100]; default value: 1. +* `instance_count` - (Optional, **Deprecated**) It has been deprecated from version 1.59.17. Use built-in `count` instead. The number of instances to be purchased. Value range:[1,100]; default value: 1. * `instance_name` - (Optional) The name of the instance. The max length of instance_name is 60, and default value is `Terraform-CVM-Instance`. * `instance_type` - (Optional) The type of the instance. * `internet_charge_type` - (Optional, ForceNew) Internet charge type of the instance, Valid values are `BANDWIDTH_PREPAID`, `TRAFFIC_POSTPAID_BY_HOUR`, `BANDWIDTH_POSTPAID_BY_HOUR` and `BANDWIDTH_PACKAGE`. This value does not need to be set when `allocate_public_ip` is false. * `internet_max_bandwidth_out` - (Optional) Maximum outgoing bandwidth to the public network, measured in Mbps (Mega bits per second). This value does not need to be set when `allocate_public_ip` is false. -* `keep_image_login` - (Optional, ForceNew) Whether to keep image login or not, default is `false`. When the image type is private or shared or imported, this parameter can be set `true`. +* `keep_image_login` - (Optional) Whether to keep image login or not, default is `false`. When the image type is private or shared or imported, this parameter can be set `true`. Modifying will cause the instance reset. * `key_name` - (Optional) The key pair to use for the instance, it looks like `skey-16jig7tx`. * `password` - (Optional) Password for the instance. In order for the new password to take effect, the instance will be restarted after the password change. * `placement_group_id` - (Optional, ForceNew) The ID of a placement group. @@ -171,6 +171,7 @@ The following arguments are supported: * `security_groups` - (Optional) A list of security group IDs to associate with. * `spot_instance_type` - (Optional) Type of spot instance, only support `ONE-TIME` now. Note: it only works when instance_charge_type is set to `SPOTPAID`. * `spot_max_price` - (Optional, ForceNew) Max price of a spot instance, is the format of decimal string, for example "0.50". Note: it only works when instance_charge_type is set to `SPOTPAID`. +* `stopped_mode` - (Optional) Billing method of a pay-as-you-go instance after shutdown. Available values: `KEEP_CHARGING`,`STOP_CHARGING`. Default `KEEP_CHARGING`. * `subnet_id` - (Optional) The ID of a VPC subnet. If you want to create instances in a VPC network, this parameter must be set. * `system_disk_id` - (Optional) System disk snapshot ID used to initialize the system disk. When system disk type is `LOCAL_BASIC` and `LOCAL_SSD`, disk id is not supported. * `system_disk_size` - (Optional, ForceNew) Size of the system disk. Valid value ranges: (50~1000). and unit is GB. Default is 50GB.