-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix checkov scan findings #22
Merged
Merged
Changes from 11 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
4167257
add vpc module for #21
kunduso 0101fa3
add vpc cidr for #21
kunduso 4901d61
add policy to access vpc for #21
kunduso 6b4aade
add sg for lambda #21
kunduso e8d9b1f
add endpoint to access aws services from vpc #21
kunduso e081e18
removed comment
kunduso 44e509b
updated vpc configuration
kunduso dee6483
corrected reference to vpc
kunduso 9687bd5
corrected reference to vpc
kunduso 89a3849
added vpc config
kunduso eef1a2a
sg is attached to lambda hence removing comment
kunduso ef727eb
update docs
kunduso File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group | ||
resource "aws_security_group" "lambda" { | ||
name = "${var.name}-lambda-sg" | ||
description = "Security group for Lambda in ${var.name}" | ||
vpc_id = module.vpc.vpc.id | ||
tags = { | ||
"Name" = "${var.name}-lambda-sg" | ||
} | ||
} | ||
#https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule | ||
resource "aws_security_group_rule" "egress_vpc_endpoint_lambda" { | ||
description = "allow traffic from vpc-endpoint to reach lambda" | ||
type = "egress" | ||
from_port = 443 | ||
to_port = 443 | ||
protocol = "tcp" | ||
source_security_group_id = aws_security_group.endpoint_sg.id | ||
security_group_id = aws_security_group.lambda.id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module "vpc" { | ||
#CKV_TF_1: Ensure Terraform module sources use a commit hash | ||
#checkov:skip=CKV_TF_1: This is a self hosted module where the version number is tagged rather than the commit hash. | ||
source = "github.com/kunduso/terraform-aws-vpc?ref=v1.0.2" | ||
region = var.region | ||
vpc_cidr = var.vpc_cidr | ||
enable_dns_support = "true" | ||
enable_dns_hostnames = "true" | ||
vpc_name = var.name | ||
subnet_cidr_private = var.subnet_cidr_private | ||
enable_flow_log = "true" | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group | ||
resource "aws_security_group" "endpoint_sg" { | ||
name = "endpoint_access" | ||
description = "allow inbound traffic" | ||
vpc_id = module.vpc.vpc.id | ||
tags = { | ||
"Name" = "${var.name}-endpoint-sg" | ||
} | ||
} | ||
#https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule | ||
resource "aws_security_group_rule" "ingress_vpc_endpoint" { | ||
description = "Enable access for the endpoints." | ||
type = "ingress" | ||
from_port = 443 | ||
to_port = 443 | ||
protocol = "tcp" | ||
cidr_blocks = [module.vpc.vpc.cidr_block] | ||
security_group_id = aws_security_group.endpoint_sg.id | ||
} | ||
#https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint | ||
resource "aws_vpc_endpoint" "logs" { | ||
vpc_id = module.vpc.vpc.id | ||
service_name = "com.amazonaws.${var.region}.logs" | ||
vpc_endpoint_type = "Interface" | ||
subnet_ids = [for subnet in module.vpc.private_subnets : subnet.id] | ||
security_group_ids = [aws_security_group.endpoint_sg.id] | ||
private_dns_enabled = true | ||
tags = { | ||
"Name" = "${var.name}-logs" | ||
} | ||
} | ||
#https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint | ||
resource "aws_vpc_endpoint" "ssm" { | ||
vpc_id = module.vpc.vpc.id | ||
service_name = "com.amazonaws.${var.region}.ssm" | ||
vpc_endpoint_type = "Interface" | ||
subnet_ids = [for subnet in module.vpc.private_subnets : subnet.id] | ||
security_group_ids = [aws_security_group.endpoint_sg.id] | ||
private_dns_enabled = true | ||
tags = { | ||
"Name" = "${var.name}-ssm" | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / checkov
Ensure Terraform module sources use a commit hash Warning