Commit e99d5fb 1 parent 95ebae9 commit e99d5fb Copy full SHA for e99d5fb
File tree 1 file changed +20
-0
lines changed
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments