Skip to content

Commit b291333

Browse files
authored
Merge pull request #13 from aws-samples/sast
update sast and lint to use specified versions
2 parents 0901dd7 + 4560a3a commit b291333

File tree

5 files changed

+20
-10
lines changed

5 files changed

+20
-10
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ module "pipeline" {
6969
build_timeout = 10
7070
terraform_version = "1.5.7"
7171
checkov_version = "3.2.0"
72-
tflint_version = "0.33.0"
72+
tflint_version = "0.48.0"
7373
7474
7575
checkov_skip = [
@@ -91,11 +91,11 @@ module "pipeline" {
9191

9292
`build_timeout` is the CodeBuild project build timeout. It defaults to 10 (minutes).
9393

94-
`terraform_version` controls the terraform version. It defaults to latest.
94+
`terraform_version` controls the terraform version. It defaults to 1.5.7.
9595

9696
`checkov_version` controls the [Checkov](https://www.checkov.io/) version. It defaults to latest.
9797

98-
`tflint_version` controls the [tflint](https://github.com/terraform-linters/tflint) version. It defaults to 0.33.0.
98+
`tflint_version` controls the [tflint](https://github.com/terraform-linters/tflint) version. It defaults to 0.48.0.
9999

100100
`checkov_skip` defines [Checkov](https://www.checkov.io/) skips for the pipeline. This is useful for organization-wide policies, removing the need to add individual resource skips.
101101

locals.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ locals {
88
validate = "hashicorp/terraform:${var.terraform_version}"
99
fmt = "hashicorp/terraform:${var.terraform_version}"
1010
lint = "aws/codebuild/amazonlinux2-x86_64-standard:5.0"
11-
sast = "bridgecrew/checkov:${var.checkov_version}"
11+
sast = "aws/codebuild/amazonlinux2-x86_64-standard:5.0"
1212
}
1313

1414
env_var = {
1515
TFLINT_VERSION = var.tflint_version
1616
SAST_REPORT_ARN = aws_codebuild_report_group.sast.arn
1717
CHECKOV_SKIPS = join(",", "${var.checkov_skip}")
18+
TF_VERSION = "1.5.7"
1819
}
1920
}

modules/codebuild/buildspecs/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ phases:
77
- cd /usr/bin
88
- yum install -y yum-utils
99
- yum-config-manager --add-repo https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo
10-
- yum install -y terraform
10+
- yum install -y terraform-${TF_VERSION}
1111
- curl --location https://github.com/terraform-linters/tflint/releases/download/v${TFLINT_VERSION}/tflint_linux_amd64.zip --output tflint_linux_amd64.zip
1212
- curl --location https://github.com/terraform-linters/tflint/releases/download/v${TFLINT_VERSION}/checksums.txt --output checksums.txt
1313
- file=$(sha256sum tflint_linux_amd64.zip | cut -d" " -f1)

modules/codebuild/buildspecs/sast.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
version: 0.2
22

33
phases:
4+
5+
install:
6+
runtime-versions:
7+
python: 3.12
8+
commands:
9+
- cd /usr/bin
10+
- yum install -y yum-utils
11+
- yum-config-manager --add-repo https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo
12+
- yum install -y terraform-${TF_VERSION}
13+
- python -V
14+
- pip3 install checkov
15+
416
build:
517
commands:
618
- cd "$CODEBUILD_SRC_DIR"
@@ -11,8 +23,6 @@ phases:
1123
checkov --directory ./ --skip-path ./deploy --skip-check ${CHECKOV_SKIPS} -o junitxml > checkov.xml
1224
fi
1325
14-
- cat checkov.xml
15-
1626
post_build:
1727
commands:
1828
- echo "checkov complete, see report for details"
@@ -23,4 +33,3 @@ reports:
2333
- checkov.xml
2434
base-directory: ./
2535
file-format: JUNITXML
26-

variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ variable "kms_key" {
7373

7474
variable "terraform_version" {
7575
type = string
76-
default = "latest"
76+
default = "1.5.7"
7777
}
7878

7979
variable "tflint_version" {
8080
type = string
81-
default = "0.33.0"
81+
default = "0.48.0"
8282
}

0 commit comments

Comments
 (0)