Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cvm): [137843507] Modify multiple cvm doc #3157

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
15 changes: 15 additions & 0 deletions .changelog/3157.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```release-note:enhancement
resource/tencentcloud_eip_association: update doc
```

```release-note:enhancement
resource/tencentcloud_eip_public_address_adjust: update doc
```

```release-note:enhancement
resource/tencentcloud_instance: update doc
```

```release-note:enhancement
resource/tencentcloud_instance_set: Added a new field `private_ip_addresses` to support specifying multiple IPs to create instances
```
2 changes: 1 addition & 1 deletion tencentcloud/services/cvm/resource_tc_eip_association.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func ResourceTencentCloudEipAssociation() *schema.Resource {
ConflictsWith: []string{
"instance_id",
},
Description: "Indicates an IP belongs to the `network_interface_id`. This field is conflict with `instance_id`.",
Description: "The private IP to bind to. If `network_interface_id` is specified, `private_ip` must also be specified. It cannot be specified at the same time as `instance_id`.Also make sure the specified `private_ip` is a private IP on the specified `network_interface_id`.",
},
},
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Provides a resource to create a eip public_address_adjust
Provides a resource to create a eip public_address_adjust. Used to change the IP address. It supports changing the common public IP of the CVM instance and the EIP with monthly bandwidth. `address_id` and `instance_id` cannot exist at the same time. When `address_id` is passed, only the EIP with monthly bandwidth is supported.

Example Usage

