@go-to-k/cdkd 0.290.38 → 0.290.39
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/dist/{asg-provider-B70ujDSS.js → asg-provider-CH4oHOxq.js} +3 -3
- package/dist/{asg-provider-B70ujDSS.js.map → asg-provider-CH4oHOxq.js.map} +1 -1
- package/dist/cli.js +2 -2
- package/dist/{deploy-engine-BdYBI1uT.js → deploy-engine-Vze2lc-H.js} +369 -66
- package/dist/{deploy-engine-BdYBI1uT.js.map → deploy-engine-Vze2lc-H.js.map} +1 -1
- package/dist/index.js +2 -2
- package/dist/{logger-BX4pJk0T.js → logger-BkcLg0jL.js} +11 -3
- package/dist/logger-BkcLg0jL.js.map +1 -0
- package/dist/{program-Br4uc31m.js → program-BC_cHG7r.js} +224 -49
- package/dist/{program-Br4uc31m.js.map → program-BC_cHG7r.js.map} +1 -1
- package/dist/{version-BeHfM5ow.js → version-DzcgAjCn.js} +2 -2
- package/dist/{version-BeHfM5ow.js.map → version-DzcgAjCn.js.map} +1 -1
- package/package.json +1 -1
- package/dist/logger-BX4pJk0T.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { $ as yellow, $i as
|
|
2
|
-
import { C as displayAwsMessage, D as truncateCodePoints, E as isPasteableIdent, S as UNRENDERABLE, T as displaySafe, _ as withSkipPrefix, b as SECRET_REF_MAX_CODE_POINTS, c as PATTERN_B_NAME_OPTIONS, f as explicitNamePropertyFor, h as getCurrentStackName, i as reserveStdoutForPayload, l as PATTERN_B_NAME_PROPERTIES, m as generateResourceNameWithFallback, n as getLogger, o as runStackBuffered, p as generateResourceName, s as getLiveRenderer, u as PATTERN_B_RESOURCE_TYPES, v as withStackName, w as displayIdent, x as STACK_REF_MAX_CODE_POINTS } from "./logger-
|
|
1
|
+
import { $ as yellow, $i as CrossAccountSecretRefusalError, $n as TemplateParser, $r as validateAssetBucketName, $t as requireConfigObject, A as createPreDeleteFinalSnapshot, Ai as ssmResolvedValueType, An as malformedResourcePropertiesWarning, Ar as hasReasonlessBaselineRefusal, At as carriesDynamicReference, B as isStatefulRecreateTargetSync, Bi as canonicalizeRegion, Bn as refuseMalformedResourcesForDestroy, Br as WorkGraph, Bt as isSettledInstanceState, C as namesAnyDeclaredParameter, Ca as isThrottlingError, Ci as resolveCaptureObservedState, Cn as malformedExportSourceWarning, Cr as forceQuitRecoveryClause, Ct as slowCcOperationTimeoutMs, D as PRE_DELETE_SNAPSHOT_TYPES, Da as retryClassificationText, Di as resolveUseCdkBootstrapAssets, Dn as malformedOutputsWarning, Dr as DEFAULT_STATE_PREFIX, Dt as disableInstanceApiTermination, E as ATOMIC_FINAL_SNAPSHOT_TYPES, Ea as markRedactedCause, Ei as resolveStateBucketWithDefaultAndSource, En as malformedOutputsRefusalMessage, Er as CUSTOM_RESOURCE_RESPONSE_PREFIX, Et as deleteSkipReason, F as extractDeploymentEventError, Fi as uploadCfnTemplate, Fn as refuseMalformedNestedChildOutputs, Fr as orphansAfterRollback, Ft as isImpossibleEmptyStoredAttribute, G as toCfnInteger, Gi as resolveBucketRegion, Gn as repairMalformedResourcesForReadOnly, Gr as AssetModeResolver, Gt as coerceCfnBoolean, H as WARM_THROUGHPUT_MEMBERS, Hi as AssemblyReader, Hn as repairMalformedOutputsForReadOnly, Hr as createAssetRedirectResolver, Ht as normalizeAwsTagsToCfn, I as makeSiblingClaimReader, Ii as CUSTOM_RESOURCE_RESPONSE_OBJECT_DESCRIPTION, In as refuseMalformedOutputs, Ir as orphansCarriedFrom, It as isNamelessDynamicReferenceError, J as bold, Ji as resetAwsClients, Jn as findActionableSilentDrops, Jr as ensureAssetStorage, Jt as configIntegerRefusal, K as toFiniteNumber, Ki as AwsClients, Kn as safeRegion, Kr as BOOTSTRAP_MARKER_PREFIX, Kt as coerceCfnInteger, L as planOrphanAdoption, Li as decodeListingKey, Ln as refuseMalformedOutputsForDestroy, Lr as shouldRetainResource, Lt as isUnboundTemplateParameter, M as refusesFinalSnapshot, Mi as CFN_TEMPLATE_URL_LIMIT, Mn as malformedStateRefusalMessage, Mr as importableOutputKeys, Mt as cfnRefValueFromPhysicalId, N as unsupportedFinalSnapshotError, Ni as MIGRATE_TMP_PREFIX, Nn as producerRecordKey, Nr as importableOutputs, Nt as coerceParameterTypedValue, O as buildFinalSnapshotIdentifier, Oa as describeAwsFailure, Oi as stateBucketExistenceConfirmed, On as malformedRenderedContainersWarning, Or as exportNamesCarriedFrom, Ot as isTerminationProtectionPropagationError, P as makeCanonicalizePropertiesFn, Pi as findLargeInlineResources, Pn as refuseDivergentRecordRegionForDestroy, Pr as isReadableBag, Pt as getAccountInfo, Q as red, Qn as DagBuilder, Qr as readBootstrapMarkerBody, Qt as requireConfigArray, R as MULTI_REGION_RECREATE_BLOCKED_TYPES, Ri as expectedOwnerParam, Rn as refuseMalformedResourceEntries, Rr as AssetPublisher, Rt as parameterTypeMayLoseSecretIdentity, S as computeParameterTaint, Sa as isRetryableTransientError, Si as resolveAutoAssetStorage, Sn as malformedExportNamesWarning, Sr as buildLockContentionMessage, St as isWaitAbandonedError, T as resourcesNamingDeclaredParameter, Ta as markNonRetryable, Ti as resolveStateBucketWithDefault, Tn as malformedOrphanRecordsWarning, Tr as shellQuote, Tt as deleteIndeterminateGuards, U as coerceWarmThroughput$1, Ui as processStackMessages, Un as repairMalformedResourceEntriesForReadOnly, Ur as loadPublishableAssetManifest, Ut as resolveExplicitPhysicalId, V as renderStatefulReason, Vi as derivePartitionAndUrlSuffix, Vn as refuseMalformedState, Vr as buildAssetRedirectMap, Vt as WAFv2WebACLProvider, W as isWarmThroughputDecrease, Wn as repairMalformedResourcePropertiesForReadOnly, Wr as rewriteTemplateAssetReferences, Wt as assertRegionMatch, X as gray, Xn as describeTypeWithThrottleRetry, Xr as isCrossRegionRedirect, Xt as readConfigString, Y as cyan, Yi as setAwsClients, Yn as findSilentDropProperties, Yr as getBootstrapMarkerKey, Yt as configStringRefusal, Z as green, Zi as CdkdError, Zn as withRetry, Zr as parseBootstrapMarker, Zt as replayWarn, _ as bagHoldsSecretExpression, _i as Synthesizer, _n as UNREADABLE_RESOURCES_MAP_ROW, _r as LockManager, _t as endCommandInterruptScope, a as DeploymentEventsStore, aa as LocalStartServiceError, ai as describeDockerFailure, an as s3BucketDomainName, ar as createSecretMasker, at as secretBearingStateKeyWarning, b as mergeNoChangeOutputs, ba as withErrorHandling, bi as getLegacyStateBucketName, bn as hasReadableResources, br as UNREPRODUCIBLE_LOCK_CLAUSE, bt as startInterruptWatch, c as replayFailedOperations, ca as NestedStackChildDirectDestroyError, ci as getDockerCmd, cn as s3BucketWebsiteUrl, cr as identityKeyFor, ct as IAMRoleProvider, d as updatePartialMessage, da as ResourceTimeoutError, di as runDockerForeground, dn as applyCallerIdentityCredentials, dr as maskSecretsInError, dt as ProviderRegistry, ei as validateContainerRepoName, en as requireConfigString, er as STATE_SOURCED_BASELINE_RULES, et as collectDeclaredOutputNames, f as updatePartialReason, fa as ResourceUpdateNotSupportedError, fi as runDockerStreaming, fn as callerEnvCredentials, fr as maskSecretsInText, ft as wouldReturnToSdkProvider, g as computeImplicitDeleteEdges, ga as SynthesisError, gi as getDockerImageBySourceHash, gn as STATE_RESOURCES_MALFORMED, gr as scrubResourceRecord, gt as beginCommandInterruptScope, h as IMPLICIT_DELETE_DEPENDENCIES, hi as AssetManifestLoader, hn as INTRINSIC_KEYS, hr as redactSecretsForState, ht as maskerOrIdentity, i as DeploymentEventsReader, ia as LocalInvokeBuildError$1, ii as describeDockerExecFailure, in as s3BucketArn, ir as carriesSecretMask, it as secretBearing, j as isFinalSnapshotError, ji as CFN_TEMPLATE_BODY_LIMIT, jn as malformedResourcesWarning, jr as hasUnverifiableParameterRefusal, jt as carriesFetchableDynamicReference, k as ccRoutedFinalSnapshotError, ka as safeStringify, ki as warnDeprecatedNoPrefixCliFlag, kn as malformedResourceEntriesWarning, kr as hasReadableExportSet, kt as IntrinsicFunctionResolver, l as replayRollback, la as PartialFailureError, li as partitionSensitiveEnv, ln as applyRoleArnIfSet, lr as isSingleDynamicReferenceToken, lt as collectInlinePolicyNamesManagedBySiblings, m as maskingRetryLogger, ma as StackTerminationProtectionError, mi as stripControlChars, mn as DiffCalculator, mr as recoverMaskedOutput, mt as maskDeep, n as DEFAULT_RESOURCE_WARN_AFTER_MS, na as DynamicReferenceRegionAmbiguousError, ni as buildDockerImage, nn as producerRegionsFromState, nr as STATE_SOURCED_READBACK_RULES, nt as exportAliasCollisionScrubWarning, o as planFailedOps, oi as dockerSpawnEnvWithSensitive, on as s3BucketDualStackDomainName, or as dynamicReferenceTokens, ot as secretSafeKeyDisplay, p as withResourceDeadline, pa as StackHasActiveImportsError, pi as escapeRegExp, pn as envCredentialsAreAssumedRole, pr as recordMaskOnlyValue, pt as createMaskedRetryLogger, q as formatResourceLine, qi as getAwsClients, qn as safeStackName, qr as assertAssetBucketRegion, qt as configBooleanRefusal, r as DeployEngine, ra as IntrinsicResolutionRefusalError, ri as describeDockerCapturedOutput, rn as withSharedDrainBudget, rr as TEMPLATE_SOURCED_RULES, rt as isExportAliasCollision, s as planRollback, sa as MalformedProducerRecordRefusalError, si as formatDockerLoginError, sn as s3BucketRegionalDomainName, sr as errorCauseChain, st as getCurrentResourceSecrets, t as DEFAULT_RESOURCE_TIMEOUT_MS, ta as DeployCancelledError, ti as buildDenyExternalAccessPolicy, tn as classifyReplaySecretRegion, tr as STATE_SOURCED_CROSS_GENERATION_RULES, tt as collectPublishedOutputNames, u as resolveReplacementOldType, ua as ProvisioningError, ui as redactDockerArgvValues, un as AWS_CREDENTIAL_ENV_KEYS, ur as markSameGenerationBag, ut as clearOnUpdateRemoval, v as isSecretBearingReferenceString, vi as synthesisStatusMessage, vn as displayLogicalId, vr as S3StateBackend, vt as interruptWatchListenerCount, w as reachableDivergentParameters, wa as isTransientServerError, wi as resolveSkipPrefix, wn as malformedLocalOutputsWarning, wr as formatLockExpiry, wt as UNSPECIFIED_SKIP_REASON, x as bindingSkippedOutputs, xa as isMarkedNonRetryable, xi as resolveApp, xn as isReadableResourceEntry, xr as buildForceUnlockCommand, xt as CloudControlProvider, y as keptWholeReasonText, ya as normalizeAwsError, yi as getDefaultStateBucketName, yn as hasReadableOutputs, yr as rebuildClientForBucketRegion, yt as isInterruptedWaitError, z as isStatefulRecreateTargetForReplace, zi as PARTITION_TABLE, zn as refuseMalformedResourcePropertiesForOrphan, zr as stringifyValue, zt as refStateLookupFromResource } from "./deploy-engine-Vze2lc-H.js";
|
|
2
|
+
import { C as displayAwsMessage, D as truncateCodePoints, E as isPasteableIdent, S as UNRENDERABLE, T as displaySafe, _ as withSkipPrefix, b as SECRET_REF_MAX_CODE_POINTS, c as PATTERN_B_NAME_OPTIONS, f as explicitNamePropertyFor, h as getCurrentStackName, i as reserveStdoutForPayload, l as PATTERN_B_NAME_PROPERTIES, m as generateResourceNameWithFallback, n as getLogger, o as runStackBuffered, p as generateResourceName, s as getLiveRenderer, u as PATTERN_B_RESOURCE_TYPES, v as withStackName, w as displayIdent, x as STACK_REF_MAX_CODE_POINTS } from "./logger-BkcLg0jL.js";
|
|
3
3
|
import { n as awsClientDefaults } from "./aws-client-defaults-BoIxyCir.js";
|
|
4
|
-
import { t as getCdkdVersion } from "./version-
|
|
5
|
-
import { a as renderDisableCommand, i as protectedReplacementAdvice, r as UNNAMEABLE_ID_CLAUSE, t as ASGProvider } from "./asg-provider-
|
|
4
|
+
import { t as getCdkdVersion } from "./version-DzcgAjCn.js";
|
|
5
|
+
import { a as renderDisableCommand, i as protectedReplacementAdvice, r as UNNAMEABLE_ID_CLAUSE, t as ASGProvider } from "./asg-provider-CH4oHOxq.js";
|
|
6
6
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
7
7
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
8
8
|
import { CopyObjectCommand, CreateBucketCommand, DeleteBucketAnalyticsConfigurationCommand, DeleteBucketCommand, DeleteBucketCorsCommand, DeleteBucketEncryptionCommand, DeleteBucketIntelligentTieringConfigurationCommand, DeleteBucketInventoryConfigurationCommand, DeleteBucketLifecycleCommand, DeleteBucketMetricsConfigurationCommand, DeleteBucketOwnershipControlsCommand, DeleteBucketPolicyCommand, DeleteBucketReplicationCommand, DeleteBucketTaggingCommand, DeleteBucketWebsiteCommand, DeleteObjectsCommand, GetBucketAccelerateConfigurationCommand, GetBucketCorsCommand, GetBucketEncryptionCommand, GetBucketLifecycleConfigurationCommand, GetBucketLocationCommand, GetBucketLoggingCommand, GetBucketNotificationConfigurationCommand, GetBucketOwnershipControlsCommand, GetBucketPolicyCommand, GetBucketReplicationCommand, GetBucketTaggingCommand, GetBucketVersioningCommand, GetBucketWebsiteCommand, GetObjectCommand, GetObjectLockConfigurationCommand, GetPublicAccessBlockCommand, HeadBucketCommand, ListBucketAnalyticsConfigurationsCommand, ListBucketIntelligentTieringConfigurationsCommand, ListBucketInventoryConfigurationsCommand, ListBucketMetricsConfigurationsCommand, ListObjectVersionsCommand, ListObjectsV2Command, NoSuchBucket, NotFound, PutBucketAccelerateConfigurationCommand, PutBucketAnalyticsConfigurationCommand, PutBucketCorsCommand, PutBucketEncryptionCommand, PutBucketIntelligentTieringConfigurationCommand, PutBucketInventoryConfigurationCommand, PutBucketLifecycleConfigurationCommand, PutBucketLoggingCommand, PutBucketMetricsConfigurationCommand, PutBucketNotificationConfigurationCommand, PutBucketOwnershipControlsCommand, PutBucketPolicyCommand, PutBucketReplicationCommand, PutBucketTaggingCommand, PutBucketVersioningCommand, PutBucketWebsiteCommand, PutObjectCommand, PutObjectLockConfigurationCommand, PutPublicAccessBlockCommand, S3Client, S3ServiceException } from "@aws-sdk/client-s3";
|
|
@@ -67807,6 +67807,8 @@ function conditionsDependOnTokenParameters(template, tokenParameterNames) {
|
|
|
67807
67807
|
}
|
|
67808
67808
|
return false;
|
|
67809
67809
|
}
|
|
67810
|
+
/** How many unreadable row names the human preview lists before summarizing. */
|
|
67811
|
+
const UNREADABLE_PREVIEW_NAMES = 10;
|
|
67810
67812
|
/** Empty template used to diff a removed nested child's state → all DELETE. */
|
|
67811
67813
|
const EMPTY_TEMPLATE = { Resources: {} };
|
|
67812
67814
|
/**
|
|
@@ -67869,20 +67871,35 @@ function indexNestedChildTemplates(template, templatePath) {
|
|
|
67869
67871
|
async function loadStateOrEmpty(stackName, region, stateBackend) {
|
|
67870
67872
|
const result = await stateBackend.getState(stackName, region);
|
|
67871
67873
|
if (result) {
|
|
67872
|
-
|
|
67874
|
+
const unreadable = [];
|
|
67875
|
+
if (repairMalformedResourcesForReadOnly(result.state)) {
|
|
67876
|
+
logger.warn(malformedResourcesWarning(stackName, region));
|
|
67877
|
+
unreadable.push(UNREADABLE_RESOURCES_MAP_ROW);
|
|
67878
|
+
}
|
|
67879
|
+
const dropped = repairMalformedResourceEntriesForReadOnly(result.state);
|
|
67880
|
+
if (dropped.length > 0) {
|
|
67881
|
+
logger.warn(malformedResourceEntriesWarning(stackName, region, dropped));
|
|
67882
|
+
unreadable.push(...dropped);
|
|
67883
|
+
}
|
|
67873
67884
|
const unreadableProps = repairMalformedResourcePropertiesForReadOnly(result.state);
|
|
67874
67885
|
if (unreadableProps.length > 0) logger.warn(malformedResourcePropertiesWarning(stackName, region, unreadableProps));
|
|
67875
67886
|
if (repairMalformedOutputsForReadOnly(result.state)) logger.warn(malformedOutputsWarning(stackName, region));
|
|
67876
67887
|
if (isReadableBag(result.state.outputs) && !hasReadableExportSet(result.state)) logger.warn(malformedExportNamesWarning(stackName, region));
|
|
67877
|
-
return
|
|
67888
|
+
return {
|
|
67889
|
+
state: result.state,
|
|
67890
|
+
unreadable
|
|
67891
|
+
};
|
|
67878
67892
|
}
|
|
67879
67893
|
return {
|
|
67880
|
-
|
|
67881
|
-
|
|
67882
|
-
|
|
67883
|
-
|
|
67884
|
-
|
|
67885
|
-
|
|
67894
|
+
state: {
|
|
67895
|
+
stackName,
|
|
67896
|
+
region,
|
|
67897
|
+
resources: {},
|
|
67898
|
+
outputs: {},
|
|
67899
|
+
version: 10,
|
|
67900
|
+
lastModified: Date.now()
|
|
67901
|
+
},
|
|
67902
|
+
unreadable: []
|
|
67886
67903
|
};
|
|
67887
67904
|
}
|
|
67888
67905
|
/**
|
|
@@ -68032,8 +68049,19 @@ async function computeStackDiff(currentState, template, region, stackName, state
|
|
|
68032
68049
|
let adoptedRecords = {};
|
|
68033
68050
|
let blocking = [];
|
|
68034
68051
|
let stateForDiff = currentState;
|
|
68052
|
+
const unreadableOrphans = [];
|
|
68035
68053
|
if (currentState.orphans?.length && options.previewOrphanAdoption) {
|
|
68036
|
-
const
|
|
68054
|
+
const readableOrphans = currentState.orphans.filter((record) => {
|
|
68055
|
+
if (isReadableResourceEntry(record?.state)) return true;
|
|
68056
|
+
const id = record?.logicalId;
|
|
68057
|
+
unreadableOrphans.push(typeof id === "string" ? id : "");
|
|
68058
|
+
return false;
|
|
68059
|
+
});
|
|
68060
|
+
if (unreadableOrphans.length > 0) logger.warn(malformedOrphanRecordsWarning(stackName, region, unreadableOrphans));
|
|
68061
|
+
const plan = await options.previewOrphanAdoption({
|
|
68062
|
+
...currentState,
|
|
68063
|
+
orphans: readableOrphans
|
|
68064
|
+
}, effectiveTemplate, stackName, region);
|
|
68037
68065
|
adoptedOrphans = Object.keys(plan.adopted);
|
|
68038
68066
|
adoptedRecords = plan.adopted;
|
|
68039
68067
|
blocking = plan.refusals;
|
|
@@ -68088,7 +68116,8 @@ async function computeStackDiff(currentState, template, region, stackName, state
|
|
|
68088
68116
|
outputChanges,
|
|
68089
68117
|
adoptedOrphans,
|
|
68090
68118
|
adoptedRecords,
|
|
68091
|
-
blocking
|
|
68119
|
+
blocking,
|
|
68120
|
+
unreadableOrphans
|
|
68092
68121
|
};
|
|
68093
68122
|
}
|
|
68094
68123
|
/**
|
|
@@ -68167,9 +68196,9 @@ async function resolveChildStackParameters(parentStackRow, parentTemplate, paren
|
|
|
68167
68196
|
*/
|
|
68168
68197
|
async function buildDiffTree(args) {
|
|
68169
68198
|
const { stackName, displayName, region, template, nestedTemplates, recursive, stateBackend, diffCalculator, parentHasSecretReference, parameters, canonicalizeProperties, assetRedirect, cfnFallback, previewOrphanAdoption, ancestorTemplatePaths } = args;
|
|
68170
|
-
const state = await loadStateOrEmpty(stackName, region, stateBackend);
|
|
68199
|
+
const { state, unreadable } = await loadStateOrEmpty(stackName, region, stateBackend);
|
|
68171
68200
|
const secretBearingAbove = parentHasSecretReference === true || templateHasSecretDynamicReference(template);
|
|
68172
|
-
const { changes, outputChanges, adoptedOrphans, adoptedRecords, blocking } = await computeStackDiff(state, template, region, stackName, stateBackend, diffCalculator, {
|
|
68201
|
+
const { changes, outputChanges, adoptedOrphans, adoptedRecords, blocking, unreadableOrphans } = await computeStackDiff(state, template, region, stackName, stateBackend, diffCalculator, {
|
|
68173
68202
|
...parameters && { parameters },
|
|
68174
68203
|
...canonicalizeProperties && { canonicalizeProperties },
|
|
68175
68204
|
...cfnFallback !== void 0 && { cfnFallback },
|
|
@@ -68192,6 +68221,7 @@ async function buildDiffTree(args) {
|
|
|
68192
68221
|
outputChanges,
|
|
68193
68222
|
adoptedOrphans,
|
|
68194
68223
|
blocking,
|
|
68224
|
+
unreadable: [...unreadable, ...unreadableOrphans],
|
|
68195
68225
|
children: []
|
|
68196
68226
|
};
|
|
68197
68227
|
if (!recursive) return node;
|
|
@@ -68241,7 +68271,7 @@ async function buildDiffTree(args) {
|
|
|
68241
68271
|
* (also all DELETE).
|
|
68242
68272
|
*/
|
|
68243
68273
|
async function buildDeletedSubtree(stackName, region, stateBackend, diffCalculator, parentHasSecretReference) {
|
|
68244
|
-
const state = await loadStateOrEmpty(stackName, region, stateBackend);
|
|
68274
|
+
const { state, unreadable } = await loadStateOrEmpty(stackName, region, stateBackend);
|
|
68245
68275
|
const { changes, outputChanges } = await computeStackDiff(state, EMPTY_TEMPLATE, region, stackName, stateBackend, diffCalculator, { inheritSecretBearingTemplate: parentHasSecretReference });
|
|
68246
68276
|
const node = {
|
|
68247
68277
|
stackName,
|
|
@@ -68251,6 +68281,7 @@ async function buildDeletedSubtree(stackName, region, stateBackend, diffCalculat
|
|
|
68251
68281
|
ccApiRoutes: /* @__PURE__ */ new Map(),
|
|
68252
68282
|
adoptedOrphans: [],
|
|
68253
68283
|
blocking: [],
|
|
68284
|
+
unreadable,
|
|
68254
68285
|
outputChanges,
|
|
68255
68286
|
children: []
|
|
68256
68287
|
};
|
|
@@ -68317,7 +68348,7 @@ function collectCcApiRoutes(template, state) {
|
|
|
68317
68348
|
/** True when this node has at least one real (non-`NO_CHANGE`) change. */
|
|
68318
68349
|
function nodeHasChanges(node) {
|
|
68319
68350
|
for (const change of node.changes.values()) if (change.changeType !== "NO_CHANGE") return true;
|
|
68320
|
-
return node.outputChanges.length > 0 || node.adoptedOrphans.length > 0;
|
|
68351
|
+
return node.outputChanges.length > 0 || node.adoptedOrphans.length > 0 || node.unreadable.length > 0;
|
|
68321
68352
|
}
|
|
68322
68353
|
/** True when this node OR any descendant has a real change (tree-wide drift detector for `--fail`). */
|
|
68323
68354
|
/**
|
|
@@ -68390,6 +68421,7 @@ function diffTreeToJson(node) {
|
|
|
68390
68421
|
})),
|
|
68391
68422
|
adoptedOrphans: node.adoptedOrphans,
|
|
68392
68423
|
blocking: node.blocking,
|
|
68424
|
+
unreadable: node.unreadable,
|
|
68393
68425
|
children: node.children.map(diffTreeToJson)
|
|
68394
68426
|
};
|
|
68395
68427
|
}
|
|
@@ -68627,6 +68659,12 @@ function renderDiffTree(node, isRoot, logFn) {
|
|
|
68627
68659
|
logFn(`\n${create} to create, ${update} to update, ${del} to delete`);
|
|
68628
68660
|
if (outputs.add + outputs.change + outputs.remove > 0) logFn(`${outputs.add} output(s) to add, ${outputs.change} to change, ${outputs.remove} to remove`);
|
|
68629
68661
|
if (node.adoptedOrphans.length > 0) logFn(`${node.adoptedOrphans.length} resource(s) to adopt from a previous rollback: ${node.adoptedOrphans.map(stripControlChars).join(", ")}`);
|
|
68662
|
+
if (node.unreadable.length > 0) {
|
|
68663
|
+
const named = node.unreadable.slice(0, UNREADABLE_PREVIEW_NAMES).map((id) => id === "(resources map)" ? id : displayLogicalId(id));
|
|
68664
|
+
const rest = node.unreadable.length - named.length;
|
|
68665
|
+
const onlyTheMap = node.unreadable.length === 1 && node.unreadable[0] === "(resources map)";
|
|
68666
|
+
logFn(`${node.unreadable.length} state record row(s) could not be read: ${named.join(", ")}${rest > 0 ? ` and ${rest} more` : ""}.` + (onlyTheMap ? "" : " One the template still declares is shown above as a create; one it no longer declares is not shown above."));
|
|
68667
|
+
}
|
|
68630
68668
|
}
|
|
68631
68669
|
if (node.blocking.length > 0) {
|
|
68632
68670
|
logFn("\n Blocking (cdkd deploy will refuse):");
|
|
@@ -73056,6 +73094,10 @@ const UNCOMPARED_REASONS = {
|
|
|
73056
73094
|
kind: "unknown",
|
|
73057
73095
|
phrase: "not compared AT ALL: the read or comparison failed"
|
|
73058
73096
|
},
|
|
73097
|
+
unreadableRecord: {
|
|
73098
|
+
kind: "unknown",
|
|
73099
|
+
phrase: "not compared AT ALL: their state record is not readable as a resource"
|
|
73100
|
+
},
|
|
73059
73101
|
baselineRefused: {
|
|
73060
73102
|
kind: "unknown",
|
|
73061
73103
|
phrase: "not compared AT ALL: a `cdkd import` run refused to capture their observed baseline"
|
|
@@ -73078,9 +73120,36 @@ const UNCOMPARED_REASONS = {
|
|
|
73078
73120
|
}
|
|
73079
73121
|
};
|
|
73080
73122
|
/**
|
|
73123
|
+
* Was ANY of the resource's properties compared?
|
|
73124
|
+
*
|
|
73125
|
+
* A THIRD exhaustive record beside {@link notComparedReason}'s and
|
|
73126
|
+
* {@link UNCOMPARED_REASONS}, and it exists because this question was answered
|
|
73127
|
+
* THREE times by a hand-written `readFailed` / `baselineRefused` cause list —
|
|
73128
|
+
* the summary parenthetical and the block heading, and `--json`'s
|
|
73129
|
+
* `referencesUnresolved`. Hand lists of one growing union are how a new cause
|
|
73130
|
+
* comes to be described as something it is not, which is exactly what those
|
|
73131
|
+
* sites' own comments say happened when `baselineRefused` was added.
|
|
73132
|
+
* go-to-k/cdkd#3018 added a further cause and every list was silently wrong
|
|
73133
|
+
* again, reporting an unreadable record as "only PARTIALLY compared" and as
|
|
73134
|
+
* `referencesUnresolved: true` — understating it in the reassuring direction,
|
|
73135
|
+
* the one failure mode the comments name. All three readers take this record.
|
|
73136
|
+
*
|
|
73137
|
+
* `false` means none of it was compared. It is a SEPARATE axis from
|
|
73138
|
+
* {@link UncomparedKind}, which asks whether cdkd is uncertain or simply does
|
|
73139
|
+
* not cover the type; a `skipped` resource is `byDesign` and also had nothing
|
|
73140
|
+
* compared, and collapsing the two would make one of the answers wrong.
|
|
73141
|
+
*/
|
|
73142
|
+
const ANY_OF_IT_COMPARED = {
|
|
73143
|
+
refused: true,
|
|
73144
|
+
unresolvedToken: true,
|
|
73145
|
+
readFailed: false,
|
|
73146
|
+
baselineRefused: false,
|
|
73147
|
+
unreadableRecord: false
|
|
73148
|
+
};
|
|
73149
|
+
/**
|
|
73081
73150
|
* The sentence lead each {@link UncomparedKind} group is reported under.
|
|
73082
73151
|
*
|
|
73083
|
-
* Exhaustive for the same reason
|
|
73152
|
+
* Exhaustive for the same reason `UNCOMPARED_REASONS` is, and SEPARATE from it
|
|
73084
73153
|
* because the lead is per GROUP while the phrase is per reason: writing the
|
|
73085
73154
|
* claim into each phrase would put five copies of two sentences in the file,
|
|
73086
73155
|
* and five copies is how two of them come to disagree.
|
|
@@ -73254,7 +73323,7 @@ async function driftCommand(stacks, options) {
|
|
|
73254
73323
|
const reports = [];
|
|
73255
73324
|
for (const ref of targetRefs) {
|
|
73256
73325
|
if (!ref.region) throw new Error(`Stack '${ref.stackName}' has only a legacy state record without a region. Run 'cdkd deploy ${ref.stackName}' (or any cdkd write) to migrate it to the region-scoped layout, then re-run drift detection.`);
|
|
73257
|
-
const report = await runDriftForStack(ref.stackName, ref.region, stateBackend, providerRegistry, ccApiFallback, resolvePrincipalUniqueId);
|
|
73326
|
+
const report = await runDriftForStack(ref.stackName, ref.region, stateBackend, providerRegistry, ccApiFallback, resolvePrincipalUniqueId, options.accept || options.revert ? "refuse" : "repair");
|
|
73258
73327
|
reports.push(report);
|
|
73259
73328
|
}
|
|
73260
73329
|
if (options.json) writeJsonReport(reports);
|
|
@@ -73606,6 +73675,7 @@ function notComparedReason(cause) {
|
|
|
73606
73675
|
refused: "cdkd refused to resolve a dynamic reference its state records (spell the reference as a full ARN, which names its region)",
|
|
73607
73676
|
unresolvedToken: "its state records a `{{resolve:...}}` spelling cdkd resolves for nobody (permanent; a re-run cannot clear it)",
|
|
73608
73677
|
readFailed: "the read or comparison threw, so NONE of its properties were compared",
|
|
73678
|
+
unreadableRecord: "its state record is not readable as a resource — not an object, or carrying no resource type — so there was nothing to compare (repair or re-import the record)",
|
|
73609
73679
|
baselineRefused: "a `cdkd import` run refused to capture its observed baseline, so the only baseline available is the recorded properties that refusal already found untrustworthy (deploy a change to this resource to restore one)"
|
|
73610
73680
|
}[cause];
|
|
73611
73681
|
}
|
|
@@ -73959,13 +74029,37 @@ function redactDriftChanges(changes, secrets, secretPaths, maskPaths) {
|
|
|
73959
74029
|
* `--revert` can pass the captured AWS-current snapshot to
|
|
73960
74030
|
* `provider.update` as the `previousProperties` argument.
|
|
73961
74031
|
*/
|
|
73962
|
-
async function runDriftForStack(stackName, region, stateBackend, providerRegistry, ccApiFallback, resolvePrincipalUniqueId) {
|
|
74032
|
+
async function runDriftForStack(stackName, region, stateBackend, providerRegistry, ccApiFallback, resolvePrincipalUniqueId, malformedRecordMode) {
|
|
73963
74033
|
const result = await stateBackend.getState(stackName, region);
|
|
73964
74034
|
if (!result) throw new Error(`No state found for stack '${stackName}' (${region}). Run 'cdkd state list' to see available stacks.`);
|
|
73965
74035
|
return await withStackName(stackName, async () => {
|
|
73966
74036
|
const outcomes = [];
|
|
73967
74037
|
const state = result.state;
|
|
73968
74038
|
const logger = getLogger();
|
|
74039
|
+
if (malformedRecordMode === "refuse") {
|
|
74040
|
+
refuseMalformedState(state, stackName, region);
|
|
74041
|
+
refuseMalformedResourceEntries(state, stackName, region);
|
|
74042
|
+
} else {
|
|
74043
|
+
if (repairMalformedResourcesForReadOnly(state)) {
|
|
74044
|
+
logger.warn(malformedResourcesWarning(stackName, region));
|
|
74045
|
+
outcomes.push({
|
|
74046
|
+
kind: "notCompared",
|
|
74047
|
+
logicalId: UNREADABLE_RESOURCES_MAP_ROW,
|
|
74048
|
+
resourceType: "unreadable record",
|
|
74049
|
+
notComparedCause: "unreadableRecord"
|
|
74050
|
+
});
|
|
74051
|
+
}
|
|
74052
|
+
const dropped = repairMalformedResourceEntriesForReadOnly(state);
|
|
74053
|
+
if (dropped.length > 0) {
|
|
74054
|
+
logger.warn(malformedResourceEntriesWarning(stackName, region, dropped));
|
|
74055
|
+
for (const logicalId of dropped) outcomes.push({
|
|
74056
|
+
kind: "notCompared",
|
|
74057
|
+
logicalId,
|
|
74058
|
+
resourceType: "unreadable record",
|
|
74059
|
+
notComparedCause: "unreadableRecord"
|
|
74060
|
+
});
|
|
74061
|
+
}
|
|
74062
|
+
}
|
|
73969
74063
|
const secretResolvers = new DriftSecretResolvers(region);
|
|
73970
74064
|
const producerRegions = producerRegionsFromState(state);
|
|
73971
74065
|
const entries = Object.entries(state.resources ?? {}).sort(([a], [b]) => a.localeCompare(b));
|
|
@@ -74198,6 +74292,7 @@ function buildReadCurrentStateContext(state, excludedLogicalId) {
|
|
|
74198
74292
|
const siblings = {};
|
|
74199
74293
|
for (const [lid, res] of Object.entries(state.resources ?? {})) {
|
|
74200
74294
|
if (lid === excludedLogicalId) continue;
|
|
74295
|
+
if (!isReadableResourceEntry(res)) continue;
|
|
74201
74296
|
siblings[lid] = {
|
|
74202
74297
|
resourceType: res.resourceType,
|
|
74203
74298
|
physicalId: res.physicalId,
|
|
@@ -75819,7 +75914,7 @@ function writeJsonReport(reports) {
|
|
|
75819
75914
|
const notCompared = notComparedOutcomes(r).map(({ outcome, cause }) => ({
|
|
75820
75915
|
logicalId: outcome.logicalId,
|
|
75821
75916
|
type: outcome.resourceType,
|
|
75822
|
-
referencesUnresolved: cause
|
|
75917
|
+
referencesUnresolved: ANY_OF_IT_COMPARED[cause],
|
|
75823
75918
|
cause
|
|
75824
75919
|
}));
|
|
75825
75920
|
return {
|
|
@@ -75864,7 +75959,7 @@ function writeHumanReport(reports) {
|
|
|
75864
75959
|
const checked = inspected - notCompared.length;
|
|
75865
75960
|
if (drifted.length === 0) {
|
|
75866
75961
|
if (notCompared.length === 0 && checked === 0 && report.outcomes.length > 0) process.stdout.write(`⚠ ${report.stackName} (${report.region}): no drift detected, but NOTHING was compared — 0 of ${report.outcomes.length} resource${report.outcomes.length === 1 ? "" : "s"} checked (${unsupported.length} unsupported, ${skippedCount} skipped)\n`);
|
|
75867
|
-
else if (notCompared.length > 0) process.stdout.write(`⚠ ${report.stackName} (${report.region}): no drift detected, but ${checked} of ${inspected} resource${inspected === 1 ? "" : "s"} fully checked ` + (notCompared.some((n) => n.cause
|
|
75962
|
+
else if (notCompared.length > 0) process.stdout.write(`⚠ ${report.stackName} (${report.region}): no drift detected, but ${checked} of ${inspected} resource${inspected === 1 ? "" : "s"} fully checked ` + (notCompared.some((n) => !ANY_OF_IT_COMPARED[n.cause]) ? `(${notCompared.length} not fully compared), ` : `(${notCompared.length} only partially compared), `) + `${unsupported.length} unsupported\n`);
|
|
75868
75963
|
else process.stdout.write(`✓ ${report.stackName} (${report.region}): no drift detected (${checked} resource${checked === 1 ? "" : "s"} checked, ${unsupported.length} unsupported)\n`);
|
|
75869
75964
|
} else {
|
|
75870
75965
|
const word = drifted.length === 1 ? "resource" : "resources";
|
|
@@ -75879,11 +75974,9 @@ function writeHumanReport(reports) {
|
|
|
75879
75974
|
}
|
|
75880
75975
|
}
|
|
75881
75976
|
if (notCompared.length > 0) {
|
|
75882
|
-
const notComparedAtAll = notCompared.filter((n) => n.cause
|
|
75883
|
-
const readFailedCount = notCompared.filter((n) => n.cause === "readFailed").length;
|
|
75884
|
-
const baselineRefusedCount = notCompared.filter((n) => n.cause === "baselineRefused").length;
|
|
75977
|
+
const notComparedAtAll = notCompared.filter((n) => !ANY_OF_IT_COMPARED[n.cause]).length;
|
|
75885
75978
|
const referenceCaused = notCompared.length - notComparedAtAll;
|
|
75886
|
-
const atAllCause =
|
|
75979
|
+
const atAllCause = Object.keys(UNCOMPARED_REASONS).filter((cause) => cause in ANY_OF_IT_COMPARED).filter((cause) => !ANY_OF_IT_COMPARED[cause] && notCompared.some((n) => n.cause === cause)).map((cause) => UNCOMPARED_REASONS[cause].phrase.replace(/^not compared AT ALL: /, "")).join("; ");
|
|
75887
75980
|
process.stdout.write(notComparedAtAll === 0 ? `\n ${notCompared.length} resource(s) only PARTIALLY compared — cdkd could not, or refused to, resolve a dynamic reference their state records, so their secret-bearing properties were NOT compared:\n` : `\n ${notCompared.length} resource(s) NOT fully compared — ${notComparedAtAll} not compared AT ALL (${atAllCause})` + (referenceCaused > 0 ? `, ${referenceCaused} only PARTIALLY compared (a dynamic reference cdkd could not, or refused to, resolve)` : "") + `:\n`);
|
|
75888
75981
|
for (const { outcome, cause } of notCompared) process.stdout.write(` ! ${outcome.logicalId} (${outcome.resourceType}) — ${notComparedReason(cause)}\n`);
|
|
75889
75982
|
}
|
|
@@ -78073,7 +78166,10 @@ async function exportCommand(stackArg, options) {
|
|
|
78073
78166
|
try {
|
|
78074
78167
|
if (nestedStackRows.length > 0) {
|
|
78075
78168
|
const nestedStackTree = await buildCdkdStateStackTree(resolvedStackName, targetRegion, stateBackend, state);
|
|
78076
|
-
reportDriftBaselineGaps(state, logger
|
|
78169
|
+
reportDriftBaselineGaps(state, logger, {
|
|
78170
|
+
stackName: resolvedStackName,
|
|
78171
|
+
region: migrationPending ? void 0 : targetRegion
|
|
78172
|
+
});
|
|
78077
78173
|
if (allSynthStacks.length > 0) {
|
|
78078
78174
|
const crossRefs = scanCrossStackReferences(allSynthStacks, resolvedStackName);
|
|
78079
78175
|
if (crossRefs.length > 0) {
|
|
@@ -78161,7 +78257,10 @@ async function exportCommand(stackArg, options) {
|
|
|
78161
78257
|
return;
|
|
78162
78258
|
}
|
|
78163
78259
|
}
|
|
78164
|
-
reportDriftBaselineGaps(state, logger
|
|
78260
|
+
reportDriftBaselineGaps(state, logger, {
|
|
78261
|
+
stackName: resolvedStackName,
|
|
78262
|
+
region: migrationPending ? void 0 : targetRegion
|
|
78263
|
+
});
|
|
78165
78264
|
if (allSynthStacks.length > 0) {
|
|
78166
78265
|
const crossRefs = scanCrossStackReferences(allSynthStacks, resolvedStackName);
|
|
78167
78266
|
if (crossRefs.length > 0) {
|
|
@@ -79360,17 +79459,49 @@ function classifyOverlayCurrentValue(current) {
|
|
|
79360
79459
|
return "literal";
|
|
79361
79460
|
}
|
|
79362
79461
|
/**
|
|
79462
|
+
* How much of an overlay value's JSON this function is willing to quote back.
|
|
79463
|
+
*
|
|
79464
|
+
* CODE POINTS, not UTF-16 code units — see {@link boundedOverlayPreview}. The
|
|
79465
|
+
* number is the pre-go-to-k/cdkd#3018 one, kept so no in-range message moves.
|
|
79466
|
+
*/
|
|
79467
|
+
const OVERLAY_PREVIEW_MAX_CODE_POINTS = 120;
|
|
79468
|
+
/**
|
|
79469
|
+
* `JSON.stringify(value)`, cut to {@link OVERLAY_PREVIEW_MAX_CODE_POINTS} code
|
|
79470
|
+
* points through the shared helper rather than by `slice` (go-to-k/cdkd#3018).
|
|
79471
|
+
*
|
|
79472
|
+
* `String.prototype.slice` counts UTF-16 code units, so a cut landing between
|
|
79473
|
+
* the halves of an astral character leaves a LONE HIGH SURROGATE at the end of
|
|
79474
|
+
* the preview — `JSON.stringify` emits an astral character as the raw pair
|
|
79475
|
+
* rather than as two `\u` escapes, so the pair really is what gets cut.
|
|
79476
|
+
* `truncateCodePoints` in `src/utils/display-safe.ts` owns that rule, and this
|
|
79477
|
+
* is the site go-to-k/cdkd#3018 was opened over. Other `slice`-based display
|
|
79478
|
+
* truncations remain elsewhere (`src/local/websocket-server.ts`,
|
|
79479
|
+
* `src/local/rest-v1-integrations.ts` among them); closing this one is not a
|
|
79480
|
+
* claim about them.
|
|
79481
|
+
*
|
|
79482
|
+
* Deliberately NOT applied to the SCALAR branch below, which is the arm that
|
|
79483
|
+
* cannot exceed the cap: tracing the two call sites, it is reachable only with
|
|
79484
|
+
* a NUMBER or a BOOLEAN. A string `current` never reaches the rewrite warning
|
|
79485
|
+
* (`typeof current !== 'string'` gates it) and never reaches the refusal (only
|
|
79486
|
+
* a list classifies `unrepresentable`), and a number arriving from a parsed
|
|
79487
|
+
* template is a double, so its JSON is a couple of dozen characters. Capping it
|
|
79488
|
+
* anyway would be behaviour no test can distinguish from not capping it, which
|
|
79489
|
+
* is worse than the asymmetry: it reads as a guard while pinning nothing.
|
|
79490
|
+
*/
|
|
79491
|
+
function boundedOverlayPreview(value) {
|
|
79492
|
+
const { text, truncated } = truncateCodePoints(displaySafe(JSON.stringify(value)), OVERLAY_PREVIEW_MAX_CODE_POINTS);
|
|
79493
|
+
return truncated ? `${text}…` : text;
|
|
79494
|
+
}
|
|
79495
|
+
/**
|
|
79363
79496
|
* Human-readable shape of an overlay value, for the refusal error and the
|
|
79364
79497
|
* rewrite warning. Bounded: the value is user-supplied and lands in an error
|
|
79365
|
-
* message that a failed export persists, so a large
|
|
79498
|
+
* message that a failed export persists, so a large value is summarized rather
|
|
79366
79499
|
* than serialized whole.
|
|
79367
79500
|
*/
|
|
79368
79501
|
function describeOverlayValueShape(current) {
|
|
79369
79502
|
if (Array.isArray(current)) {
|
|
79370
79503
|
if (current.length === 0) return "an empty list";
|
|
79371
|
-
|
|
79372
|
-
const shown = preview.length > 120 ? `${preview.slice(0, 120)}…` : preview;
|
|
79373
|
-
return `a ${current.length}-element list (${shown})`;
|
|
79504
|
+
return `a ${current.length}-element list (${boundedOverlayPreview(current)})`;
|
|
79374
79505
|
}
|
|
79375
79506
|
if (current === null) return "an explicit null";
|
|
79376
79507
|
return `a ${typeof current} (${JSON.stringify(current)})`;
|
|
@@ -79415,10 +79546,18 @@ function applyImportOverlayForPhase2(template, phase1Imports) {
|
|
|
79415
79546
|
return result;
|
|
79416
79547
|
}
|
|
79417
79548
|
/**
|
|
79418
|
-
*
|
|
79419
|
-
*
|
|
79420
|
-
*
|
|
79549
|
+
* How many logical ids each of this advice's three lists names before it stops
|
|
79550
|
+
* and counts the rest.
|
|
79551
|
+
*
|
|
79552
|
+
* ONE constant for all three because they are one decision — how long a warning
|
|
79553
|
+
* block may get before it stops being read — and three hand-spelled `10`s are
|
|
79554
|
+
* how two of them end up disagreeing after a later edit. Its siblings are
|
|
79555
|
+
* `UNREADABLE_PREVIEW_NAMES` in `diff-recursive.ts` (the `cdkd diff` preview)
|
|
79556
|
+
* and `NAMED_UNREADABLE_ENTRIES` in the shared module (the refusal texts);
|
|
79557
|
+
* deliberately not shared with either, since a list inside one warning line and
|
|
79558
|
+
* a block of indented rows do not have the same budget.
|
|
79421
79559
|
*/
|
|
79560
|
+
const NAMED_BASELINE_IDS = 10;
|
|
79422
79561
|
/**
|
|
79423
79562
|
* Pre-flight check for missing drift baselines (`observedProperties`)
|
|
79424
79563
|
* in the exporting stack's state. cdkd state schema v3 captures
|
|
@@ -79437,26 +79576,46 @@ function applyImportOverlayForPhase2(template, phase1Imports) {
|
|
|
79437
79576
|
*
|
|
79438
79577
|
* Exported for unit testing.
|
|
79439
79578
|
*/
|
|
79440
|
-
function reportDriftBaselineGaps(state, logger) {
|
|
79441
|
-
const
|
|
79579
|
+
function reportDriftBaselineGaps(state, logger, loaded) {
|
|
79580
|
+
const stackName = loaded?.stackName ?? state.stackName;
|
|
79581
|
+
const rawRegion = loaded ? loaded.region : state.region;
|
|
79582
|
+
const region = typeof rawRegion === "string" && rawRegion !== "" ? rawRegion : void 0;
|
|
79583
|
+
if (!hasReadableResources(state)) {
|
|
79584
|
+
logger.warn(malformedResourcesWarning(stackName, region));
|
|
79585
|
+
return;
|
|
79586
|
+
}
|
|
79587
|
+
const entries = Object.entries(state.resources);
|
|
79442
79588
|
if (entries.length === 0) return;
|
|
79443
|
-
const
|
|
79589
|
+
const stackRef = shellQuote(safeStackName(stackName)) + (region !== void 0 ? ` --stack-region ${shellQuote(safeRegion(region))}` : "");
|
|
79590
|
+
const rendersExactly = region !== void 0 && safeStackName(stackName) === stackName && safeRegion(region) === region;
|
|
79591
|
+
const readsAsAnOption = /^-/.test(stackName);
|
|
79592
|
+
const refreshCommand = rendersExactly && !readsAsAnOption ? `cdkd state refresh-observed ${stackRef}` : void 0;
|
|
79593
|
+
const refreshWithheld = region === void 0 ? "'cdkd state refresh-observed' for this stack once it is migrated: this record has no region, the legacy layout that command refuses, so migrate it first with any cdkd write, such as a deploy." : rendersExactly ? "'cdkd state refresh-observed' for this stack. The command is not printed: this stack's name starts with '-', which the CLI reads as an option however it is quoted, and '--all' would rewrite every record in the region rather than this one." : "'cdkd state refresh-observed' for this stack. The command is not printed: the stack name or region cdkd loaded cannot be rendered exactly, and a near-match could rewrite a different stack's baseline.";
|
|
79594
|
+
const readable = entries.filter((entry) => isReadableResourceEntry(entry[1]));
|
|
79595
|
+
const unreadableCount = entries.length - readable.length;
|
|
79596
|
+
if (unreadableCount > 0) {
|
|
79597
|
+
const unreadable = entries.filter(([, r]) => !isReadableResourceEntry(r)).map(([logicalId]) => logicalId);
|
|
79598
|
+
logger.warn(`${unreadable.length} of ${entries.length} resource(s) in cdkd state have a record that is not readable as a resource — not an object, or carrying no resource type — so their drift baseline cannot be reported on. The state record is malformed or truncated. Inspect it with: cdkd state show ${stackRef} --json`);
|
|
79599
|
+
for (const logicalId of unreadable.slice(0, NAMED_BASELINE_IDS)) logger.warn(` ${displayLogicalId(logicalId)}`);
|
|
79600
|
+
if (unreadable.length > NAMED_BASELINE_IDS) logger.warn(` ... and ${unreadable.length - NAMED_BASELINE_IDS} more`);
|
|
79601
|
+
}
|
|
79602
|
+
const missing = readable.filter(([, r]) => r.observedProperties === void 0);
|
|
79444
79603
|
if (missing.length === 0) return;
|
|
79445
79604
|
if (state.version !== void 0 && state.version < 3) {
|
|
79446
|
-
logger.warn(`cdkd state schema is v${state.version} (pre-observedProperties). cdkd drift cannot reliably compare against AWS for this stack; the next
|
|
79605
|
+
logger.warn(`cdkd state schema is v${state.version} (pre-observedProperties). cdkd drift cannot reliably compare against AWS for this stack; the next 'cdk deploy' after migration may surface spurious changes if AWS has drifted from the ` + (unreadableCount > 0 ? `template. Repair the ${unreadableCount} unreadable record(s) named above first — 'cdkd state refresh-observed' refuses a record that holds one — then capture an AWS-current baseline before export.` : `template. Capture an AWS-current baseline before export — any redeploy does ` + (refreshCommand !== void 0 ? `it, or run: ${refreshCommand}` : `it, or run ${refreshWithheld}`)));
|
|
79447
79606
|
return;
|
|
79448
79607
|
}
|
|
79449
79608
|
const refused = missing.filter(([, r]) => r.observedBaselineRefused === true);
|
|
79450
79609
|
const refreshable = missing.filter(([, r]) => r.observedBaselineRefused !== true);
|
|
79451
79610
|
if (refreshable.length > 0) {
|
|
79452
|
-
logger.warn(`${refreshable.length} of ${entries.length} resource(s) in cdkd state lack an AWS-current baseline (observedProperties). cdkd drift may produce false positives for them; the next
|
|
79453
|
-
for (const [logicalId] of refreshable.slice(0,
|
|
79454
|
-
if (refreshable.length >
|
|
79611
|
+
logger.warn(`${refreshable.length} of ${entries.length} resource(s) in cdkd state lack an AWS-current baseline (observedProperties). cdkd drift may produce false positives for them; the next 'cdk deploy' after migration may surface unexpected changes. ` + (unreadableCount > 0 ? `Repair the ${unreadableCount} unreadable record(s) named above first — 'cdkd state refresh-observed' refuses a record that holds one. Then capture a baseline and run 'cdkd drift' to verify the stack matches AWS.` : refreshCommand !== void 0 ? `Capture a baseline before export, then run 'cdkd drift' to verify the stack matches AWS, with: ${refreshCommand}` : `Capture a baseline before export with ${refreshWithheld} Then run 'cdkd drift' to verify the stack matches AWS.`));
|
|
79612
|
+
for (const [logicalId] of refreshable.slice(0, NAMED_BASELINE_IDS)) logger.warn(` ${displayLogicalId(logicalId)}`);
|
|
79613
|
+
if (refreshable.length > NAMED_BASELINE_IDS) logger.warn(` ... and ${refreshable.length - NAMED_BASELINE_IDS} more`);
|
|
79455
79614
|
}
|
|
79456
79615
|
if (refused.length > 0) {
|
|
79457
79616
|
logger.warn(`${refused.length} of ${entries.length} resource(s) had their baseline REFUSED by a \`cdkd import\` run, because their recorded properties can no longer position the secret redaction. \`cdkd state refresh-observed\` will decline them too — capturing a readback against those properties could persist a resolved secret into state.json in plaintext. Deploy a change to each one to restore its baseline.`);
|
|
79458
|
-
for (const [logicalId] of refused.slice(0,
|
|
79459
|
-
if (refused.length >
|
|
79617
|
+
for (const [logicalId] of refused.slice(0, NAMED_BASELINE_IDS)) logger.warn(` ${displayLogicalId(logicalId)}`);
|
|
79618
|
+
if (refused.length > NAMED_BASELINE_IDS) logger.warn(` ... and ${refused.length - NAMED_BASELINE_IDS} more`);
|
|
79460
79619
|
}
|
|
79461
79620
|
}
|
|
79462
79621
|
/**
|
|
@@ -82247,6 +82406,16 @@ async function stateRefreshObservedCommand(stackArgs, options) {
|
|
|
82247
82406
|
}
|
|
82248
82407
|
}
|
|
82249
82408
|
}
|
|
82409
|
+
const regionScoped = targets.flatMap((target) => target.region ? [{
|
|
82410
|
+
stackName: target.stackName,
|
|
82411
|
+
region: target.region
|
|
82412
|
+
}] : []);
|
|
82413
|
+
if (regionScoped.length > 1) for (const target of regionScoped) {
|
|
82414
|
+
const loaded = await setup.stateBackend.getState(target.stackName, target.region);
|
|
82415
|
+
if (!loaded) continue;
|
|
82416
|
+
refuseMalformedState(loaded.state, target.stackName, target.region);
|
|
82417
|
+
refuseMalformedResourceEntries(loaded.state, target.stackName, target.region);
|
|
82418
|
+
}
|
|
82250
82419
|
if (!options.yes && !options.dryRun) {
|
|
82251
82420
|
const targetList = targets.map(formatStackRefSafe).join(", ");
|
|
82252
82421
|
if (!await confirmRefresh(`Refresh observedProperties for ${targets.length} stack(s) (${targetList})?`)) {
|
|
@@ -82254,12 +82423,16 @@ async function stateRefreshObservedCommand(stackArgs, options) {
|
|
|
82254
82423
|
return;
|
|
82255
82424
|
}
|
|
82256
82425
|
}
|
|
82426
|
+
for (const target of targets) if (!target.region) {
|
|
82427
|
+
const stack = shellQuote(safeStackName(target.stackName));
|
|
82428
|
+
const example = safeStackName(target.stackName) === target.stackName && !/^-|[*/]/.test(target.stackName) ? ` For example: cdkd deploy ${stack}` : "";
|
|
82429
|
+
throw new Error(`Stack ${stack} has only a legacy state record without a region. Migrate it to the region-scoped layout with any cdkd write, then re-run refresh-observed.` + example);
|
|
82430
|
+
}
|
|
82257
82431
|
let totalRefreshed = 0;
|
|
82258
82432
|
let totalUnsupported = 0;
|
|
82259
82433
|
let totalFailed = 0;
|
|
82260
82434
|
let totalRefusedBaseline = 0;
|
|
82261
|
-
for (const target of
|
|
82262
|
-
if (!target.region) throw new Error(`Stack '${target.stackName}' has only a legacy state record without a region. Run 'cdkd deploy ${target.stackName}' (or any cdkd write) first to migrate it to the region-scoped layout, then re-run refresh-observed.`);
|
|
82435
|
+
for (const target of regionScoped) {
|
|
82263
82436
|
const counts = await refreshObservedForStack(target.stackName, target.region, setup.stateBackend, setup.lockManager, providerRegistry, {
|
|
82264
82437
|
dryRun: options.dryRun ?? false,
|
|
82265
82438
|
logger,
|
|
@@ -82337,7 +82510,9 @@ async function refreshObservedForStack(stackName, region, stateBackend, lockMana
|
|
|
82337
82510
|
const result = await stateBackend.getState(stackName, region);
|
|
82338
82511
|
if (!result) throw new Error(`No state found for stack '${stackName}' (${region}). Run 'cdkd state list' to see available stacks.`);
|
|
82339
82512
|
const { state, etag, migrationPending } = result;
|
|
82340
|
-
|
|
82513
|
+
refuseMalformedState(state, stackName, region);
|
|
82514
|
+
refuseMalformedResourceEntries(state, stackName, region);
|
|
82515
|
+
const entries = Object.entries(state.resources);
|
|
82341
82516
|
if (entries.length === 0) {
|
|
82342
82517
|
logger.info(`✓ ${stackName} (${region}): no resources in state, skipping`);
|
|
82343
82518
|
return {
|
|
@@ -97023,4 +97198,4 @@ function buildProgram() {
|
|
|
97023
97198
|
|
|
97024
97199
|
//#endregion
|
|
97025
97200
|
export { buildProgram };
|
|
97026
|
-
//# sourceMappingURL=program-
|
|
97201
|
+
//# sourceMappingURL=program-BC_cHG7r.js.map
|