Skip to content

Commit

Permalink
Switch to looking explicitly for policy_checker.json file
Browse files Browse the repository at this point in the history
  • Loading branch information
KashifSaadat committed Apr 22, 2022
1 parent d4ca86b commit 366a4d8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
This is a tool that can be used both locally and in CI to determine if your repository is compliant with your Organisation's Policy as Code.

Policy location and versions are determined by:
- **Terraform:** Scans `x.tfvars.json` files in your repository looking for 3 keys:
- **Terraform:** Scans `policy_checker.json` file in your repository looking for 3 keys:
```json
{
"policy_checker_source": "https://github.com/appvia/policy",
"policy_checker_version": "1.0.1",
"policy_checker_config": "infra/generic/config.yaml"
"source": "https://github.com/appvia/policy",
"version": "1.0.1",
"config": "infra/generic/config.yaml"
}
```
- **Kubernetes:** *Not yet implemented*
Expand All @@ -26,4 +26,4 @@ $ docker run --rm -v ${PWD}:/workdir -e RUN_CHECKOV_POLICIES=true ghcr.io/appvia
## Examples

- **Policy as Code:** https://github.com/appvia/policy
- **Terraform Module:** https://github.com/appvia/tf-aws-rds-postgres
- **Terraform Module:** https://github.com/appvia/tf-aws-rds-postgres
10 changes: 5 additions & 5 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ function jq_fetch () {
}

if $RUN_CHECKOV_POLICIES ; then
echo "Locating policy-checker variables within *.tfvars.json files.."
TFVARS_CONTENT=`cat *.tfvars.json`
POLICY_SOURCE=$(jq_fetch "${TFVARS_CONTENT}" "policy_checker_source")
POLICY_VERSION=$(jq_fetch "${TFVARS_CONTENT}" "policy_checker_version")
POLICY_CONFIG=$(jq_fetch "${TFVARS_CONTENT}" "policy_checker_config")
echo "Locating policy-checker variables within policy_checker.json file..."
POLICY_CHECKER_VARIABLES=`cat policy_checker.json`
POLICY_SOURCE=$(jq_fetch "${POLICY_CHECKER_VARIABLES}" "source")
POLICY_VERSION=$(jq_fetch "${POLICY_CHECKER_VARIABLES}" "version")
POLICY_CONFIG=$(jq_fetch "${POLICY_CHECKER_VARIABLES}" "config")
echo "Policy Package: ${POLICY_SOURCE}:${POLICY_VERSION}"

echo "Fetching Policies..."
Expand Down

0 comments on commit 366a4d8

Please sign in to comment.