alicloud_ecp_instance
更新时间:
Provides a Elastic Cloud Phone (ECP) Instance resource.
For information about Elastic Cloud Phone (ECP) Instance and how to use it, see What is Instance.
-> NOTE: Available since v1.158.0.
Example Usage
Basic Usage
variable "name" {
default = "terraform-example"
}
provider "alicloud" {
region = "cn-hangzhou"
}
data "alicloud_ecp_zones" "default" {
}
data "alicloud_ecp_instance_types" "default" {
}
resource "random_integer" "default" {
min = 10000
max = 99999
}
resource "alicloud_vpc" "default" {
vpc_name = "${var.name}-${random_integer.default.result}"
cidr_block = "192.168.0.0/16"
}
resource "alicloud_vswitch" "default" {
vswitch_name = "${var.name}-${random_integer.default.result}"
vpc_id = alicloud_vpc.default.id
cidr_block = "192.168.192.0/24"
zone_id = data.alicloud_ecp_zones.default.zones.0.zone_id
}
resource "alicloud_security_group" "default" {
name = "${var.name}-${random_integer.default.result}"
vpc_id = alicloud_vpc.default.id
}
resource "alicloud_ecp_key_pair" "default" {
key_pair_name = "${var.name}-${random_integer.default.result}"
public_key_body = "ssh-rsa AAAAB3Nza12345678qwertyuudsfsg"
}
resource "alicloud_ecp_instance" "default" {
instance_type = data.alicloud_ecp_instance_types.default.instance_types.0.instance_type
image_id = "android-image-release5501072_a11_20240530.raw"
vswitch_id = alicloud_vswitch.default.id
security_group_id = alicloud_security_group.default.id
key_pair_name = alicloud_ecp_key_pair.default.key_pair_name
vnc_password = "Ecp123"
payment_type = "PayAsYouGo"
instance_name = var.name
description = var.name
force = "true"
}
Argument Reference
The following arguments are supported:
instance_type- (Required, ForceNew) The specifications of the ECP instance.image_id- (Required, ForceNew) The ID of the image.vswitch_id- (Required, ForceNew) The ID of the vSwitch.security_group_id- (Required, ForceNew) The ID of the security group.eip_bandwidth- (Optional, ForceNew, Int) The bandwidth of the elastic IP address (EIP). NOTE: From version 1.232.0,eip_bandwidthcannot be modified.resolution- (Optional) The resolution that you want to select for the ECP instance. NOTE: From version 1.232.0,resolutioncan be modified.key_pair_name- (Optional) The name of the key pair that you want to use to connect to the instance.vnc_password- (Optional) The VNC password of the instance. The password must be6characters in length and can contain only uppercase letters, lowercase letters, and digits.payment_type- (Optional, ForceNew) The billing method of the ECP instance. Default value:PayAsYouGo. Valid values:PayAsYouGo,Subscription. NOTE: From version 1.232.0,payment_typecannot be modified.auto_pay- (Optional, Bool) Specifies whether to enable the auto-payment feature. Valid values:true: Enable.false: Disable.
period- (Optional) The subscription duration. Default value:1. Valid values:- If
period_unitis set toMonth. Valid values:1,2,3, and6. - If
period_unitis set toYear. Valid values:1to5.
- If
period_unit- (Optional) The unit of the subscription duration. Default value:Month. Valid values:Month,Year.auto_renew- (Optional, Bool) Specifies whether to enable the auto-renewal feature. Valid values:true: Enable.false: Disable.
instance_name- (Optional) The name of the ECP instance. The name must be2to128characters in length. It must start with a letter but cannot start withhttp://orhttps://. It can contain letters, digits, colons (:), underscores (_), periods (.), and hyphens (-).description- (Optional) The description of the ECP instance. The description must be2to256characters in length and cannot start withhttp://orhttps://.force- (Optional, Bool) Specifies whether to forcefully stop and release the instance. Default value:false. Valid values:true: Enable.false: Disable. -> NOTE: If you want to destroyalicloud_ecp_instance,forcemust be set totrue, and ifforceset totrue, whenstatusis set toStopped, cache data that is not written to storage in the instance will be lost, which is similar to the effect of a power-off action.
status- (Optional) The status of the Instance. Valid values:Running,Stopped.
Attributes Reference
The following attributes are exported:
id- The resource ID in terraform of Instance.
Timeouts
The timeouts block allows you to specify timeouts for certain actions:
create- (Defaults to 3 mins) Used when create the Instance.update- (Defaults to 3 mins) Used when update the Instance.delete- (Defaults to 3 mins) Used when delete the Instance.
Import
Elastic Cloud Phone (ECP) Instance can be imported using the id, e.g.
$ terraform import alicloud_ecp_instance.example <id>
该文章对您有帮助吗?