working test on mock data
This commit is contained in:
@@ -81,9 +81,13 @@ else
|
||||
# We continue execution to run all checks
|
||||
fi
|
||||
|
||||
echo -e "\n${YELLOW}Generating Terraform plan...${NC}"
|
||||
terraform plan -var-file="variables.tfvars" -out=tfplan
|
||||
terraform show -json tfplan | jq > tfplan.json
|
||||
|
||||
# Step 3: Run checkov
|
||||
echo -e "\n${YELLOW}Running checkov security scanner...${NC}"
|
||||
checkov -d .
|
||||
checkov -f tfplan.json
|
||||
CHECKOV_EXIT=$?
|
||||
if [ $CHECKOV_EXIT -eq 0 ]; then
|
||||
echo -e "${GREEN}✅ checkov scan passed.${NC}"
|
||||
@@ -93,13 +97,11 @@ else
|
||||
fi
|
||||
|
||||
# Step 4: Generate plan and run OPA policies
|
||||
echo -e "\n${YELLOW}Generating Terraform plan...${NC}"
|
||||
terraform plan -var-file="variables.tfvars" -out=tfplan
|
||||
terraform show -json tfplan > tfplan.json
|
||||
|
||||
|
||||
echo -e "\n${YELLOW}Running OPA policy checks...${NC}"
|
||||
if [ -d "policies" ]; then
|
||||
conftest test tfplan.json -p policies/
|
||||
if [ -d "policy" ]; then
|
||||
conftest test tfplan.json -p policy/
|
||||
CONFTEST_EXIT=$?
|
||||
if [ $CONFTEST_EXIT -eq 0 ]; then
|
||||
echo -e "${GREEN}✅ OPA policy checks passed.${NC}"
|
||||
|
||||
Reference in New Issue
Block a user