Skip to content
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 12 commits into from
Nov 25, 2024
Merged

Fix checkov scan findings #22

merged 12 commits into from
Nov 25, 2024

Conversation

kunduso
Copy link
Owner

@kunduso kunduso commented Nov 24, 2024

The changes in this PR closes #21

@kunduso kunduso self-assigned this Nov 24, 2024
Comment on lines +1 to +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"
}

Check warning

Code scanning / checkov

Ensure Terraform module sources use a commit hash Warning

Ensure Terraform module sources use a commit hash
Copy link

github-actions bot commented Nov 24, 2024

💰 Infracost report

Monthly estimate generated

This comment will be updated when code changes.

Copy link

Terraform Format and Style 🖌success

Terraform Initialization ⚙️success

Terraform Plan 📖success

Terraform Validation 🤖success

Show Plan

terraform
data.archive_file.python_file: Reading...
data.archive_file.python_file: Read complete after 0s [id=efca5ba5d15c470502277886d6f89aea9b62262c]
module.vpc.data.aws_caller_identity.current: Reading...
module.vpc.data.aws_availability_zones.available: Reading...
data.aws_caller_identity.current: Reading...
module.vpc.data.aws_iam_policy_document.assume_role: Reading...
aws_iam_role.lambda_role: Refreshing state... [id=app-7-lambda-role]
module.vpc.aws_kms_key.custom_kms_key[0]: Refreshing state... [id=13ed7c50-95b4-48f4-9d6b-1cf992ecaa76]
aws_cloudwatch_event_rule.lambda_trigger: Refreshing state... [id=app-7-lambda-trigger-rule]
module.vpc.aws_vpc.this: Refreshing state... [id=vpc-04e21c3bc04de39d6]
aws_kms_key.encryption: Refreshing state... [id=8271b626-7314-47c0-8868-33d1a13e622c]
module.vpc.data.aws_iam_policy_document.assume_role: Read complete after 0s [id=2717921857]
module.vpc.aws_iam_role.vpc_flow_log_role[0]: Refreshing state... [id=app-7-vpc-flow-role]
data.aws_caller_identity.current: Read complete after 1s [id=743794601996]
module.vpc.data.aws_caller_identity.current: Read complete after 1s [id=743794601996]
module.vpc.data.aws_availability_zones.available: Read complete after 1s [id=us-east-2]
aws_iam_role_policy_attachment.managed_vpc_policy_attachement: Refreshing state... [id=app-7-lambda-role-20241123033232789900000001]
aws_kms_alias.encryption: Refreshing state... [id=alias/app-7]
aws_cloudwatch_log_group.lambda_log: Refreshing state... [id=/aws/lambda/app-7]
aws_ssm_parameter.parameter: Refreshing state... [id=/app-7]
aws_sqs_queue.dlq: Refreshing state... [id=https://sqs.us-east-2.amazonaws.com/743794601996/app-7-lambda-dlq]
data.aws_iam_policy_document.encryption_policy: Reading...
data.aws_iam_policy_document.encryption_policy: Read complete after 0s [id=1711526448]
module.vpc.aws_kms_alias.key[0]: Refreshing state... [id=alias/app-7-encrypt-flow-log]
module.vpc.aws_cloudwatch_log_group.network_flow_logging[0]: Refreshing state... [id=app-7-flow-logs]
module.vpc.aws_kms_key_policy.encrypt_log[0]: Refreshing state... [id=13ed7c50-95b4-48f4-9d6b-1cf992ecaa76]
aws_kms_key_policy.encryption: Refreshing state... [id=8271b626-7314-47c0-8868-33d1a13e622c]
aws_cloudwatch_log_stream.log_stream: Refreshing state... [id=app-7-lambda-log-stream]
module.vpc.data.aws_iam_policy_document.vpc_flow_log_policy_document[0]: Reading...
module.vpc.data.aws_iam_policy_document.vpc_flow_log_policy_document[0]: Read complete after 0s [id=2325604698]
module.vpc.aws_iam_role_policy.vpc_flow_log_role_policy[0]: Refreshing state... [id=app-7-vpc-flow-role:app-7-vpc-flow-policy]
aws_iam_policy.lambda_policy: Refreshing state... [id=arn:aws:iam::743794601996:policy/app-7-lambda-policy]
aws_iam_role_policy_attachment.lambda_policy_attachement: Refreshing state... [id=app-7-lambda-role-20241123033307728800000002]
module.vpc.aws_route_table.private[2]: Refreshing state... [id=rtb-0f2185335b017cc61]
module.vpc.aws_subnet.private[2]: Refreshing state... [id=subnet-0d4f4ca9f096464dd]
module.vpc.aws_route_table.private[1]: Refreshing state... [id=rtb-09c1c57a008223393]
module.vpc.aws_route_table.private[0]: Refreshing state... [id=rtb-07dc9c4526a82a973]
module.vpc.aws_subnet.private[0]: Refreshing state... [id=subnet-01aac8e8a532f352e]
module.vpc.aws_flow_log.network_flow_logging[0]: Refreshing state... [id=fl-08a25384f951ea198]
module.vpc.aws_subnet.private[1]: Refreshing state... [id=subnet-0c1a7cee6a8e46052]
module.vpc.aws_default_security_group.default: Refreshing state... [id=sg-091608f1675d5545a]
aws_security_group.endpoint_sg: Refreshing state... [id=sg-06287cec3cb8cbbb2]
aws_security_group.lambda: Refreshing state... [id=sg-0298ed11ba1bcb222]
aws_security_group_rule.egress_vpc_endpoint_lambda: Refreshing state... [id=sgrule-1992856239]
aws_security_group_rule.ingress_vpc_endpoint: Refreshing state... [id=sgrule-525218061]
module.vpc.aws_route_table_association.private[0]: Refreshing state... [id=rtbassoc-05a448c2f0b3c7501]
module.vpc.aws_route_table_association.private[1]: Refreshing state... [id=rtbassoc-048811f1e801b4cf0]
module.vpc.aws_route_table_association.private[2]: Refreshing state... [id=rtbassoc-089de4b952c53c8ed]
aws_vpc_endpoint.logs: Refreshing state... [id=vpce-026304585cf0f958f]
aws_vpc_endpoint.ssm: Refreshing state... [id=vpce-0fb8a50fc0fe70029]
aws_lambda_function.lambda_run: Refreshing state... [id=app-7]
aws_lambda_permission.allow_cloudwatch: Refreshing state... [id=AllowExecutionFromCloudWatch]
aws_cloudwatch_event_target.lambda_target: Refreshing state... [id=app-7-lambda-trigger-rule-lambda_target]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # aws_lambda_function.lambda_run will be updated in-place
  ~ resource "aws_lambda_function" "lambda_run" {
        id                             = "app-7"
      ~ last_modified                  = "2024-11-23T03:34:09.972+0000" -> (known after apply)
      ~ source_code_hash               = "NTFp25PFL/eo3L2aze0dY/cM+BVOnmrJ1/SY7tbRREk=" -> "r/IEcoyUiZqdbjpfqNbrR03Z+f3qKrwjwkDn/9yI5Wo="
        tags                           = {}
        # (27 unchanged attributes hidden)

        # (6 unchanged blocks hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

─────────────────────────────────────────────────────────────────────────────

Saved the plan to: TFplan.JSON

To perform exactly these actions, run the following command to apply:
    terraform apply "TFplan.JSON"

Pushed by: @kunduso, Action: pull_request

Copy link

Terraform Format and Style 🖌success

Terraform Initialization ⚙️success

Terraform Plan 📖success

Terraform Validation 🤖success

Show Plan

terraform
data.archive_file.python_file: Reading...
data.archive_file.python_file: Read complete after 0s [id=efca5ba5d15c470502277886d6f89aea9b62262c]
module.vpc.data.aws_availability_zones.available: Reading...
module.vpc.data.aws_iam_policy_document.assume_role: Reading...
module.vpc.data.aws_caller_identity.current: Reading...
data.aws_caller_identity.current: Reading...
aws_cloudwatch_event_rule.lambda_trigger: Refreshing state... [id=app-7-lambda-trigger-rule]
module.vpc.aws_vpc.this: Refreshing state... [id=vpc-04e21c3bc04de39d6]
aws_kms_key.encryption: Refreshing state... [id=8271b626-7314-47c0-8868-33d1a13e622c]
aws_iam_role.lambda_role: Refreshing state... [id=app-7-lambda-role]
module.vpc.aws_kms_key.custom_kms_key[0]: Refreshing state... [id=13ed7c50-95b4-48f4-9d6b-1cf992ecaa76]
module.vpc.data.aws_iam_policy_document.assume_role: Read complete after 0s [id=2717921857]
module.vpc.aws_iam_role.vpc_flow_log_role[0]: Refreshing state... [id=app-7-vpc-flow-role]
module.vpc.data.aws_caller_identity.current: Read complete after 0s [id=743794601996]
data.aws_caller_identity.current: Read complete after 0s [id=743794601996]
module.vpc.data.aws_availability_zones.available: Read complete after 0s [id=us-east-2]
aws_iam_role_policy_attachment.managed_vpc_policy_attachement: Refreshing state... [id=app-7-lambda-role-20241123033232789900000001]
module.vpc.aws_kms_alias.key[0]: Refreshing state... [id=alias/app-7-encrypt-flow-log]
aws_cloudwatch_log_group.lambda_log: Refreshing state... [id=/aws/lambda/app-7]
aws_ssm_parameter.parameter: Refreshing state... [id=/app-7]
aws_sqs_queue.dlq: Refreshing state... [id=https://sqs.us-east-2.amazonaws.com/743794601996/app-7-lambda-dlq]
data.aws_iam_policy_document.encryption_policy: Reading...
aws_kms_alias.encryption: Refreshing state... [id=alias/app-7]
module.vpc.aws_kms_key_policy.encrypt_log[0]: Refreshing state... [id=13ed7c50-95b4-48f4-9d6b-1cf992ecaa76]
module.vpc.aws_cloudwatch_log_group.network_flow_logging[0]: Refreshing state... [id=app-7-flow-logs]
data.aws_iam_policy_document.encryption_policy: Read complete after 0s [id=1711526448]
aws_kms_key_policy.encryption: Refreshing state... [id=8271b626-7314-47c0-8868-33d1a13e622c]
aws_cloudwatch_log_stream.log_stream: Refreshing state... [id=app-7-lambda-log-stream]
module.vpc.data.aws_iam_policy_document.vpc_flow_log_policy_document[0]: Reading...
module.vpc.data.aws_iam_policy_document.vpc_flow_log_policy_document[0]: Read complete after 0s [id=2325604698]
module.vpc.aws_iam_role_policy.vpc_flow_log_role_policy[0]: Refreshing state... [id=app-7-vpc-flow-role:app-7-vpc-flow-policy]
aws_iam_policy.lambda_policy: Refreshing state... [id=arn:aws:iam::743794601996:policy/app-7-lambda-policy]
aws_iam_role_policy_attachment.lambda_policy_attachement: Refreshing state... [id=app-7-lambda-role-20241123033307728800000002]
module.vpc.aws_default_security_group.default: Refreshing state... [id=sg-091608f1675d5545a]
aws_security_group.endpoint_sg: Refreshing state... [id=sg-06287cec3cb8cbbb2]
aws_security_group.lambda: Refreshing state... [id=sg-0298ed11ba1bcb222]
module.vpc.aws_route_table.private[2]: Refreshing state... [id=rtb-0f2185335b017cc61]
module.vpc.aws_flow_log.network_flow_logging[0]: Refreshing state... [id=fl-08a25384f951ea198]
module.vpc.aws_route_table.private[1]: Refreshing state... [id=rtb-09c1c57a008223393]
module.vpc.aws_route_table.private[0]: Refreshing state... [id=rtb-07dc9c4526a82a973]
module.vpc.aws_subnet.private[2]: Refreshing state... [id=subnet-0d4f4ca9f096464dd]
module.vpc.aws_subnet.private[0]: Refreshing state... [id=subnet-01aac8e8a532f352e]
module.vpc.aws_subnet.private[1]: Refreshing state... [id=subnet-0c1a7cee6a8e46052]
aws_security_group_rule.ingress_vpc_endpoint: Refreshing state... [id=sgrule-525218061]
aws_security_group_rule.egress_vpc_endpoint_lambda: Refreshing state... [id=sgrule-1992856239]
module.vpc.aws_route_table_association.private[1]: Refreshing state... [id=rtbassoc-048811f1e801b4cf0]
module.vpc.aws_route_table_association.private[0]: Refreshing state... [id=rtbassoc-05a448c2f0b3c7501]
module.vpc.aws_route_table_association.private[2]: Refreshing state... [id=rtbassoc-089de4b952c53c8ed]
aws_vpc_endpoint.ssm: Refreshing state... [id=vpce-0fb8a50fc0fe70029]
aws_lambda_function.lambda_run: Refreshing state... [id=app-7]
aws_vpc_endpoint.logs: Refreshing state... [id=vpce-026304585cf0f958f]
aws_lambda_permission.allow_cloudwatch: Refreshing state... [id=AllowExecutionFromCloudWatch]
aws_cloudwatch_event_target.lambda_target: Refreshing state... [id=app-7-lambda-trigger-rule-lambda_target]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # aws_lambda_function.lambda_run will be updated in-place
  ~ resource "aws_lambda_function" "lambda_run" {
        id                             = "app-7"
      ~ last_modified                  = "2024-11-23T03:34:09.972+0000" -> (known after apply)
      ~ source_code_hash               = "NTFp25PFL/eo3L2aze0dY/cM+BVOnmrJ1/SY7tbRREk=" -> "r/IEcoyUiZqdbjpfqNbrR03Z+f3qKrwjwkDn/9yI5Wo="
        tags                           = {}
        # (27 unchanged attributes hidden)

        # (6 unchanged blocks hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

─────────────────────────────────────────────────────────────────────────────

Saved the plan to: TFplan.JSON

To perform exactly these actions, run the following command to apply:
    terraform apply "TFplan.JSON"

Pushed by: @kunduso, Action: pull_request

@kunduso kunduso merged commit 142bee4 into main Nov 25, 2024
3 checks passed
@kunduso kunduso deleted the fix-checkov-scan-findings branch November 25, 2024 05:21
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.

Configure the AWS Lambda function inside a VPC
1 participant