title: Terraform: How to append the server count and assign servers to multiple AZ's?
body: <p><strong>main.tf</strong></p>
  
  <pre><code>resource "aws_instance" "service" {
    ami           = "${lookup(var.aws_winamis, var.awsregion)}"
    count         = "${var.count}"
    key_name      = "${var.key_name}"
    instance_type = "t2.medium"
    subnet_id     = "${aws_subnet.private.id}"
    # private_ip    = "${lookup(var.server_instance_ips, count.index)}"
    vpc_security_group_ids = ["${aws_security_group.private-sg.id}"]
    associate_public_ip_address = false
    availability_zone           = "${var.awsregion}a"
    tags {
      Name        = "${format("server-%01d", count.index + 1)}"
      Environment = "${var.environment}"
    }
  }
  </code></pre>
  
  <p><strong>Variable.tf</strong></p>
  
  <pre><code>variable "awsregion" {default =""}
  variable "count" {default = ""}
  variable "server_instance_ips" {default = ""}
  </code></pre>
  
  <p><strong>dev.tfvars</strong></p>
  
  <pre><code>server_instance_ips = ["10.0.2.25", "10.0.2.26"] #doesn't work as a list but works with single IP address
  count = "4"
  awsregion = "us-east-1"
  </code></pre>
  
  <p>I want the servers to have tags - <code>dla-server-1</code>/<code>2</code>/<code>3</code>/<code>4</code> after they're created but with my above code I can only do <code>server-1</code>/<code>2</code>/<code>3</code>/<code>4</code> but not <code>dla</code>/<code>sla</code>/<code>pla</code> depending on the environments; IP addresses are randomly assigned to the servers as I'm not able to pass the list of IP's and lastly, how can I create servers in different AZ's i.e. 2 servers in AZ1a and 2 servers in AZ1b?</p>