CtrlK
BlogDocsLog inGet started
Tessl Logo

nitinjain999/platform-skills

Production-grade platform engineering handbook — Kubernetes, Terraform, Flux CD, GitHub Actions, AWS, and more.

67

Quality

84%

Does it follow best practices?

Impact

No eval scenarios have been run

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

README.mdexamples/demo/terraform-iam-risk/

Demo: Terraform IAM Risk

Status: Stable

A Terraform IAM policy that gives an application AdministratorAccess in disguise. Platform-skills catches it before the plan is applied.

What's wrong with bad.tf

FindingSeverityRisk
Action: "*" — full AWS accessCriticalAny compromised instance = full account takeover
Resource: "*" — all resourcesCriticalNo scope boundary on any service
No Condition on assume-roleHighRole can be assumed from any region
Single catch-all policyMediumImpossible to audit what the app actually needs

What changed in fixed.tf

  • Actions scoped to exactly what the app does: s3:GetObject, s3:ListBucket, s3:PutObject, s3:DeleteObject, secretsmanager:GetSecretValue
  • Resources scoped to named bucket and app-prefixed secrets — no wildcard
  • Regional Condition on assume-role — blocks cross-region assume
  • Separate policy statements with Sid labels — auditable in CloudTrail

Blast radius of bad.tf

  • Compromised EC2 instance → attacker has iam:CreateUser, iam:AttachUserPolicy, ec2:RunInstances → lateral movement across the account
  • Misconfigured app → accidentally deletes S3 buckets, terminates instances, modifies security groups

Validation

bad.tf and fixed.tf intentionally define the same resources so they cannot be validated together as one module. Copy fixed.tf to a clean directory to validate it:

mkdir /tmp/tf-demo && cp examples/demo/terraform-iam-risk/fixed.tf examples/demo/terraform-iam-risk/versions.tf /tmp/tf-demo/
cd /tmp/tf-demo
terraform init && terraform validate
terraform plan -var="app_name=myapp" -var="bucket_name=my-bucket" -var="aws_region=us-east-1"

Try it yourself

Use $platform-skills to review this Terraform IAM policy for least privilege.
Flag wildcard actions, wildcard resources, missing conditions, and safer alternatives.

examples

demo

terraform-iam-risk

BEFORE_AFTER.md

CHANGELOG.md

CODE_OF_CONDUCT.md

COMMANDS.md

CONTRIBUTING.md

EDITOR_INTEGRATIONS.md

GETTING_STARTED.md

HOW_IT_WORKS.md

install.sh

INSTALLATION.md

LAUNCH.md

PROMPTS.md

QUICKSTART.md

README.md

renovate.json

SECURITY.md

SKILL.md

tessl.json

tile.json