forked from bacchus-snu/infra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathec2.tf
65 lines (50 loc) · 1.07 KB
/
ec2.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
data "aws_ami" "debian_bullseye" {
most_recent = true
owners = ["amazon", "aws-marketplace"]
filter {
name = "architecture"
values = ["x86_64"]
}
filter {
name = "name"
values = ["debian-11-*"]
}
filter {
name = "root-device-type"
values = ["ebs"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
}
resource "aws_instance" "bacchus_vpn_kr" {
ami = data.aws_ami.debian_bullseye.id
instance_type = "t3a.micro"
vpc_security_group_ids = [
aws_security_group.wireguard_with_ssh.id,
]
user_data = file("${path.module}/setup-vpn.yml")
root_block_device {
volume_size = 20
}
lifecycle {
ignore_changes = [ami]
}
iam_instance_profile = aws_iam_instance_profile.ec2_ssm.name
tags = {
Name = "bacchus-vpn-kr"
}
}
resource "aws_eip" "bacchus_vpn_kr" {
instance = aws_instance.bacchus_vpn_kr.id
vpc = true
}
moved {
from = aws_instance.bacchus_vpn
to = aws_instance.bacchus_vpn_kr
}
moved {
from = aws_eip.bacchus_vpn
to = aws_eip.bacchus_vpn_kr
}