-
Notifications
You must be signed in to change notification settings - Fork 1
/
instance.tf
38 lines (30 loc) · 825 Bytes
/
instance.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
resource "aws_key_pair" "mykey" {
key_name = "tkey"
public_key = file(var.PATH_TO_PUBLIC_KEY)
}
resource "aws_instance" "example" {
ami = var.AMIS[var.AWS_REGION]
instance_type = "t2.micro"
key_name = aws_key_pair.mykey.key_name
# the VPC subnet
subnet_id = aws_subnet.main-public-1.id
# the security group
vpc_security_group_ids = [aws_security_group.allow-ssh.id]
#Let's give the instance a tag
tags = {
Name = "Web1"
}
}
resource "aws_instance" "example2" {
ami = var.AMIS[var.AWS_REGION]
instance_type = "t2.micro"
key_name = aws_key_pair.mykey.key_name
# the VPC subnet
subnet_id = aws_subnet.main-public-2.id
# the security group
vpc_security_group_ids = [aws_security_group.allow-ssh.id]
#Let's give the instance a tag
tags = {
Name = "Web2"
}
}