-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathec2.tf
91 lines (70 loc) · 2.34 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
data "aws_ami" "amzn-linux-2023-ami" {
most_recent = true
owners = ["amazon"]
filter {
name = "name"
values = ["al2023-ami-2023.*-x86_64"]
}
}
###======================== CTFd EC2 ====================== ###
resource "aws_instance" "ctfd" {
#checkov:skip=CKV_AWS_8:Ensure all data stored in the Launch configuration or instance Elastic Blocks Store is securely encrypted
#checkov:skip=CKV_AWS_126:Ensure that detailed monitoring is enabled for EC2 instances
#checkov:skip=CKV_AWS_135:Ensure that EC2 is EBS optimized
ami = data.aws_ami.amzn-linux-2023-ami.id
instance_type = var.instance_type
availability_zone = var.aws_availability_zone_a
subnet_id = aws_subnet.ctfd.id
associate_public_ip_address = false
vpc_security_group_ids = [
aws_security_group.ctf.id
]
metadata_options {
http_endpoint = "enabled"
http_tokens = "required"
http_put_response_hop_limit = 1
}
root_block_device {
volume_size = 40
}
iam_instance_profile = aws_iam_instance_profile.ctf.id
user_data = <<-EOF
#!/bin/bash
dnf update -y
dnf install -y ansible
EOF
tags = {
Name = "CTFd"
}
}
###================= OWASP Juice Shop EC2 ================= ###
resource "aws_instance" "owaspjs" {
#checkov:skip=CKV_AWS_8:Ensure all data stored in the Launch configuration or instance Elastic Blocks Store is securely encrypted
#checkov:skip=CKV_AWS_126:Ensure that detailed monitoring is enabled for EC2 instances
#checkov:skip=CKV_AWS_135:Ensure that EC2 is EBS optimized
ami = data.aws_ami.amzn-linux-2023-ami.id
instance_type = var.instance_type
availability_zone = var.aws_availability_zone_a
subnet_id = aws_subnet.owaspjs.id
associate_public_ip_address = false
vpc_security_group_ids = [
aws_security_group.ctf.id
]
metadata_options {
http_endpoint = "enabled"
http_tokens = "required"
http_put_response_hop_limit = 1
}
root_block_device {
volume_size = 40
}
iam_instance_profile = aws_iam_instance_profile.ctf.id
user_data = <<-EOF
#!/bin/bash
dnf update -y
dnf install -y ansible
EOF
tags = {
Name = "OWASP Juice Shop"
}
}