Provides an ECS Launch Template resource.
For information about Launch Template and how to use it, see Launch Template.
data "alicloud_images" "images" {
owners = "system"
}
data "alicloud_instances" "instances" {
}
resource "alicloud_launch_template" "template" {
name = "tf-test-template"
description = "test1"
image_id = data.alicloud_images.images.images[0].id
host_name = "tf-test-host"
instance_charge_type = "PrePaid"
instance_name = "tf-instance-name"
instance_type = data.alicloud_instances.instances.instances[0].instance_type
internet_charge_type = "PayByBandwidth"
internet_max_bandwidth_in = 5
internet_max_bandwidth_out = 0
io_optimized = "none"
key_pair_name = "test-key-pair"
ram_role_name = "xxxxx"
network_type = "vpc"
security_enhancement_strategy = "Active"
spot_price_limit = 5
spot_strategy = "SpotWithPriceLimit"
security_group_id = "sg-zxcvj0lasdf102350asdf9a"
system_disk_category = "cloud_ssd"
system_disk_description = "test disk"
system_disk_name = "hello"
system_disk_size = 40
resource_group_id = "rg-zkdfjahg9zxncv0"
userdata = "xxxxxxxxxxxxxx"
vswitch_id = "sw-ljkngaksdjfj0nnasdf"
vpc_id = "vpc-asdfnbg0as8dfk1nb2"
zone_id = "beijing-a"
tags = {
tag1 = "hello"
tag2 = "world"
}
network_interfaces {
name = "eth0"
description = "hello1"
primary_ip = "10.0.0.2"
security_group_id = "xxxx"
vswitch_id = "xxxxxxx"
}
data_disks {
name = "disk1"
description = "test1"
}
data_disks {
name = "disk2"
description = "test2"
}
}
The following arguments are supported:
name
- (Required, ForceNew) Instance launch template name. Can contain [2, 128] characters in length. It must start with an English letter or Chinese, can contain numbers, periods (.), colons (:), underscores (_), and hyphens (-). It cannot start with "http://" or "https://".description
- (Optional) Description of instance launch template version 1. It can be [2, 256] characters in length. It cannot start with "http://" or "https://". The default value is null.host_name
- (Optional) Instance host name.It cannot start or end with a period (.) or a hyphen (-) and it cannot have two or more consecutive periods (.) or hyphens (-).For Windows: The host name can be [2, 15] characters in length. It can contain A-Z, a-z, numbers, periods (.), and hyphens (-). It cannot only contain numbers. For other operating systems: The host name can be [2, 64] characters in length. It can be segments separated by periods (.). It can contain A-Z, a-z, numbers, and hyphens (-).image_id
- (Optional) Image ID.instance_name
- (Optional) The name of the instance. The name is a string of 2 to 128 characters. It must begin with an English or a Chinese character. It can contain A-Z, a-z, Chinese characters, numbers, periods (.), colons (:), underscores (_), and hyphens (-).instance_charge_type
- (Optional)Billing methods. Optional values:
Default value: PostPaid.
instance_type
- (Optional) Instance type. For more information, call resource_alicloud_instances to obtain the latest instance type list.auto_release_time
- (Optional) Instance auto release time. The time is presented using the ISO8601 standard and in UTC time. The format is YYYY-MM-DDTHH:MM:SSZ.internet_charge_type
- (Optional) Internet bandwidth billing method. Optional values: PayByTraffic
| PayByBandwidth
.internet_max_bandwidth_in
- (Optional) The maximum inbound bandwidth from the Internet network, measured in Mbit/s. Value range: [1, 200].internet_max_bandwidth_out
- (Optional) Maximum outbound bandwidth from the Internet, its unit of measurement is Mbit/s. Value range: [0, 100].io_optimized
- (Optional) Whether it is an I/O-optimized instance or not. Optional values:
md5-2febde4e61af1ad43495f94194392c46
Default to cloud_efficiency
.
encrypted
-(Optional, Bool) Encrypted the data in this disk.
Default to false
snapshot_id
- (Optional) The snapshot ID used to initialize the data disk. If the size specified by snapshot is greater that the size of the disk, use the size specified by snapshot as the size of the data disk.delete_with_instance
- (Optional) Delete this data disk when the instance is destroyed. It only works on cloud, cloud_efficiency, cloud_ssd and cloud_essd disk. If the category of this data disk was ephemeral_ssd, please don't set this param.
Default to true
description
- (Optional) The description of the data disk.tags
- (Optional) A mapping of tags to assign to the resource.
The following attributes are exported:
id
- The Launch Template ID.Launch Template can be imported using the id, e.g.
$ terraform import alicloud_launch_template.lt lt-abc1234567890000