-
Notifications
You must be signed in to change notification settings - Fork 1
/
bastion.tf
45 lines (40 loc) · 1.32 KB
/
bastion.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
resource "aws_instance" "k5s_bastion" {
ami = "ami-033a6a056910d1137"
availability_zone = aws_subnet.k5s_public_subnet[0].availability_zone
instance_type = "t2.micro"
key_name = aws_key_pair.k5s_key.key_name
vpc_security_group_ids = [
aws_default_security_group.k5s_vpc_sg_default.id,
aws_security_group.k5s_sg_bastion.id
]
subnet_id = aws_subnet.k5s_public_subnet[0].id
associate_public_ip_address = true
tags = {
"Name" = "${var.aws_default_name}-BastionHost"
}
}
resource "aws_instance" "k5s_jenkins" {
ami = "ami-033a6a056910d1137"
availability_zone = aws_subnet.k5s_public_subnet[0].availability_zone
instance_type = "t3.small"
key_name = aws_key_pair.k5s_key.key_name
vpc_security_group_ids = [
aws_default_security_group.k5s_vpc_sg_default.id,
aws_security_group.k5s_sg_jenkins.id
]
subnet_id = aws_subnet.k5s_public_subnet[0].id
associate_public_ip_address = true
tags = {
"Name" = "${var.aws_default_name}-Jenkins"
}
}
resource "aws_eip" "k5s_bastion_eip" {
vpc = true
instance = aws_instance.k5s_bastion.id
depends_on = [aws_internet_gateway.k5s_igw]
}
resource "aws_eip" "k5s_jenkins_eip" {
vpc = true
instance = aws_instance.k5s_jenkins.id
depends_on = [aws_internet_gateway.k5s_igw]
}