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

     1  resource "alicloud_vpc" "main" {
     2    name = "${var.long_name}"
     3    cidr_block = "${var.vpc_cidr}"
     4  }
     5  
     6  resource "alicloud_vswitch" "main" {
     7    vpc_id = "${alicloud_vpc.main.id}"
     8    count = "${length(split(",", var.availability_zones))}"
     9    cidr_block = "${lookup(var.cidr_blocks, "az${count.index}")}"
    10    availability_zone = "${element(split(",", var.availability_zones), count.index)}"
    11    depends_on = [
    12      "alicloud_vpc.main"]
    13  }
    14  
    15  resource "alicloud_slb" "instance" {
    16    name = "${var.name}"
    17    vswitch_id = "${alicloud_vswitch.main.id}"
    18    internet_charge_type = "${var.internet_charge_type}"
    19    listener = [
    20      {
    21        "instance_port" = "2111"
    22        "lb_port" = "21"
    23        "lb_protocol" = "tcp"
    24        "bandwidth" = "5"
    25      }]
    26  }
    27