forked from arielkru/badCode
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathec2.tf
More file actions
36 lines (35 loc) · 1.15 KB
/
ec2.tf
File metadata and controls
36 lines (35 loc) · 1.15 KB
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
resource "aws_instance" "web_host" {
# ec2 have plain text secrets in user data
ami = "${var.ami}"
instance_type = "t2.nano"
vpc_security_group_ids = [
"${aws_security_group.web-node.id}"]
subnet_id = "${aws_subnet.web_subnet.id}"
user_data = <<EOF
#! /bin/bash
sudo apt-get update
sudo apt-get install -y apache2
sudo systemctl start apache2
sudo systemctl enable apache2
export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMAAA
export AWS_SECRET_ACCESS_KEY=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
export AWS_DEFAULT_REGION=us-west-2
echo "<h1>Deployed via Terraform</h1>" | sudo tee /var/www/html/index.html
EOF
tags = merge({
Name = "${local.resource_prefix.value}-ec2"
}, {
git_commit = "d68d2897add9bc2203a5ed0632a5cdd8ff8cefb0"
git_file = "terraform/aws/ec2.tf"
git_last_modified_at = "2020-06-16 14:46:24"
git_last_modified_by = "jmagee@paloaltonetworks.com"
git_modifiers = "jmagee"
git_org = "bridgecrewio"
git_repo = "terragoat"
yor_trace = "347af3cd-4f70-4632-aca3-4d5e30ffc0b6"
}, {
yor_name = "web_host"
}, {
env = ""
})
}