cloud-platform-skills / skills
Cursor rule1 starsChanged 4 months agoMITView on GitHub
Enterprise IaC governance: Terragrunt DRY multi-account layouts, generated backends and providers, dependency graphs, and policy-as-code gates with OPA and Conftest. Use when Terraform has been copy-pasted across many accounts or environments, or when non-compliant resources such as unencrypted or untagged S3 buckets must be blocked in CI before apply rather than found afterwards.
In this repository167 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .agents/rules/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/00-index.mdcCursor rule
- .cursor/rules/skills/ai-agent-security-llm-threats.mdcCursor rule
- .cursor/rules/skills/api-gateway-service-mesh.mdcCursor rule
- .cursor/rules/skills/aws-cloud-migration-strategies.mdcCursor rule
- .cursor/rules/skills/aws-eks-enterprise-patterns.mdcCursor rule
- .cursor/rules/skills/aws-iam-zero-trust-policies.mdcCursor rule
- .cursor/rules/skills/azure-aks-enterprise-landing-zones.mdcCursor rule
- .cursor/rules/skills/azure-cloud-engineering-patterns.mdcCursor rule
- .cursor/rules/skills/backup-and-disaster-recovery.mdcCursor rule
- .cursor/rules/skills/chaos-engineering-resilience-testing.mdcCursor rule
- .cursor/rules/skills/cicd-pipeline-design.mdcCursor rule
- .cursor/rules/skills/cloud-native-microservices-patterns.mdcCursor rule
- .cursor/rules/skills/cloud-security-posture-cspm-cis.mdcCursor rule
- .cursor/rules/skills/configuration-management-ansible.mdcCursor rule
- .cursor/rules/skills/container-runtime-security-falco.mdcCursor rule
- .cursor/rules/skills/database-devops-lifecycle.mdcCursor rule
- .cursor/rules/skills/detection-engineering-threat-hunting.mdcCursor rule
- .cursor/rules/skills/devops-metrics-dora-kpis.mdcCursor rule
- .cursor/rules/skills/docker-containerization-basics.mdcCursor rule
- .cursor/rules/skills/finops-framework-inform-optimize-operate.mdcCursor rule
- .cursor/rules/skills/gcp-cloud-engineering-patterns.mdcCursor rule
- .cursor/rules/skills/gcp-gke-autopilot-multi-tenant.mdcCursor rule
- .cursor/rules/skills/git-branching-merge-strategies.mdcCursor rule
- .cursor/rules/skills/gitops-multi-cluster-argo-flux.mdcCursor rule
- .cursor/rules/skills/helm-kubernetes-deployment.mdcCursor rule
- .cursor/rules/skills/incident-management-and-postmortem.mdcCursor rule
- .cursor/rules/skills/infrastructure-host-monitoring.mdcCursor rule
- .cursor/rules/skills/internal-developer-portal-backstage.mdcCursor rule
- .cursor/rules/skills/linux-sysadmin-troubleshooting.mdcCursor rule
- .cursor/rules/skills/performance-load-testing.mdcCursor rule
- .cursor/rules/skills/policy-as-code-opa-kyverno.mdcCursor rule
- .cursor/rules/skills/prometheus-grafana-otel-tracing.mdcCursor rule
- .cursor/rules/skills/scalability-high-availability-patterns.mdcCursor rule
- .cursor/rules/skills/scripting-and-automation.mdcCursor rule
- .cursor/rules/skills/secops-incident-triage-forensics.mdcCursor rule
- .cursor/rules/skills/secrets-management-vault-kms.mdcCursor rule
- .cursor/rules/skills/serverless-event-driven-architecture.mdcCursor rule
- .cursor/rules/skills/shift-left-security-sast-sca.mdcCursor rule
- .cursor/rules/skills/sli-slo-error-budget-design.mdcCursor rule
- .cursor/rules/skills/supply-chain-security-slsa-sigstore.mdcCursor rule
- .cursor/rules/skills/terraform-iac-modules.mdcCursor rule
- .cursor/rules/skills/write-a-skill.mdcCursor rule
- .cursor/rules/skills/zero-downtime-release-strategies.mdcCursor rule
- ai-agent-security-llm-threatsSkill
- api-gateway-service-meshSkill
- aws-cloud-migration-strategiesSkill
- aws-eks-enterprise-patternsSkill
- aws-iam-zero-trust-policiesSkill
- azure-aks-enterprise-landing-zonesSkill
- azure-cloud-engineering-patternsSkill
- backup-and-disaster-recoverySkill
- chaos-engineering-resilience-testingSkill
- cicd-pipeline-designSkill
- cloud-native-microservices-patternsSkill
- cloud-security-posture-cspm-cisSkill
- configuration-management-ansibleSkill
- The first 60 shown.
The file
Files
---
description: "Enterprise IaC governance: Terragrunt DRY multi-account layouts, generated backends and providers, dependency graphs, and policy-as-code gates with OPA and Conftest. Use when Terraform has been copy-pasted across many accounts or environments, or when non-compliant resources such as unencrypted or untagged S3 buckets must be blocked in CI before apply rather than found afterwards."
globs:
alwaysApply: false
---
# Enterprise IaC Architecture & Terragrunt Governance
## When to Use This Skill
**Triggers — load this skill when:**
- Terraform has been copy-pasted across accounts/environments and needs DRY structure
- Infrastructure policy must be enforced in CI before apply (OPA/Conftest/Sentinel)
- State, backend, and provider configuration must be generated rather than duplicated
**Route elsewhere when:**
- Single-repo module design fundamentals -> `terraform-iac-modules`
- Runtime posture scanning of deployed resources -> `cloud-security-posture-cspm-cis`
## 1. Multi-Account Terragrunt Architecture
```text
live/
├── terragrunt.hcl # Root configuration (remote state, global tags)
├── _envcommon/
│ └── vpc.hcl # Reusable module definitions
├── prod/
│ ├── account.hcl # Account-specific variables & role ARNs
│ └── us-east-1/
│ └── networking/
│ └── terragrunt.hcl # Includes _envcommon/vpc.hcl
```
### Root Terragrunt Remote State & Provider Injection
```hcl
remote_state {
backend = "s3"
generate = {
path = "backend.tf"
if_exists = "overwrite_terragrunt"
}
config = {
bucket = "tf-state-${get_aws_account_id()}"
key = "${path_relative_to_include()}/terraform.tfstate"
region = "us-east-1"
encrypt = true
dynamodb_table = "tf-locks"
}
}
```
---
## 2. Policy-as-Code Enforcements (OPA Rego)
Enforce mandatory tagging and encryption across all Terraform plans before applying:
```rego
package terraform.analysis
default allow = false
# Rule: S3 Buckets must have server-side encryption enabled
deny[msg] {
resource := input.resource_changes[_]
resource.type == "aws_s3_bucket"
not resource.change.after.server_side_encryption_configuration
msg := sprintf("S3 Bucket '%v' must specify server_side_encryption_configuration", [resource.address])
}
allow {
count(deny) == 0
}
```
---
## 3. Governance Gate in CI (Conftest)
```yaml
- name: Terragrunt plan to JSON
run: |
terragrunt run-all plan -out=tfplan.binary --terragrunt-non-interactive
terragrunt run-all show -json tfplan.binary > tfplan.json
- name: Enforce policy
run: conftest test --policy policy/ --all-namespaces tfplan.json
```
Gate on the plan JSON, never on HCL source: only the plan reveals the resolved,
post-variable, post-module values an apply will actually create.
## 4. Best Practices & Anti-Patterns
| Do | Don't |
| --- | --- |
| Pin `terraform_version` and module `source` refs to immutable tags/SHAs | Track `main` or float provider versions across accounts |
| Keep one state file per account/region/component (blast-radius sizing) | Keep a monolithic state for the whole organization |
| Generate `backend.tf` / `provider.tf` via Terragrunt `generate` blocks | Copy backend and provider stanzas into every leaf module |
| Express cross-stack wiring with `dependency` blocks and outputs | Hardcode ARNs, VPC IDs, or account numbers between stacks |
| Fail the pipeline on policy `deny` before `apply` | Detect violations only after resources exist |
| Assume a per-account role via OIDC at plan/apply time | Share one long-lived admin credential across environments |
### Anti-patterns that reliably cause outages
- `run-all apply` across production without a reviewed, artifact-pinned plan.
- Policy exceptions granted in code comments instead of an expiring, owned waiver file.
- Terragrunt used purely as a `terraform` wrapper while duplication stays in leaf modules.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

