Skip to main content

DriftCTL alignment mark DriftCTL

Infrastructure Drift Control Platform

Python 3.11 or later Terraform state Read-only AWS collection GNU Affero General Public License v3.0 DriftCTL copyright notice Contributions welcome

Detect Terraform-to-AWS drift before it becomes operational debt.

DriftCTL is a read-only Terraform drift-detection and remediation-planning tool for AWS. It helps teams identify and safely resolve Terraform state drift: the common situation where a Terraform-managed environment no longer matches the configuration that exists in AWS.

The tool compares Terraform's recorded expected state with live AWS inventory, identifies the difference, classifies its risk, recommends a safe next action, and records a hash-chained audit trail. It never runs terraform apply, changes Terraform state, or calls AWS mutation APIs.

Core Features

Capability What it provides
Expected versus live comparison Loads Terraform state through terraform show -json, collects supported AWS configuration through read-only APIs, and compares normalized resource snapshots.
Drift taxonomy Classifies every finding as missing, unmanaged, or modified, so teams can distinguish deleted resources, AWS-only resources, and changed configuration.
Risk classification Uses modular severity rules to classify findings as minor, moderate, severe, or critical. Public SSH, RDP, and all-port security-group exposure are treated as critical risks; public RDS exposure and weakened RDS encryption or deletion protection are treated as severe.
Reports and audit history Produces a Markdown report grouped by resource category and severity, plus hash-chained JSONL audit events for each scan, finding, and recommendation.
Read-only AWS access Uses a dedicated least-privilege AWS policy and only Describe, List, and Get collection APIs. The scanner observes and reports; it does not apply remediation.
Environment scoping Supports repeatable --tag KEY=VALUE filters so a scan can focus on one environment without unrelated regional resources creating findings.
Current AWS coverage EC2 instances, security groups and their inline or standalone Terraform rules, S3 bucket public-access and encryption controls, VPCs, subnets, internet gateways, NAT gateways, route tables, network ACLs, IAM roles and instance profiles, Application Load Balancers, target groups, listeners, listener rules, RDS DB instances, ECS clusters, task definitions and services, Lambda functions, scheduled EventBridge rules and targets, CloudWatch log groups, EKS clusters and managed node groups, plus Route 53 hosted zones and records. Unsupported Terraform types are reported as collection diagnostics rather than misclassified as drift.
Extension model Future AWS services will be added through the same adapter, collector, comparison, severity, reporting, and validation pattern. Each supported service is documented here when it becomes part of the tool.
Automation Jenkins and GitHub Actions workflows run scheduled and on-demand scans, retain reports and audit logs, and notify teams about critical drift without changing DriftCTL's read-only decision boundary.

How DriftCTL Is Used

DriftCTL supports two team workflows:

  • Manual scanning: After a Terraform apply, during an investigation, or before an approved change, an engineer runs a read-only scan against the applied Terraform state and corresponding AWS environment. DriftCTL reports supported differences within the chosen tag scope. It can inspect production or non-production infrastructure when the team applies its normal access controls and change process. See the Usage Guide for the complete first-time and repeatable manual workflow.

  • Scheduled automation: A Jenkins pipeline or GitHub Actions workflow runs the same read-only comparison on a team-defined schedule or on demand, retains reports and audit records, and notifies the team about critical findings through the team's chosen notification channel.

The optional controlled-validation procedures in the validation guide document how DriftCTL's detection behavior was verified in a non-production environment. They are evidence, not a third operating mode or a prerequisite for using DriftCTL. In routine use, DriftCTL reports supported drift that already exists; teams do not need to create drift first.

Quick Walkthrough Video

Watch the DriftCTL quick walkthrough video

Quick Start

DriftCTL is designed to inspect your existing Terraform-managed AWS environment. Install the released package, configure a dedicated read-only AWS identity, and run the scan from your own Terraform project's applied state. You need Python 3.11+, pipx, Terraform, and AWS CLI; the detailed, first-time-user guide is docs/USAGE.md.

  1. Install pipx. It installs the DriftCTL command in an isolated environment without requiring a repository clone. Platform-specific commands are in the Usage Guide.
Linux: install pipx

Run this as one pasted Bash command. The trailing backslashes continue the command onto the next line; they are not separate commands.

sudo apt update && \
sudo apt install -y python3-pip pipx && \
pipx ensurepath && \
export PATH="$HOME/.local/bin:$PATH"

This path is for Ubuntu or Debian. pipx ensurepath makes the command available in future terminals; the final export also makes it available in the terminal you are using now.

  1. Install the released package and confirm the product command:
pipx install drift-control
driftctl --help
  1. Attach the dedicated read-only policy from infra/iam/driftctl-read-only-policy.json to an AWS identity such as driftctl-readonly, then configure that identity for your terminal.
How to create the read-only policy and connect your terminal
  1. In the AWS Console, open IAM and choose Policies.
  2. Choose Create policy, then choose the JSON editor.
  3. Open infra/iam/driftctl-read-only-policy.json, copy its complete contents, replace the editor contents, then choose Next.
  4. Name the policy, for example DriftCTLReadOnly, and create it.
  5. Attach it to a dedicated IAM user, IAM role, or IAM Identity Center permission set. Do not attach it to the identity that applies Terraform unless your organisation explicitly requires that arrangement.
  6. Choose the AWS credential method your environment already uses:
    • IAM Identity Center (SSO): use this only if your organization provides an AWS access portal URL and SSO Region.
    • Dedicated shared AWS CLI profile: use this in a personal or learning account that permits programmatic IAM-user credentials.
    • Existing approved profile or assumed role: use it directly; do not reconfigure it.
