Skip to content

Commit e99d5fb

Browse files
committed
Add missing bastion file
1 parent 95ebae9 commit e99d5fb

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

infra/bastion.tf

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# We don't want to create the key in terraform. Otherwise the private key would be saved in terraform state.
2+
# Let's save the key here as ec2 instance user data.
3+
4+
# Just the smallest arm instance available
5+
resource "aws_instance" "bastion-ec2-instance" {
6+
ami = "ami-0854da2f8540b70a2" # Amazon Linux 2
7+
instance_type = "t4g.nano"
8+
subnet_id = aws_subnet.public[0].id
9+
vpc_security_group_ids = [aws_security_group.bastion.id]
10+
iam_instance_profile = aws_iam_instance_profile.ec2-iam-profile.name
11+
tenancy = "default"
12+
user_data = templatefile(
13+
"bastion_user_data.tpl",
14+
{bastion_public_key = "${var.bastion_public_key}"}
15+
)
16+
17+
tags = merge(local.default_tags, {
18+
Name = "${var.prefix}-bastion"
19+
})
20+
}

0 commit comments

Comments
 (0)