github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/examples/alicloud-ecs-userdata/main.tf (about)

     1  
     2  resource "alicloud_vpc" "default" {
     3    name = "tf-vpc"
     4    cidr_block = "${var.vpc_cidr}"
     5  }
     6  
     7  resource "alicloud_vswitch" "vsw" {
     8    vpc_id = "${alicloud_vpc.default.id}"
     9    cidr_block = "${var.vswitch_cidr}"
    10    availability_zone = "${var.zone}"
    11  }
    12  
    13  resource "alicloud_security_group" "sg" {
    14  	name = "tf-sg"
    15  	description = "sg"
    16  	vpc_id = "${alicloud_vpc.default.id}"
    17  }
    18  
    19  resource "alicloud_instance" "website" {
    20  	# cn-beijing
    21  	availability_zone = "${var.zone}"
    22  	vswitch_id = "${alicloud_vswitch.vsw.id}"
    23  	image_id = "${var.image}"
    24  
    25  	# series II
    26  	instance_type = "${var.ecs_type}"
    27  	io_optimized = "optimized"
    28  	system_disk_category = "cloud_efficiency"
    29  
    30  	internet_charge_type = "PayByTraffic"
    31  	internet_max_bandwidth_out = 5
    32  	allocate_public_ip = true
    33  	security_groups = ["${alicloud_security_group.sg.id}"]
    34  	instance_name = "test_foo"
    35  
    36  	user_data = "${file("userdata.sh")}"
    37  }