cloud-drift-report 0.2.0__tar.gz → 0.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cloud_drift_report-0.2.0 → cloud_drift_report-0.2.1}/PKG-INFO +32 -15
- {cloud_drift_report-0.2.0 → cloud_drift_report-0.2.1}/README.md +31 -14
- {cloud_drift_report-0.2.0 → cloud_drift_report-0.2.1}/pyproject.toml +1 -1
- {cloud_drift_report-0.2.0 → cloud_drift_report-0.2.1}/skills/cloud-drift-report/scripts/cloud_drift_report.egg-info/PKG-INFO +32 -15
- {cloud_drift_report-0.2.0 → cloud_drift_report-0.2.1}/skills/cloud-drift-report/scripts/drift_report.py +13 -10
- {cloud_drift_report-0.2.0 → cloud_drift_report-0.2.1}/tests/test_drift_report.py +9 -0
- {cloud_drift_report-0.2.0 → cloud_drift_report-0.2.1}/LICENSE +0 -0
- {cloud_drift_report-0.2.0 → cloud_drift_report-0.2.1}/setup.cfg +0 -0
- {cloud_drift_report-0.2.0 → cloud_drift_report-0.2.1}/skills/cloud-drift-report/scripts/aws_inventory.py +0 -0
- {cloud_drift_report-0.2.0 → cloud_drift_report-0.2.1}/skills/cloud-drift-report/scripts/cloud_drift_report.egg-info/SOURCES.txt +0 -0
- {cloud_drift_report-0.2.0 → cloud_drift_report-0.2.1}/skills/cloud-drift-report/scripts/cloud_drift_report.egg-info/dependency_links.txt +0 -0
- {cloud_drift_report-0.2.0 → cloud_drift_report-0.2.1}/skills/cloud-drift-report/scripts/cloud_drift_report.egg-info/entry_points.txt +0 -0
- {cloud_drift_report-0.2.0 → cloud_drift_report-0.2.1}/skills/cloud-drift-report/scripts/cloud_drift_report.egg-info/requires.txt +0 -0
- {cloud_drift_report-0.2.0 → cloud_drift_report-0.2.1}/skills/cloud-drift-report/scripts/cloud_drift_report.egg-info/top_level.txt +0 -0
- {cloud_drift_report-0.2.0 → cloud_drift_report-0.2.1}/tests/test_aws_inventory.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cloud-drift-report
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: Read-only drift and not-in-IaC report for Terraform/OpenTofu (any cloud) and AWS CloudFormation
|
|
5
5
|
License-Expression: Apache-2.0
|
|
6
6
|
Project-URL: Homepage, https://www.orchesterra.in/?utm_source=drift-skill&utm_medium=oss
|
|
@@ -30,11 +30,17 @@ file or stack knows about. It ranks them by severity and explains each one in pl
|
|
|
30
30
|
| CloudFormation drift | ✅ | — |
|
|
31
31
|
| Resources not in any IaC | ✅ | planned |
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
<p align="center">
|
|
34
|
+
<img src="https://raw.githubusercontent.com/orchesterra/cloud-drift-report/main/docs/report-screenshot.png"
|
|
35
|
+
alt="HTML drift report: six drifted resources ranked high, medium and low, with before and after values and what probably happened" width="820">
|
|
36
|
+
</p>
|
|
37
|
+
|
|
38
|
+
It ships four ways, from the same code:
|
|
34
39
|
|
|
35
40
|
- a **command-line tool** (`cloud-drift-report`)
|
|
36
41
|
- a **Claude skill** (Claude Code, Claude desktop and claude.ai)
|
|
37
42
|
- a **Cursor skill**, plus a Cursor rule for older versions
|
|
43
|
+
- a **GitHub Action** (`orchesterra/cloud-drift-report@v0`)
|
|
38
44
|
|
|
39
45
|
It never writes to AWS or to Terraform state, sends no telemetry and needs no account.
|
|
40
46
|
|
|
@@ -136,8 +142,9 @@ the tool reads; see [Safety](#safety) for the exact calls.
|
|
|
136
142
|
|
|
137
143
|
### In GitHub Actions
|
|
138
144
|
|
|
139
|
-
|
|
140
|
-
drifted or is not in IaC
|
|
145
|
+
Use the action. It posts the report on the run's summary page, keeps the HTML, Markdown and JSON reports as
|
|
146
|
+
an artifact, and fails the job when something drifted or is not in IaC. With GitHub's OIDC and a read-only
|
|
147
|
+
role, no keys are stored:
|
|
141
148
|
|
|
142
149
|
```yaml
|
|
143
150
|
name: drift-report
|
|
@@ -156,19 +163,29 @@ jobs:
|
|
|
156
163
|
with:
|
|
157
164
|
role-to-assume: arn:aws:iam::123456789012:role/drift-report-readonly
|
|
158
165
|
aws-region: us-east-1
|
|
159
|
-
- uses:
|
|
160
|
-
with:
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
cloud-drift-report unmanaged --state s3://acme-tf-state/prod/
|
|
164
|
-
--format html -o not-in-iac.html --fail-on-drift
|
|
165
|
-
- if: always()
|
|
166
|
-
uses: actions/upload-artifact@v4
|
|
167
|
-
with: { name: drift-report, path: not-in-iac.html }
|
|
166
|
+
- uses: orchesterra/cloud-drift-report@v0
|
|
167
|
+
with:
|
|
168
|
+
mode: unmanaged
|
|
169
|
+
args: --region us-east-1 --state s3://acme-tf-state/prod/
|
|
168
170
|
```
|
|
169
171
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
+
Terraform/OpenTofu drift: add `hashicorp/setup-terraform` or `opentofu/setup-opentofu` and run `init`, then use
|
|
173
|
+
`mode: terraform` with `args: --dir ./infra`. CloudFormation: `mode: cloudformation` with
|
|
174
|
+
`args: --region us-east-1`.
|
|
175
|
+
|
|
176
|
+
| Input | Default | |
|
|
177
|
+
|---|---|---|
|
|
178
|
+
| `mode` | (required) | `terraform`, `cloudformation` or `unmanaged` |
|
|
179
|
+
| `args` | | the mode's flags, as on the command line |
|
|
180
|
+
| `fail-on-drift` | `true` | fail the step when anything is found |
|
|
181
|
+
| `upload-report` | `true` | keep the reports as a workflow artifact |
|
|
182
|
+
| `report-name` | `cloud-drift-report` | the artifact's name |
|
|
183
|
+
|
|
184
|
+
Outputs: `findings` (count), `high` (high-severity count) and `report-dir` (folder with `report.html`,
|
|
185
|
+
`report.md` and `report.json`), for example to post to Slack only when `high` is not `0`.
|
|
186
|
+
|
|
187
|
+
Without the action: `pip install cloud-drift-report`, then run the CLI with `-o report.html -o report.md`
|
|
188
|
+
(each file takes the format of its extension) and `--fail-on-drift`.
|
|
172
189
|
|
|
173
190
|
## Examples
|
|
174
191
|
|
|
@@ -10,11 +10,17 @@ file or stack knows about. It ranks them by severity and explains each one in pl
|
|
|
10
10
|
| CloudFormation drift | ✅ | — |
|
|
11
11
|
| Resources not in any IaC | ✅ | planned |
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
<p align="center">
|
|
14
|
+
<img src="https://raw.githubusercontent.com/orchesterra/cloud-drift-report/main/docs/report-screenshot.png"
|
|
15
|
+
alt="HTML drift report: six drifted resources ranked high, medium and low, with before and after values and what probably happened" width="820">
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
It ships four ways, from the same code:
|
|
14
19
|
|
|
15
20
|
- a **command-line tool** (`cloud-drift-report`)
|
|
16
21
|
- a **Claude skill** (Claude Code, Claude desktop and claude.ai)
|
|
17
22
|
- a **Cursor skill**, plus a Cursor rule for older versions
|
|
23
|
+
- a **GitHub Action** (`orchesterra/cloud-drift-report@v0`)
|
|
18
24
|
|
|
19
25
|
It never writes to AWS or to Terraform state, sends no telemetry and needs no account.
|
|
20
26
|
|
|
@@ -116,8 +122,9 @@ the tool reads; see [Safety](#safety) for the exact calls.
|
|
|
116
122
|
|
|
117
123
|
### In GitHub Actions
|
|
118
124
|
|
|
119
|
-
|
|
120
|
-
drifted or is not in IaC
|
|
125
|
+
Use the action. It posts the report on the run's summary page, keeps the HTML, Markdown and JSON reports as
|
|
126
|
+
an artifact, and fails the job when something drifted or is not in IaC. With GitHub's OIDC and a read-only
|
|
127
|
+
role, no keys are stored:
|
|
121
128
|
|
|
122
129
|
```yaml
|
|
123
130
|
name: drift-report
|
|
@@ -136,19 +143,29 @@ jobs:
|
|
|
136
143
|
with:
|
|
137
144
|
role-to-assume: arn:aws:iam::123456789012:role/drift-report-readonly
|
|
138
145
|
aws-region: us-east-1
|
|
139
|
-
- uses:
|
|
140
|
-
with:
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
cloud-drift-report unmanaged --state s3://acme-tf-state/prod/
|
|
144
|
-
--format html -o not-in-iac.html --fail-on-drift
|
|
145
|
-
- if: always()
|
|
146
|
-
uses: actions/upload-artifact@v4
|
|
147
|
-
with: { name: drift-report, path: not-in-iac.html }
|
|
146
|
+
- uses: orchesterra/cloud-drift-report@v0
|
|
147
|
+
with:
|
|
148
|
+
mode: unmanaged
|
|
149
|
+
args: --region us-east-1 --state s3://acme-tf-state/prod/
|
|
148
150
|
```
|
|
149
151
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
+
Terraform/OpenTofu drift: add `hashicorp/setup-terraform` or `opentofu/setup-opentofu` and run `init`, then use
|
|
153
|
+
`mode: terraform` with `args: --dir ./infra`. CloudFormation: `mode: cloudformation` with
|
|
154
|
+
`args: --region us-east-1`.
|
|
155
|
+
|
|
156
|
+
| Input | Default | |
|
|
157
|
+
|---|---|---|
|
|
158
|
+
| `mode` | (required) | `terraform`, `cloudformation` or `unmanaged` |
|
|
159
|
+
| `args` | | the mode's flags, as on the command line |
|
|
160
|
+
| `fail-on-drift` | `true` | fail the step when anything is found |
|
|
161
|
+
| `upload-report` | `true` | keep the reports as a workflow artifact |
|
|
162
|
+
| `report-name` | `cloud-drift-report` | the artifact's name |
|
|
163
|
+
|
|
164
|
+
Outputs: `findings` (count), `high` (high-severity count) and `report-dir` (folder with `report.html`,
|
|
165
|
+
`report.md` and `report.json`), for example to post to Slack only when `high` is not `0`.
|
|
166
|
+
|
|
167
|
+
Without the action: `pip install cloud-drift-report`, then run the CLI with `-o report.html -o report.md`
|
|
168
|
+
(each file takes the format of its extension) and `--fail-on-drift`.
|
|
152
169
|
|
|
153
170
|
## Examples
|
|
154
171
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "cloud-drift-report"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.1"
|
|
8
8
|
description = "Read-only drift and not-in-IaC report for Terraform/OpenTofu (any cloud) and AWS CloudFormation"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "Apache-2.0"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cloud-drift-report
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: Read-only drift and not-in-IaC report for Terraform/OpenTofu (any cloud) and AWS CloudFormation
|
|
5
5
|
License-Expression: Apache-2.0
|
|
6
6
|
Project-URL: Homepage, https://www.orchesterra.in/?utm_source=drift-skill&utm_medium=oss
|
|
@@ -30,11 +30,17 @@ file or stack knows about. It ranks them by severity and explains each one in pl
|
|
|
30
30
|
| CloudFormation drift | ✅ | — |
|
|
31
31
|
| Resources not in any IaC | ✅ | planned |
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
<p align="center">
|
|
34
|
+
<img src="https://raw.githubusercontent.com/orchesterra/cloud-drift-report/main/docs/report-screenshot.png"
|
|
35
|
+
alt="HTML drift report: six drifted resources ranked high, medium and low, with before and after values and what probably happened" width="820">
|
|
36
|
+
</p>
|
|
37
|
+
|
|
38
|
+
It ships four ways, from the same code:
|
|
34
39
|
|
|
35
40
|
- a **command-line tool** (`cloud-drift-report`)
|
|
36
41
|
- a **Claude skill** (Claude Code, Claude desktop and claude.ai)
|
|
37
42
|
- a **Cursor skill**, plus a Cursor rule for older versions
|
|
43
|
+
- a **GitHub Action** (`orchesterra/cloud-drift-report@v0`)
|
|
38
44
|
|
|
39
45
|
It never writes to AWS or to Terraform state, sends no telemetry and needs no account.
|
|
40
46
|
|
|
@@ -136,8 +142,9 @@ the tool reads; see [Safety](#safety) for the exact calls.
|
|
|
136
142
|
|
|
137
143
|
### In GitHub Actions
|
|
138
144
|
|
|
139
|
-
|
|
140
|
-
drifted or is not in IaC
|
|
145
|
+
Use the action. It posts the report on the run's summary page, keeps the HTML, Markdown and JSON reports as
|
|
146
|
+
an artifact, and fails the job when something drifted or is not in IaC. With GitHub's OIDC and a read-only
|
|
147
|
+
role, no keys are stored:
|
|
141
148
|
|
|
142
149
|
```yaml
|
|
143
150
|
name: drift-report
|
|
@@ -156,19 +163,29 @@ jobs:
|
|
|
156
163
|
with:
|
|
157
164
|
role-to-assume: arn:aws:iam::123456789012:role/drift-report-readonly
|
|
158
165
|
aws-region: us-east-1
|
|
159
|
-
- uses:
|
|
160
|
-
with:
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
cloud-drift-report unmanaged --state s3://acme-tf-state/prod/
|
|
164
|
-
--format html -o not-in-iac.html --fail-on-drift
|
|
165
|
-
- if: always()
|
|
166
|
-
uses: actions/upload-artifact@v4
|
|
167
|
-
with: { name: drift-report, path: not-in-iac.html }
|
|
166
|
+
- uses: orchesterra/cloud-drift-report@v0
|
|
167
|
+
with:
|
|
168
|
+
mode: unmanaged
|
|
169
|
+
args: --region us-east-1 --state s3://acme-tf-state/prod/
|
|
168
170
|
```
|
|
169
171
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
+
Terraform/OpenTofu drift: add `hashicorp/setup-terraform` or `opentofu/setup-opentofu` and run `init`, then use
|
|
173
|
+
`mode: terraform` with `args: --dir ./infra`. CloudFormation: `mode: cloudformation` with
|
|
174
|
+
`args: --region us-east-1`.
|
|
175
|
+
|
|
176
|
+
| Input | Default | |
|
|
177
|
+
|---|---|---|
|
|
178
|
+
| `mode` | (required) | `terraform`, `cloudformation` or `unmanaged` |
|
|
179
|
+
| `args` | | the mode's flags, as on the command line |
|
|
180
|
+
| `fail-on-drift` | `true` | fail the step when anything is found |
|
|
181
|
+
| `upload-report` | `true` | keep the reports as a workflow artifact |
|
|
182
|
+
| `report-name` | `cloud-drift-report` | the artifact's name |
|
|
183
|
+
|
|
184
|
+
Outputs: `findings` (count), `high` (high-severity count) and `report-dir` (folder with `report.html`,
|
|
185
|
+
`report.md` and `report.json`), for example to post to Slack only when `high` is not `0`.
|
|
186
|
+
|
|
187
|
+
Without the action: `pip install cloud-drift-report`, then run the CLI with `-o report.html -o report.md`
|
|
188
|
+
(each file takes the format of its extension) and `--fail-on-drift`.
|
|
172
189
|
|
|
173
190
|
## Examples
|
|
174
191
|
|
|
@@ -34,7 +34,7 @@ from dataclasses import asdict, dataclass, field
|
|
|
34
34
|
from datetime import datetime, timezone
|
|
35
35
|
from typing import Any, Iterable
|
|
36
36
|
|
|
37
|
-
__version__ = "0.2.
|
|
37
|
+
__version__ = "0.2.1"
|
|
38
38
|
|
|
39
39
|
PRODUCT_URL = "https://www.orchesterra.in/?utm_source=drift-skill&utm_medium=oss"
|
|
40
40
|
FOOTER = f"Run this daily across all your AWS accounts, with approvals and auto-fix PRs → {PRODUCT_URL}"
|
|
@@ -677,7 +677,9 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
677
677
|
p.add_argument("--version", action="version", version=f"%(prog)s {__version__}")
|
|
678
678
|
common = argparse.ArgumentParser(add_help=False)
|
|
679
679
|
common.add_argument("--format", "-f", choices=sorted(RENDERERS), default="md", help="report format (default md)")
|
|
680
|
-
common.add_argument("--output", "-o",
|
|
680
|
+
common.add_argument("--output", "-o", action="append", default=[],
|
|
681
|
+
help="write the report to this file (default stdout); may repeat, and a .md, .csv, "
|
|
682
|
+
".json or .html extension picks that file's format")
|
|
681
683
|
common.add_argument("--fail-on-drift", action="store_true", help="exit 2 when drift is found (for CI)")
|
|
682
684
|
common.add_argument("--share", action="store_true", help="coming soon: share the report with teammates on OrchesTerra")
|
|
683
685
|
sub = p.add_subparsers(dest="mode", required=True)
|
|
@@ -798,15 +800,16 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
798
800
|
print(f"error: {exc}", file=sys.stderr)
|
|
799
801
|
return 1
|
|
800
802
|
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
803
|
+
c = report.counts()
|
|
804
|
+
for path in args.output:
|
|
805
|
+
ext = os.path.splitext(path)[1].lstrip(".").lower()
|
|
806
|
+
fmt = ext if len(args.output) > 1 and ext in RENDERERS else args.format
|
|
807
|
+
with open(path, "w", encoding="utf-8", newline="") as fh:
|
|
808
|
+
fh.write(RENDERERS[fmt](report))
|
|
809
|
+
print(f"Wrote {path}: {report.noun()} (high {c['high']}, medium {c['medium']}, "
|
|
807
810
|
f"low {c['low']}).", file=sys.stderr)
|
|
808
|
-
|
|
809
|
-
sys.stdout.write(
|
|
811
|
+
if not args.output:
|
|
812
|
+
sys.stdout.write(RENDERERS[args.format](report))
|
|
810
813
|
if args.share:
|
|
811
814
|
share_report(report, render_html(report))
|
|
812
815
|
return 2 if args.fail_on_drift and report.findings else 0
|
|
@@ -327,3 +327,12 @@ def test_script_runs_standalone():
|
|
|
327
327
|
capture_output=True, text=True, env={**os.environ, "PYTHONPATH": ""})
|
|
328
328
|
assert proc.returncode == 0, proc.stderr
|
|
329
329
|
assert json.loads(proc.stdout)["summary"]["total"] == 6
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
def test_several_outputs_take_their_format_from_the_extension(tmp_path):
|
|
333
|
+
md, html_, js = tmp_path / "r.md", tmp_path / "r.html", tmp_path / "r.json"
|
|
334
|
+
code = dr.main(["terraform", "--plan-json", str(FIXTURE), "-o", str(md), "-o", str(html_), "-o", str(js)])
|
|
335
|
+
assert code == 0
|
|
336
|
+
assert md.read_text().startswith("# Drift report")
|
|
337
|
+
assert html_.read_text().startswith("<!doctype html>")
|
|
338
|
+
assert json.loads(js.read_text())["summary"]["total"] == 6
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|