Terraform 가드레일 MCP

발행: (2026년 1월 2일 오전 05:27 GMT+9)
5 분 소요
원문: Dev.to

I’m happy to translate the article for you, but I’ll need the full text of the post (excluding the source line you already provided). Could you please paste the article content here? Once I have it, I’ll translate it into Korean while preserving the original formatting, markdown syntax, and any code blocks or URLs.

개요

  • MCP 서버 – 공급자 메타데이터와 규정 준수 검사를 노출합니다.
  • CLI – Terraform 구성(.tf, .tfvars) 및 상태 파일(.tfstate)을 스캔하여 민감한 유출 및 ephemeral = true 플래그 누락을 확인합니다.
  • Web UI – 빠른 업로드를 통한 스캔 및 시각적 보고서를 제공합니다.
  • Rules engine – 일시적인 값, 쓰기 전용 인수, 비밀 위생에 중점을 둡니다.

아키텍처

flowchart LR
    subgraph Interfaces
        CLI[CLI]
        MCP[MCP Server]
        WEB[Web UI]
    end

    subgraph Core
        SCAN[Compliance Engine]
        GEN[Snippet Generator]
    end

    REG[Terraform Registry]
    TF[Terraform CLI]

    CLI --> SCAN
    WEB --> SCAN
    MCP --> SCAN
    MCP --> GEN
    SCAN --> TF
    GEN --> REG
    MCP --> REG
flowchart TB
    INPUTS[Inputs: .tf, .tfvars, .tfstate] --> PARSE[Parse & Normalize]
    PARSE --> RULES[Apply Rules TG001‑TG005]
    RULES --> REPORT[Findings + Summary Report]
    REPORT --> OUTPUT[CLI JSON / UI Render / MCP Response]

기능

  • .tf.tfvars 파일에서 민감한 값과 누락된 ephemeral = true를 스캔합니다.
  • .tfstate에서 유출된 민감한 값을 스캔합니다.
  • Terraform Registry를 통해 AWS 및 Azure의 제공자 메타데이터를 가져옵니다.
  • 일반적인 AWS/Azure 리소스를 위한 Terraform 스니펫을 생성합니다.
  • 스키마 인식 검증 (Terraform CLI와 초기화된 워크스페이스가 필요합니다).
  • 다중 환경 정책 및 OPA 호환 출력.
  • 스택 인식 오케스트레이션 및 드리프트 감지.

설치

# Create a virtual environment
python -m venv .venv
source .venv/bin/activate

# Install the package (editable mode with dev extras)
pip install -e "[dev]"

또는 PyPI에서 직접 설치하세요:

pip install terraform-guardrail
  • PyPI: (최신: 0.2.3)

사용법

CLI 스캔

# 디렉터리 스캔 (기본 JSON 출력)
terraform-guardrail scan ./examples --format json

# 상태 파일과 함께 스캔
terraform-guardrail scan ./examples --state ./examples/sample.tfstate

# 스키마 인식 검증 활성화 (Terraform CLI + 초기화된 워크스페이스 필요)
terraform-guardrail scan ./examples --schema

스니펫 생성

terraform-guardrail generate aws aws_s3_bucket --name demo

MCP 서버 (STDIO)

terraform-guardrail mcp

웹 UI

terraform-guardrail web

Terraform 파일을 방문하고 업로드하여 규정 준수 보고서를 확인하세요.

또는 Streamlit 앱을 실행하세요:

streamlit run streamlit_app.py

실시간 데모:

Deployment Guide

  1. Push the repository to GitHub.
  2. Create a new Streamlit Cloud app.
  3. Set the main file path to streamlit_app.py.
  4. Deploy – Streamlit will install dependencies from requirements.txt.

For a detailed walkthrough, see docs/streamlit_cloud.md in the repository.

릴리스 체크리스트

  • pyproject.toml 파일의 버전을 업데이트합니다.

  • RELEASE_NOTES.mdCHANGELOG.md를 업데이트합니다.

  • 변경 사항을 커밋하고 main 브랜치에 푸시합니다.

  • 릴리스를 태그합니다:

    git tag -a vX.Y.Z -m "vX.Y.Z"
    git push origin vX.Y.Z
  • GitHub Actions 릴리스 워크플로가 성공적으로 완료되는지 확인합니다.

저장소는 git‑cliff을 사용하여 CHANGELOG.md를 생성합니다:

git cliff -o CHANGELOG.md
# or
make changelog

추가 make 타깃:

make release-dry VERSION=0.2.1   # dry‑run release
make version-bump VERSION=0.2.1 # bump version

도구 개요

도구설명
scan_terraform경로와 선택적 상태 파일에 대한 규정 준수 검사를 실행합니다.
get_provider_metadataTerraform Registry(AWS 및 Azure)에서 제공자 메타데이터를 가져옵니다.
generate_snippet일반적인 AWS/Azure 리소스를 위한 Terraform 스니펫을 생성합니다.
Schema‑aware code generation임시 값에 대한 안전한 재작성 생성을 위해 제공자 스키마를 사용합니다.

참고 자료

  • GitHub repository:
  • Architecture diagram (README):
  • Wiki diagrams:
  • GitHub releases:

MIT License

Back to Blog

관련 글

더 보기 »

RGB LED 사이드퀘스트 💡

markdown !Jennifer Davis https://media2.dev.to/dynamic/image/width=50,height=50,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%...

Mendex: 내가 만드는 이유

소개 안녕하세요 여러분. 오늘은 제가 누구인지, 무엇을 만들고 있는지, 그리고 그 이유를 공유하고 싶습니다. 초기 경력과 번아웃 저는 개발자로서 17년 동안 경력을 시작했습니다.