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
35 changes: 35 additions & 0 deletions .github/workflows/checkov.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: checkov
on:
pull_request:
push:
branches:
- main
jobs:
scan:
runs-on: ubuntu-latest
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for GitHub/codeql-action/upload-sarif to upload SARIF results

steps:
- uses: actions/checkout@v2

- name: Run checkov
id: checkov
uses: bridgecrewio/checkov-action@master
with:
directory: code/
#soft_fail: true
#api-key: ${{ secrets.BC_API_KEY }}
#env:
#PRISMA_API_URL: https://api4.prismacloud.io

- name: Upload SARIF file
uses: GitHub/codeql-action/upload-sarif@v2

# Results are generated only on a success or failure
# this is required since GitHub by default won't run the next step
# when the previous one has failed. Alternatively, enable soft_fail in checkov action.
if: success() || failure()
with:
sarif_file: results.sarif
19 changes: 19 additions & 0 deletions .github/workflows/yor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: IaC tag and trace

on:
push:
pull_request:

jobs:
yor:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v2
name: Checkout repo
with:
fetch-depth: 0
- name: Run yor action
uses: bridgecrewio/yor-action@main
150 changes: 141 additions & 9 deletions code/deployment_ec2.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,55 @@ export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMAAAKEY
export AWS_DEFAULT_REGION=us-west-2
echo "<h1>Deployed via Terraform</h1>" | sudo tee /var/www/html/index.html
EOF


tags = {
git_commit = "d4c35e0270bfd542051278ca30b4b3872c1ae0b2"
git_file = "code/deployment_ec2.tf"
git_last_modified_at = "2024-01-26 23:01:56"
git_last_modified_by = "[email protected]"
git_modifiers = "tprendervill"
git_org = "nextdrought"
git_repo = "prisma-cloud-devsecops-workshop"
yor_name = "web_host"
yor_trace = "d296ce0c-1c1e-44e4-a9b3-8bb09f89f362"
}
}

resource "aws_ebs_volume" "web_host_storage" {
# unencrypted volume
availability_zone = "${var.region}a"
#encrypted = false # Setting this causes the volume to be recreated on apply
size = 1


tags = {
git_commit = "d4c35e0270bfd542051278ca30b4b3872c1ae0b2"
git_file = "code/deployment_ec2.tf"
git_last_modified_at = "2024-01-26 23:01:56"
git_last_modified_by = "[email protected]"
git_modifiers = "tprendervill"
git_org = "nextdrought"
git_repo = "prisma-cloud-devsecops-workshop"
yor_name = "web_host_storage"
yor_trace = "2def9329-0226-47b1-a4c5-0cf0c443f4fc"
}
}

resource "aws_ebs_snapshot" "example_snapshot" {
# ebs snapshot without encryption
volume_id = "${aws_ebs_volume.web_host_storage.id}"
description = "${local.resource_prefix.value}-ebs-snapshot"


tags = {
git_commit = "d4c35e0270bfd542051278ca30b4b3872c1ae0b2"
git_file = "code/deployment_ec2.tf"
git_last_modified_at = "2024-01-26 23:01:56"
git_last_modified_by = "[email protected]"
git_modifiers = "tprendervill"
git_org = "nextdrought"
git_repo = "prisma-cloud-devsecops-workshop"
yor_name = "example_snapshot"
yor_trace = "5389a2cf-4a68-4eb0-b0b3-10704b9cc26b"
}
}

resource "aws_volume_attachment" "ebs_att" {
Expand Down Expand Up @@ -69,14 +102,36 @@ resource "aws_security_group" "web-node" {
"0.0.0.0/0"]
}
depends_on = [aws_vpc.web_vpc]


tags = {
git_commit = "d4c35e0270bfd542051278ca30b4b3872c1ae0b2"
git_file = "code/deployment_ec2.tf"
git_last_modified_at = "2024-01-26 23:01:56"
git_last_modified_by = "[email protected]"
git_modifiers = "tprendervill"
git_org = "nextdrought"
git_repo = "prisma-cloud-devsecops-workshop"
yor_name = "web-node"
yor_trace = "5d87308b-e78d-4129-86a2-96e18b99458a"
}
}

resource "aws_vpc" "web_vpc" {
cidr_block = "172.16.0.0/16"
enable_dns_hostnames = true
enable_dns_support = true


tags = {
git_commit = "d4c35e0270bfd542051278ca30b4b3872c1ae0b2"
git_file = "code/deployment_ec2.tf"
git_last_modified_at = "2024-01-26 23:01:56"
git_last_modified_by = "[email protected]"
git_modifiers = "tprendervill"
git_org = "nextdrought"
git_repo = "prisma-cloud-devsecops-workshop"
yor_name = "web_vpc"
yor_trace = "c21f93b9-1453-4c73-b669-36fbd500ac56"
}
}

