-
Notifications
You must be signed in to change notification settings - Fork 0
/
instances.tf
40 lines (34 loc) · 946 Bytes
/
instances.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
#Grab latest ami image for AWS linux 2
data "aws_ami" "amazon-linux-2" {
most_recent = true
filter {
name = "name"
values = ["amzn2-ami-hvm-*-x86_64-ebs"]
}
owners = ["amazon"]
}
#create instance to be test jump box
resource "aws_instance" "bastion" {
ami = "${data.aws_ami.amazon-linux-2.id}"
instance_type = "t2.micro"
subnet_id = aws_subnet.Front.id
private_ip = "10.0.1.10"
vpc_security_group_ids = [aws_security_group.front_security_group.id]
key_name = "demokey"
user_data = file("install_apache.sh")
tags = {
Name = "Jump Box"
}
}
#create middle instance to test ssh
resource "aws_instance" "app" {
ami = "${data.aws_ami.amazon-linux-2.id}"
instance_type = "t2.micro"
subnet_id = aws_subnet.Middle.id
private_ip = "10.0.2.10"
vpc_security_group_ids = [aws_security_group.middle_security_group.id]
key_name = "demokey"
tags = {
Name = "Middle Instance"
}
}