Metadata-Version: 2.4
Name: stackdrift
Version: 0.1.2
Summary: CloudFormation drift detector with property-level diffs and Slack/GitHub integration
Author: Brian
License: MIT
Keywords: aws,cloudformation,drift,devops,cli
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: System :: Systems Administration
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: boto3<2,>=1.34
Requires-Dist: click<9,>=8.1
Requires-Dist: rich<15,>=13.7
Requires-Dist: requests<3,>=2.31
Provides-Extra: dev
Requires-Dist: moto[cloudformation]>=5.0; extra == "dev"
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: pytest-mock>=3.12; extra == "dev"
Requires-Dist: pytest-cov>=5.0; extra == "dev"
Requires-Dist: ruff>=0.4; extra == "dev"
Dynamic: license-file

# stackdrift

A pip-installable CloudFormation drift detector. Detects when deployed AWS resources have drifted from their CloudFormation template definitions.

[![CI](https://github.com/Specter099/stackdrift/actions/workflows/ci.yml/badge.svg)](https://github.com/Specter099/stackdrift/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Features

- Detects drift across all stacks in your AWS account (or a filtered subset)
- Property-level diffs with human-readable annotations
- Concurrent drift detection (configurable, default: 5 simultaneous)
- Rich terminal output (tree view), JSON, and Markdown formats
- Slack webhook integration
- GitHub PR comment integration
- CI-friendly: exits with code 1 when drift is detected

## Installation

```bash
pip install stackdrift
```

## Usage

```bash
# Check all stacks
stackdrift

# Check specific stacks
stackdrift --stack my-stack
stackdrift --stack my-stack-1 --stack my-stack-2

# Filter by prefix or tag
stackdrift --prefix prod-
stackdrift --tag Environment=prod

# Show only drifted stacks
stackdrift --drifted-only

# Output formats
stackdrift --format table    # default (Rich tree)
stackdrift --format json
stackdrift --format markdown

# Post to Slack (requires STACKDRIFT_SLACK_WEBHOOK env var)
stackdrift --post-slack

# Post as GitHub PR comment (requires GITHUB_TOKEN, GITHUB_REPO env vars)
stackdrift --post-github-pr 42

# Control concurrency
stackdrift --max-concurrent 5
```

## Required IAM Permissions

```json
{
  "Effect": "Allow",
  "Action": [
    "cloudformation:ListStacks",
    "cloudformation:DetectStackDrift",
    "cloudformation:DescribeStackDriftDetectionStatus",
    "cloudformation:DescribeStackResourceDrifts",
    "cloudformation:DescribeStacks"
  ],
  "Resource": "*"
}
```

## Development Setup

```bash
git clone https://github.com/Specter099/stackdrift.git
cd stackdrift
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
```

## Running Tests

```bash
pytest
```

## Linting

```bash
ruff check src/ tests/
```

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

## Security

See [SECURITY.md](SECURITY.md) for reporting vulnerabilities.

## License

[MIT](LICENSE)
