-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathec2.tf
45 lines (23 loc) · 725 Bytes
/
ec2.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# ec2 instances
# data "aws_ami" "myami" {
# most_recent = true
# owners = ["397850908274"]
# }
resource "aws_instance" "green_server" {
count = "${var.env == "dev" ? 3 : 1}"
ami = "${lookup(var.amis,var.region)}"
# ami = "ami-0b0dcb5067f052a63"
# count = 3
#count = "${"var.env" == "dev" ? 3 : 1}"
#availability_zone = "us-east-1a"
subnet_id = "${element(aws_subnet.public_subnets.*.id,count.index)}"
#security_groups = "${aws_security_group.allow-all.tags.Name}"
vpc_security_group_ids = ["${aws_security_group.allow-all.id}"]
key_name = "laptop"
instance_type = "${var.vm-type}"
associate_public_ip_address = true
tags = {
Name = "green-server-${count.index}"
Env = "${var.env}"
}
}