202310111147-check_terraform_with_checkov
You can check specific files: checkov -f module.tf.
You can also check a whole terraform plan at once:
terraform init
terraform plan -out tf.plan
terraform show -json tf.plan > tf.json
checkov -f tf.json
The json will have all terraform code one a single line, so be aware that all error messages will point to line 0.
If you have jq installed, you can instead use:
terraform init
terraform plan -out tf.binary
terraform show -json tf.binary | jq > tfplan.json
checkov -f tfplan.json