This repository is a deliberately vulnerable Terraform project for demonstrating Codacy analysis with Trivy, Checkov, and Opengrep.
Do not apply this infrastructure. The resources are intentionally configured with security issues so static analyzers have useful findings to report.
- Publicly exposed cloud resources
- Missing encryption and logging controls
- Overly permissive IAM policies
- Hardcoded credentials and secrets
- Risky Terraform provisioner usage
- Insecure Kubernetes workload settings
The exact rule identifiers can vary by analyzer version and policy bundle, but these files should produce representative findings:
storage.tf: public S3 access, disabled bucket controls, unencrypted datanetwork.tf: security groups open to the internetcompute.tf: public EC2 instance, weak metadata settings, shell provisionerdatabase.tf: public database, weak backup/encryption protectionsiam.tf: wildcard IAM permissionskubernetes.tf: privileged container and hardcoded secret materialvariables.tf: hardcoded sensitive defaults
The local environment did not have Terraform or Checkov installed, so those commands were not run here.
Trivy was available and reported 25 Terraform misconfiguration findings:
compute.tf: 3 findingsdatabase.tf: 6 findingsiam.tf: 1 findingnetwork.tf: 4 findingsstorage.tf: 11 findings
Opengrep was available and reported 10 code findings using --config auto,
including public EC2/subnet exposure, local provisioner usage, public RDS,
wildcard IAM permissions, public S3 access, and unencrypted EBS storage.
terraform fmt -check -recursive
terraform validateterraform validate may require terraform init first so Terraform can install
the AWS and Kubernetes providers.