github.com/candidpartners/terraform@v0.9.5-0.20171005231213-29f5f88820f6/examples/alicloud-ess-scaling/main.tf (about) 1 data "alicloud_images" "ecs_image" { 2 most_recent = true 3 name_regex = "^centos_6\\w{1,5}[64].*" 4 } 5 6 resource "alicloud_security_group" "sg" { 7 name = "${var.security_group_name}" 8 description = "tf-sg" 9 } 10 11 resource "alicloud_security_group_rule" "ssh-in" { 12 type = "ingress" 13 ip_protocol = "tcp" 14 nic_type = "internet" 15 policy = "accept" 16 port_range = "22/22" 17 priority = 1 18 security_group_id = "${alicloud_security_group.sg.id}" 19 cidr_ip = "0.0.0.0/0" 20 } 21 22 resource "alicloud_ess_scaling_group" "scaling" { 23 min_size = "${var.scaling_min_size}" 24 max_size = "${var.scaling_max_size}" 25 scaling_group_name = "tf-scaling" 26 removal_policies = "${var.removal_policies}" 27 28 } 29 30 resource "alicloud_ess_scaling_configuration" "config" { 31 scaling_group_id = "${alicloud_ess_scaling_group.scaling.id}" 32 enable = "${var.enable}" 33 34 image_id = "${data.alicloud_images.ecs_image.images.0.id}" 35 instance_type = "${var.ecs_instance_type}" 36 io_optimized = "optimized" 37 security_group_id = "${alicloud_security_group.sg.id}" 38 }