Expand Down
16 changes: 8 additions & 8 deletions tencentcloud/services/cvm/resource_tc_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func ResourceTencentCloudInstance() *schema.Resource {
"instance_count": {
Type: schema.TypeInt,
Optional: true,
Deprecated: "It has been deprecated from version 1.59.18. Use built-in `count` instead.",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个不用去吧

Deprecated: "It has been deprecated from version 1.59.18. Use built-in `count` instead. https://developer.hashicorp.com/terraform/language/meta-arguments/count.",
ValidateFunc: tccommon.ValidateIntegerInRange(1, 100),
Description: "The number of instances to be purchased. Value range:[1,100]; default value: 1.",
},
Expand Down Expand Up @@ -98,7 +98,7 @@ func ResourceTencentCloudInstance() *schema.Resource {
"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`.",
Description: "Billing method of a pay-as-you-go instance after shutdown. Available values: `KEEP_CHARGING`,`STOP_CHARGING`. Default `KEEP_CHARGING`.Need to be used with the running_flag field set to `false`.",
ValidateFunc: tccommon.ValidateAllowedStringValue([]string{
CVM_STOP_MODE_KEEP_CHARGING,
CVM_STOP_MODE_STOP_CHARGING,
Expand Down Expand Up @@ -622,9 +622,9 @@ func resourceTencentCloudInstanceCreate(d *schema.ResourceData, meta interface{}
request.SystemDisk.DiskSize = &diskSize
}

if v, ok := d.GetOk("system_disk_id"); ok {
request.SystemDisk.DiskId = helper.String(v.(string))
}
// if v, ok := d.GetOk("system_disk_id"); ok {
// request.SystemDisk.DiskId = helper.String(v.(string))
// }

if v, ok := d.GetOk("system_disk_name"); ok {
request.SystemDisk.DiskName = helper.String(v.(string))
Expand Down Expand Up @@ -658,9 +658,9 @@ func resourceTencentCloudInstanceCreate(d *schema.ResourceData, meta interface{}
}
}

if value["data_disk_id"] != "" {
dataDisk.DiskId = helper.String(value["data_disk_id"].(string))
}
// if value["data_disk_id"] != "" {
// dataDisk.DiskId = helper.String(value["data_disk_id"].(string))
// }

if deleteWithInstance, ok := value["delete_with_instance"]; ok {
deleteWithInstanceBool := deleteWithInstance.(bool)
Expand Down
38 changes: 34 additions & 4 deletions tencentcloud/services/cvm/resource_tc_instance_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,23 @@ func ResourceTencentCloudInstanceSet() *schema.Resource {
Description: "The ID of a VPC subnet. If you want to create instances in a VPC network, this parameter must be set.",
},
"private_ip": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Description: "The private IP to be assigned to this instance, must be in the provided subnet and available.",
Type: schema.TypeString,
Optional: true,
Computed: true,
ConflictsWith: []string{
"private_ip_addresses",
},
Description: "The private IP to be assigned to this instance, must be in the provided subnet and available. Cannot be set at the same time as `private_ip_addresses`.",
},
"private_ip_addresses": {
Type: schema.TypeSet,
Elem: &schema.Schema{Type: schema.TypeString},
Optional: true,
Computed: true,
ConflictsWith: []string{
"private_ip",
},
Description: "Private network subnet IP array, which can be used when creating an instance or modifying instance vpc attributes. Currently, only batch creation of multiple instances supports passing in multiple IPs of the same subnet. Cannot be set at the same time as `private_ip`.",
},
// security group
"security_groups": {
Expand Down Expand Up @@ -415,6 +428,15 @@ func doResourceTencentCloudInstanceSetCreate(d *schema.ResourceData, meta interf
if v, ok = d.GetOk("private_ip"); ok {
request.VirtualPrivateCloud.PrivateIpAddresses = []*string{helper.String(v.(string))}
}

if v, ok := d.GetOk("private_ip_addresses"); ok {
addressListSet := v.(*schema.Set).List()
for i := range addressListSet {
addressList := addressListSet[i].(string)
request.VirtualPrivateCloud.PrivateIpAddresses = append(request.VirtualPrivateCloud.PrivateIpAddresses, &addressList)
}
}

}

if v, ok := d.GetOk("security_groups"); ok {
Expand Down Expand Up @@ -579,6 +601,14 @@ func doResourceTencentCloudInstanceSetRead(d *schema.ResourceData, meta interfac
_ = d.Set("keep_image_login", *instance.LoginSettings.KeepImageLogin == CVM_IMAGE_LOGIN)
}

privateIpAddresses := []*string{}
for _, v := range instanceSet {
if len(v.PrivateIpAddresses) > 0 {
privateIpAddresses = append(privateIpAddresses, v.PrivateIpAddresses...)
}
}
_ = d.Set("private_ip_addresses", privateIpAddresses)

return nil
}

Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/eip_association.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ The following arguments are supported:
* `eip_id` - (Required, String, ForceNew) The ID of EIP.
* `instance_id` - (Optional, String, ForceNew) The CVM or CLB instance id going to bind with the EIP. This field is conflict with `network_interface_id` and `private_ip fields`.
* `network_interface_id` - (Optional, String, ForceNew) Indicates the network interface id like `eni-xxxxxx`. This field is conflict with `instance_id`.
* `private_ip` - (Optional, String, ForceNew) Indicates an IP belongs to the `network_interface_id`. This field is conflict with `instance_id`.
* `private_ip` - (Optional, String, ForceNew) The private IP to bind to. If `network_interface_id` is specified, `private_ip` must also be specified. It cannot be specified at the same time as `instance_id`.Also make sure the specified `private_ip` is a private IP on the specified `network_interface_id`.

## Attributes Reference

Expand Down
4 changes: 2 additions & 2 deletions website/docs/r/eip_public_address_adjust.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ layout: "tencentcloud"
page_title: "TencentCloud: tencentcloud_eip_public_address_adjust"
sidebar_current: "docs-tencentcloud-resource-eip_public_address_adjust"
description: |-
Provides a resource to create a eip public_address_adjust
Provides a resource to create a eip public_address_adjust. Used to change the IP address. It supports changing the common public IP of the CVM instance and the EIP with monthly bandwidth. `address_id` and `instance_id` cannot exist at the same time. When `address_id` is passed, only the EIP with monthly bandwidth is supported.
---

# tencentcloud_eip_public_address_adjust

Provides a resource to create a eip public_address_adjust
Provides a resource to create a eip public_address_adjust. Used to change the IP address. It supports changing the common public IP of the CVM instance and the EIP with monthly bandwidth. `address_id` and `instance_id` cannot exist at the same time. When `address_id` is passed, only the EIP with monthly bandwidth is supported.

## Example Usage

Expand Down
4 changes: 2 additions & 2 deletions website/docs/r/instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ The following arguments are supported:
* `instance_charge_type_prepaid_period` - (Optional, Int) 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`, `48`, `60`.
* `instance_charge_type_prepaid_renew_flag` - (Optional, String) 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`.
* `instance_charge_type` - (Optional, String) The charge type of instance. Valid values are `PREPAID`, `POSTPAID_BY_HOUR`, `SPOTPAID`, `CDHPAID` and `CDCPAID`. 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, Int, **Deprecated**) It has been deprecated from version 1.59.18. Use built-in `count` instead. The number of instances to be purchased. Value range:[1,100]; default value: 1.
* `instance_count` - (Optional, Int, **Deprecated**) It has been deprecated from version 1.59.18. Use built-in `count` instead. https://developer.hashicorp.com/terraform/language/meta-arguments/count. The number of instances to be purchased. Value range:[1,100]; default value: 1.
* `instance_name` - (Optional, String) The name of the instance. The max length of instance_name is 128, and default value is `Terraform-CVM-Instance`.
* `instance_type` - (Optional, String) The type of the instance.
* `internet_charge_type` - (Optional, String) Internet charge type of the instance, Valid values are `BANDWIDTH_PREPAID`, `TRAFFIC_POSTPAID_BY_HOUR`, `BANDWIDTH_POSTPAID_BY_HOUR` and `BANDWIDTH_PACKAGE`. If not set, internet charge type are consistent with the cvm charge type by default. This value takes NO Effect when changing and does not need to be set when `allocate_public_ip` is false.
Expand All @@ -250,7 +250,7 @@ The following arguments are supported:
* `security_groups` - (Optional, Set: [`String`], **Deprecated**) It will be deprecated. Use `orderly_security_groups` instead. A list of security group IDs to associate with.
* `spot_instance_type` - (Optional, String) 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, String, 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, String) Billing method of a pay-as-you-go instance after shutdown. Available values: `KEEP_CHARGING`,`STOP_CHARGING`. Default `KEEP_CHARGING`.
* `stopped_mode` - (Optional, String) Billing method of a pay-as-you-go instance after shutdown. Available values: `KEEP_CHARGING`,`STOP_CHARGING`. Default `KEEP_CHARGING`.Need to be used with the running_flag field set to `false`.
* `subnet_id` - (Optional, String) 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, String) 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_name` - (Optional, String) Name of the system disk.
Expand Down
3 changes: 2 additions & 1 deletion website/docs/r/instance_set.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ The following arguments are supported:
* `key_name` - (Optional, String) The key pair to use for the instance, it looks like `skey-16jig7tx`. Modifying will cause the instance reset.
* `password` - (Optional, String) Password for the instance. In order for the new password to take effect, the instance will be restarted after the password change. Modifying will cause the instance reset.
* `placement_group_id` - (Optional, String, ForceNew) The ID of a placement group.
* `private_ip` - (Optional, String) The private IP to be assigned to this instance, must be in the provided subnet and available.
* `private_ip_addresses` - (Optional, Set: [`String`]) Private network subnet IP array, which can be used when creating an instance or modifying instance vpc attributes. Currently, only batch creation of multiple instances supports passing in multiple IPs of the same subnet. Cannot be set at the same time as `private_ip`.
* `private_ip` - (Optional, String) The private IP to be assigned to this instance, must be in the provided subnet and available. Cannot be set at the same time as `private_ip_addresses`.
* `project_id` - (Optional, Int) The project the instance belongs to, default to 0.
* `security_groups` - (Optional, Set: [`String`]) A list of security group IDs to associate with.
* `subnet_id` - (Optional, String) The ID of a VPC subnet. If you want to create instances in a VPC network, this parameter must be set.
Expand Down
Loading