resource "aws_subnet" "web_subnet" {
Expand All @@ -85,7 +140,18 @@ resource "aws_subnet" "web_subnet" {
availability_zone = "${var.region}a"
map_public_ip_on_launch = true



tags = {
git_commit = "d4c35e0270bfd542051278ca30b4b3872c1ae0b2"
git_file = "code/deployment_ec2.tf"
git_last_modified_at = "2024-01-26 23:01:56"
git_last_modified_by = "[email protected]"
git_modifiers = "tprendervill"
git_org = "nextdrought"
git_repo = "prisma-cloud-devsecops-workshop"
yor_name = "web_subnet"
yor_trace = "6de12493-42f4-48e4-8157-2f61739c3139"
}
}

resource "aws_subnet" "web_subnet2" {
Expand All @@ -94,20 +160,53 @@ resource "aws_subnet" "web_subnet2" {
availability_zone = "${var.region}b"
map_public_ip_on_launch = true



tags = {
git_commit = "d4c35e0270bfd542051278ca30b4b3872c1ae0b2"
git_file = "code/deployment_ec2.tf"
git_last_modified_at = "2024-01-26 23:01:56"
git_last_modified_by = "[email protected]"
git_modifiers = "tprendervill"
git_org = "nextdrought"
git_repo = "prisma-cloud-devsecops-workshop"
yor_name = "web_subnet2"
yor_trace = "f15257c7-9946-4af4-9a54-847a8dacfb5c"
}
}


resource "aws_internet_gateway" "web_igw" {
vpc_id = aws_vpc.web_vpc.id



tags = {
git_commit = "d4c35e0270bfd542051278ca30b4b3872c1ae0b2"
git_file = "code/deployment_ec2.tf"
git_last_modified_at = "2024-01-26 23:01:56"
git_last_modified_by = "[email protected]"
git_modifiers = "tprendervill"
git_org = "nextdrought"
git_repo = "prisma-cloud-devsecops-workshop"
yor_name = "web_igw"
yor_trace = "4fbe8e03-d242-48b7-8254-316c36198723"
}
}

resource "aws_route_table" "web_rtb" {
vpc_id = aws_vpc.web_vpc.id



tags = {
git_commit = "d4c35e0270bfd542051278ca30b4b3872c1ae0b2"
git_file = "code/deployment_ec2.tf"
git_last_modified_at = "2024-01-26 23:01:56"
git_last_modified_by = "[email protected]"
git_modifiers = "tprendervill"
git_org = "nextdrought"
git_repo = "prisma-cloud-devsecops-workshop"
yor_name = "web_rtb"
yor_trace = "2aa72173-bbb2-4267-af02-22db40600d01"
}
}

resource "aws_route_table_association" "rtbassoc" {
Expand All @@ -134,6 +233,17 @@ resource "aws_network_interface" "web-eni" {
subnet_id = aws_subnet.web_subnet.id
private_ips = ["172.16.10.100"]

tags = {
git_commit = "d4c35e0270bfd542051278ca30b4b3872c1ae0b2"
git_file = "code/deployment_ec2.tf"
git_last_modified_at = "2024-01-26 23:01:56"
git_last_modified_by = "[email protected]"
git_modifiers = "tprendervill"
git_org = "nextdrought"
git_repo = "prisma-cloud-devsecops-workshop"
yor_name = "web-eni"
yor_trace = "27a88918-a4c6-4ea4-a8bc-5ceee8e060e3"
}
}

# VPC Flow Logs to S3
Expand All @@ -144,12 +254,34 @@ resource "aws_flow_log" "vpcflowlogs" {
vpc_id = aws_vpc.web_vpc.id


tags = {
git_commit = "d4c35e0270bfd542051278ca30b4b3872c1ae0b2"
git_file = "code/deployment_ec2.tf"
git_last_modified_at = "2024-01-26 23:01:56"
git_last_modified_by = "[email protected]"
git_modifiers = "tprendervill"
git_org = "nextdrought"
git_repo = "prisma-cloud-devsecops-workshop"
yor_name = "vpcflowlogs"
yor_trace = "1c869732-577f-4446-a345-9c2a97470c68"
}
}

resource "aws_s3_bucket" "flowbucket" {
bucket = "${local.resource_prefix.value}-flowlogs"
force_destroy = true

tags = {
git_commit = "d4c35e0270bfd542051278ca30b4b3872c1ae0b2"
git_file = "code/deployment_ec2.tf"
git_last_modified_at = "2024-01-26 23:01:56"
git_last_modified_by = "[email protected]"
git_modifiers = "tprendervill"
git_org = "nextdrought"
git_repo = "prisma-cloud-devsecops-workshop"
yor_name = "flowbucket"
yor_trace = "1372d49b-2d93-48cb-833b-06738d727dd4"
}
}

# OUTPUTS
Expand Down
76 changes: 71 additions & 5 deletions code/deployment_s3.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,36 @@ resource "aws_s3_bucket" "data" {
# bucket does not have versioning
bucket = "${local.resource_prefix.value}-data"
force_destroy = true


tags = {
git_commit = "d4c35e0270bfd542051278ca30b4b3872c1ae0b2"
git_file = "code/deployment_s3.tf"
git_last_modified_at = "2024-01-26 23:01:56"
git_last_modified_by = "[email protected]"
git_modifiers = "tprendervill"
git_org = "nextdrought"
git_repo = "prisma-cloud-devsecops-workshop"
yor_name = "data"
yor_trace = "6f2d0929-9b79-4927-9696-1231e70b4a66"
}
}

resource "aws_s3_bucket_object" "data_object" {
bucket = aws_s3_bucket.data.id
key = "customer-master.xlsx"
source = "resources/customer-master.xlsx"


tags = {
git_commit = "d4c35e0270bfd542051278ca30b4b3872c1ae0b2"
git_file = "code/deployment_s3.tf"
git_last_modified_at = "2024-01-26 23:01:56"
git_last_modified_by = "[email protected]"
git_modifiers = "tprendervill"
git_org = "nextdrought"
git_repo = "prisma-cloud-devsecops-workshop"
yor_name = "data_object"
yor_trace = "869b9cf9-0a98-4ba8-8064-2953e147e649"
}
}

resource "aws_s3_bucket" "financials" {
Expand All @@ -23,6 +45,17 @@ resource "aws_s3_bucket" "financials" {
acl = "private"
force_destroy = true

tags = {
git_commit = "d4c35e0270bfd542051278ca30b4b3872c1ae0b2"
git_file = "code/deployment_s3.tf"
git_last_modified_at = "2024-01-26 23:01:56"
git_last_modified_by = "[email protected]"
git_modifiers = "tprendervill"
git_org = "nextdrought"
git_repo = "prisma-cloud-devsecops-workshop"
yor_name = "financials"
yor_trace = "f2a83413-ba18-4eaa-aa0d-9c33f6e77160"
}
}

resource "aws_s3_bucket" "operations" {
Expand All @@ -34,7 +67,18 @@ resource "aws_s3_bucket" "operations" {
enabled = true
}
force_destroy = true


tags = {
git_commit = "d4c35e0270bfd542051278ca30b4b3872c1ae0b2"
git_file = "code/deployment_s3.tf"
git_last_modified_at = "2024-01-26 23:01:56"
git_last_modified_by = "[email protected]"
git_modifiers = "tprendervill"
git_org = "nextdrought"
git_repo = "prisma-cloud-devsecops-workshop"
yor_name = "operations"
yor_trace = "95ad244c-8ab1-4d06-84b5-545cf7709bde"
}
}

resource "aws_s3_bucket" "data_science" {
Expand All @@ -49,7 +93,18 @@ resource "aws_s3_bucket" "data_science" {
target_prefix = "log/"
}
force_destroy = true


tags = {
git_commit = "d4c35e0270bfd542051278ca30b4b3872c1ae0b2"
git_file = "code/deployment_s3.tf"
git_last_modified_at = "2024-01-26 23:01:56"
git_last_modified_by = "[email protected]"
git_modifiers = "tprendervill"
git_org = "nextdrought"
git_repo = "prisma-cloud-devsecops-workshop"
yor_name = "data_science"
yor_trace = "7326a609-18f2-48cd-ab43-5f882c27c922"
}
}

resource "aws_s3_bucket" "logs" {
Expand All @@ -67,5 +122,16 @@ resource "aws_s3_bucket" "logs" {
}
}
force_destroy = true


tags = {
git_commit = "d4c35e0270bfd542051278ca30b4b3872c1ae0b2"
git_file = "code/deployment_s3.tf"
git_last_modified_at = "2024-01-26 23:01:56"
git_last_modified_by = "[email protected]"
git_modifiers = "tprendervill"
git_org = "nextdrought"
git_repo = "prisma-cloud-devsecops-workshop"
yor_name = "logs"
yor_trace = "4c0b547a-ae0d-4158-96dd-a0c4b94538eb"
}
}
Loading