cdk-real-drift 0.22.4 → 0.22.5
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.
- package/README.md +45 -20
- package/dist/cli.js +18 -9
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -141,6 +141,28 @@ Each block above is one kind of finding, and neither needed a baseline:
|
|
|
141
141
|
At the prompt you act on each finding: **record** it (accept and watch),
|
|
142
142
|
**revert** it (undo the change), or **ignore** it (stop reporting).
|
|
143
143
|
|
|
144
|
+
### Every kind of drift and how it prints
|
|
145
|
+
|
|
146
|
+
Those are just the two a first run can show. The full set, confirmed or
|
|
147
|
+
potential:
|
|
148
|
+
|
|
149
|
+
| label | drift | judged against | appears |
|
|
150
|
+
| ------------------------ | ----------------------------------------------------------------------------------------- | ---------------------------- | ------------------ |
|
|
151
|
+
| `[CFn-Declared Drift]` | a declared property whose live value differs | the deployed template | from the first run |
|
|
152
|
+
| `[CFn-Undeclared Drift]` | a live-only value changed out of band (the differentiator) | your `.cdkrd` baseline | after you `record` |
|
|
153
|
+
| `[Added Resource]` | a recorded [out-of-band resource](#added-out-of-band-resources) changed since the record | your `.cdkrd` baseline | after you `record` |
|
|
154
|
+
| `[Deleted]` | a declared resource, or an added one you recorded, deleted out of band (the most blatant) | the template / your baseline | from the first run |
|
|
155
|
+
| `[Potential Drift]` | unconfirmed live-only values (and unrecorded added resources) | nothing yet | until you `record` |
|
|
156
|
+
|
|
157
|
+
The first four are confirmed drift, the kind that fails CI (see
|
|
158
|
+
[In CI](#in-ci)); `[Potential Drift]`, being unconfirmed, never does: it waits
|
|
159
|
+
for your record / revert / ignore decision. Record it (next section) and it
|
|
160
|
+
leaves the report but **stays watched**: a later out-of-band change to that
|
|
161
|
+
value surfaces as confirmed `[CFn-Undeclared Drift]`, and a whole recorded
|
|
162
|
+
resource comes back as `[Added Resource]` if changed, or `[Deleted]` if
|
|
163
|
+
deleted. Everything else `check` prints is informational, not drift: it is
|
|
164
|
+
folded into a one-line `info:` footer and detailed in [Output](#output).
|
|
165
|
+
|
|
144
166
|
### Recording
|
|
145
167
|
|
|
146
168
|
Recording snapshots those live-only values into a git-committed `.cdkrd` baseline,
|
|
@@ -163,6 +185,10 @@ result: 1 drift(s) (undeclared=1)
|
|
|
163
185
|
─────────────────────────────────
|
|
164
186
|
```
|
|
165
187
|
|
|
188
|
+
The same applies one level up: a whole out-of-band resource you've recorded
|
|
189
|
+
surfaces as **`[Added Resource]`** if its live model changes after the record
|
|
190
|
+
(see [Added out-of-band resources](#added-out-of-band-resources)).
|
|
191
|
+
|
|
166
192
|
`record` covers live-only state only, not a `[CFn-Declared Drift]`; the other
|
|
167
193
|
verbs are in [The model](#the-model-one-verb-you-run-three-it-offers).
|
|
168
194
|
|
|
@@ -250,20 +276,14 @@ undeployed code changes don't show up as drift by default. `--pre-deploy` invert
|
|
|
250
276
|
that, checking live state against the freshly synthesized template (see
|
|
251
277
|
[`--pre-deploy`](#--pre-deploy)).
|
|
252
278
|
|
|
253
|
-
###
|
|
254
|
-
|
|
255
|
-
Named so "declared" is never ambiguous (`CFn-declared` means **in the deployed
|
|
256
|
-
template**, not your CDK code and not your `.cdkrd` baseline):
|
|
279
|
+
### Naming and mechanics
|
|
257
280
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
(`CFn-undeclared` is a template axis; `recorded` / `unrecorded` is a separate
|
|
266
|
-
baseline-file axis: whether you've snapshotted that value yet.)
|
|
281
|
+
The kinds themselves, and the label each prints under, are the
|
|
282
|
+
[table in How to use](#every-kind-of-drift-and-how-it-prints). The names are
|
|
283
|
+
chosen so "declared" is never ambiguous: `CFn-declared` means **in the deployed
|
|
284
|
+
template**, not your CDK code and not your `.cdkrd` baseline. (`CFn-undeclared`
|
|
285
|
+
is a template axis; `recorded` / `unrecorded` is a separate baseline-file axis:
|
|
286
|
+
whether you've snapshotted that value yet.)
|
|
267
287
|
|
|
268
288
|
The mechanics:
|
|
269
289
|
|
|
@@ -286,11 +306,12 @@ A whole child resource that exists live but isn't in your template (e.g. an API
|
|
|
286
306
|
Gateway `ANY` method added on `/` via the console) is the resource-level sibling
|
|
287
307
|
of an undeclared property, and is reconciled the same way against your baseline:
|
|
288
308
|
|
|
289
|
-
| state | reported as
|
|
290
|
-
| --------------------------- |
|
|
291
|
-
| added, **not** recorded | **Potential Drift** (no baseline, unconfirmed)
|
|
292
|
-
| recorded, unchanged | suppressed
|
|
293
|
-
| recorded, **changed** since | failing drift
|
|
309
|
+
| state | reported as |
|
|
310
|
+
| --------------------------- | --------------------------------------------------------------- |
|
|
311
|
+
| added, **not** recorded | **Potential Drift** (no baseline, unconfirmed) |
|
|
312
|
+
| recorded, unchanged | suppressed |
|
|
313
|
+
| recorded, **changed** since | failing drift (`[Added Resource]`) |
|
|
314
|
+
| recorded, **deleted** since | failing drift (`[Deleted]`: record keeps watching; detect-only) |
|
|
294
315
|
|
|
295
316
|
`cdk drift` / CFn drift detection compare only template-declared resources, so an
|
|
296
317
|
out-of-band addition is invisible to them. Decide it like any finding: `record`
|
|
@@ -657,8 +678,12 @@ info:
|
|
|
657
678
|
run with --verbose for the list
|
|
658
679
|
```
|
|
659
680
|
|
|
660
|
-
|
|
661
|
-
|
|
681
|
+
The table of every drift kind and its section label is up in
|
|
682
|
+
[How to use](#every-kind-of-drift-and-how-it-prints); the mechanics:
|
|
683
|
+
|
|
684
|
+
- The four **confirmed drift tiers** (`deleted` / `declared` / `undeclared` /
|
|
685
|
+
`added`) are always listed in full and drive the `--fail` exit. They are the
|
|
686
|
+
point.
|
|
662
687
|
- **`[Potential Drift: N]`**: undeclared values with no baseline yet; cdkrd
|
|
663
688
|
can't tell an intentional setting from an out-of-band change, so they're listed
|
|
664
689
|
in full as _potential_ (unconfirmed) drift and don't drive the `--fail` exit;
|
package/dist/cli.js
CHANGED
|
@@ -2528,6 +2528,7 @@ const KNOWN_DEFAULTS = {
|
|
|
2528
2528
|
KeyUsage: "ENCRYPT_DECRYPT",
|
|
2529
2529
|
Origin: "AWS_KMS"
|
|
2530
2530
|
},
|
|
2531
|
+
"AWS::DLM::LifecyclePolicy": { RetainInterval: 7 },
|
|
2531
2532
|
"AWS::IAM::Group": { Path: "/" },
|
|
2532
2533
|
"AWS::IAM::User": { Path: "/" },
|
|
2533
2534
|
"AWS::IAM::InstanceProfile": { Path: "/" },
|
|
@@ -3739,6 +3740,7 @@ const VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS = {
|
|
|
3739
3740
|
};
|
|
3740
3741
|
const VALUE_INDEPENDENT_DEFAULT_NESTED_PATHS = {
|
|
3741
3742
|
"AWS::Batch::ComputeEnvironment": new Set(["ComputeResources.DesiredvCpus"]),
|
|
3743
|
+
"AWS::DLM::LifecyclePolicy": new Set(["PolicyDetails.Schedules.*.CreateRule.Times"]),
|
|
3742
3744
|
"AWS::AutoScaling::AutoScalingGroup": new Set(["Tags.*.ResourceId", "Tags.*.ResourceType"])
|
|
3743
3745
|
};
|
|
3744
3746
|
function isPhysicalIdSegment(value, physicalId) {
|
|
@@ -3918,14 +3920,14 @@ const ELB_TG_ATTRIBUTE_DEFAULTS_BY_PROTOCOL = {
|
|
|
3918
3920
|
},
|
|
3919
3921
|
UDP: {
|
|
3920
3922
|
"stickiness.type": "source_ip",
|
|
3921
|
-
"deregistration_delay.connection_termination.enabled": "
|
|
3923
|
+
"deregistration_delay.connection_termination.enabled": "true",
|
|
3922
3924
|
"proxy_protocol_v2.enabled": "false",
|
|
3923
3925
|
"target_health_state.unhealthy.connection_termination.enabled": "true",
|
|
3924
3926
|
"target_health_state.unhealthy.draining_interval_seconds": "0"
|
|
3925
3927
|
},
|
|
3926
3928
|
TCP_UDP: {
|
|
3927
3929
|
"stickiness.type": "source_ip",
|
|
3928
|
-
"deregistration_delay.connection_termination.enabled": "
|
|
3930
|
+
"deregistration_delay.connection_termination.enabled": "true",
|
|
3929
3931
|
"proxy_protocol_v2.enabled": "false",
|
|
3930
3932
|
"target_health_state.unhealthy.connection_termination.enabled": "true",
|
|
3931
3933
|
"target_health_state.unhealthy.draining_interval_seconds": "0"
|
|
@@ -11772,6 +11774,10 @@ const readDlmLifecyclePolicy = async ({ physicalId, declared, region }) => {
|
|
|
11772
11774
|
if (declared.PolicyDetails === void 0 && DLM_DEFAULT_POLICY_SHORTHAND.some((k) => declared[k] !== void 0)) {
|
|
11773
11775
|
for (const k of DLM_DEFAULT_POLICY_SHORTHAND) if (details[k] !== void 0) model[k] = details[k];
|
|
11774
11776
|
} else if (Object.keys(details).length > 0) model.PolicyDetails = details;
|
|
11777
|
+
if (p.DefaultPolicy === true) {
|
|
11778
|
+
const rt = str$1(details.ResourceType);
|
|
11779
|
+
if (rt !== void 0) model.DefaultPolicy = rt;
|
|
11780
|
+
}
|
|
11775
11781
|
const dlmTags = projectTagList(Object.entries(p.Tags ?? {}).map(([Key, Value]) => ({
|
|
11776
11782
|
Key,
|
|
11777
11783
|
Value
|
|
@@ -16919,7 +16925,7 @@ function report(rawFindings, header, opts = {}) {
|
|
|
16919
16925
|
const tierSection = (tier, leadingBlank) => section(byTier(tier), TIER_NAMES[tier], TIER_NOTES[tier], tierStyle(tier), leadingBlank);
|
|
16920
16926
|
log(style.header(`=== check: ${header} ===`));
|
|
16921
16927
|
if (unrecordedShown.length > 0) {
|
|
16922
|
-
log(style.undeclaredTier("No baseline yet — these live-only values can't be confirmed as drift. Record them right from this `cdkrd check` prompt, or run `cdkrd record`."));
|
|
16928
|
+
log(style.undeclaredTier(opts.hasBaseline ? "Not in your baseline — these live-only values are on resources record couldn't fully snapshot (see readGap/skipped in info:), so cdkrd can't confirm them as drift. Record to accept them." : "No baseline yet — these live-only values can't be confirmed as drift. Record them right from this `cdkrd check` prompt, or run `cdkrd record`."));
|
|
16923
16929
|
log("");
|
|
16924
16930
|
}
|
|
16925
16931
|
let driftSections = 0;
|
|
@@ -17861,17 +17867,18 @@ const writeDlmLifecyclePolicy = async (ctx, ops) => {
|
|
|
17861
17867
|
...CLIENT_TIMEOUTS
|
|
17862
17868
|
});
|
|
17863
17869
|
const m = await desiredModel("AWS::DLM::LifecyclePolicy", ctx, ops);
|
|
17864
|
-
|
|
17865
|
-
|
|
17866
|
-
|
|
17867
|
-
for (const k of DLM_DEFAULT_POLICY_SHORTHAND) if (m[k] !== void 0)
|
|
17870
|
+
const details = m.PolicyDetails;
|
|
17871
|
+
const shorthand = {};
|
|
17872
|
+
if (details === void 0) {
|
|
17873
|
+
for (const k of DLM_DEFAULT_POLICY_SHORTHAND) if (m[k] !== void 0) shorthand[k] = m[k];
|
|
17868
17874
|
}
|
|
17869
17875
|
await c.send(new UpdateLifecyclePolicyCommand({
|
|
17870
17876
|
PolicyId: id,
|
|
17871
17877
|
...str(m.Description) !== void 0 && { Description: str(m.Description) },
|
|
17872
17878
|
...str(m.State) !== void 0 && { State: str(m.State) },
|
|
17873
17879
|
...str(m.ExecutionRoleArn) !== void 0 && { ExecutionRoleArn: str(m.ExecutionRoleArn) },
|
|
17874
|
-
...details !== void 0 && { PolicyDetails: details }
|
|
17880
|
+
...details !== void 0 && { PolicyDetails: details },
|
|
17881
|
+
...shorthand
|
|
17875
17882
|
}));
|
|
17876
17883
|
};
|
|
17877
17884
|
const writeMetricFilter = async (ctx, ops) => {
|
|
@@ -19347,6 +19354,7 @@ const CC_REVERTABLE_DESPITE_READ_OVERRIDE = new Set([
|
|
|
19347
19354
|
"AWS::EC2::EIP"
|
|
19348
19355
|
]);
|
|
19349
19356
|
const REVERT_SET_DEFAULT_PATHS = new Set([
|
|
19357
|
+
"AWS::DLM::LifecyclePolicy\0RetainInterval",
|
|
19350
19358
|
"AWS::IAM::Role\0MaxSessionDuration",
|
|
19351
19359
|
"AWS::IAM::Role\0Description",
|
|
19352
19360
|
"AWS::Lambda::Alias\0Description",
|
|
@@ -22315,7 +22323,8 @@ async function runCheck(args) {
|
|
|
22315
22323
|
code = jsonCode;
|
|
22316
22324
|
} else code = report(reconciled, reportHeader, {
|
|
22317
22325
|
verbose: a.verbose,
|
|
22318
|
-
expandAtDefault: a.showAll
|
|
22326
|
+
expandAtDefault: a.showAll,
|
|
22327
|
+
...a.showAll ? {} : { hasBaseline: baseline !== void 0 }
|
|
22319
22328
|
});
|
|
22320
22329
|
const hasUnrecorded = reconciled.some((f) => f.unrecorded === true);
|
|
22321
22330
|
if (shouldOfferInteractiveResolve(a, {
|