본문으로 건너뛰기
Skillpedia
배포 및 클라우드 (DevOps)35k · #7684

auditing-terraform-infrastructure-for-security

하는 일

이 도구는 클라우드에 배포하기 전에 인프라 코드(Terraform)의 보안 설정 오류를 점검합니다. 지나치게 넓은 접근 권한, 암호화되지 않은 데이터, 공개적으로 노출된 리소스 같은 문제를 찾도록 돕습니다.

사용하는 경우

  • ✓자동화된 배포 과정(CI/CD)에 보안 점검을 넣을 때.
  • ✓보안 모범 사례를 따르는지 확인하려고 적용 전에 Terraform 코드를 검토할 때.
  • ✓인프라가 안전하게 구성되도록 자동 규칙을 만들 때.

스킬 링크

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/auditing-terraform-infrastructure-for-security/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/auditing-terraform-infrastructure-for-security/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“내 Terraform 코드의 보안 문제를 검사하고 무엇을 고쳐야 하는지 알려 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

이 도구는 Checkov, tfsec, Terrascan, OPA 같은 다른 프로그램을 사용해 Terraform 코드를 분석합니다. 이 프로그램들은 알려진 안전하지 않은 설정 패턴을 찾고, 여러분이 정의한 보안 규칙과 비교합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Auditing Terraform Infrastructure for Security

When to Use

  • When integrating security scanning into CI/CD pipelines for Terraform deployments
  • When reviewing Terraform plans and modules for security best practices before applying
  • When building policy-as-code guardrails for cloud infrastructure provisioning
  • When auditing existing Terraform state files to identify deployed misconfigurations
  • When enforcing organizational security standards across multiple Terraform projects

Do not use for runtime security monitoring (use CSPM tools), for application security testing (use SAST/DAST tools), or for cloud configuration drift detection (use AWS Config or Azure Policy after deployment).

Prerequisites

  • Checkov installed (pip install checkov)
  • tfsec installed (brew install tfsec or binary from GitHub)
  • Terrascan installed (brew install terrascan)
  • Terraform v1.0+ for plan generation
  • OPA (Open Policy Agent) for custom policy enforcement
  • Git repository with Terraform code to audit

Workflow

Step 1: Scan Terraform Code with Checkov

Run Checkov for comprehensive IaC security scanning with built-in and custom policies.

# Scan a Terraform directory
checkov -d ./terraform/ --framework terraform

# Scan with specific check categories
checkov -d ./terraform/ --check CKV_AWS_18,CKV_AWS_19,CKV_AWS_20,CKV_AWS_21

# Scan and output results in JSON
checkov -d ./terraform/ --output json > checkov-results.json

# Scan a Terraform plan file for more accurate analysis
terraform init && terraform plan -out=tfplan
terraform show -json tfplan > tfplan.json
checkov -f tfplan.json --framework terraform_plan

# Skip specific checks with justification
checkov -d ./terraform/ --skip-check CKV_AWS_145 \
  --bc-api-key $BRIDGECREW_API_KEY

# Scan Terraform modules
checkov -d ./modules/ --framework terraform --compact

# List all available checks
checkov --list --framework terraform | grep CKV_AWS

Step 2: Scan with tfsec for Terraform-Specific Issues

Use tfsec for Terraform-native security analysis with detailed remediation guidance.

# Scan a Terraform directory
tfsec ./terraform/

# Scan with minimum severity threshold
tfsec ./terraform/ --minimum-severity HIGH

# Output in JSON for CI/CD processing
tfsec ./terraform/ --format json > tfsec-results.json

# Scan with custom checks
tfsec ./terraform/ --custom-check-dir ./custom-checks/

# Exclude specific rules
tfsec ./terraform/ --exclude-downloaded-modules \
  --exclude aws-s3-enable-bucket-logging

# Scan and fail on specific severity
tfsec ./terraform/ --minimum-severity CRITICAL --soft-fail

# Generate SARIF output for GitHub Security tab
tfsec ./terraform/ --format sarif > tfsec.sarif

Step 3: Run Terrascan for Multi-Framework Compliance

Execute Terrascan for compliance checking against CIS, NIST, and SOC 2 frameworks.

# Scan Terraform against CIS AWS benchmark
terrascan scan -t aws -i terraform -d ./terraform/ \
  --policy-type aws --verbose

# Scan against specific compliance frameworks
terrascan scan -t aws -i terraform -d ./terraform/ \
  --policy-type aws \
  --categories "Compliance Validation"

# Output in JSON
terrascan scan -t aws -i terraform -d ./terraform/ \
  --output json > terrascan-results.json

# Scan a Terraform plan
terrascan scan -t aws -i terraform \
  --iac-file tfplan.json \
  --iac-type tfplan

# List available policies
terrascan scan --list-policies -t aws

Step 4: Create Custom OPA Policies for Organization Standards

Write Rego policies for organization-specific security requirements.

# policy/aws_s3_encryption.rego
package terraform.aws.s3

deny[msg] {
    resource := input.resource.aws_s3_bucket[name]
    not resource.server_side_encryption_configuration
    msg := sprintf("S3 bucket '%s' must have server-side encryption enabled", [name])
}

# policy/aws_iam_no_wildcards.rego
package terraform.aws.iam

deny[msg] {
    resource := input.resource.aws_iam_policy[name]
    statement := resource.policy.Statement[_]
    statement.Action == "*"
    statement.Effect == "Allow"
    msg := sprintf("IAM policy '%s' must not use wildcard (*) actions", [name])
}

deny[msg] {
    resource := input.resource.aws_iam_policy[name]
    statement := resource.policy.Statement[_]
    statement.Resource == "*"
    statement.Effect == "Allow"
    contains(statement.Action[_], "*")
    msg := sprintf("IAM policy '%s' has overly permissive actions on wildcard resources", [name])
}


…
자주 묻는 질문

Terraform이란 무엇인가요?

서버나 데이터베이스 같은 클라우드 인프라를 화면에서 클릭하는 대신 코드 파일로 기술하고 관리할 수 있게 해 주는 도구입니다.

'보안 설정 오류'란 무엇인가요?

인프라를 설정할 때 생긴 실수나 소홀함입니다. 예를 들어 데이터베이스를 인터넷의 누구나 접근할 수 있게 두면 시스템이 공격에 노출됩니다.

이미 실행 중인 인프라를 모니터링하는 데도 쓸 수 있나요?

아니요, 이 도구는 배포 전의 코드를 점검하기 위한 것입니다. 실행 중인 인프라를 모니터링하려면 다른 전용 도구가 필요합니다.

상세 정보

작성자의 원본 설명

Auditing Terraform infrastructure-as-code for security misconfigurations using Checkov, tfsec, Terrascan, and OPA/Rego policies to detect overly permissive IAM policies, public resource exposure, missing encryption, and insecure defaults before cloud deployment. '

repo: mukul975/Anthropic-Cybersecurity-Skills

인기도

GitHub 스타
35k
순위
#7684
라이선스
Apache-2.0
업데이트
2026. 8. 31.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