Option A: IAM Identity Center (SSO)

Use this only when your organization provides IAM Identity Center access. An administrator can find the portal URL in AWS Console under IAM Identity Center > Settings > AWS access portal URL. It usually looks like https://d-xxxxxxxxxx.awsapps.com/start; it is not the normal AWS Console URL. Then run:

aws configure sso --profile driftctl-readonly

At the interactive prompts, use a local session name such as driftctl-sso, paste the access portal URL, select the SSO Region supplied by your organization, accept the default sso:account:access registration scope unless instructed otherwise, then select the account and read-only role your administrator assigned. Choose the AWS Region that contains the infrastructure you plan to scan as the profile's default Region.

aws sso login --profile driftctl-readonly
Option B: Dedicated shared AWS CLI profile

Use this in a personal or learning account only when programmatic IAM-user credentials are permitted. Run the following and enter only credentials for the read-only identity. Treat the access key and secret key as private credentials: never share them, and make sure they are not visible in recordings or screenshots.

Before running it, obtain those values from AWS Console > IAM > Users > select the dedicated read-only user > Security credentials > Access keys > Create access key. Select Command Line Interface (CLI), then copy the access key ID and secret access key when AWS displays them. The secret key is shown only once.

aws configure --profile driftctl-readonly

At the prompts, enter the new read-only user's access key ID and secret access key, choose the AWS Region containing the infrastructure you will scan, and enter json for output. The Usage Guide explains each prompt in detail.

Option C: Existing approved profile or assumed role

Use the existing profile or role name directly. Do not run either configuration command above.

  1. Verify the chosen profile:
aws sts get-caller-identity --profile driftctl-readonly

driftctl-readonly is an example profile name. Replace it with your own read-only AWS profile name throughout this Quick Start.

Warning: Do not use administrator credentials for scanning. The DriftCTL identity needs only the read-only policy supplied by this repository.

  1. In the root of your own Terraform project, verify that Terraform can read its applied state.

Windows PowerShell

terraform show -json | Out-Null

macOS or Linux (Bash/Zsh)

terraform show -json > /dev/null
  1. Create the scan configuration in that Terraform project:
driftctl init

Enter the read-only AWS CLI profile, AWS Region, and optional KEY=VALUE tag scope when prompted. The command writes a non-secret driftctl.toml; it never stores AWS credentials.

  1. Scan from that Terraform project:
driftctl scan

DriftCTL writes a report and hash-chained audit evidence, then exits 0 when clean, 2 when it finds drift, or 1 when the scan cannot complete. A finding is evidence for a human decision, never automatic remediation.

No Terraform infrastructure yet? Use the no-cost, disposable live-usage sample or the credential-free offline fixtures described in the full Usage Guide. For a direct Ubuntu/Debian walkthrough that uses the disposable example, see the Linux quick walkthrough. Contributors and users who want repository examples can still install from source.

Learn More

  • Usage guide: the complete first-time-user workflow for scanning your own Terraform-managed AWS environment.
  • Linux quick walkthrough: one copy-ready Ubuntu/Debian path using separate Terraform-admin and read-only scanning profiles with the disposable example.
  • Architecture: the scan pipeline, provider-neutral data model, safety boundaries, evidence design, and extension model.
  • Controlled validation lab: the project's own non-production test infrastructure, deliberate drift scenarios, evidence screenshots, remediation, and cleanup record.
  • Terraform infrastructure: the version-controlled non-production infrastructure reference used for this project's controlled live validation.
  • Read-only IAM policy: the least-privilege AWS inspection policy used by the live-scan workflow. The usage guide explains how to apply it safely.
  • Changelog: release history and the current release's known boundaries.
  • Publishing guide: maintainer-only PyPI trusted-publishing and release procedure.
  • License: GNU Affero General Public License v3.0 permissions, conditions, and limitations. Modified versions offered to users over a network must provide their corresponding source code under the same license.
  • Copyright notice: ownership, license reference, redistribution, third-party-material, and warranty notices for DriftCTL.
  • Evidence index: screenshots from the offline and controlled live-validation demonstrations.

Metadata

Release files for drift-control 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for drift-control 1.0.1
File Size Uploaded Provenance Actions
drift_control-1.0.1.tar.gz 5.1 MB With provenance Details for drift_control-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for drift-control 1.0.1
File Interpreter ABI Platform Actions
drift_control-1.0.1-py3-none-any.whl Python 3 none any Details for drift_control-1.0.1-py3-none-any.whl

Total release size: 5.1 MB

Release files / drift_control-1.0.1.tar.gz

Download URL drift_control-1.0.1.tar.gz
Size 5.1 MB
Tags Source
SHA-256 checksum
How to use checksums
d4a9c649d9ed1305b5d70245dccd0f518c8762fa6339dfaf69ceb41f92ed527b
BLAKE2b-256 checksum
How to use checksums
6931c257e6ac703154829d8b8d7598277aecb221f24887fffdd88c411831e484
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

Release files / drift_control-1.0.1-py3-none-any.whl

Download URL drift_control-1.0.1-py3-none-any.whl
Size 67.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b94e1ef27eea1bbb722e230218edfcdb3ff21219230792edba6f4e72b69377be
BLAKE2b-256 checksum
How to use checksums
36197436b7651e3ca70e9773d1b936f6618cdf165c81a34491161d022f132074
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

Security for drift-control 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for drift_control-1.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page