Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/package-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
aws-region: ap-southeast-1

- name: Terraform init
run: terraform init
Expand Down
44 changes: 44 additions & 0 deletions .terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,14 @@ COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD ["node", "index.js"]
CMD ["node", "index.js"]
FROM node:20-alpine

WORKDIR /app

COPY package.json package-lock.json ./
RUN npm install

COPY . .

CMD ["node", "index.js"] # Or your main script
6 changes: 3 additions & 3 deletions backend.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

terraform {
backend "s3" {
bucket = "sctp-ce9-tfstate"
key = "package-vul-scan-luqman.tfstate" #Change the value of this to <your suggested name>.tfstate for example
region = "us-east-1"
bucket = "sctp-ce10-tfstate"
key = "package-vul-scan-monica.tfstate" #Change the value of this to <your suggested name>.tfstate for example
region = "ap-southeast-1"
}
}
Binary file added files/index.zip
Binary file not shown.
16 changes: 10 additions & 6 deletions lambda.tf
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
# Defines the lambda function code that will be zipped

data "archive_file" "lambda" {
type = "zip"
source_file = "./files/${var.lambda_file_name}.mjs"
output_path = "./files/${var.lambda_file_name}.zip"
}

# Defines the lambda function to be created using file

resource "aws_lambda_function" "own_lambda" {
function_name = var.lambda_function_name
handler = "lambda_function.lambda_handler"
runtime = "nodejs22.x"
role = aws_iam_role.iam_for_lambda.arn
filename = data.archive_file.lambda.output_path # Adjust the path
source_code_hash = data.archive_file.lambda.output_base64sha256 # Adjust the path
}
role = aws_iam_role.iam_for_lambda.arn
filename = data.archive_file.lambda.output_path
source_code_hash = data.archive_file.lambda.output_base64sha256

tracing_config {
mode = "Active" # Enables AWS X-Ray tracing
}
}


13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/luqmannnn/serverless-package-scan.git"
"url": "git+github.com/mpatra123/serverless-package-scan.git"
},
"author": "luqman",
"author": "monica patra",
"license": "ISC",
"bugs": {
"url": "https://github.com/luqmannnn/serverless-package-scan/issues"
"url": "https://github.com/mpatra123/serverless-package-scan"
},
"homepage": "https://github.com/luqmannnn/serverless-package-scan#readme"
"homepage": "https://github.com/mpatra123/serverless-package-scan#readme"
}
12 changes: 8 additions & 4 deletions provider.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
terraform {
required_version = ">= 1.3"

required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
version = ">= 5.0, < 7.0"
}
}
}

# Configure the AWS Provider
provider "aws" {}
variable "aws_region" {
description = "The AWS region to deploy into"
type = string
default = "ap-southeast-1" # or your preferred region
}
8 changes: 4 additions & 4 deletions variable.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
variable lambda_function_name {
description = "Name of lambda function"
type = string
default = "luqman-package-scan-lambda-fn"
default = "monica-package-scan-lambda-fn"
}

variable lambda_file_name {
Expand All @@ -13,17 +13,17 @@ variable lambda_file_name {
variable "iam_name" {
description = "Name of IAM"
type = string
default = "iam_package_scan_luqman_lambda"
default = "iam_package_scan_monica_lambda"
}

variable "vpc_name" {
description = "The ID of the VPC"
type = string
default = "luqman-vpc-tf-module"
default = "monica-vpc-tf-module"
}

variable "created_by" {
description = "The name of vpc creator"
type = string
default = "luqman"
default = "monica patra"
}
4 changes: 2 additions & 2 deletions vpc.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module "vpc" {
name = var.vpc_name
cidr = "10.0.0.0/16"

azs = ["us-east-1a", "us-east-1b", "us-east-1c"]
azs = ["ap-southeast-1a", "ap-southeast-1b", "ap-southeast-1c"]
private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
public_subnets = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"]

Expand All @@ -14,7 +14,7 @@ module "vpc" {
Terraform = "true"
Environment = "dev"
Created_by = var.created_by
Cohort = "CE9"
Cohort = "CE10"
}
}

Expand Down