Skip to content

Create main.tf#4

Open
Chathumiii wants to merge 2 commits intoprodfrom
staging
Open

Create main.tf#4
Chathumiii wants to merge 2 commits intoprodfrom
staging

Conversation

@Chathumiii
Copy link
Owner

No description provided.

Comment on lines +45 to +58
resource "aws_instance" "web" {
ami = data.aws_ami.ubuntu.id
instance_type = "t2.micro"
vpc_security_group_ids = [aws_security_group.web-sg.id]

user_data = <<-EOF
#!/bin/bash
apt-get update
apt-get install -y apache2
sed -i -e 's/80/8080/' /etc/apache2/ports.conf
echo "Hello World" > /var/www/html/index.html
systemctl restart apache2
EOF
}

Check failure

Code scanning / defsec

Instance with unencrypted block device.

Root block device is not encrypted.
Comment on lines +45 to +58
resource "aws_instance" "web" {
ami = data.aws_ami.ubuntu.id
instance_type = "t2.micro"
vpc_security_group_ids = [aws_security_group.web-sg.id]

user_data = <<-EOF
#!/bin/bash
apt-get update
apt-get install -y apache2
sed -i -e 's/80/8080/' /etc/apache2/ports.conf
echo "Hello World" > /var/www/html/index.html
systemctl restart apache2
EOF
}

Check failure

Code scanning / defsec

aws_instance should activate session tokens for Instance Metadata Service.

Instance does not require IMDS access to require a token
Comment on lines 60 to 75
resource "aws_security_group" "web-sg" {
name = "${random_pet.sg.id}-sg"
ingress {
from_port = 8080
to_port = 8080
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
// connectivity to ubuntu mirrors is required to run `apt-get update` and `apt-get install apache2`
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}

Check notice

Code scanning / defsec

Missing description for security group.

Security group explicitly uses the default description.
Comment on lines 60 to 75
resource "aws_security_group" "web-sg" {
name = "${random_pet.sg.id}-sg"
ingress {
from_port = 8080
to_port = 8080
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
// connectivity to ubuntu mirrors is required to run `apt-get update` and `apt-get install apache2`
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}

Check notice

Code scanning / defsec

Missing description for security group rule.

Security group rule does not have a description.
Comment on lines 60 to 75
resource "aws_security_group" "web-sg" {
name = "${random_pet.sg.id}-sg"
ingress {
from_port = 8080
to_port = 8080
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
// connectivity to ubuntu mirrors is required to run `apt-get update` and `apt-get install apache2`
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}

Check notice

Code scanning / defsec

Missing description for security group rule.

Security group rule does not have a description.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant