# Terraform Security Toolkit by Sachan & Partners

Production-ready, battle-tested policy-as-code guardrails for Google Cloud Platform (GCP), Amazon Web Services (AWS), and Microsoft Azure.

Developed and maintained by [Sachan & Partners](https://sachanpartners.co.uk) — UK Cloud, AI and Cyber Security Advisory.

---

## What's Included

* **Google Cloud (`gcp_org_policies.tf`):**
  * Prevent long-lived service account JSON key creation (`iam.disableServiceAccountKeyCreation`).
  * Enforce public access prevention on all Cloud Storage buckets (`storage.publicAccessPrevention`).
  * Restrict public IP addresses on Compute Engine instances (`compute.vmExternalIpAccess`).
* **Amazon Web Services (`aws_scp_guardrails.tf`):**
  * Enforce IMDSv2 token authentication for all EC2 workloads to mitigate SSRF credential theft.
  * Deny all API actions executed by the root user account.
  * Restrict provisioning to approved UK / EU regions (`eu-west-2`, `eu-west-1`).
* **Microsoft Azure (`azure_security_policies.tf`):**
  * Deny direct Public IP attachments to Virtual Machine Network Interfaces (NICs).
  * Require automated disk encryption for all managed disks.
* **CI/CD Automation (`.github/workflows/security-scan.yml`):**
  * Automated pull request scanning with Trivy and Checkov to catch misconfigurations before `terraform apply`.

---

## Quick Start

### 1. Google Cloud Org Policies
```hcl
module "gcp_guardrails" {
  source     = "./gcp_org_policies.tf"
  project_id = "your-gcp-project-id"
}
```

### 2. Run Automated Security Scan
```bash
# Run Trivy IaC Scanner locally
trivy config .
```

---

## Need Tailored Enterprise Guardrails?

Need custom landing zones, compliance alignment (Cyber Essentials, NHS DSPT, ISO 27001), or hands-on implementation?

* **Website:** [sachanpartners.co.uk](https://sachanpartners.co.uk)
* **Email:** [advisory@sachanpartners.co.uk](mailto:advisory@sachanpartners.co.uk)
* **Consultation:** [Book a 30-minute discovery call](https://cal.com/sachan-partners/intro)

---

## Licence
MIT License. Free for commercial and non-commercial use.
