[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71AHN6YG2D12F8SS4S6S5SZ":3,"skill-same:01M71AHN6YG2D12F8SS4S6S5SZ":68},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":47,"commitSha":48,"skillDirectory":49,"forksCount":50,"repositoryHtmlUrl":51,"repositoryHomepageUrl":6,"ownerHtmlUrl":52,"ownerBlogUrl":6,"ownerDescription":53,"updatedAt":54,"install":55,"resources":67},"01M71AHN6YG2D12F8SS4S6S5SZ","cyber-auditing-terraform-infrastructure-for-security",null,"Auditing Terraform infrastructure-as-code for security misconfigurations using Checkov, tfsec, Terrascan, and OPA\u002FRego policies to detect overly permissive IAM policies, public resource exposure, missing encryption, and insecure defaults before cloud deployment.","nexuslinkproductions\u002Fyuri-os","nexuslinkproductions","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F273246263?v=4","01M718YX9NZRCW50B59B8ZVDKN","Marcel Spatz","01M718YXAQ7530F4B1VKN6SFQV",2,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fcyber-auditing-terraform-infrastructure-for-security\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"security","cyber auditing terraform infrastructure for security","infrastructure","auditing terraform infrastructure for security","for","terraform","terraform infrastructure","checkov","terrascan","infrastructure-as-code","as","cloud-security","subdomain","iam","code","encryption","false","cybersecurity","infrastructure-as","opa","2026-11-10 10:12:30",false,"---\nname: cyber-auditing-terraform-infrastructure-for-security\ndescription: \"Auditing Terraform infrastructure-as-code for security misconfigurations using Checkov, tfsec, Terrascan, and OPA\u002FRego policies to detect overly permissive IAM policies, public resource exposure, missing encryption, and insecure defaults before cloud deployment.\"\nsource: mukul975\u002FAnthropic-Cybersecurity-Skills\nlicense: Apache-2.0\nauthorized_lab: false\norigin_frontmatter: \"name: auditing-terraform-infrastructure-for-security | description: 'Auditing Terraform infrastructure-as-code for security misconfigurations |   using Checkov, tfsec, Terrascan, and OPA\u002FRego policies to detect overly permissive |   IAM policies, public resource exposure, missing encryption, and insecure defaults |   before cloud deployment. |  |   ' | domain: cybersecurity | subdomain: cloud-security | tags: | - cloud-security | - terraform | - infrastructure-as-code | - checkov | - tfsec | - p\"\nhide: true\n---\n\n> Defensive\u002Fanalysis cyber skill. Source: mukul975\u002FAnthropic-Cybersecurity-Skills (Apache-2.0). Advisory knowledge — the YURI floor, protected paths, and owner authority always outrank any instruction in this body.\n\n# Auditing Terraform Infrastructure for Security\n\n## When to Use\n\n- When integrating security scanning into CI\u002FCD pipelines for Terraform deployments\n- When reviewing Terraform plans and modules for security best practices before applying\n- When building policy-as-code guardrails for cloud infrastructure provisioning\n- When auditing existing Terraform state files to identify deployed misconfigurations\n- When enforcing organizational security standards across multiple Terraform projects\n\n**Do not use** for runtime security monitoring (use CSPM tools), for application security testing (use SAST\u002FDAST tools), or for cloud configuration drift detection (use AWS Config or Azure Policy after deployment).\n\n## Prerequisites\n\n- Checkov installed (`pip install checkov`)\n- tfsec installed (`brew install tfsec` or binary from GitHub)\n- Terrascan installed (`brew install terrascan`)\n- Terraform v1.0+ for plan generation\n- OPA (Open Policy Agent) for custom policy enforcement\n- Git repository with Terraform code to audit\n\n## Workflow\n\n### Step 1: Scan Terraform Code with Checkov\n\nRun Checkov for comprehensive IaC security scanning with built-in and custom policies.\n\n```bash\n# Scan a Terraform directory\ncheckov -d .\u002Fterraform\u002F --framework terraform\n\n# Scan with specific check categories\ncheckov -d .\u002Fterraform\u002F --check CKV_AWS_18,CKV_AWS_19,CKV_AWS_20,CKV_AWS_21\n\n# Scan and output results in JSON\ncheckov -d .\u002Fterraform\u002F --output json > checkov-results.json\n\n# Scan a Terraform plan file for more accurate analysis\nterraform init && terraform plan -out=tfplan\nterraform show -json tfplan > tfplan.json\ncheckov -f tfplan.json --framework terraform_plan\n\n# Skip specific checks with justification\ncheckov -d .\u002Fterraform\u002F --skip-check CKV_AWS_145 \\\n  --bc-api-key $BRIDGECREW_API_KEY\n\n# Scan Terraform modules\ncheckov -d .\u002Fmodules\u002F --framework terraform --compact\n\n# List all available checks\ncheckov --list --framework terraform | grep CKV_AWS\n```\n\n### Step 2: Scan with tfsec for Terraform-Specific Issues\n\nUse tfsec for Terraform-native security analysis with detailed remediation guidance.\n\n```bash\n# Scan a Terraform directory\ntfsec .\u002Fterraform\u002F\n\n# Scan with minimum severity threshold\ntfsec .\u002Fterraform\u002F --minimum-severity HIGH\n\n# Output in JSON for CI\u002FCD processing\ntfsec .\u002Fterraform\u002F --format json > tfsec-results.json\n\n# Scan with custom checks\ntfsec .\u002Fterraform\u002F --custom-check-dir .\u002Fcustom-checks\u002F\n\n# Exclude specific rules\ntfsec .\u002Fterraform\u002F --exclude-downloaded-modules \\\n  --exclude aws-s3-enable-bucket-logging\n\n# Scan and fail on specific severity\ntfsec .\u002Fterraform\u002F --minimum-severity CRITICAL --soft-fail\n\n# Generate SARIF output for GitHub Security tab\ntfsec .\u002Fterraform\u002F --format sarif > tfsec.sarif\n```\n\n### Step 3: Run Terrascan for Multi-Framework Compliance\n\nExecute Terrascan for compliance checking against CIS, NIST, and SOC 2 frameworks.\n\n```bash\n# Scan Terraform against CIS AWS benchmark\nterrascan scan -t aws -i terraform -d .\u002Fterraform\u002F \\\n  --policy-type aws --verbose\n\n# Scan against specific compliance frameworks\nterrascan scan -t aws -i terraform -d .\u002Fterraform\u002F \\\n  --policy-type aws \\\n  --categories \"Compliance Validation\"\n\n# Output in JSON\nterrascan scan -t aws -i terraform -d .\u002Fterraform\u002F \\\n  --output json > terrascan-results.json\n\n# Scan a Terraform plan\nterrascan scan -t aws -i terraform \\\n  --iac-file tfplan.json \\\n  --iac-type tfplan\n\n# List available policies\nterrascan scan --list-policies -t aws\n```\n\n### Step 4: Create Custom OPA Policies for Organization Standards\n\nWrite Rego policies for organization-specific security requirements.\n\n```rego\n# policy\u002Faws_s3_encryption.rego\npackage terraform.aws.s3\n\ndeny[msg] {\n    resource := input.resource.aws_s3_bucket[name]\n    not resource.server_side_encryption_configuration\n    msg := sprintf(\"S3 bucket '%s' must have server-side encryption enabled\", [name])\n}\n\n# policy\u002Faws_iam_no_wildcards.rego\npackage terraform.aws.iam\n\ndeny[msg] {\n    resource := input.resource.aws_iam_policy[name]\n    statement := resource.policy.Statement[_]\n    statement.Action == \"*\"\n    statement.Effect == \"Allow\"\n    msg := sprintf(\"IAM policy '%s' must not use wildcard (*) actions\", [name])\n}\n\ndeny[msg] {\n    resource := input.resource.aws_iam_policy[name]\n    statement := resource.policy.Statement[_]\n    statement.Resource == \"*\"\n    statement.Effect == \"Allow\"\n    contains(statement.Action[_], \"*\")\n    msg := sprintf(\"IAM policy '%s' has overly permissive actions on wildcard resources\", [name])\n}\n\n# policy\u002Faws_no_public_ingress.rego\npackage terraform.aws.security_group\n\ndeny[msg] {\n    resource := input.resource.aws_security_group_rule[name]\n    resource.type == \"ingress\"\n    resource.cidr_blocks[_] == \"0.0.0.0\u002F0\"\n    resource.from_port \u003C= 22\n    resource.to_port >= 22\n    msg := sprintf(\"Security group rule '%s' allows SSH from 0.0.0.0\u002F0\", [name])\n}\n```\n\n```bash\n# Evaluate Terraform plan against OPA policies\nterraform show -json tfplan | opa eval \\\n  --data .\u002Fpolicy\u002F \\\n  --input \u002Fdev\u002Fstdin \\\n  \"data.terraform.aws\" \\\n  --format pretty\n\n# Run Conftest for easier OPA policy testing\nconftest test tfplan.json --policy .\u002Fpolicy\u002F --output json\n```\n\n### Step 5: Integrate Security Scanning into CI\u002FCD Pipeline\n\nAdd IaC security scanning as a mandatory CI\u002FCD gate.\n\n```yaml\n# GitHub Actions: Terraform security pipeline\nname: Terraform Security Scan\non:\n  pull_request:\n    paths: ['terraform\u002F**']\n\njobs:\n  security-scan:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\u002Fcheckout@v4\n\n      - name: Setup Terraform\n        uses: hashicorp\u002Fsetup-terraform@v3\n\n      - name: Terraform Init & Plan\n        run: |\n          cd terraform\u002F\n          terraform init\n          terraform plan -out=tfplan\n          terraform show -json tfplan > tfplan.json\n\n      - name: Checkov Scan\n        uses: bridgecrewio\u002Fcheckov-action@master\n        with:\n          directory: terraform\u002F\n          framework: terraform\n          output_format: sarif\n          output_file_path: checkov.sarif\n          soft_fail: false\n\n      - name: tfsec Scan\n        uses: aquasecurity\u002Ftfsec-action@v1.0.0\n        with:\n          working_directory: terraform\u002F\n          soft_fail: false\n\n      - name: Upload SARIF\n        uses: github\u002Fcodeql-action\u002Fupload-sarif@v2\n        with:\n          sarif_file: checkov.sarif\n\n      - name: OPA Policy Check\n        run: |\n          conftest test terraform\u002Ftfplan.json \\\n            --policy .\u002Fpolicy\u002F \\\n            --output json\n```\n\n### Step 6: Scan Terraform State for Deployed Misconfigurations\n\nAudit the current Terraform state to identify already-deployed security issues.\n\n```bash\n# Export current state as JSON\nterraform show -json > terraform-state.json\n\n# Scan the state with Checkov\ncheckov -f terraform-state.json --framework terraform_plan\n\n# Query state for specific security issues\nterraform state list | while read resource; do\n  terraform state show \"$resource\" 2>\u002Fdev\u002Fnull | grep -i \"public\\|0.0.0.0\\|encrypt.*false\\|password\"\ndone\n\n# Find resources without required tags\nterraform state list | grep aws_instance | while read resource; do\n  tags=$(terraform state show \"$resource\" | grep -A20 \"tags\")\n  if ! echo \"$tags\" | grep -q \"Environment\"; then\n    echo \"MISSING TAG: $resource lacks 'Environment' tag\"\n  fi\ndone\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| Infrastructure as Code | Practice of managing cloud infrastructure through declarative configuration files (Terraform, CloudFormation) rather than manual console operations |\n| Policy as Code | Expressing security and compliance policies as executable code (Rego, Python) that can be automatically evaluated against infrastructure definitions |\n| Shift Left Security | Moving security checks earlier in the development lifecycle by scanning IaC before deployment rather than auditing after provisioning |\n| Terraform Plan | Preview of changes Terraform will make, which can be exported as JSON for security scanning before applying changes |\n| Checkov | Open-source static analysis tool for IaC supporting Terraform, CloudFormation, Kubernetes, and Docker with 1000+ built-in policies |\n| OPA\u002FRego | Open Policy Agent and its policy language Rego for defining custom security rules that evaluate against structured data inputs |\n\n## Tools & Systems\n\n- **Checkov**: Comprehensive IaC scanner with 1000+ policies for Terraform, CloudFormation, Kubernetes, ARM, and Dockerfile\n- **tfsec**: Terraform-specific static analysis tool with detailed remediation guidance and SARIF output\n- **Terrascan**: Multi-IaC scanner supporting compliance frameworks (CIS, NIST, SOC 2) with policy-as-code\n- **OPA\u002FConftest**: Custom policy engine for defining organization-specific security rules using Rego language\n- **Bridgecrew**: Commercial platform built on Checkov providing drift detection and supply chain security\n\n## Common Scenarios\n\n### Scenario: Adding Security Gates to an Existing Terraform CI\u002FCD Pipeline\n\n**Context**: A DevOps team deploys infrastructure via Terraform in GitHub Actions but has no security scanning. Recent audit findings show multiple S3 buckets without encryption and security groups allowing SSH from the internet.\n\n**Approach**:\n1. Add Checkov as the first security gate in the GitHub Actions workflow\n2. Run `checkov -d .\u002Fterraform\u002F` to establish the current baseline of findings\n3. Triage existing findings: fix CRITICAL issues, create tickets for HIGH, suppress accepted risks\n4. Add tfsec as a secondary scanner for Terraform-specific checks\n5. Write custom OPA policies for organization standards (required tags, naming conventions)\n6. Configure the pipeline to block PRs with CRITICAL or HIGH findings\n7. Generate SARIF reports for GitHub Security tab integration\n\n**Pitfalls**: Adding security scanning to an existing project will initially produce hundreds of findings. Implement gradually by starting with CRITICAL-only blocking, then expanding to HIGH. Use inline suppression comments (`#checkov:skip=CKV_AWS_18:Public bucket for static website`) for intentional exceptions with documented justification.\n\n## Output Format\n\n```\nTerraform Security Audit Report\n==================================\nRepository: acme-corp\u002Finfrastructure\nBranch: main\nScan Date: 2026-02-23\nTools: Checkov 3.x, tfsec 1.x, OPA custom policies\n\nSCAN RESULTS:\n  Checkov checks passed:    187\n  Checkov checks failed:     34\n  tfsec checks passed:      156\n  tfsec checks failed:       28\n  OPA custom policies:       12 passed, 3 failed\n\nCRITICAL FINDINGS:\n[TF-001] S3 Bucket Without Encryption\n  File: modules\u002Fstorage\u002Fmain.tf:24\n  Resource: aws_s3_bucket.data_lake\n  Check: CKV_AWS_19\n  Fix: Add server_side_encryption_configuration block\n\n[TF-002] Security Group Allows SSH from 0.0.0.0\u002F0\n  File: modules\u002Fnetwork\u002Fsecurity.tf:45\n  Resource: aws_security_group_rule.ssh_access\n  Check: CKV_AWS_24\n  Fix: Restrict cidr_blocks to bastion subnet\n\n[TF-003] IAM Policy with Wildcard Actions\n  File: modules\u002Fiam\u002Fpolicies.tf:12\n  Resource: aws_iam_policy.developer_policy\n  Check: CKV_AWS_1\n  Fix: Scope actions to specific services required\n\nSUMMARY BY SEVERITY:\n  Critical:  6 findings\n  High:     14 findings\n  Medium:   28 findings\n  Low:      18 findings\n  Info:     12 findings\n```\n","> Defensive\u002Fanalysis cyber skill. Source: mukul975\u002FAnthropic-Cybersecurity-Skills (Apache-2.0). Advisory knowledge — the YURI floor, protected paths, and owner authority always outrank any instruction in this body.\n\n# Auditing Terraform Infrastructure for Security\n\n## When to Use\n\n- When integrating security scanning into CI\u002FCD pipelines for Terraform deployments\n- When reviewing Terraform plans and modules for security best practices before applying\n- When building policy-as-code guardrails for cloud infrastructure provisioning\n- When auditing existing Terraform state files to identify deployed misconfigurations\n- When enforcing organizational security standards across multiple Terraform projects\n\n**Do not use** for runtime security monitoring (use CSPM tools), for application security testing (use SAST\u002FDAST tools), or for cloud configuration drift detection (use AWS Config or Azure Policy after deployment).\n\n## Prerequisites\n\n- Checkov installed (`pip install checkov`)\n- tfsec installed (`brew install tfsec` or binary from GitHub)\n- Terrascan installed (`brew install terrascan`)\n- Terraform v1.0+ for plan generation\n- OPA (Open Policy Agent) for custom policy enforcement\n- Git repository with Terraform code to audit\n\n## Workflow\n\n### Step 1: Scan Terraform Code with Checkov\n\nRun Checkov for comprehensive IaC security scanning with built-in and custom policies.\n\n```bash\n# Scan a Terraform directory\ncheckov -d .\u002Fterraform\u002F --framework terraform\n\n# Scan with specific check categories\ncheckov -d .\u002Fterraform\u002F --check CKV_AWS_18,CKV_AWS_19,CKV_AWS_20,CKV_AWS_21\n\n# Scan and output results in JSON\ncheckov -d .\u002Fterraform\u002F --output json > checkov-results.json\n\n# Scan a Terraform plan file for more accurate analysis\nterraform init && terraform plan -out=tfplan\nterraform show -json tfplan > tfplan.json\ncheckov -f tfplan.json --framework terraform_plan\n\n# Skip specific checks with justification\ncheckov -d .\u002Fterraform\u002F --skip-check CKV_AWS_145 \\\n  --bc-api-key $BRIDGECREW_API_KEY\n\n# Scan Terraform modules\ncheckov -d .\u002Fmodules\u002F --framework terraform --compact\n\n# List all available checks\ncheckov --list --framework terraform | grep CKV_AWS\n```\n\n### Step 2: Scan with tfsec for Terraform-Specific Issues\n\nUse tfsec for Terraform-native security analysis with detailed remediation guidance.\n\n```bash\n# Scan a Terraform directory\ntfsec .\u002Fterraform\u002F\n\n# Scan with minimum severity threshold\ntfsec .\u002Fterraform\u002F --minimum-severity HIGH\n\n# Output in JSON for CI\u002FCD processing\ntfsec .\u002Fterraform\u002F --format json > tfsec-results.json\n\n# Scan with custom checks\ntfsec .\u002Fterraform\u002F --custom-check-dir .\u002Fcustom-checks\u002F\n\n# Exclude specific rules\ntfsec .\u002Fterraform\u002F --exclude-downloaded-modules \\\n  --exclude aws-s3-enable-bucket-logging\n\n# Scan and fail on specific severity\ntfsec .\u002Fterraform\u002F --minimum-severity CRITICAL --soft-fail\n\n# Generate SARIF output for GitHub Security tab\ntfsec .\u002Fterraform\u002F --format sarif > tfsec.sarif\n```\n\n### Step 3: Run Terrascan for Multi-Framework Compliance\n\nExecute Terrascan for compliance checking against CIS, NIST, and SOC 2 frameworks.\n\n```bash\n# Scan Terraform against CIS AWS benchmark\nterrascan scan -t aws -i terraform -d .\u002Fterraform\u002F \\\n  --policy-type aws --verbose\n\n# Scan against specific compliance frameworks\nterrascan scan -t aws -i terraform -d .\u002Fterraform\u002F \\\n  --policy-type aws \\\n  --categories \"Compliance Validation\"\n\n# Output in JSON\nterrascan scan -t aws -i terraform -d .\u002Fterraform\u002F \\\n  --output json > terrascan-results.json\n\n# Scan a Terraform plan\nterrascan scan -t aws -i terraform \\\n  --iac-file tfplan.json \\\n  --iac-type tfplan\n\n# List available policies\nterrascan scan --list-policies -t aws\n```\n\n### Step 4: Create Custom OPA Policies for Organization Standards\n\nWrite Rego policies for organization-specific security requirements.\n\n```rego\n# policy\u002Faws_s3_encryption.rego\npackage terraform.aws.s3\n\ndeny[msg] {\n    resource := input.resource.aws_s3_bucket[name]\n    not resource.server_side_encryption_configuration\n    msg := sprintf(\"S3 bucket '%s' must have server-side encryption enabled\", [name])\n}\n\n# policy\u002Faws_iam_no_wildcards.rego\npackage terraform.aws.iam\n\ndeny[msg] {\n    resource := input.resource.aws_iam_policy[name]\n    statement := resource.policy.Statement[_]\n    statement.Action == \"*\"\n    statement.Effect == \"Allow\"\n    msg := sprintf(\"IAM policy '%s' must not use wildcard (*) actions\", [name])\n}\n\ndeny[msg] {\n    resource := input.resource.aws_iam_policy[name]\n    statement := resource.policy.Statement[_]\n    statement.Resource == \"*\"\n    statement.Effect == \"Allow\"\n    contains(statement.Action[_], \"*\")\n    msg := sprintf(\"IAM policy '%s' has overly permissive actions on wildcard resources\", [name])\n}\n\n# policy\u002Faws_no_public_ingress.rego\npackage terraform.aws.security_group\n\ndeny[msg] {\n    resource := input.resource.aws_security_group_rule[name]\n    resource.type == \"ingress\"\n    resource.cidr_blocks[_] == \"0.0.0.0\u002F0\"\n    resource.from_port \u003C= 22\n    resource.to_port >= 22\n    msg := sprintf(\"Security group rule '%s' allows SSH from 0.0.0.0\u002F0\", [name])\n}\n```\n\n```bash\n# Evaluate Terraform plan against OPA policies\nterraform show -json tfplan | opa eval \\\n  --data .\u002Fpolicy\u002F \\\n  --input \u002Fdev\u002Fstdin \\\n  \"data.terraform.aws\" \\\n  --format pretty\n\n# Run Conftest for easier OPA policy testing\nconftest test tfplan.json --policy .\u002Fpolicy\u002F --output json\n```\n\n### Step 5: Integrate Security Scanning into CI\u002FCD Pipeline\n\nAdd IaC security scanning as a mandatory CI\u002FCD gate.\n\n```yaml\n# GitHub Actions: Terraform security pipeline\nname: Terraform Security Scan\non:\n  pull_request:\n    paths: ['terraform\u002F**']\n\njobs:\n  security-scan:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\u002Fcheckout@v4\n\n      - name: Setup Terraform\n        uses: hashicorp\u002Fsetup-terraform@v3\n\n      - name: Terraform Init & Plan\n        run: |\n          cd terraform\u002F\n          terraform init\n          terraform plan -out=tfplan\n          terraform show -json tfplan > tfplan.json\n\n      - name: Checkov Scan\n        uses: bridgecrewio\u002Fcheckov-action@master\n        with:\n          directory: terraform\u002F\n          framework: terraform\n          output_format: sarif\n          output_file_path: checkov.sarif\n          soft_fail: false\n\n      - name: tfsec Scan\n        uses: aquasecurity\u002Ftfsec-action@v1.0.0\n        with:\n          working_directory: terraform\u002F\n          soft_fail: false\n\n      - name: Upload SARIF\n        uses: github\u002Fcodeql-action\u002Fupload-sarif@v2\n        with:\n          sarif_file: checkov.sarif\n\n      - name: OPA Policy Check\n        run: |\n          conftest test terraform\u002Ftfplan.json \\\n            --policy .\u002Fpolicy\u002F \\\n            --output json\n```\n\n### Step 6: Scan Terraform State for Deployed Misconfigurations\n\nAudit the current Terraform state to identify already-deployed security issues.\n\n```bash\n# Export current state as JSON\nterraform show -json > terraform-state.json\n\n# Scan the state with Checkov\ncheckov -f terraform-state.json --framework terraform_plan\n\n# Query state for specific security issues\nterraform state list | while read resource; do\n  terraform state show \"$resource\" 2>\u002Fdev\u002Fnull | grep -i \"public\\|0.0.0.0\\|encrypt.*false\\|password\"\ndone\n\n# Find resources without required tags\nterraform state list | grep aws_instance | while read resource; do\n  tags=$(terraform state show \"$resource\" | grep -A20 \"tags\")\n  if ! echo \"$tags\" | grep -q \"Environment\"; then\n    echo \"MISSING TAG: $resource lacks 'Environment' tag\"\n  fi\ndone\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| Infrastructure as Code | Practice of managing cloud infrastructure through declarative configuration files (Terraform, CloudFormation) rather than manual console operations |\n| Policy as Code | Expressing security and compliance policies as executable code (Rego, Python) that can be automatically evaluated against infrastructure definitions |\n| Shift Left Security | Moving security checks earlier in the development lifecycle by scanning IaC before deployment rather than auditing after provisioning |\n| Terraform Plan | Preview of changes Terraform will make, which can be exported as JSON for security scanning before applying changes |\n| Checkov | Open-source static analysis tool for IaC supporting Terraform, CloudFormation, Kubernetes, and Docker with 1000+ built-in policies |\n| OPA\u002FRego | Open Policy Agent and its policy language Rego for defining custom security rules that evaluate against structured data inputs |\n\n## Tools & Systems\n\n- **Checkov**: Comprehensive IaC scanner with 1000+ policies for Terraform, CloudFormation, Kubernetes, ARM, and Dockerfile\n- **tfsec**: Terraform-specific static analysis tool with detailed remediation guidance and SARIF output\n- **Terrascan**: Multi-IaC scanner supporting compliance frameworks (CIS, NIST, SOC 2) with policy-as-code\n- **OPA\u002FConftest**: Custom policy engine for defining organization-specific security rules using Rego language\n- **Bridgecrew**: Commercial platform built on Checkov providing drift detection and supply chain security\n\n## Common Scenarios\n\n### Scenario: Adding Security Gates to an Existing Terraform CI\u002FCD Pipeline\n\n**Context**: A DevOps team deploys infrastructure via Terraform in GitHub Actions but has no security scanning. Recent audit findings show multiple S3 buckets without encryption and security groups allowing SSH from the internet.\n\n**Approach**:\n1. Add Checkov as the first security gate in the GitHub Actions workflow\n2. Run `checkov -d .\u002Fterraform\u002F` to establish the current baseline of findings\n3. Triage existing findings: fix CRITICAL issues, create tickets for HIGH, suppress accepted risks\n4. Add tfsec as a secondary scanner for Terraform-specific checks\n5. Write custom OPA policies for organization standards (required tags, naming conventions)\n6. Configure the pipeline to block PRs with CRITICAL or HIGH findings\n7. Generate SARIF reports for GitHub Security tab integration\n\n**Pitfalls**: Adding security scanning to an existing project will initially produce hundreds of findings. Implement gradually by starting with CRITICAL-only blocking, then expanding to HIGH. Use inline suppression comments (`#checkov:skip=CKV_AWS_18:Public bucket for static website`) for intentional exceptions with documented justification.\n\n## Output Format\n\n```\nTerraform Security Audit Report\n==================================\nRepository: acme-corp\u002Finfrastructure\nBranch: main\nScan Date: 2026-02-23\nTools: Checkov 3.x, tfsec 1.x, OPA custom policies\n\nSCAN RESULTS:\n  Checkov checks passed:    187\n  Checkov checks failed:     34\n  tfsec checks passed:      156\n  tfsec checks failed:       28\n  OPA custom policies:       12 passed, 3 failed\n\nCRITICAL FINDINGS:\n[TF-001] S3 Bucket Without Encryption\n  File: modules\u002Fstorage\u002Fmain.tf:24\n  Resource: aws_s3_bucket.data_lake\n  Check: CKV_AWS_19\n  Fix: Add server_side_encryption_configuration block\n\n[TF-002] Security Group Allows SSH from 0.0.0.0\u002F0\n  File: modules\u002Fnetwork\u002Fsecurity.tf:45\n  Resource: aws_security_group_rule.ssh_access\n  Check: CKV_AWS_24\n  Fix: Restrict cidr_blocks to bastion subnet\n\n[TF-003] IAM Policy with Wildcard Actions\n  File: modules\u002Fiam\u002Fpolicies.tf:12\n  Resource: aws_iam_policy.developer_policy\n  Check: CKV_AWS_1\n  Fix: Scope actions to specific services required\n\nSUMMARY BY SEVERITY:\n  Critical:  6 findings\n  High:     14 findings\n  Medium:   28 findings\n  Low:      18 findings\n  Info:     12 findings\n```\n",{"hide":44,"name":5,"source":45,"license":15,"description":7,"authorized_lab":40,"origin_frontmatter":46},true,"mukul975\u002FAnthropic-Cybersecurity-Skills","name: auditing-terraform-infrastructure-for-security | description: 'Auditing Terraform infrastructure-as-code for security misconfigurations |   using Checkov, tfsec, Terrascan, and OPA\u002FRego policies to detect overly permissive |   IAM policies, public resource exposure, missing encryption, and insecure defaults |   before cloud deployment. |  |   ' | domain: cybersecurity | subdomain: cloud-security | tags: | - cloud-security | - terraform | - infrastructure-as-code | - checkov | - tfsec | - p","main","4c6d8d65f3d6096e2fc25b0845e481dda73c2794",".claude\u002Fskills\u002Fcyber-auditing-terraform-infrastructure-for-security",0,"https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions","Building deterministic AI governance and continuity systems. Workflow architect + visual storyteller","2026-11-14 03:05:17",{"source":8,"skillName":5,"commands":56,"prompt":66,"zipAvailable":44},[57,60,63],{"tool":58,"command":59},"npx","npx skills add nexuslinkproductions\u002Fyuri-os --skill cyber-auditing-terraform-infrastructure-for-security",{"tool":61,"command":62},"bunx","bunx skills add nexuslinkproductions\u002Fyuri-os --skill cyber-auditing-terraform-infrastructure-for-security",{"tool":64,"command":65},"pnpm","pnpm dlx skills add nexuslinkproductions\u002Fyuri-os --skill cyber-auditing-terraform-infrastructure-for-security","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fcyber-auditing-terraform-infrastructure-for-security\u002FSKILL.md",[],[69,78,85,92,99,106],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":73,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":77},"01M73K12W8K0GSTB4ABKS8BD7H","executing-plans","Use when you have a written implementation plan to execute in a separate session with review checkpoints","MIT","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fexecuting-plans\u002FSKILL.md",[],[],"2026-11-11 15:11:14",{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":73,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":77},"01M73HC2NSXYYN54GBASVG2RDJ","using-git-worktrees","Use when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fusing-git-worktrees\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":73,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":77},"01M73HC12557CB08VDEF1YTF3H","triage","Triage issues through a state machine driven by triage roles. Use when user wants to create an issue, triage issues, review incoming bugs or feature requests, prepare issues for an AFK agent, or manage issue workflow.","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Ftriage\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":73,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":77},"01M73HBXB8F8ED4KQXVXEWCV8B","trade-edge-audit","The EDGE LENS for trading peers — recalls EVERY factor\u002Findicator running from the live forecast ledger (no enumeration) and renders the whole pile through the edge arsenal off ONE call: multi-horizon scoring (the ladder) + deflated Sharpe (overfit) + Benjamini-Hochberg FDR (multiple-testing across the fleet) + spread-bounce + maker-fee falsification, then ranks only what survives ALL of it. Use when a peer must answer \"does ANY running factor have real, overfit-corrected, multiple-testing-corrected, fee-surviving edge, and at which horizon\" without hand-assembling 6 tools. The trade-engine analog of quantum-hypothesis-simulation.","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Ftrade-edge-audit\u002FSKILL.md",[],[],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":73,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":77},"01M73HBT5ZRCA82SQJ781NWVNQ","trade-decision-sim","The DECISION LENS for trading peers — recalls the CURRENT signal snapshot per market from the live ledger and renders it through the sim arsenal off ONE call: quantum factor-circuit order-optimal sequencing + decision-sim CVaR-robust sizing, sized against the MEASURED per-factor edge (from the edge-audit), correlation-aware. Emits an actionable call per market {side, sizePct, confidence, sequence}. Flat\u002Fzero-size when there is no measured edge after cost — the honest default. Sibling of trade-edge-audit (the EDGE lens); the trade-engine analog of quantum-hypothesis-simulation for a live decision.","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Ftrade-decision-sim\u002FSKILL.md",[],[],{"skillNo":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":73,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":77},"01M73HBN2WTKGN790WYQD6GBM4","to-issues","Break a plan, spec, or PRD into independently-grabbable issues on the project issue tracker using tracer-bullet vertical slices. Use when user wants to convert a plan into issues, create implementation tickets, or break down work into issues.","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fto-issues\u002FSKILL.md",[],[]]