@go-to-k/cdkd 0.299.8 → 0.300.1

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.
Files changed (31) hide show
  1. package/dist/{asg-provider-ebjf5E8o.js → asg-provider-BS5i71bK.js} +3 -3
  2. package/dist/{asg-provider-ebjf5E8o.js.map → asg-provider-BS5i71bK.js.map} +1 -1
  3. package/dist/{aws-clients-Bj7qH5Ph.js → aws-clients-B_CEQGE1.js} +21 -1
  4. package/dist/aws-clients-B_CEQGE1.js.map +1 -0
  5. package/dist/cli.js +2 -2
  6. package/dist/{deploy-engine-BU3iY59A.js → deploy-engine-BK4gG_5A.js} +734 -80
  7. package/dist/deploy-engine-BK4gG_5A.js.map +1 -0
  8. package/dist/{iam-policy-targets-dAY3-gXJ.js → iam-policy-targets-DAs3w7QW.js} +47 -6
  9. package/dist/{iam-policy-targets-dAY3-gXJ.js.map → iam-policy-targets-DAs3w7QW.js.map} +1 -1
  10. package/dist/{iam-role-provider-C8O3q2ua.js → iam-role-provider-SmvPHPLC.js} +16 -11
  11. package/dist/iam-role-provider-SmvPHPLC.js.map +1 -0
  12. package/dist/index.d.ts +10 -0
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +4 -4
  15. package/dist/{neptune-provider-CuJF3t-Q.js → neptune-provider-CqZ1FaqT.js} +3 -3
  16. package/dist/{neptune-provider-CuJF3t-Q.js.map → neptune-provider-CqZ1FaqT.js.map} +1 -1
  17. package/dist/{program-C87Q8YFK.js → program-DVPHKsxv.js} +668 -512
  18. package/dist/program-DVPHKsxv.js.map +1 -0
  19. package/dist/{provider-classes-DmohfhIq.js → provider-classes-CDzT2xg0.js} +1433 -158
  20. package/dist/provider-classes-CDzT2xg0.js.map +1 -0
  21. package/dist/{rds-provider-Br3hPyHP.js → rds-provider-DraxDuQq.js} +13 -7
  22. package/dist/rds-provider-DraxDuQq.js.map +1 -0
  23. package/dist/{version-BtTEjOpj.js → version-DTSDiQcV.js} +2 -2
  24. package/dist/{version-BtTEjOpj.js.map → version-DTSDiQcV.js.map} +1 -1
  25. package/package.json +3 -1
  26. package/dist/aws-clients-Bj7qH5Ph.js.map +0 -1
  27. package/dist/deploy-engine-BU3iY59A.js.map +0 -1
  28. package/dist/iam-role-provider-C8O3q2ua.js.map +0 -1
  29. package/dist/program-C87Q8YFK.js.map +0 -1
  30. package/dist/provider-classes-DmohfhIq.js.map +0 -1
  31. package/dist/rds-provider-Br3hPyHP.js.map +0 -1
@@ -1,9 +1,9 @@
1
- import { a as runWithStackAwsClients, i as resetAwsClients, o as setAwsClients, t as AwsClients } from "./aws-clients-Bj7qH5Ph.js";
1
+ import { a as runWithStackAwsClients, i as resetAwsClients, o as setAwsClients, t as AwsClients } from "./aws-clients-B_CEQGE1.js";
2
2
  import { A as UNRENDERABLE, B as safeMsg, D as SAFE_MSG_ALTERED_CHAR, F as displaySafe, I as displayStackName, L as isPasteableIdent, M as cutMarker, N as displayAwsMessage, O as SECRET_REF_MAX_CODE_POINTS, P as displayIdent, T as withStackName, U as truncateCodePoints, V as stringifyJsonPayload, _ as derivesPatternBName, a as getLogger, f as getLiveRenderer, h as PATTERN_B_RESOURCE_TYPES, k as STACK_REF_MAX_CODE_POINTS, l as runStackBuffered, m as PATTERN_B_NAME_PROPERTIES, o as isStdoutReservedForPayload, p as PATTERN_B_NAME_OPTIONS, r as safeStringify, s as reserveStdoutForPayload, t as describeAwsFailure, v as explicitNamePropertyFor, w as withSkipPrefix, y as generateResourceName, z as plainIdentOr } from "./aws-failure-text-BEQfs6za.js";
3
- import { $n as isAmbiguousOutcomeError, $t as credentialFingerprint, Bn as withheldTargetClause, D as VALUE_NOT_SHOWN, Dn as TIMEOUT_FLAG_RESOURCE_TYPE, E as assertRegionMatch, En as withErrorHandling, Ft as buildLockContentionMessage, G as runDeleteAttempt, Hn as setPasteableVerbFlags, Ht as CUSTOM_RESOURCE_RESPONSE_PREFIX, In as plainOrDescribed, It as forceQuitRecoveryClause, Jt as setPasteableAwsProfile, Kt as producerCoordinateKey, Ln as quotedOrDescribed, Lt as formatLockExpiry, Nn as isInertUnquoted, Nt as UNREPRODUCIBLE_LOCK_CLAUSE, P as remedyLogicalId, Pn as pasteableCommand, Pt as buildForceUnlockCommand, Qt as clientDefaultsFor, Rn as shellBoundedDisplay, Rt as formatLockOperation, Sn as SynthesisError, T as RESOURCE_NOT_FOUND, Tn as normalizeAwsError, Ut as DEFAULT_STATE_PREFIX, Vn as setPasteableRunFlags, Wt as injectiveKey, Xt as ambientClientDefaults, Yt as withPasteableAwsProfile, Z as isAwsCliLiteral, Zt as ambientCredentialConfig, _n as ResourceTimeoutError, ar as isMarkedNonRetryable, bn as StackTerminationProtectionError, cn as IntrinsicResolutionRefusalError, en as AccountIdUnavailableError, ft as logicalIdShown, gn as ProvisioningError, hn as PartialFailureError, in as CrossAccountSecretRefusalError, it as isInterruptedWaitError, jn as commandHole, kn as SHELL_ACTIVE_WHY, ln as LocalInvokeBuildError$1, mn as NestedStackChildDirectDestroyError, mt as resourceTypeShown, n as RESOLVED_PREVIOUS_PRINCIPAL_KEYS, nn as CdkdError, nr as isTransientServerError, nt as endCommandInterruptScope, on as DeployCancelledError, or as isThrottlingError, pn as MalformedProducerRecordRefusalError, qt as producerRecordKey, rr as retryClassificationText, rt as interruptWatchListenerCount, s as readRecordedPrincipals, sn as DynamicReferenceRegionAmbiguousError, sr as markNonRetryable, t as IAM_PRINCIPAL_NAME, tr as isRetryableTransientError, tt as beginCommandInterruptScope, un as LocalStartServiceError, vn as ResourceUpdateNotSupportedError, xn as StateError, yn as StackHasActiveImportsError, zn as shellQuote, zt as formatLockOwner } from "./iam-policy-targets-dAY3-gXJ.js";
4
- import { a as setAssumedRoleCredentials, n as awsClientDefaults, r as getAssumedRoleCredentials, u as formatAuthority } from "./aws-client-defaults-DBXBcg0J.js";
5
- import { $a as unwrittenCreateOnlyReplacement, $c as getLegacyStateBucketName, $i as malformedExportSourceWarning, $n as formatDestructiveChange, $o as recordLogOnlyParameterValue, $r as explicitRoleArnOrThrow, $s as hasReadableExportSet, $t as replacementNeverSwapped, A as diffSecurity, Aa as refuseMalformedResourceEntriesForImport, Ac as describeDockerExecFailure, Ai as cfnRefValueFromPhysicalId, Al as absoluteAssemblyPathEscape, An as DEFAULT_RESOURCE_WARN_AFTER_MS, Ar as RollbackInlinePolicyWriters, As as recordNoEchoParameterFreshValue, At as withNestedStackContext, B as readProtection, Ba as refuseMalformedState, Bc as redactedCause, Bi as STATE_RESOURCES_MALFORMED, Bn as extractDeploymentEventError, Bo as noEchoLeavesOf, Bs as isLockInfoExpired, Ca as refuseMalformedOrphansForOrphan, Cc as readBootstrapMarkerBody, Ci as getAccountInfo, Cl as StageLoadError, Cn as isWholeDynamicReferenceValue, Cr as withPrintingSecrets, Cs as recordPhysicalNameCopy, Ct as nestedChildStackName$1, D as findServiceTokenRefusals, Da as refuseMalformedResourceEntries, Dc as buildDockerImage, Di as isNamelessDynamicReferenceError, Dl as hasPlainPrototype, Dn as isExportAliasCollision, Do as withRetry, Dr as CloudControlProvider, Ds as recordMaskOnlyValue, Dt as withNestedRevertRun, E as deferredServiceTokenWarning, Ea as refuseMalformedResourceAttributesForOrphan, Ec as buildDenyExternalAccessPolicy, Ei as carriesFetchableDynamicReference, El as hasOwnKey, En as collectPublishedOutputNames, Eo as describeTypeWithThrottleRetry, Er as customResourceResponseExpirationWarning, Es as provenPublicValue, Et as revertedNestedRowIds, F as recordedProtectionEvidence, Fa as refuseMalformedResourcePropertiesForExport, Fc as getDockerCmd, Fi as parameterInputsFor, Fl as injectAwsRegion, Fn as secretNamePrintingBag, Fo as maskAtCoordinates, Fs as STATE_SOURCED_READBACK_RULES, Ft as loadJournaledOrphans, Ga as repairMalformedResourcePropertiesForReadOnly, Gc as escapeRegExp, Gi as displayLogicalId, Gn as createPreDeleteFinalSnapshot, Go as valueAtCoordinate, Gr as INTRINSIC_KEYS, Gs as applyCrossPrefixScan, Gt as recordAfterRollbackUpdate, Ha as repairMalformedOrphansForReadOnly, Hc as runDockerForeground, Hi as UNREADABLE_RESOURCES_MAP_ROW, Hn as PRE_DELETE_SNAPSHOT_TYPES, Hs as rebuildClientForBucketRegion, I as recordedProtectionNote, Ia as refuseMalformedResourcePropertiesForOrphan, Ic as isDockerClientEnvKey, Il as injectedAwsRegionValue, In as secretNamePrintingBags, Io as maskReadbackAtCoordinates, Ir as isWaitAbandonedError, Is as TEMPLATE_SOURCED_RULES, It as makeForeignHolderScan, Ja as unreadableOrphanRecords, Jc as AssetManifestLoader, Ji as hasReadableResources, Jn as refusesFinalSnapshot, Jo as createUnionSecretMasker, Jr as producerLookupOver, Js as isNotImplemented, Jt as isReplacementOrphan, Ka as repairMalformedResourcesForReadOnly, Kc as stripControlChars, Ki as hasReadableOrphans, Kn as effectiveDeletionPolicy, Ko as liveMatchesUnresolvedTokenFrame, Kr as IntrinsicFunctionResolver, Ks as crossPrefixDeniedWarning, Kt as demoteSupersededOrphans, L as PROTECTION_PROPERTY_BY_TYPE, La as refuseMalformedResourcesForDeploy, Lc as isMalformedEnvKey, Li as declaresNoEcho, Ln as secretNamedRecordNeedles, Lo as maskWholeValue, Ls as WHOLE_DYNAMIC_REFERENCE_PATTERN, Lt as sameJournaledOrphans, M as noEchoComparisonForTemplate, Ma as refuseMalformedResourceEntriesForOrphan, Mc as dockerSpawnEnvWithSensitive, Mi as refStateLookupFromResource, Ml as displayAssemblyPath, Mn as journaledOrphanPrintingBag, Mo as TemplateParser, Mr as deleteIndeterminateGuards, Ms as wholeStringLeavesOf, Mt as dropFailedHint, N as noEchoExactEchoLeavesOf, Na as refuseMalformedResourcePropertiesForDestroy, Nc as finchSecretArgvRefusal, Nl as renderAssemblyPathEscape, Nn as maskEventTextWithBoundBags, No as canonicalCoordinates, Nr as deleteLeftInPlace, Ns as STATE_SOURCED_BASELINE_RULES, Nt as isHandledOrphan, O as serviceTokenBlockingReason, Oa as refuseMalformedResourceEntriesForDeploy, Oc as resolveDockerContextDirectory, Oi as keepsSecretReferenceToken, Ol as nullPrototypeRecord, On as bindingSkippedOutputs, Or as slowCcOperationTimeoutMs, Os as recordMaskOnlyValuesIn, Ot as collectNestedChildUnaddressed, P as noEchoParameterNamesOf, Pa as refuseMalformedResourcePropertiesForDrift, Pc as formatDockerLoginError, Pi as withSharedDrainBudget, Pl as resolveAssemblyPath, Pn as orphanRecordsPrintingBag, Po as isMarkedCoordinate, Pr as deleteSkipReason, Ps as STATE_SOURCED_CROSS_GENERATION_RULES, Pt as journaledOrphanLines, Qc as getDefaultStateBucketName, Qi as malformedExportNamesWarning, Qn as findDestructiveChanges, Qo as printingCorpusOf, Qr as assertSendableRoleArn, Qs as exportNamesCarriedFrom, Qt as recordUnderIdIsNotOwn, R as isProtectionValueActive, Ra as refuseMalformedResourcesForDestroy, Rc as partitionSensitiveEnv, Ri as JSON_LISTING_HOLE_VALUE, Rl as resolveBucketRegion, Rn as stateSecretNameNeedles, Ro as maskedLeafCoordinatesOf, Rs as isSingleDynamicReferenceToken, Rt as replayFailedOperations, Sa as refuseMalformedOrphansForDestroy, Sc as parseBootstrapMarker, Si as parameterTypeMayLoseSecretIdentity, Sl as AssemblyReader, Sn as exportNameSecretExposure, T as recordRetainedForReadoption, Ta as refuseMalformedOutputsForDestroy, Tc as validateContainerRepoName, Ti as carriesDynamicReference, Tl as defineOwnKey, Tn as collectDeclaredOutputNames, To as templateResourceTypes, Tr as applyCustomResourceResponseExpiration, Ts as carriesSecretMask, Ua as repairMalformedOutputsForReadOnly, Uc as runDockerStreaming, Ui as accountArgs, Un as buildFinalSnapshotIdentifier, Uo as readbackPathFor, Us as CrossPrefixReadError, Ut as withStackRecords, Va as repairMalformedOrphanRecordsForReadOnly, Vc as redactedDockerCause, Vi as UNREADABLE_ORPHANS_CONTAINER_ROW, Vn as ATOMIC_FINAL_SNAPSHOT_TYPES, Vo as noEchoOutputsComparison, Vs as S3StateBackend, Vt as destroyStackRecordsView, Wa as repairMalformedResourceEntriesForReadOnly, Wc as warnFinchArgvExposure, Wi as deployRefusesOrphanRowsReason, Wn as ccRoutedFinalSnapshotError, Wo as readsNoEchoSource, Wr as DiffCalculator, Ws as CrossPrefixScanCache, Wt as removeProtectionTypeList, Xa as withheldAccountClause, Xc as Synthesizer, Xi as isReadableResourceEntry, Xn as maskingRetryLogger, Xo as literalSplitDelimitersOf, Xr as applyRoleArnIfSet, Xs as acceptedCreateOnlyDropsOf, Xt as planRollback, Ya as unreadableResourceEntries, Yc as getDockerImageBySourceHash, Yi as isReadableOrphanRecord, Yn as unsupportedFinalSnapshotError, Yo as hasMaskableValues, Yr as refuseUnreadableCdkCrossAccountRefs, Ys as splitImportedOps, Yt as planFailedOps, Za as findActionableSilentDrops, Zc as synthesisStatusMessage, Zi as malformedDriftResourcePropertiesWarning, Zn as constructPathOf, Zo as logOnlyValueCount, Zr as assertFlagRoleArn, Zs as describeRegionValueKind, Zt as recheckFailedPlan, _ as keptWholeReasonText, _a as refuseDivergentRecordRegionForDestroy, _c as BOOTSTRAP_MARKER_PREFIX, _i as classifyReplaySecretRegion, _l as decodeListingKey, _n as secretBearing, _r as isCustomResource, _s as identityKeyFor, _t as planOrphanAdoption, a as inheritedProvenanceForChildDiff, aa as malformedOrphanRowsKeptWarning, ac as orphansAfterRollback, ai as envCredentialsAreAssumedRole, al as resolveStateBucketWithDefault, an as inheritProducerRegions, ao as MULTI_REGION_RECREATE_BLOCKED_TYPES, as as maskSecretsInText, at as createReadOnlyAttributeHealerFactory, ba as refuseMalformedOrphanRecordsForDestroy, bc as getBootstrapMarkerKey, bi as coerceParameterTypedValue, bl as canonicalizeRegion, bn as carriedExportAliasExposure, br as readsNoEchoDeleteValues, bt as displacedPhysicalIdShown, c as isAbsoluteAssetPath, ca as malformedOutputsRefusalMessage, cc as AssetPublisher, cl as stateBucketExistenceConfirmed, co as renderStatefulReason, ct as gray, d as templateIdentity, da as malformedResourceEntriesWarning, dc as WorkGraph, dl as CFN_TEMPLATE_BODY_LIMIT, dn as updatePartialReason, ds as withPhysicalNameCopies, dt as yellow, ea as malformedLocalOutputsWarning, ec as hasReasonlessBaselineRefusal, ei as isIamRoleArn, el as loadCdkJson, en as resolveReplacementOldType, es as recordLogOnlyValue, f as conditionFingerprint, fa as malformedResourcePropertiesWarning, fc as buildAssetRedirectMap, fl as CFN_TEMPLATE_URL_LIMIT, fn as DeploymentEventsReader, ft as computeParameterTaint, g as isSecretBearingReferenceString, ga as previewableOrphanRecords, gc as AssetModeResolver, gi as classifyRecordedSecretRegion, gl as CUSTOM_RESOURCE_RESPONSE_OBJECT_DESCRIPTION, gn as exportAliasCollisionScrubWarning, gr as ccBrokenReason, gs as pathCrossesDottedKey, gt as makeSiblingClaimReader, h as readRecordedConditionVerdicts, ha as malformedStateRefusalMessage, hc as rewriteTemplateAssetReferences, hl as uploadCfnTemplate, hn as displayTextOrWithheld, hr as ProviderRegistry, hs as isUncertifiedBaselineMaskPosition, ht as resourcesNamingDeclaredParameter, i as crossStackOutputProvenanceSource, ia as malformedOrphanRecordsWarning, ic as isReadableBag, ii as callerEnvCredentials, il as resolveSkipPrefix, io as shownType, is as maskSecretsInError, it as formatResourceLine, j as noEchoAttributeNamesOf, ja as refuseMalformedResourceEntriesForImportSave, jc as describeDockerFailure, ji as isStalePlaceholderArnAttribute, jl as describeFileReadFailure, jn as completedReplayEntries, jo as DagBuilder, jr as UNSPECIFIED_SKIP_REASON, js as recordProvenPublicExpression, jt as deleteJournaledOrphans, k as withResourceDeadline, ka as refuseMalformedResourceEntriesForDestroy, kc as describeDockerCapturedOutput, ki as AWS_NO_VALUE, kl as ownValue, kn as DEFAULT_RESOURCE_TIMEOUT_MS, ks as recordNoEchoAttributeValues, l as listNestedTemplateRows, la as malformedOutputsWarning, lc as isSensitiveAttributeName, li as recordedOutputReferenceRegions, ll as warnDeprecatedNoPrefixCliFlag, ls as redactSecretsForState, lt as green, m as parentSuppliedValues, ma as malformedScrubResourceEntriesRefusalMessage, mc as loadPublishableAssetManifest, ml as findLargeInlineResources, mn as WITHHELD_NAME_DISPLAY, mr as CC_BROKEN_REASON, ms as dynamicReferenceTokens, mt as reachableDivergentParameters, n as IMPLICIT_DELETE_DEPENDENCIES, na as malformedLocalResourcesWarning, nc as importableOutputKeys, ni as AWS_CREDENTIAL_ENV_KEYS, nl as resolveAutoAssetStorage, nn as orphanDeleteNeedsIdentity, no as hasNoCloudControlHandlers, ns as createSecretMasker, o as childTemplateLoader, oa as malformedOrphansRefusalMessage, oc as orphansCarriedFrom, ol as resolveStateBucketWithDefaultAndSource, oo as isStatefulRecreateTargetForReplace, os as markSameGenerationBag, ot as bold, p as conditionInputsFrom, pa as malformedResourcesWarning, pc as createAssetRedirectResolver, pl as MIGRATE_TMP_PREFIX, pn as DeploymentEventsStore, ps as DYNAMIC_REFERENCE_TOKEN_SCAN, pt as namesAnyDeclaredParameter, qa as unpreviewableOrphanRecords, qc as stripForDisplay, qi as hasReadableOutputs, qn as isFinalSnapshotError, qo as carryLogOnlyValues, qr as poisonRenderedSpellingsCollidingIn, qs as isAccessDenied, qt as isJournaledOrphan, r as computeImplicitDeleteEdges, ra as malformedOrphanRecordsRefusalMessage, rc as importableOutputs, ri as applyCallerIdentityCredentials, rl as resolveCaptureObservedState, rn as findNestedStackTypeChanges, ro as findReplacedReadersOfRecreateTargets, rr as withCreateTokenLedger, rs as errorCauseChain, s as findNestedTemplateTreeDefect, sa as malformedOrphansWarning, sc as shouldRetainResource, si as keepHeldTokenProvenance, sl as resolveUseCdkBootstrapAssets, so as isStatefulRecreateTargetSync, st as cyan, t as DeployEngine, ta as malformedLocalResourceEntriesWarning, tc as hasUnverifiableParameterRefusal, ti as sendableAssumeRoleCommand, tl as resolveApp, tn as seedsDeleteFirstGuard, to as NO_CC_HANDLERS_REASON, tr as ledgerForStack, ts as shareLogOnlyValues, u as renderNestedTemplateTreeDefect, ua as malformedRenderedContainersWarning, uc as stringifyValue, ui as recordedReferenceRegions, ul as ssmResolvedValueType, un as updatePartialMessage, us as scrubResourceRecord, ut as red, v as mergeNoChangeOutputs, vc as assertAssetBucketRegion, vi as producerRegionsFromState, vl as expectedOwnerParam, vn as secretBearingStateKeyWarning, vr as wouldReturnToSdkProvider, vs as inheritNestedStackParameterAssociations, vt as NESTED_PENDING_PARENT_REASON, w as keptForReadoption, wa as refuseMalformedOutputs, wc as validateAssetBucketName, wi as isImpossibleEmptyStoredAttribute, wl as processStackMessages, wn as noEchoParameterValueSeed, wo as prefetchCreateOnlyPropertyPaths, wr as CUSTOM_RESOURCE_RESPONSE_LIFECYCLE_RULE_ID, ws as splitGetAttStringForm, wt as recordDisplacedSkips, xa as refuseMalformedOrphans, xc as isCrossRegionRedirect, xi as isUnboundTemplateParameter, xl as derivePartitionAndUrlSuffix, xn as exportNameNoEchoParameters, xr as isCustomResourceType$1, xs as physicalNameCopiesOf, xt as dropSettledNestedJournals, y as makeCanonicalizePropertiesFn, ya as refuseMalformedOrphanRecords, yc as ensureAssetStorage, yi as regionLessSecretName, yl as PARTITION_TABLE, yn as secretSafeKeyDisplay, yr as TemplateNoEchoReresolver, ys as recordNestedStackParameterExpressions, yt as displacedOpClause, z as perType, za as refuseMalformedResourcesForExport, zc as redactDockerArgvValues, zi as STATE_REGION_DIVERGED, zn as storedSecretNameNeedles, zo as noEchoCoordinatesOf, zs as LockManager, zt as replayRollback } from "./deploy-engine-BU3iY59A.js";
6
- import { t as getCdkdVersion } from "./version-BtTEjOpj.js";
3
+ import { $t as ambientCredentialConfig, Bn as shellBoundedDisplay, Bt as formatLockOperation, Cn as StateError, D as VALUE_NOT_SHOWN, Dn as normalizeAwsError, E as assertRegionMatch, Fn as isInertUnquoted, Ft as UNREPRODUCIBLE_LOCK_CLAUSE, G as runDeleteAttempt, Gt as DEFAULT_STATE_PREFIX, Hn as withheldTargetClause, In as pasteableCommand, It as buildForceUnlockCommand, Jt as producerCoordinateKey, Kt as injectiveKey, Lt as buildLockContentionMessage, Nn as commandHole, On as withErrorHandling, P as remedyLogicalId, Qt as ambientClientDefaults, Rn as plainOrDescribed, Rt as forceQuitRecoveryClause, Sn as StackTerminationProtectionError, T as RESOURCE_NOT_FOUND, Un as setPasteableRunFlags, Vn as shellQuote, Vt as formatLockOwner, Wn as setPasteableVerbFlags, Wt as CUSTOM_RESOURCE_RESPONSE_PREFIX, Xt as setPasteableAwsProfile, Yt as producerRecordKey, Z as isAwsCliLiteral, Zt as withPasteableAwsProfile, _n as PartialFailureError, ar as retryClassificationText, bn as ResourceUpdateNotSupportedError, cn as DeployCancelledError, cr as isThrottlingError, dn as LocalInvokeBuildError$1, en as clientDefaultsFor, fn as LocalStartServiceError, ft as logicalIdShown, gn as NestedStackChildDirectDestroyError, hn as MalformedProducerRecordRefusalError, in as CdkdError, ir as isTransientServerError, it as isInterruptedWaitError, jn as SHELL_ACTIVE_WHY, kn as TIMEOUT_FLAG_RESOURCE_TYPE, ln as DynamicReferenceRegionAmbiguousError, lr as markNonRetryable, mt as resourceTypeShown, n as RESOLVED_PREVIOUS_PRINCIPAL_KEYS, nn as AccountIdUnavailableError, nt as endCommandInterruptScope, on as CrossAccountSecretRefusalError, rr as isRetryableTransientError, rt as interruptWatchListenerCount, s as readRecordedPrincipals, sr as isMarkedNonRetryable, t as IAM_PRINCIPAL_NAME, tn as credentialFingerprint, tr as isAmbiguousOutcomeError, tt as beginCommandInterruptScope, un as IntrinsicResolutionRefusalError, vn as ProvisioningError, wn as SynthesisError, xn as StackHasActiveImportsError, yn as ResourceTimeoutError, zn as quotedOrDescribed, zt as formatLockExpiry } from "./iam-policy-targets-DAs3w7QW.js";
4
+ import { a as setAssumedRoleCredentials, l as runInStackAwsScope, n as awsClientDefaults, r as getAssumedRoleCredentials, u as formatAuthority } from "./aws-client-defaults-DBXBcg0J.js";
5
+ import { $a as withheldAccountClause, $c as getDockerImageBySourceHash, $i as isReadableResourceEntry, $n as findDestructiveChanges, $o as literalSplitDelimitersOf, $r as applyRoleArnIfSet, $s as splitImportedOps, $t as recordUnderIdIsNotOwn, A as diffSecurity, Aa as refuseMalformedResourceEntries, Ac as buildDenyExternalAccessPolicy, Ai as isNamelessDynamicReferenceError, Al as hasOwnKey, An as DEFAULT_RESOURCE_TIMEOUT_MS, Ao as withRetry, Ar as CloudControlProvider, As as provenPublicValue, At as withNestedStackContext, B as readProtection, Ba as refuseMalformedResourcesForDeploy, Bc as isDockerClientEnvKey, Bi as declaresNoEcho, Bl as injectedAwsRegionValue, Bn as storedSecretNameNeedles, Bo as maskWholeValue, Bs as TEMPLATE_SOURCED_RULES, Ca as refuseMalformedOrphanRecordsForDestroy, Cc as ensureAssetStorage, Ci as coerceParameterTypedValue, Cl as PARTITION_TABLE, Cn as exportNameSecretExposure, Cr as readsNoEchoDeleteValues, Cs as recordNestedStackParameterExpressions, Ct as nestedChildStackName$1, D as findServiceTokenRefusals, Da as refuseMalformedOutputs, Dc as readBootstrapMarkerBody, Di as isImpossibleEmptyStoredAttribute, Dl as StageLoadError, Dn as collectPublishedOutputNames, Do as prefetchCreateOnlyPropertyPaths, Dr as CUSTOM_RESOURCE_RESPONSE_LIFECYCLE_RULE_ID, Ds as recordPhysicalNameCopy, Dt as withNestedRevertRun, E as deferredServiceTokenWarning, Ea as refuseMalformedOrphansForOrphan, Ec as parseBootstrapMarker, Ei as getAccountInfo, El as AssemblyReader, En as collectDeclaredOutputNames, Er as withPrintingSecrets, Et as revertedNestedRowIds, F as recordedProtectionEvidence, Fa as refuseMalformedResourceEntriesForOrphan, Fc as describeDockerFailure, Fi as refStateLookupFromResource, Fl as describeFileReadFailure, Fn as orphanRecordsPrintingBag, Fo as TemplateParser, Fr as deleteIndeterminateGuards, Fs as recordProvenPublicExpression, Ft as loadJournaledOrphans, Ga as repairMalformedOrphansForReadOnly, Gc as redactedDockerCause, Gi as UNREADABLE_RESOURCES_MAP_ROW, Gn as ccRoutedFinalSnapshotError, Gs as S3StateBackend, Ha as refuseMalformedResourcesForExport, Hc as partitionSensitiveEnv, Hi as STATE_REGION_DIVERGED, Hl as resolveBucketRegion, Hn as ATOMIC_FINAL_SNAPSHOT_TYPES, Ho as noEchoCoordinatesOf, Hs as isSingleDynamicReferenceToken, I as recordedProtectionNote, Ia as refuseMalformedResourcePropertiesForDestroy, Ic as dockerSpawnEnvWithSensitive, Il as displayAssemblyPath, In as secretNamePrintingBag, Io as canonicalCoordinates, Ir as deleteLeftInPlace, Is as wholeStringLeavesOf, It as makeForeignHolderScan, Ja as repairMalformedResourcePropertiesForReadOnly, Jc as warnFinchArgvExposure, Ji as displayLogicalId, Jn as isFinalSnapshotError, Jo as valueAtCoordinate, Jr as INTRINSIC_KEYS, Js as CrossPrefixScanCache, Jt as isJournaledOrphan, Ka as repairMalformedOutputsForReadOnly, Kc as runDockerForeground, Ki as accountArgs, Kn as createPreDeleteFinalSnapshot, Ko as readbackPathFor, Ks as rebuildClientForBucketRegion, Kt as recordAfterRollbackUpdate, L as PROTECTION_PROPERTY_BY_TYPE, La as refuseMalformedResourcePropertiesForDrift, Lc as finchSecretArgvRefusal, Li as withSharedDrainBudget, Ll as renderAssemblyPathEscape, Ln as secretNamePrintingBags, Lo as isMarkedCoordinate, Lr as deleteSkipReason, Ls as STATE_SOURCED_BASELINE_RULES, Lt as sameJournaledOrphans, M as noEchoComparisonForTemplate, Ma as refuseMalformedResourceEntriesForDestroy, Mc as resolveDockerContextDirectory, Mi as AWS_NO_VALUE, Ml as nullPrototypeRecord, Mn as completedReplayEntries, Ms as recordMaskOnlyValuesIn, Mt as dropFailedHint, N as noEchoExactEchoLeavesOf, Na as refuseMalformedResourceEntriesForImport, Nc as describeDockerCapturedOutput, Ni as cfnRefValueFromPhysicalId, Nl as ownValue, Nn as journaledOrphanPrintingBag, Nr as RollbackInlinePolicyWriters, Ns as recordNoEchoAttributeValues, Nt as isHandledOrphan, O as serviceTokenBlockingReason, Oa as refuseMalformedOutputsForDestroy, Oc as validateAssetBucketName, Oi as carriesDynamicReference, Ol as processStackMessages, On as isExportAliasCollision, Oo as templateResourceTypes, Or as applyCustomResourceResponseExpiration, Os as splitGetAttStringForm, Ot as collectNestedChildUnaddressed, P as noEchoParameterNamesOf, Pa as refuseMalformedResourceEntriesForImportSave, Pc as describeDockerExecFailure, Pi as isStalePlaceholderArnAttribute, Pl as absoluteAssemblyPathEscape, Pn as maskEventTextWithBoundBags, Po as DagBuilder, Pr as UNSPECIFIED_SKIP_REASON, Ps as recordNoEchoParameterFreshValue, Pt as journaledOrphanLines, Qa as unreadableResourceEntries, Qc as AssetManifestLoader, Qi as isReadableOrphanRecord, Qn as constructPathOf, Qo as hasMaskableValues, Qr as refuseUnreadableCdkCrossAccountRefs, Qs as isNotImplemented, Qt as recheckFailedPlan, R as isProtectionValueActive, Ra as refuseMalformedResourcePropertiesForExport, Rc as formatDockerLoginError, Ri as parameterInputsFor, Rl as resolveAssemblyPath, Rn as secretNamedRecordNeedles, Ro as maskAtCoordinates, Rs as STATE_SOURCED_CROSS_GENERATION_RULES, Rt as replayFailedOperations, Sa as refuseMalformedOrphanRecords, Sc as assertAssetBucketRegion, Si as regionLessSecretName, Sl as expectedOwnerParam, Sn as exportNameNoEchoParameters, Sr as TemplateNoEchoReresolver, Ss as inheritNestedStackParameterAssociations, T as recordRetainedForReadoption, Ta as refuseMalformedOrphansForDestroy, Tc as isCrossRegionRedirect, Ti as parameterTypeMayLoseSecretIdentity, Tl as derivePartitionAndUrlSuffix, Tn as noEchoParameterValueSeed, Ts as physicalNameCopiesOf, Ua as refuseMalformedState, Uc as redactDockerArgvValues, Ui as STATE_RESOURCES_MALFORMED, Un as PRE_DELETE_SNAPSHOT_TYPES, Uo as noEchoLeavesOf, Us as LockManager, Ut as withStackRecords, Va as refuseMalformedResourcesForDestroy, Vc as isMalformedEnvKey, Vi as JSON_LISTING_HOLE_VALUE, Vn as extractDeploymentEventError, Vo as maskedLeafCoordinatesOf, Vs as WHOLE_DYNAMIC_REFERENCE_PATTERN, Vt as destroyStackRecordsView, Wa as repairMalformedOrphanRecordsForReadOnly, Wc as redactedCause, Wi as UNREADABLE_ORPHANS_CONTAINER_ROW, Wn as buildFinalSnapshotIdentifier, Wo as noEchoOutputsComparison, Ws as isLockInfoExpired, Wt as removeProtectionTypeList, Xa as unpreviewableOrphanRecords, Xc as stripControlChars, Xi as hasReadableOutputs, Xn as unsupportedFinalSnapshotError, Xo as carryLogOnlyValues, Xr as poisonRenderedSpellingsCollidingIn, Xs as crossPrefixDeniedWarning, Xt as planFailedOps, Ya as repairMalformedResourcesForReadOnly, Yc as escapeRegExp, Yi as hasReadableOrphans, Yn as refusesFinalSnapshot, Yo as liveMatchesUnresolvedTokenFrame, Yr as IntrinsicFunctionResolver, Ys as applyCrossPrefixScan, Yt as isReplacementOrphan, Za as unreadableOrphanRecords, Zc as stripForDisplay, Zi as hasReadableResources, Zn as maskingRetryLogger, Zo as createUnionSecretMasker, Zr as producerLookupOver, Zs as isAccessDenied, Zt as planRollback, _ as keptWholeReasonText, _a as malformedScrubResourceEntriesRefusalMessage, _c as createAssetRedirectResolver, _l as MIGRATE_TMP_PREFIX, _n as exportAliasCollisionScrubWarning, _r as CC_BROKEN_REASON, _s as DYNAMIC_REFERENCE_TOKEN_SCAN, _t as planOrphanAdoption, a as inheritedProvenanceForChildDiff, aa as malformedLocalResourcesWarning, ac as hasUnverifiableParameterRefusal, ai as AWS_CREDENTIAL_ENV_KEYS, al as resolveApp, ao as hasNoCloudControlHandlers, as as unionOfSecretBags, at as createReadOnlyAttributeHealerFactory, ba as refuseDivergentRecordRegionForDestroy, bc as AssetModeResolver, bi as classifyReplaySecretRegion, bl as CUSTOM_RESOURCE_RESPONSE_OBJECT_DESCRIPTION, bn as secretSafeKeyDisplay, br as isCustomResource, bs as pathCrossesDottedKey, bt as displacedPhysicalIdShown, c as isAbsoluteAssetPath, ca as malformedOrphanRowsKeptWarning, cc as isReadableBag, ci as envCredentialsAreAssumedRole, cl as resolveSkipPrefix, co as MULTI_REGION_RECREATE_BLOCKED_TYPES, cs as maskSecretsInError, ct as gray, d as templateIdentity, da as malformedOutputsRefusalMessage, dc as shouldRetainResource, dl as resolveUseCdkBootstrapAssets, dn as updatePartialMessage, do as renderStatefulReason, dt as yellow, ea as malformedDriftResourcePropertiesWarning, ec as acceptedCreateOnlyDropsOf, ei as assertFlagRoleArn, el as Synthesizer, en as replacementNeverSwapped, eo as findActionableSilentDrops, er as formatDestructiveChange, es as logOnlyValueCount, f as conditionFingerprint, fa as malformedOutputsWarning, fc as AssetPublisher, fi as recordedOutputReferenceRegions, fl as stateBucketExistenceConfirmed, fn as updatePartialReason, ft as computeParameterTaint, g as isSecretBearingReferenceString, ga as malformedResourcesWarning, gc as buildAssetRedirectMap, gl as CFN_TEMPLATE_URL_LIMIT, gn as displayTextOrWithheld, gt as makeSiblingClaimReader, h as readRecordedConditionVerdicts, ha as malformedResourcePropertiesWarning, hc as WorkGraph, hl as CFN_TEMPLATE_BODY_LIMIT, hn as WITHHELD_NAME_DISPLAY, hs as withPhysicalNameCopies, ht as resourcesNamingDeclaredParameter, i as crossStackOutputProvenanceSource, ia as malformedLocalResourceEntriesWarning, ic as hasReasonlessBaselineRefusal, ii as sendableAssumeRoleCommand, il as loadCdkJson, in as findNestedStackTypeChanges, io as NO_CC_HANDLERS_REASON, ir as withCreateTokenLedger, is as shareLogOnlyValues, it as formatResourceLine, j as noEchoAttributeNamesOf, ja as refuseMalformedResourceEntriesForDeploy, jc as buildDockerImage, ji as keepsSecretReferenceToken, jl as hasPlainPrototype, jn as DEFAULT_RESOURCE_WARN_AFTER_MS, jr as slowCcOperationTimeoutMs, js as recordMaskOnlyValue, jt as deleteJournaledOrphans, k as withResourceDeadline, ka as refuseMalformedResourceAttributesForOrphan, kc as validateContainerRepoName, ki as carriesFetchableDynamicReference, kl as defineOwnKey, kn as bindingSkippedOutputs, ko as describeTypeWithThrottleRetry, kr as customResourceResponseExpirationWarning, ks as carriesSecretMask, kt as getCurrentNestedStackContext, l as listNestedTemplateRows, la as malformedOrphansRefusalMessage, lc as orphansAfterRollback, ll as resolveStateBucketWithDefault, lo as isStatefulRecreateTargetForReplace, ls as maskSecretsInText, lt as green, m as parentSuppliedValues, ma as malformedResourceEntriesWarning, mc as stringifyValue, ml as ssmResolvedValueType, mn as DeploymentEventsStore, ms as scrubResourceRecord, mt as reachableDivergentParameters, n as IMPLICIT_DELETE_DEPENDENCIES, na as malformedExportSourceWarning, nc as exportNamesCarriedFrom, ni as explicitRoleArnOrThrow, nl as getDefaultStateBucketName, nn as seedsDeleteFirstGuard, no as unwrittenCreateOnlyReplacement, nr as ledgerForStack, ns as recordLogOnlyParameterValue, o as childTemplateLoader, oa as malformedOrphanRecordsRefusalMessage, oc as importableOutputKeys, oi as applyCallerIdentityCredentials, ol as resolveAutoAssetStorage, on as inheritProducerRegions, oo as findReplacedReadersOfRecreateTargets, os as createSecretMasker, ot as bold, p as conditionInputsFrom, pa as malformedRenderedContainersWarning, pc as isSensitiveAttributeName, pi as recordedReferenceRegions, pl as warnDeprecatedNoPrefixCliFlag, pn as DeploymentEventsReader, ps as redactSecretsForState, pt as namesAnyDeclaredParameter, qa as repairMalformedResourceEntriesForReadOnly, qc as runDockerStreaming, qi as deployRefusesOrphanRowsReason, qn as effectiveDeletionPolicy, qo as readsNoEchoSource, qr as DiffCalculator, qs as CrossPrefixReadError, qt as demoteSupersededOrphans, r as computeImplicitDeleteEdges, ra as malformedLocalOutputsWarning, rc as hasReadableExportSet, ri as isIamRoleArn, rl as getLegacyStateBucketName, rn as orphanDeleteNeedsIdentity, rs as recordLogOnlyValue, s as findNestedTemplateTreeDefect, sa as malformedOrphanRecordsWarning, sc as importableOutputs, si as callerEnvCredentials, sl as resolveCaptureObservedState, so as shownType, ss as errorCauseChain, st as cyan, t as DeployEngine, ta as malformedExportNamesWarning, tc as describeRegionValueKind, ti as assertSendableRoleArn, tl as synthesisStatusMessage, tn as resolveReplacementOldType, ts as printingCorpusOf, u as renderNestedTemplateTreeDefect, ua as malformedOrphansWarning, uc as orphansCarriedFrom, ui as keepHeldTokenProvenance, ul as resolveStateBucketWithDefaultAndSource, uo as isStatefulRecreateTargetSync, us as markSameGenerationBag, ut as red, v as mergeNoChangeOutputs, va as malformedStateRefusalMessage, vc as loadPublishableAssetManifest, vl as findLargeInlineResources, vn as secretBearing, vr as ProviderRegistry, vs as dynamicReferenceTokens, vt as NESTED_PENDING_PARENT_REASON, w as keptForReadoption, wa as refuseMalformedOrphans, wc as getBootstrapMarkerKey, wi as isUnboundTemplateParameter, wl as canonicalizeRegion, wn as isWholeDynamicReferenceValue, wr as isCustomResourceType$1, wt as recordDisplacedSkips, xc as BOOTSTRAP_MARKER_PREFIX, xi as producerRegionsFromState, xl as decodeListingKey, xn as carriedExportAliasExposure, xr as wouldReturnToSdkProvider, xs as identityKeyFor, xt as dropSettledNestedJournals, y as makeCanonicalizePropertiesFn, ya as previewableOrphanRecords, yc as rewriteTemplateAssetReferences, yi as classifyRecordedSecretRegion, yl as uploadCfnTemplate, yn as secretBearingStateKeyWarning, yr as ccBrokenReason, ys as isUncertifiedBaselineMaskPosition, yt as displacedOpClause, z as perType, za as refuseMalformedResourcePropertiesForOrphan, zc as getDockerCmd, zl as injectAwsRegion, zn as stateSecretNameNeedles, zo as maskReadbackAtCoordinates, zr as isWaitAbandonedError, zs as STATE_SOURCED_READBACK_RULES, zt as replayRollback } from "./deploy-engine-BK4gG_5A.js";
6
+ import { t as getCdkdVersion } from "./version-DTSDiQcV.js";
7
7
  import { randomBytes, randomUUID } from "node:crypto";
8
8
  import { CopyObjectCommand, CreateBucketCommand, DeleteBucketCommand, DeleteObjectsCommand, GetBucketLocationCommand, GetObjectCommand, HeadBucketCommand, ListObjectVersionsCommand, ListObjectsV2Command, NoSuchBucket, NotFound, PutBucketEncryptionCommand, PutBucketPolicyCommand, PutBucketVersioningCommand, PutObjectCommand, S3Client, S3ServiceException } from "@aws-sdk/client-s3";
9
9
  import { GetRoleCommand, GetUserCommand } from "@aws-sdk/client-iam";
@@ -764,7 +764,7 @@ async function bootstrapDestroyCommand(options) {
764
764
  } catch (error) {
765
765
  markerListingSucceeded = false;
766
766
  if (options.includeStateBucket) throw new CdkdError(`Cannot verify which bootstrap markers the state bucket '${bucketName}' still holds (listing '${BOOTSTRAP_MARKER_PREFIX}' failed), and --include-state-bucket deletes every one of them. Grant s3:ListBucket on this bucket and re-run.`, "STATE_BUCKET_MARKER_SCAN_FAILED", error);
767
- logger.warn(`Could not list bootstrap markers under '${BOOTSTRAP_MARKER_PREFIX}' (${error instanceof Error ? error.message : String(error)}). Continuing — this only means a marker for this region under another spelling of its name would not be reported.`);
767
+ logger.warn(`Could not list bootstrap markers under '${BOOTSTRAP_MARKER_PREFIX}' (${describeAwsFailure(error).detail}). Continuing — this only means a marker for this region under another spelling of its name would not be reported.`);
768
768
  }
769
769
  let marker;
770
770
  if (markerBody === null) {
@@ -1876,7 +1876,7 @@ async function findDownstreamConsumers(input) {
1876
1876
  try {
1877
1877
  refs = await input.stateBackend.listStacks();
1878
1878
  } catch (err) {
1879
- logger.debug(`findDownstreamConsumers: listStacks failed; falling back to empty enumeration. ${err instanceof Error ? err.message : String(err)}`);
1879
+ logger.debug(`findDownstreamConsumers: listStacks failed; falling back to empty enumeration. ${describeAwsFailure(err).detail}`);
1880
1880
  return [];
1881
1881
  }
1882
1882
  return (await Promise.all(refs.map(async (ref) => {
@@ -1917,7 +1917,7 @@ async function findDownstreamConsumers(input) {
1917
1917
  }
1918
1918
  return out.length > 0 ? out : null;
1919
1919
  } catch (err) {
1920
- logger.debug(`findDownstreamConsumers: skip ${ref.stackName} (${region}); ${err instanceof Error ? err.message : String(err)}`);
1920
+ logger.debug(`findDownstreamConsumers: skip ${ref.stackName} (${region}); ${describeAwsFailure(err).detail}`);
1921
1921
  return null;
1922
1922
  }
1923
1923
  }))).filter((r) => r !== null).flat();
@@ -2561,11 +2561,11 @@ function collectCrossStackRefs(node, onRef, unconditional) {
2561
2561
  //#region src/provisioning/register-providers.ts
2562
2562
  let providerClasses;
2563
2563
  function loadProviderClasses() {
2564
- providerClasses ??= import("./provider-classes-DmohfhIq.js");
2564
+ providerClasses ??= import("./provider-classes-CDzT2xg0.js");
2565
2565
  return providerClasses;
2566
2566
  }
2567
2567
  function registerAllProviders(registry, classes) {
2568
- const { IAMRoleProvider, IAMPolicyProvider, IAMManagedPolicyProvider, IAMInstanceProfileProvider, IAMAccessKeyProvider, IAMUserGroupProvider, S3BucketProvider, S3BucketPolicyProvider, SQSQueueProvider, SQSQueuePolicyProvider, SNSTopicProvider, SNSSubscriptionProvider, SNSTopicPolicyProvider, LambdaFunctionProvider, LambdaPermissionProvider, LambdaUrlProvider, LambdaEventSourceMappingProvider, LambdaLayerVersionProvider, LambdaEventInvokeConfigProvider, LambdaMicrovmImageProvider, DynamoDBTableProvider, DynamoDBGlobalTableProvider, LogsLogGroupProvider, CloudWatchAlarmProvider, CloudWatchAnomalyDetectorProvider, SecretsManagerSecretProvider, SSMParameterProvider, EventBridgeRuleProvider, EventBridgeBusProvider, EC2Provider, ApiGatewayProvider, ApiGatewayV2Provider, CloudFrontOAIProvider, CloudFrontOACProvider, CloudFrontDistributionProvider, AgentCoreRuntimeProvider, AgentCoreBrowserProvider, AgentCoreCodeInterpreterProvider, AgentCoreEvaluatorProvider, StepFunctionsProvider, ECSProvider, ELBv2Provider, RDSProvider, RDSDBProxyProvider, RDSDBProxyEndpointProvider, RDSDBProxyTargetGroupProvider, DocDBProvider, DocDBSubnetGroupProvider, NeptuneProvider, Route53Provider, WAFv2WebACLProvider, CognitoUserPoolProvider, ElastiCacheProvider, ServiceDiscoveryProvider, AppSyncProvider, GlueProvider, GlueWorkflowProvider, GlueSecurityConfigurationProvider, GlueJobProvider, GlueCrawlerProvider, GlueConnectionProvider, GlueTriggerProvider, KMSProvider, BudgetsBudgetProvider, KinesisStreamProvider, KinesisStreamConsumerProvider, SchedulerScheduleProvider, PipesPipeProvider, EFSProvider, FSxFileSystemProvider, EMRClusterProvider, EMRInstanceGroupConfigProvider, EMRInstanceFleetConfigProvider, FirehoseProvider, CloudTrailProvider, CodeBuildProvider, CodeCommitRepositoryProvider, DLMLifecyclePolicyProvider, S3VectorsProvider, S3DirectoryBucketProvider, S3TablesProvider, ECRProvider, ASGProvider, NestedStackProvider, WaitConditionHandleProvider, ACMCertificateProvider } = classes;
2568
+ const { IAMRoleProvider, IAMPolicyProvider, IAMManagedPolicyProvider, IAMInstanceProfileProvider, IAMAccessKeyProvider, IAMUserGroupProvider, S3BucketProvider, S3BucketPolicyProvider, SQSQueueProvider, SQSQueuePolicyProvider, SNSTopicProvider, SNSSubscriptionProvider, SNSTopicPolicyProvider, LambdaFunctionProvider, LambdaPermissionProvider, LambdaUrlProvider, LambdaEventSourceMappingProvider, LambdaLayerVersionProvider, LambdaEventInvokeConfigProvider, LambdaMicrovmImageProvider, LambdaWebFunctionRevisionProvider, LambdaWebFunctionEndpointProvider, LambdaNetworkConnectorProvider, DynamoDBTableProvider, DynamoDBGlobalTableProvider, LogsLogGroupProvider, CloudWatchAlarmProvider, CloudWatchAnomalyDetectorProvider, SecretsManagerSecretProvider, SSMParameterProvider, EventBridgeRuleProvider, EventBridgeBusProvider, EC2Provider, ApiGatewayProvider, ApiGatewayV2Provider, CloudFrontOAIProvider, CloudFrontOACProvider, CloudFrontDistributionProvider, AgentCoreRuntimeProvider, AgentCoreBrowserProvider, AgentCoreCodeInterpreterProvider, AgentCoreEvaluatorProvider, StepFunctionsProvider, ECSProvider, ELBv2Provider, RDSProvider, RDSDBProxyProvider, RDSDBProxyEndpointProvider, RDSDBProxyTargetGroupProvider, DocDBProvider, DocDBSubnetGroupProvider, NeptuneProvider, Route53Provider, WAFv2WebACLProvider, CognitoUserPoolProvider, ElastiCacheProvider, ServiceDiscoveryProvider, AppSyncProvider, GlueProvider, GlueWorkflowProvider, GlueSecurityConfigurationProvider, GlueJobProvider, GlueCrawlerProvider, GlueConnectionProvider, GlueTriggerProvider, KMSProvider, BudgetsBudgetProvider, KinesisStreamProvider, KinesisStreamConsumerProvider, SchedulerScheduleProvider, PipesPipeProvider, EFSProvider, FSxFileSystemProvider, EMRClusterProvider, EMRInstanceGroupConfigProvider, EMRInstanceFleetConfigProvider, FirehoseProvider, CloudTrailProvider, CodeBuildProvider, CodeCommitRepositoryProvider, DLMLifecyclePolicyProvider, S3VectorsProvider, S3DirectoryBucketProvider, S3TablesProvider, ECRProvider, ASGProvider, NestedStackProvider, WaitConditionHandleProvider, ACMCertificateProvider } = classes;
2569
2569
  registry.register("AWS::IAM::Role", new IAMRoleProvider());
2570
2570
  registry.register("AWS::IAM::Policy", new IAMPolicyProvider());
2571
2571
  registry.register("AWS::IAM::ManagedPolicy", new IAMManagedPolicyProvider());
@@ -2590,6 +2590,9 @@ function registerAllProviders(registry, classes) {
2590
2590
  registry.register("AWS::Lambda::LayerVersion", new LambdaLayerVersionProvider());
2591
2591
  registry.register("AWS::Lambda::EventInvokeConfig", new LambdaEventInvokeConfigProvider());
2592
2592
  registry.register("AWS::Lambda::MicrovmImage", new LambdaMicrovmImageProvider());
2593
+ registry.register("AWS::Lambda::WebFunctionRevision", new LambdaWebFunctionRevisionProvider());
2594
+ registry.register("AWS::Lambda::WebFunctionEndpoint", new LambdaWebFunctionEndpointProvider());
2595
+ registry.register("AWS::Lambda::NetworkConnector", new LambdaNetworkConnectorProvider());
2593
2596
  registry.register("AWS::DynamoDB::Table", new DynamoDBTableProvider());
2594
2597
  registry.register("AWS::DynamoDB::GlobalTable", new DynamoDBGlobalTableProvider());
2595
2598
  registry.register("AWS::Logs::LogGroup", new LogsLogGroupProvider());
@@ -3824,7 +3827,7 @@ async function resolveTemplateOutputs(template, resolveFn, conditions, storedOut
3824
3827
  try {
3825
3828
  value = await resolveValue(structuredClone(output.Value));
3826
3829
  } catch (error) {
3827
- logger.debug(`Diff could not resolve output ${stripForDisplay(outputKey)}: ${stripForDisplay(String(error))}`);
3830
+ logger.debug(`Diff could not resolve output ${stripForDisplay(outputKey)}: ${stripForDisplay(safeStringify(error))}`);
3828
3831
  resolutionFailed = true;
3829
3832
  recordFailure(outputKey, output);
3830
3833
  failedOutputKeys.add(outputKey);
@@ -3859,7 +3862,7 @@ async function resolveTemplateOutputs(template, resolveFn, conditions, storedOut
3859
3862
  if (typeof exportName !== "string") try {
3860
3863
  exportName = await (outputsPass?.resolveInto(nameBag) ?? resolveFn)(structuredClone(exportName));
3861
3864
  } catch (error) {
3862
- logger.debug(`Diff could not resolve Export.Name of ${stripForDisplay(outputKey)}: ${stripForDisplay(String(error))}`);
3865
+ logger.debug(`Diff could not resolve Export.Name of ${stripForDisplay(outputKey)}: ${stripForDisplay(safeStringify(error))}`);
3863
3866
  resolutionFailed = true;
3864
3867
  failuresMirrorDeploy = false;
3865
3868
  continue;
@@ -4812,6 +4815,12 @@ function tokenValueForComparison(token, declaredType) {
4812
4815
  if (!coerced.every((element) => typeof element === "string")) return token;
4813
4816
  return coerced;
4814
4817
  }
4818
+ function standInTokensOf(byParameter) {
4819
+ if (byParameter === void 0) return void 0;
4820
+ const all = /* @__PURE__ */ new Set();
4821
+ for (const tokens of byParameter.values()) for (const token of tokens) all.add(token);
4822
+ return all.size > 0 ? all : void 0;
4823
+ }
4815
4824
  function diffPrintingSecrets(bags) {
4816
4825
  const all = /* @__PURE__ */ new Map();
4817
4826
  for (const bag of bags) {
@@ -4940,9 +4949,12 @@ function maskOutputChangeForDisplay(change, mask, nameCorpus) {
4940
4949
  return changed ? shown : change;
4941
4950
  }
4942
4951
  async function computeStackDiff(currentState, template, region, stackName, stateBackend, diffCalculator, options = {}) {
4943
- const { parameters, canonicalizeProperties, cfnFallback, producerLookup, consumerAccount, inheritSecretBearingTemplate, inheritedSecrets, inheritedDerivedNames, attributeHealer, parentUnresolvedParameters, inheritedNoEchoParameters, inheritedNoEchoParametersAnyVerdict } = options;
4952
+ const { parameters, canonicalizeProperties, cfnFallback, producerLookup, consumerAccount, inheritSecretBearingTemplate, inheritedSecrets, inheritedSecretTokens, inheritedDerivedNames, attributeHealer: unboundAttributeHealer, parentUnresolvedParameters, inheritedNoEchoParameters, inheritedNoEchoParametersAnyVerdict } = options;
4953
+ let healResources = currentState.resources ?? {};
4954
+ const attributeHealer = unboundAttributeHealer && healerUnderRecordPrintingBag(unboundAttributeHealer, () => healResources);
4944
4955
  const noEchoParametersOf = (t) => /* @__PURE__ */ new Set([...noEchoParameterNamesOf(t), ...inheritedNoEchoParameters ?? []]);
4945
4956
  const inheritedForResolver = inheritedSecrets !== void 0 && hasMaskableValues(inheritedSecrets) ? inheritedSecrets : void 0;
4957
+ const secretStandInTokens = standInTokensOf(inheritedSecretTokens);
4946
4958
  const intrinsicResolver = new IntrinsicFunctionResolver(region, {
4947
4959
  cfnFallback: cfnFallback ?? true,
4948
4960
  ...producerLookup && { producerLookup },
@@ -5091,6 +5103,7 @@ async function computeStackDiff(currentState, template, region, stackName, state
5091
5103
  secretNameNeedles: stateSecretNameNeedles(currentState.resources, diffSecrets),
5092
5104
  secretNameSink: derivedNames,
5093
5105
  ...inheritedForResolver && { inheritedSecrets: inheritedForResolver },
5106
+ ...secretStandInTokens && { secretStandInTokens },
5094
5107
  template: effectiveTemplate,
5095
5108
  resources: currentState.resources,
5096
5109
  stateBackend,
@@ -5133,6 +5146,7 @@ async function computeStackDiff(currentState, template, region, stackName, state
5133
5146
  ...plan.adopted
5134
5147
  }
5135
5148
  };
5149
+ healResources = stateForDiff.resources;
5136
5150
  const tornAdopted = repairMalformedResourcePropertiesForReadOnly(stateForDiff);
5137
5151
  reportedByTheAdoptedPropertiesArm = tornAdopted;
5138
5152
  if (tornAdopted.length > 0) {
@@ -5474,9 +5488,10 @@ function noEchoFedChildParameters(parentStackRow, parentNoEchoParameters, parent
5474
5488
  })) fed.add(name);
5475
5489
  return fed;
5476
5490
  }
5477
- async function resolveChildStackParameters(parentStackRow, parentTemplate, parentState, region, parentStackName, stateBackend, parentParameters, parentConditions, cfnFallback, printingSecrets, attributeHealer, unresolvedKeys, trust, derivedNameSink, producerLookup, consumerAccount) {
5491
+ async function resolveChildStackParameters(parentStackRow, parentTemplate, parentState, region, parentStackName, stateBackend, parentParameters, parentConditions, cfnFallback, printingSecrets, attributeHealer, unresolvedKeys, trust, derivedNameSink, producerLookup, consumerAccount, secretTokens) {
5478
5492
  const rawParams = parentStackRow.Properties?.["Parameters"];
5479
5493
  if (!rawParams || typeof rawParams !== "object" || Array.isArray(rawParams)) return {};
5494
+ const inheritedStandIns = standInTokensOf(secretTokens?.inherited);
5480
5495
  const resolver = new IntrinsicFunctionResolver(region, {
5481
5496
  cfnFallback: cfnFallback ?? true,
5482
5497
  ...producerLookup && { producerLookup },
@@ -5485,6 +5500,7 @@ async function resolveChildStackParameters(parentStackRow, parentTemplate, paren
5485
5500
  const resolved = {};
5486
5501
  for (const [name, value] of Object.entries(rawParams)) {
5487
5502
  if (trust === void 0 || !rowValueTrusted(value, parentState, parentConditions, trust)) unresolvedKeys?.add(name);
5503
+ const skippedSecretReferences = /* @__PURE__ */ new Set();
5488
5504
  try {
5489
5505
  const resolvedValue = await resolver.resolve(value, {
5490
5506
  template: parentTemplate,
@@ -5498,10 +5514,20 @@ async function resolveChildStackParameters(parentStackRow, parentTemplate, paren
5498
5514
  ...parentConditions && { conditions: parentConditions },
5499
5515
  ...printingSecrets && hasMaskableValues(printingSecrets) && { inheritedSecrets: printingSecrets },
5500
5516
  skipDynamicReferences: true,
5517
+ skippedSecretReferences,
5518
+ ...inheritedStandIns && { secretStandInTokens: inheritedStandIns },
5501
5519
  ...attributeHealer && { attributeHealer }
5502
5520
  });
5503
5521
  if (resolvedValue === AWS_NO_VALUE) continue;
5504
- resolved[name] = isScalarList(resolvedValue) ? resolvedValue.map((element) => String(element)).join(",") : resolvedValue;
5522
+ const childValue = isScalarList(resolvedValue) ? resolvedValue.map((element) => String(element)).join(",") : resolvedValue;
5523
+ resolved[name] = childValue;
5524
+ if (secretTokens !== void 0 && typeof childValue === "string") {
5525
+ const refs = /* @__PURE__ */ new Set();
5526
+ collectRefTargets(value, refs);
5527
+ const tokens = /* @__PURE__ */ new Set();
5528
+ for (const token of dynamicReferenceTokens(childValue)) if (skippedSecretReferences.has(token) || [...refs].some((ref) => secretTokens.inherited?.get(ref)?.has(token) === true)) tokens.add(token);
5529
+ if (tokens.size > 0) secretTokens.child.set(name, tokens);
5530
+ }
5505
5531
  } catch {
5506
5532
  unresolvedKeys?.add(name);
5507
5533
  }
@@ -5516,10 +5542,27 @@ function recordedTemplateResources(template, state) {
5516
5542
  for (const [logicalId, resource] of Object.entries(resources)) if (Object.prototype.hasOwnProperty.call(stateResources, logicalId)) recorded[logicalId] = resource;
5517
5543
  return recorded;
5518
5544
  }
5545
+ function healerUnderRecordPrintingBag(healer, resources) {
5546
+ let judged;
5547
+ const bagFor = (logicalId, resource) => {
5548
+ const map = resources();
5549
+ if (!Object.hasOwn(map, logicalId) || map[logicalId] !== resource) return secretNamePrintingBag(logicalId, {
5550
+ ...map,
5551
+ [logicalId]: resource
5552
+ });
5553
+ if (judged?.map !== map) judged = {
5554
+ map,
5555
+ bagOf: secretNamePrintingBags(map, void 0)
5556
+ };
5557
+ return judged.bagOf(logicalId);
5558
+ };
5559
+ return Object.assign((logicalId, resource) => withPrintingSecrets(bagFor(logicalId, resource), () => healer(logicalId, resource)), healer);
5560
+ }
5519
5561
  async function buildDiffTree(args) {
5520
- const { stackName, displayName, region, template, nestedTemplates, recursive, stateBackend, diffCalculator, parentHasSecretReference, parameters, parentUnresolvedParameters, canonicalizeProperties, assetRedirect, cfnFallback, producerLookup, consumerAccount, previewOrphanAdoption, attributeHealerFor, ancestorTemplatePaths, isNestedChild, inheritedSecrets, inheritedDerivedNames, inheritedNoEchoParameters, inheritedNoEchoParametersAnyVerdict, refusalRecovery, inheritedReferenceProvenance } = args;
5521
- const attributeHealer = attributeHealerFor?.(stackName, region);
5562
+ const { stackName, displayName, region, template, nestedTemplates, recursive, stateBackend, diffCalculator, parentHasSecretReference, parameters, parentUnresolvedParameters, canonicalizeProperties, assetRedirect, cfnFallback, producerLookup, consumerAccount, previewOrphanAdoption, attributeHealerFor, ancestorTemplatePaths, isNestedChild, inheritedSecrets, inheritedDerivedNames, inheritedNoEchoParameters, inheritedNoEchoParametersAnyVerdict, refusalRecovery, inheritedReferenceProvenance, inheritedSecretTokens } = args;
5563
+ const unboundHealer = attributeHealerFor?.(stackName, region);
5522
5564
  const { state, unreadable, unreadableContainers, deployRefusals } = await loadStateOrEmpty(stackName, region, stateBackend, refusalRecovery);
5565
+ const attributeHealer = unboundHealer;
5523
5566
  const createOnlyPrefetch = prefetchCreateOnlyPropertyPaths(templateResourceTypes(recordedTemplateResources(template, state)));
5524
5567
  const secretBearingAbove = parentHasSecretReference === true || templateHasSecretDynamicReference(template);
5525
5568
  let stackDiff;
@@ -5537,6 +5580,7 @@ async function buildDiffTree(args) {
5537
5580
  ...inheritedNoEchoParameters && { inheritedNoEchoParameters },
5538
5581
  ...inheritedNoEchoParametersAnyVerdict && { inheritedNoEchoParametersAnyVerdict },
5539
5582
  ...inheritedReferenceProvenance && { inheritedReferenceProvenance },
5583
+ ...inheritedSecretTokens && { inheritedSecretTokens },
5540
5584
  ...attributeHealer && { attributeHealer },
5541
5585
  ...refusalRecovery && { refusalRecovery },
5542
5586
  inheritSecretBearingTemplate: false,
@@ -5597,7 +5641,11 @@ async function buildDiffTree(args) {
5597
5641
  ...inheritedNoEchoParametersAnyVerdict ?? []
5598
5642
  ]), void 0, stateAfterAdoption.resources);
5599
5643
  const rowDerivedNames = /* @__PURE__ */ new Map();
5600
- const childParameters = await resolveChildStackParameters(resource, effectiveTemplate, stateAfterAdoption, region, stackName, stateBackend, resolvedParameters, conditions, cfnFallback, printingSecrets, attributeHealer, childUnresolvedParameters, trust, rowDerivedNames, producerLookup, consumerAccount);
5644
+ const childSecretTokens = /* @__PURE__ */ new Map();
5645
+ const childParameters = await resolveChildStackParameters(resource, effectiveTemplate, stateAfterAdoption, region, stackName, stateBackend, resolvedParameters, conditions, cfnFallback, printingSecrets, attributeHealer && healerUnderRecordPrintingBag(attributeHealer, () => stateAfterAdoption.resources ?? {}), childUnresolvedParameters, trust, rowDerivedNames, producerLookup, consumerAccount, {
5646
+ inherited: inheritedSecretTokens,
5647
+ child: childSecretTokens
5648
+ });
5601
5649
  const childDerivedNames = diffPrintingSecrets([
5602
5650
  inheritedDerivedNames,
5603
5651
  rowDerivedNames,
@@ -5636,7 +5684,8 @@ async function buildDiffTree(args) {
5636
5684
  ...childNoEchoParameters.size > 0 && { inheritedNoEchoParameters: childNoEchoParameters },
5637
5685
  ...childNoEchoParametersAnyVerdict.size > 0 && { inheritedNoEchoParametersAnyVerdict: childNoEchoParametersAnyVerdict },
5638
5686
  ...refusalRecovery && { refusalRecovery },
5639
- ...childReferenceProvenance && { inheritedReferenceProvenance: childReferenceProvenance }
5687
+ ...childReferenceProvenance && { inheritedReferenceProvenance: childReferenceProvenance },
5688
+ ...childSecretTokens.size > 0 && { inheritedSecretTokens: childSecretTokens }
5640
5689
  });
5641
5690
  node.children.push(await (hasMaskableValues(childDerivedNames) ? withPrintingSecrets(childDerivedNames, buildChild) : buildChild()));
5642
5691
  }
@@ -9979,6 +10028,8 @@ async function runDriftForStack(stackName, region, stateBackend, providerRegistr
9979
10028
  const secretResolvers = new DriftSecretResolvers(region);
9980
10029
  const producerRegions = await driftProducerRegionEvidence(state, stackName, region, stateBackend);
9981
10030
  const entries = Object.entries(state.resources ?? {}).sort(([a], [b]) => a.localeCompare(b));
10031
+ const printingBagOf = secretNamePrintingBags(state.resources ?? {}, void 0);
10032
+ const stackSecretNames = secretNamedRecordNeedles(state.resources ?? {}, void 0);
9982
10033
  const consecutiveReadFailures = {
9983
10034
  provider: 0,
9984
10035
  ccApi: 0
@@ -10065,164 +10116,168 @@ async function runDriftForStack(stackName, region, stateBackend, providerRegistr
10065
10116
  continue;
10066
10117
  }
10067
10118
  let readReturned = false;
10068
- try {
10069
- let aws;
10070
- if (provider.readCurrentState) {
10071
- aws = await provider.readCurrentState(resource.physicalId, logicalId, resource.resourceType, resource.properties ?? {}, buildReadCurrentStateContext(state, logicalId));
10072
- readReturned = true;
10073
- noteReadReturned();
10074
- } else {
10075
- if (CC_API_FALLBACK_DENY_LIST[resource.resourceType]) {
10119
+ const printing = printingBagOf(logicalId);
10120
+ await withPrintingSecrets(printing, async () => {
10121
+ try {
10122
+ let aws;
10123
+ if (provider.readCurrentState) {
10124
+ aws = await provider.readCurrentState(resource.physicalId, logicalId, resource.resourceType, resource.properties ?? {}, buildReadCurrentStateContext(state, logicalId));
10125
+ readReturned = true;
10126
+ noteReadReturned();
10127
+ } else {
10128
+ if (CC_API_FALLBACK_DENY_LIST[resource.resourceType]) {
10129
+ outcomes.push({
10130
+ kind: "unsupported",
10131
+ logicalId,
10132
+ resourceType: resource.resourceType
10133
+ });
10134
+ return;
10135
+ }
10136
+ const ccApiAws = await ccApiFallback.readCurrentState(resource.physicalId, logicalId, resource.resourceType, resource.properties ?? {});
10137
+ readReturned = true;
10138
+ noteReadReturned();
10139
+ if (ccApiAws === void 0) {
10140
+ outcomes.push({
10141
+ kind: "unsupported",
10142
+ logicalId,
10143
+ resourceType: resource.resourceType
10144
+ });
10145
+ return;
10146
+ }
10147
+ aws = ccApiAws === RESOURCE_NOT_FOUND ? ccApiAws : stripCcApiAwsManagedFields(resource.resourceType, ccApiAws);
10148
+ }
10149
+ if (aws === RESOURCE_NOT_FOUND) {
10076
10150
  outcomes.push({
10077
- kind: "unsupported",
10151
+ kind: "deleted",
10078
10152
  logicalId,
10079
10153
  resourceType: resource.resourceType
10080
10154
  });
10081
- continue;
10155
+ return;
10082
10156
  }
10083
- const ccApiAws = await ccApiFallback.readCurrentState(resource.physicalId, logicalId, resource.resourceType, resource.properties ?? {});
10084
- readReturned = true;
10085
- noteReadReturned();
10086
- if (ccApiAws === void 0) {
10157
+ if (aws === void 0) {
10087
10158
  outcomes.push({
10088
10159
  kind: "unsupported",
10089
10160
  logicalId,
10090
10161
  resourceType: resource.resourceType
10091
10162
  });
10092
- continue;
10163
+ return;
10093
10164
  }
10094
- aws = ccApiAws === RESOURCE_NOT_FOUND ? ccApiAws : stripCcApiAwsManagedFields(resource.resourceType, ccApiAws);
10095
- }
10096
- if (aws === RESOURCE_NOT_FOUND) {
10097
- outcomes.push({
10098
- kind: "deleted",
10099
- logicalId,
10100
- resourceType: resource.resourceType
10101
- });
10102
- continue;
10103
- }
10104
- if (aws === void 0) {
10105
- outcomes.push({
10106
- kind: "unsupported",
10107
- logicalId,
10108
- resourceType: resource.resourceType
10109
- });
10110
- continue;
10111
- }
10112
- const ignorePaths = provider.getDriftUnknownPaths ? provider.getDriftUnknownPaths(resource.resourceType, resource.properties ?? {}) : [];
10113
- const unorderedPaths = provider.getDriftUnorderedPaths ? provider.getDriftUnorderedPaths(resource.resourceType) : [];
10114
- const useObserved = resource.observedProperties !== void 0;
10115
- const baseline = useObserved ? resource.observedProperties : resource.properties ?? {};
10116
- const secretPaths = /* @__PURE__ */ new Set();
10117
- const seededSecretPaths = /* @__PURE__ */ new Set();
10118
- collectDynamicReferencePaths(baseline, seededSecretPaths);
10119
- if (useObserved) collectDynamicReferencePaths(resource.properties ?? {}, seededSecretPaths);
10120
- const maskSecretPaths = /* @__PURE__ */ new Set();
10121
- collectSecretMaskPaths(baseline, maskSecretPaths);
10122
- if (useObserved) collectSecretMaskPaths(resource.properties ?? {}, maskSecretPaths);
10123
- const unresolvedTokens = /* @__PURE__ */ new Set();
10124
- const noteUnresolved = (tokens) => {
10125
- for (const token of tokens) unresolvedTokens.add(token);
10126
- };
10127
- let comparisonBaseline = baseline;
10128
- let secretResolutionFailed = false;
10129
- try {
10130
- comparisonBaseline = await resolveStateSecretExpressions(baseline, secretResolvers, secrets, {
10131
- secretPaths,
10132
- onUnresolved: noteUnresolved,
10133
- logicalId,
10134
- consumerRegion: region,
10135
- record: resource,
10136
- producerRegions
10137
- });
10138
- if (useObserved) await resolveStateSecretExpressions(resource.properties ?? {}, secretResolvers, secrets, {
10139
- secretPaths,
10140
- onUnresolved: noteUnresolved,
10141
- logicalId,
10142
- consumerRegion: region,
10143
- record: resource,
10144
- producerRegions
10145
- });
10146
- } catch (err) {
10147
- secretResolutionFailed = true;
10148
- comparisonBaseline = baseline;
10149
- const refused = isDriftSecretRefusal(err);
10150
- logger.warn(`${logicalId} (${resource.resourceType}): ` + (refused ? "refused to resolve a dynamic reference this resource's state records, so its secret-bearing properties are NOT compared — " : "could not resolve the dynamic reference(s) this resource's state records, so its secret-bearing properties are NOT compared — ") + `${maskSecretsInText(describeAwsFailure(err).detail, secrets)}`);
10151
- for (const plaintext of secrets.keys()) recordLogOnlyValue(secrets, plaintext);
10152
- secrets.clear();
10153
- }
10154
- if (unresolvedTokens.size > 0) logger.warn(`${logicalId} (${resource.resourceType}): cdkd cannot resolve ${maskSecretsInText([...unresolvedTokens].join(", "), secrets)} — those properties are NOT compared. A revert leaves a property whose WHOLE value is one of these tokens untouched where its position can be matched against AWS's report (a list element pairs by an identity field, or by the list's own unchanged literal values). A token EMBEDDED in a longer string is left untouched the same way when the rest of that string is exactly what AWS holds. Where it cannot be matched, the revert writes the token literal, exactly as 'cdkd deploy' does — so a resolved value AWS holds there WOULD be overwritten. cdkd resolves 'secretsmanager', 'ssm' and 'ssm-secure' references; anything else is left as written.`);
10155
- const observedIgnorePaths = useObserved ? undeclaredEmptyObservedKeys(resource.observedProperties, resource.properties ?? {}) : [];
10156
- const normalized = await canonicalizePrincipalUniqueIds(comparisonBaseline, aws, resolvePrincipalUniqueId);
10157
- const protocolNormalized = canonicalizeIpProtocols(normalized.baseline, normalized.aws, resource.resourceType);
10158
- const canonicalized = provider.canonicalizeDriftProperties ? {
10159
- baseline: provider.canonicalizeDriftProperties(resource.resourceType, protocolNormalized.baseline),
10160
- aws: provider.canonicalizeDriftProperties(resource.resourceType, protocolNormalized.aws)
10161
- } : protocolNormalized;
10162
- const paired = provider.canonicalizeDriftPair ? await provider.canonicalizeDriftPair(resource.resourceType, canonicalized.baseline, canonicalized.aws, resource.properties ?? {}) : canonicalized;
10163
- const nameBaseline = canonicalizeDerivedPatternBName(resource.resourceType, paired.baseline, paired.aws);
10164
- const noEchoPartitioned = partitionNoEchoParameterChanges(calculateResourceDrift(nameBaseline, paired.aws, {
10165
- ignorePaths: observedIgnorePaths.length ? [...ignorePaths, ...observedIgnorePaths] : ignorePaths,
10166
- unionWalkObjects: useObserved,
10167
- unorderedPaths
10168
- }), resource, baseline);
10169
- const partitioned = partitionUncertifiedBaselineChanges(noEchoPartitioned.kept, resource.properties ?? {}, baseline);
10170
- const reported = redactDriftChanges(partitioned.kept, secrets, secretResolutionFailed ? seededSecretPaths : secretPaths, maskSecretPaths);
10171
- const notComparedCause = secretResolutionFailed ? "refused" : partitioned.uncertifiedPaths.length > 0 ? "uncertifiedBaseline" : unresolvedTokens.size > 0 ? "unresolvedToken" : noEchoPartitioned.noEchoParameterPaths.length > 0 ? "noEchoParameter" : void 0;
10172
- if (reported.changes.length === 0) {
10173
- if (notComparedCause !== void 0) outcomes.push({
10174
- kind: "notCompared",
10165
+ const ignorePaths = provider.getDriftUnknownPaths ? provider.getDriftUnknownPaths(resource.resourceType, resource.properties ?? {}) : [];
10166
+ const unorderedPaths = provider.getDriftUnorderedPaths ? provider.getDriftUnorderedPaths(resource.resourceType) : [];
10167
+ const useObserved = resource.observedProperties !== void 0;
10168
+ const baseline = useObserved ? resource.observedProperties : resource.properties ?? {};
10169
+ const secretPaths = /* @__PURE__ */ new Set();
10170
+ const seededSecretPaths = /* @__PURE__ */ new Set();
10171
+ collectDynamicReferencePaths(baseline, seededSecretPaths);
10172
+ if (useObserved) collectDynamicReferencePaths(resource.properties ?? {}, seededSecretPaths);
10173
+ const maskSecretPaths = /* @__PURE__ */ new Set();
10174
+ collectSecretMaskPaths(baseline, maskSecretPaths);
10175
+ if (useObserved) collectSecretMaskPaths(resource.properties ?? {}, maskSecretPaths);
10176
+ const unresolvedTokens = /* @__PURE__ */ new Set();
10177
+ const noteUnresolved = (tokens) => {
10178
+ for (const token of tokens) unresolvedTokens.add(token);
10179
+ };
10180
+ let comparisonBaseline = baseline;
10181
+ let secretResolutionFailed = false;
10182
+ try {
10183
+ comparisonBaseline = await resolveStateSecretExpressions(baseline, secretResolvers, secrets, {
10184
+ secretPaths,
10185
+ onUnresolved: noteUnresolved,
10186
+ logicalId,
10187
+ consumerRegion: region,
10188
+ record: resource,
10189
+ producerRegions
10190
+ });
10191
+ if (useObserved) await resolveStateSecretExpressions(resource.properties ?? {}, secretResolvers, secrets, {
10192
+ secretPaths,
10193
+ onUnresolved: noteUnresolved,
10194
+ logicalId,
10195
+ consumerRegion: region,
10196
+ record: resource,
10197
+ producerRegions
10198
+ });
10199
+ } catch (err) {
10200
+ secretResolutionFailed = true;
10201
+ comparisonBaseline = baseline;
10202
+ const refused = isDriftSecretRefusal(err);
10203
+ logger.warn(`${logicalId} (${resource.resourceType}): ` + (refused ? "refused to resolve a dynamic reference this resource's state records, so its secret-bearing properties are NOT compared — " : "could not resolve the dynamic reference(s) this resource's state records, so its secret-bearing properties are NOT compared — ") + `${maskSecretsInText(describeAwsFailure(err).detail, secrets)}`);
10204
+ for (const plaintext of secrets.keys()) recordLogOnlyValue(secrets, plaintext);
10205
+ secrets.clear();
10206
+ }
10207
+ if (unresolvedTokens.size > 0) logger.warn(`${logicalId} (${resource.resourceType}): cdkd cannot resolve ${maskSecretsInText([...unresolvedTokens].join(", "), secrets)} — those properties are NOT compared. A revert leaves a property whose WHOLE value is one of these tokens untouched where its position can be matched against AWS's report (a list element pairs by an identity field, or by the list's own unchanged literal values). A token EMBEDDED in a longer string is left untouched the same way when the rest of that string is exactly what AWS holds. Where it cannot be matched, the revert writes the token literal, exactly as 'cdkd deploy' does — so a resolved value AWS holds there WOULD be overwritten. cdkd resolves 'secretsmanager', 'ssm' and 'ssm-secure' references; anything else is left as written.`);
10208
+ const observedIgnorePaths = useObserved ? undeclaredEmptyObservedKeys(resource.observedProperties, resource.properties ?? {}) : [];
10209
+ const normalized = await canonicalizePrincipalUniqueIds(comparisonBaseline, aws, resolvePrincipalUniqueId);
10210
+ const protocolNormalized = canonicalizeIpProtocols(normalized.baseline, normalized.aws, resource.resourceType);
10211
+ const canonicalized = provider.canonicalizeDriftProperties ? {
10212
+ baseline: provider.canonicalizeDriftProperties(resource.resourceType, protocolNormalized.baseline),
10213
+ aws: provider.canonicalizeDriftProperties(resource.resourceType, protocolNormalized.aws)
10214
+ } : protocolNormalized;
10215
+ const paired = provider.canonicalizeDriftPair ? await provider.canonicalizeDriftPair(resource.resourceType, canonicalized.baseline, canonicalized.aws, resource.properties ?? {}) : canonicalized;
10216
+ const nameBaseline = canonicalizeDerivedPatternBName(resource.resourceType, paired.baseline, paired.aws);
10217
+ const noEchoPartitioned = partitionNoEchoParameterChanges(calculateResourceDrift(nameBaseline, paired.aws, {
10218
+ ignorePaths: observedIgnorePaths.length ? [...ignorePaths, ...observedIgnorePaths] : ignorePaths,
10219
+ unionWalkObjects: useObserved,
10220
+ unorderedPaths
10221
+ }), resource, baseline);
10222
+ const partitioned = partitionUncertifiedBaselineChanges(noEchoPartitioned.kept, resource.properties ?? {}, baseline);
10223
+ const reported = redactDriftChanges(partitioned.kept, secrets, secretResolutionFailed ? seededSecretPaths : secretPaths, maskSecretPaths);
10224
+ const notComparedCause = secretResolutionFailed ? "refused" : partitioned.uncertifiedPaths.length > 0 ? "uncertifiedBaseline" : unresolvedTokens.size > 0 ? "unresolvedToken" : noEchoPartitioned.noEchoParameterPaths.length > 0 ? "noEchoParameter" : void 0;
10225
+ if (reported.changes.length === 0) {
10226
+ if (notComparedCause !== void 0) outcomes.push({
10227
+ kind: "notCompared",
10228
+ logicalId,
10229
+ resourceType: resource.resourceType,
10230
+ notComparedCause
10231
+ });
10232
+ else outcomes.push({
10233
+ kind: "clean",
10234
+ logicalId,
10235
+ resourceType: resource.resourceType
10236
+ });
10237
+ } else outcomes.push({
10238
+ kind: "drifted",
10175
10239
  logicalId,
10176
10240
  resourceType: resource.resourceType,
10241
+ ...reported,
10242
+ awsProperties: aws,
10243
+ secrets,
10244
+ printingNeedles: unionOfSecretBags([printing, stackSecretNames]),
10245
+ uncertifiedPaths: partitioned.uncertifiedPaths,
10246
+ noEchoParameterPaths: noEchoPartitioned.noEchoParameterPaths,
10247
+ secretsIncomplete: secretResolutionFailed || unresolvedTokens.size > 0,
10177
10248
  notComparedCause
10178
10249
  });
10179
- else outcomes.push({
10180
- kind: "clean",
10181
- logicalId,
10182
- resourceType: resource.resourceType
10183
- });
10184
- } else outcomes.push({
10185
- kind: "drifted",
10186
- logicalId,
10187
- resourceType: resource.resourceType,
10188
- ...reported,
10189
- awsProperties: aws,
10190
- secrets,
10191
- uncertifiedPaths: partitioned.uncertifiedPaths,
10192
- noEchoParameterPaths: noEchoPartitioned.noEchoParameterPaths,
10193
- secretsIncomplete: secretResolutionFailed || unresolvedTokens.size > 0,
10194
- notComparedCause
10195
- });
10196
- } catch (err) {
10197
- if (isNoReadHandlerError(err)) {
10198
- logger.debug(`${logicalId} (${resource.resourceType}): read threw with a no-READ-handler signature, reported as drift unknown — ${maskSecretsInText(describeAwsFailure(err).detail, secrets)}`);
10199
- noteReadReturned();
10250
+ } catch (err) {
10251
+ if (isNoReadHandlerError(err)) {
10252
+ logger.debug(`${logicalId} (${resource.resourceType}): read threw with a no-READ-handler signature, reported as drift unknown — ${maskSecretsInText(describeAwsFailure(err).detail, secrets)}`);
10253
+ noteReadReturned();
10254
+ outcomes.push({
10255
+ kind: "unsupported",
10256
+ logicalId,
10257
+ resourceType: resource.resourceType
10258
+ });
10259
+ return;
10260
+ }
10200
10261
  outcomes.push({
10201
- kind: "unsupported",
10262
+ kind: "notCompared",
10202
10263
  logicalId,
10203
- resourceType: resource.resourceType
10264
+ resourceType: resource.resourceType,
10265
+ notComparedCause: "readFailed"
10204
10266
  });
10205
- continue;
10206
- }
10207
- outcomes.push({
10208
- kind: "notCompared",
10209
- logicalId,
10210
- resourceType: resource.resourceType,
10211
- notComparedCause: "readFailed"
10212
- });
10213
- let breakerTripped = false;
10214
- if (!readReturned) {
10215
- consecutiveReadFailures[readPath]++;
10216
- if (consecutiveReadFailures[readPath] === 5) {
10217
- trippedReadPaths.add(readPath);
10218
- breakerTripped = true;
10267
+ let breakerTripped = false;
10268
+ if (!readReturned) {
10269
+ consecutiveReadFailures[readPath]++;
10270
+ if (consecutiveReadFailures[readPath] === 5) {
10271
+ trippedReadPaths.add(readPath);
10272
+ breakerTripped = true;
10273
+ }
10219
10274
  }
10275
+ logger.warn(`${logicalId} (${resource.resourceType}): could not be compared — the read or comparison failed, so NONE of its properties were checked. ` + (trippedReadPaths.size > 0 ? "" : `cdkd goes on with the rest of this stack. `) + `${maskSecretsInText(describeAwsFailure(err).detail, secrets)}`);
10276
+ if (breakerTripped) logger.warn(safeMsg`${5} reads in a row in this stack failed ` + safeMsg`${DRIFT_READ_PATH_LABELS[readPath]} — expired credentials, a revoked ` + "role, a permission all of them need, or a burst of throttling — so cdkd stops reading this stack's resources that way, and reports each one left as not compared. Fix the cause, or re-run if it was throttling.");
10277
+ if (err instanceof Error && err.stack) logger.debug(`${logicalId} (${resource.resourceType}): comparison failure detail`, maskSecretsInError(err, secrets).stack);
10278
+ return;
10220
10279
  }
10221
- logger.warn(`${logicalId} (${resource.resourceType}): could not be compared — the read or comparison failed, so NONE of its properties were checked. ` + (trippedReadPaths.size > 0 ? "" : `cdkd goes on with the rest of this stack. `) + `${maskSecretsInText(describeAwsFailure(err).detail, secrets)}`);
10222
- if (breakerTripped) logger.warn(safeMsg`${5} reads in a row in this stack failed ` + safeMsg`${DRIFT_READ_PATH_LABELS[readPath]} — expired credentials, a revoked ` + "role, a permission all of them need, or a burst of throttling — so cdkd stops reading this stack's resources that way, and reports each one left as not compared. Fix the cause, or re-run if it was throttling.");
10223
- if (err instanceof Error && err.stack) logger.debug(`${logicalId} (${resource.resourceType}): comparison failure detail`, maskSecretsInError(err, secrets).stack);
10224
- continue;
10225
- }
10280
+ });
10226
10281
  }
10227
10282
  const warnings = warnIfPreV10BaselineGap(state, outcomes, logger);
10228
10283
  return {
@@ -10368,7 +10423,7 @@ async function runAccept(reports, stateBackend, stateConfig, awsClients, options
10368
10423
  const refusal = acceptRefusalReason(change, outcome.maskedPaths);
10369
10424
  if (refusal !== void 0) {
10370
10425
  const revert = revertCommandLine(report.stackName, report.region);
10371
- logger.warn(` ! ${report.stackName}/${outcome.logicalId} (${outcome.resourceType}): not accepting '${change.path}' — ${refusal}, so cdkd will not write it to ` + (revert === void 0 ? "state. Run 'cdkd drift --revert' for this stack to push the referenced value back to AWS, or re-deploy if the reference changed." : `state. Push the referenced value back to AWS with the command below, or re-deploy if the reference changed.\nRevert with: ${revert}`));
10426
+ logger.warn(` ! ${report.stackName}/${outcome.logicalId} (${outcome.resourceType}): not accepting '${displayDriftPath(outcome, change.path)}' — ${refusal}, so cdkd will not write it to ` + (revert === void 0 ? "state. Run 'cdkd drift --revert' for this stack to push the referenced value back to AWS, or re-deploy if the reference changed." : `state. Push the referenced value back to AWS with the command below, or re-deploy if the reference changed.\nRevert with: ${revert}`));
10372
10427
  continue;
10373
10428
  }
10374
10429
  setAtPath(newBaseline, change.path, change.awsValue);
@@ -10381,7 +10436,7 @@ async function runAccept(reports, stateBackend, stateConfig, awsClients, options
10381
10436
  recordedChanges++;
10382
10437
  continue;
10383
10438
  }
10384
- logger.warn(` ! ${report.stackName}/${outcome.logicalId} (${outcome.resourceType}): '${change.path}' was NOT recorded — after redaction cdkd state holds a different value at that property. Usually an unresolved '{{resolve:...}}' reference sits there and wins over an accepted value (change the template if that reference is wrong); a readback value cdkd cannot compare is never called recorded.`);
10439
+ logger.warn(` ! ${report.stackName}/${outcome.logicalId} (${outcome.resourceType}): '${displayDriftPath(outcome, change.path)}' was NOT recorded — after redaction cdkd state holds a different value at that property. Usually an unresolved '{{resolve:...}}' reference sits there and wins over an accepted value (change the template if that reference is wrong); a readback value cdkd cannot compare is never called recorded.`);
10385
10440
  }
10386
10441
  if (recordedChanges > 0) acceptedResourceCount++;
10387
10442
  const written = maskMarkedNoEchoBaselineWithLeaves(redactedBaseline, existing, hasObserved);
@@ -11098,11 +11153,11 @@ function printAcceptPlan(reports, out) {
11098
11153
  for (const change of o.changes) {
11099
11154
  const refusal = acceptRefusalReason(change, o.maskedPaths);
11100
11155
  if (refusal !== void 0) {
11101
- lines.push(` ${reportPath(change.path)}: SKIPPED — ${refusal}\n`);
11156
+ lines.push(` ${reportPath(displayDriftPath(o, change.path))}: SKIPPED — ${refusal}\n`);
11102
11157
  continue;
11103
11158
  }
11104
11159
  plannedWrites++;
11105
- lines.push(reportPlanChangeLine(change.path, change.stateValue, change.awsValue));
11160
+ lines.push(reportPlanChangeLine(displayDriftPath(o, change.path), displayDriftValue(o, change.stateValue), displayDriftValue(o, change.awsValue)));
11106
11161
  }
11107
11162
  }
11108
11163
  out.write(plannedWrites === 0 ? `\nPlan (--accept): no accepted values will be written to cdkd state for ${reportHeading(report)} — every drifted change below is refused (the run still writes the positioned re-redaction):\n` : `\nPlan (--accept): update cdkd state for ${reportHeading(report)}:\n`);
@@ -11142,7 +11197,7 @@ function printRevertPlan(reports, out, recovery) {
11142
11197
  }
11143
11198
  const word = o.changes.length === 1 ? "property path" : "property paths";
11144
11199
  out.write(` → provider.update on ${reportResource(o)}: revert ${o.changes.length} ${word}\n`);
11145
- for (const change of o.changes) out.write(reportPlanChangeLine(change.path, change.awsValue, change.stateValue));
11200
+ for (const change of o.changes) out.write(reportPlanChangeLine(displayDriftPath(o, change.path), displayDriftValue(o, change.awsValue), displayDriftValue(o, change.stateValue)));
11146
11201
  const stateResource = report.state.resources[o.logicalId];
11147
11202
  if (stateResource) {
11148
11203
  const preserved = findRevertPreservedTagKeys(o.changes, stateResource.observedProperties ?? stateResource.properties ?? {}, o.awsProperties);
@@ -11150,7 +11205,7 @@ function printRevertPlan(reports, out, recovery) {
11150
11205
  else if (preserved.length > 0) {
11151
11206
  const tagWord = preserved.length === 1 ? "tag" : "tags";
11152
11207
  out.write(` ! reverting this tag list KEEPS ${preserved.length} AWS-authored ${tagWord} the baseline does not carry:\n`);
11153
- for (const path of preserved) out.write(` ${reportPath(maskSecretsInText(path, o.secrets))}\n`);
11208
+ for (const path of preserved) out.write(` ${reportPath(displayDriftPath(o, maskSecretsInText(path, o.secrets)))}\n`);
11154
11209
  const othersRevert = stateResource.observedProperties === void 0 ? "" : `Every other tag reverts normally. `;
11155
11210
  out.write(` ${othersRevert}A service may require these (ECS needs AmazonECSManaged for managed scaling); 'aws:'-prefixed keys are AWS-reserved and cannot be removed by hand.\n`);
11156
11211
  }
@@ -11161,7 +11216,7 @@ function printRevertPlan(reports, out, recovery) {
11161
11216
  else if (unbaselined.length > 0) {
11162
11217
  const word = unbaselined.length === 1 ? "value" : "values";
11163
11218
  out.write(` ! this resource has no observed-capture baseline, so the revert pushes the raw TEMPLATE and LEAVES ${unbaselined.length} AWS-authored ${word} untouched:\n`);
11164
- for (const path of unbaselined) out.write(` ${reportPath(maskSecretsInText(path, o.secrets))}\n`);
11219
+ for (const path of unbaselined) out.write(` ${reportPath(displayDriftPath(o, maskSecretsInText(path, o.secrets)))}\n`);
11165
11220
  const refresh = mayNameTarget(report.stackName, report.region) ? pasteableCommand("cdkd state refresh-observed", [
11166
11221
  {
11167
11222
  value: report.stackName,
@@ -11212,7 +11267,12 @@ function writeJsonReport(reports) {
11212
11267
  drifted.push({
11213
11268
  logicalId: d.logicalId,
11214
11269
  type: d.resourceType,
11215
- changes: d.changes,
11270
+ changes: d.changes.map((change) => ({
11271
+ ...change,
11272
+ path: displayDriftPath(d, change.path),
11273
+ stateValue: displayDriftValue(d, change.stateValue),
11274
+ awsValue: displayDriftValue(d, change.awsValue)
11275
+ })),
11216
11276
  referencesUnresolved: d.notComparedCause !== void 0
11217
11277
  });
11218
11278
  },
@@ -11283,6 +11343,35 @@ function reportValue(value) {
11283
11343
  if (value === value.trim() && !value.startsWith("\"") && !ALTERED_BY_SAFE_MSG.test(value)) return value;
11284
11344
  return escapeJsonLiterals(JSON.stringify(value));
11285
11345
  }
11346
+ function displayDriftValue(outcome, value) {
11347
+ const bag = outcome.printingNeedles;
11348
+ if (bag === void 0 || !hasMaskableValues(bag)) return value;
11349
+ return maskDriftDisplayLeaves(value, (text) => maskSecretsInText(text, bag));
11350
+ }
11351
+ function displayDriftPath(outcome, path) {
11352
+ const bag = outcome.printingNeedles;
11353
+ if (bag === void 0 || !hasMaskableValues(bag)) return path;
11354
+ return maskSecretsInText(path, bag);
11355
+ }
11356
+ function maskDriftDisplayLeaves(value, mask) {
11357
+ if (typeof value === "string") return mask(value);
11358
+ if (Array.isArray(value)) return value.map((entry) => maskDriftDisplayLeaves(entry, mask));
11359
+ if (value !== null && typeof value === "object") {
11360
+ const out = nullPrototypeRecord();
11361
+ const entries = Object.entries(value);
11362
+ const taken = new Set(entries.map(([key]) => key).filter((key) => mask(key) === key));
11363
+ for (const [key, entry] of entries) {
11364
+ let shown = mask(key);
11365
+ if (shown !== key) {
11366
+ for (let n = 2; taken.has(shown); n++) shown = `${mask(key)}#${n}`;
11367
+ taken.add(shown);
11368
+ }
11369
+ out[shown] = maskDriftDisplayLeaves(entry, mask);
11370
+ }
11371
+ return out;
11372
+ }
11373
+ return value;
11374
+ }
11286
11375
  function reportChangeLine(sign, path, value) {
11287
11376
  return safeMsg` ${sign} ${reportIdent(path, 255)}: ${reportValue(value)}\n`;
11288
11377
  }
@@ -11345,8 +11434,8 @@ function writeHumanReport(reports) {
11345
11434
  for (const o of drifted) {
11346
11435
  process.stdout.write(` ~ ${reportResource(o)}\n`);
11347
11436
  for (const change of o.changes) {
11348
- process.stdout.write(reportChangeLine("-", change.path, change.stateValue));
11349
- process.stdout.write(reportChangeLine("+", change.path, change.awsValue));
11437
+ process.stdout.write(reportChangeLine("-", displayDriftPath(o, change.path), displayDriftValue(o, change.stateValue)));
11438
+ process.stdout.write(reportChangeLine("+", displayDriftPath(o, change.path), displayDriftValue(o, change.awsValue)));
11350
11439
  }
11351
11440
  process.stdout.write("\n");
11352
11441
  }
@@ -11677,6 +11766,37 @@ async function releaseRegistryMarkerAfterDestroy(ctx, stackName, region, logger)
11677
11766
  }
11678
11767
  }
11679
11768
  async function runDestroyForStack(stackName, state, ctx) {
11769
+ const stackRegion = state.region;
11770
+ if (!stackRegion || stackRegion === ctx.baseRegion) return destroyStackInRegion(stackName, state, ctx, void 0);
11771
+ const scopeClients = new AwsClients({
11772
+ region: stackRegion,
11773
+ ...ctx.profile && { profile: ctx.profile }
11774
+ });
11775
+ try {
11776
+ const awsScope = {
11777
+ region: stackRegion,
11778
+ clients: scopeClients
11779
+ };
11780
+ const registry = new ProviderRegistry();
11781
+ const nestedContext = getCurrentNestedStackContext();
11782
+ const destroyInScope = () => destroyStackInRegion(stackName, state, ctx, {
11783
+ clients: scopeClients,
11784
+ registry
11785
+ });
11786
+ return await runInStackAwsScope(awsScope, () => nestedContext === void 0 ? destroyInScope() : withNestedStackContext({
11787
+ ...nestedContext,
11788
+ providerRegistry: registry,
11789
+ awsClients: scopeClients
11790
+ }, destroyInScope));
11791
+ } finally {
11792
+ try {
11793
+ scopeClients.destroy();
11794
+ } catch (destroyError) {
11795
+ getLogger().debug(`Failed to destroy region-scoped AWS clients: ${describeAwsFailure(destroyError).detail}`);
11796
+ }
11797
+ }
11798
+ }
11799
+ async function destroyStackInRegion(stackName, state, ctx, stackScope) {
11680
11800
  const providerClasses = await loadProviderClasses();
11681
11801
  const logger = getLogger();
11682
11802
  const result = {
@@ -11829,29 +11949,20 @@ async function runDestroyForStack(stackName, state, ctx) {
11829
11949
  const restoreBaseRegionAndClients = () => {
11830
11950
  if (!regionSwitched) return;
11831
11951
  regionSwitched = false;
11832
- const switchedClients = destroyAwsClients;
11833
11952
  destroyAwsClients = void 0;
11834
11953
  process.env["AWS_REGION"] = ctx.baseRegion;
11835
11954
  process.env["AWS_DEFAULT_REGION"] = ctx.baseRegion;
11836
11955
  setAwsClients(ctx.baseAwsClients);
11837
- try {
11838
- switchedClients?.destroy();
11839
- } catch (destroyError) {
11840
- logger.debug(`Failed to destroy region-scoped AWS clients: ${describeAwsFailure(destroyError).detail}`);
11841
- }
11842
11956
  };
11843
- if (stackRegion && stackRegion !== ctx.baseRegion) {
11957
+ if (stackScope !== void 0 && stackRegion) {
11844
11958
  logger.info(`Stack region: ${displaySafe(stackRegion, { asciiOnly: true })}`);
11845
11959
  process.env["AWS_REGION"] = stackRegion;
11846
11960
  process.env["AWS_DEFAULT_REGION"] = stackRegion;
11847
11961
  regionSwitched = true;
11848
11962
  try {
11849
- destroyAwsClients = new AwsClients({
11850
- region: stackRegion,
11851
- ...ctx.profile && { profile: ctx.profile }
11852
- });
11963
+ destroyAwsClients = stackScope.clients;
11853
11964
  setAwsClients(destroyAwsClients);
11854
- destroyProviderRegistry = new ProviderRegistry();
11965
+ destroyProviderRegistry = stackScope.registry;
11855
11966
  registerAllProviders(destroyProviderRegistry, providerClasses);
11856
11967
  destroyProviderRegistry.setCustomResourceResponseBucket(ctx.stateBucket);
11857
11968
  if (ctx.allowUnsupportedTypes?.length) destroyProviderRegistry.allowUnsupportedTypes(ctx.allowUnsupportedTypes);
@@ -13544,6 +13655,7 @@ async function orphanCommand(pathArgs, options) {
13544
13655
  ...options.profile && { profile: options.profile }
13545
13656
  });
13546
13657
  setAwsClients(awsClients);
13658
+ let stackAwsClients;
13547
13659
  try {
13548
13660
  const stateConfig = {
13549
13661
  bucket: stateBucket,
@@ -13600,18 +13712,28 @@ async function orphanCommand(pathArgs, options) {
13600
13712
  const have = displayIdentList(Object.keys(state.resources), ", ");
13601
13713
  throw new Error(`Resource(s) not in state for stack ${displayStackName(stackInfo.stackName)} (${displaySafe(targetRegion, { asciiOnly: true })}): ${displayIdentList(missing, ", ")}.\nAvailable logical IDs: ${have}`);
13602
13714
  }
13603
- const providerRegistry = new ProviderRegistry();
13604
- registerAllProviders(providerRegistry, providerClasses);
13605
- const rewriteResult = await rewriteResourceReferences(state, orphanLogicalIds, providerRegistry, { force: options.force });
13606
- printRewriteSummary(rewriteResult.rewrites, orphanLogicalIds);
13607
- if (rewriteResult.unresolvable.length > 0 && !options.force) {
13608
- printUnresolvable(rewriteResult.unresolvable);
13609
- throw new Error(`Orphan aborted: ${rewriteResult.unresolvable.length} reference(s) could not be resolved.\nRe-run with --force to fall back to cached attribute values from state, or fix the underlying provider/AWS issue and retry.`);
13610
- }
13611
- if (rewriteResult.unresolvable.length > 0) {
13612
- printUnresolvable(rewriteResult.unresolvable);
13613
- logger.warn(`--force: continuing despite ${rewriteResult.unresolvable.length} unresolved reference(s); the original intrinsic was left in place where the cache also lacked the value.`);
13614
- }
13715
+ stackAwsClients = !targetRegion || targetRegion === awsClients.configuredRegion ? void 0 : new AwsClients({
13716
+ region: targetRegion,
13717
+ ...options.profile && { profile: options.profile }
13718
+ });
13719
+ const scopeClients = stackAwsClients ?? awsClients;
13720
+ const rewriteResult = await withPrintingSecrets(orphanPrintingBag(state), async () => {
13721
+ const result = await runWithStackAwsClients(scopeClients, async () => {
13722
+ const providerRegistry = new ProviderRegistry();
13723
+ registerAllProviders(providerRegistry, providerClasses);
13724
+ return rewriteResourceReferences(state, orphanLogicalIds, providerRegistry, { force: options.force });
13725
+ });
13726
+ printRewriteSummary(result.rewrites, orphanLogicalIds);
13727
+ if (result.unresolvable.length > 0 && !options.force) {
13728
+ printUnresolvable(result.unresolvable);
13729
+ throw new Error(`Orphan aborted: ${result.unresolvable.length} reference(s) could not be resolved.\nRe-run with --force to fall back to cached attribute values from state, or fix the underlying provider/AWS issue and retry.`);
13730
+ }
13731
+ if (result.unresolvable.length > 0) {
13732
+ printUnresolvable(result.unresolvable);
13733
+ logger.warn(`--force: continuing despite ${result.unresolvable.length} unresolved reference(s); the original intrinsic was left in place where the cache also lacked the value.`);
13734
+ }
13735
+ return result;
13736
+ });
13615
13737
  if (options.dryRun) {
13616
13738
  logger.info("--dry-run: state will NOT be written. Re-run without --dry-run to apply.");
13617
13739
  return;
@@ -13634,6 +13756,7 @@ async function orphanCommand(pathArgs, options) {
13634
13756
  });
13635
13757
  }
13636
13758
  } finally {
13759
+ stackAwsClients?.destroy();
13637
13760
  awsClients.destroy();
13638
13761
  }
13639
13762
  }
@@ -13703,6 +13826,9 @@ async function pickStackRegion$1(stateBackend, stackName, synthRegion, flag) {
13703
13826
  const regions = refs.map((ref) => ref.region === void 0 ? "(legacy)" : regionShown(ref.region)).join(", ");
13704
13827
  throw new Error(`Stack ${plainOrDescribed(stackName, "stack name")} has state in multiple regions: ${regions}. Re-run with --stack-region '<region>' to disambiguate.`);
13705
13828
  }
13829
+ function orphanPrintingBag(state) {
13830
+ return secretNamedRecordNeedles(state.resources, void 0);
13831
+ }
13706
13832
  function printRewriteSummary(rewrites, orphanLogicalIds) {
13707
13833
  const logger = getLogger();
13708
13834
  logger.info("");
@@ -18151,16 +18277,19 @@ async function stateOrphanResources(stackName, requested, options) {
18151
18277
  registerAllProviders(scoped, providerClasses);
18152
18278
  return scoped;
18153
18279
  });
18154
- const rewriteResult = await runWithStackAwsClients(scopedClients, () => rewriteResourceReferences(state, logicalIds, registry, { force: options.force }));
18155
- printRewriteSummary(rewriteResult.rewrites, logicalIds);
18156
- if (rewriteResult.unresolvable.length > 0 && !options.force) {
18157
- printUnresolvable(rewriteResult.unresolvable);
18158
- throw new Error(`Orphan aborted: ${rewriteResult.unresolvable.length} reference(s) could not be resolved.\nRe-run with --force to fall back to cached attribute values from state, or fix the underlying provider/AWS issue and retry.`);
18159
- }
18160
- if (rewriteResult.unresolvable.length > 0) {
18161
- printUnresolvable(rewriteResult.unresolvable);
18162
- logger.warn(safeMsg`--force: continuing despite ${rewriteResult.unresolvable.length} unresolved reference(s); ` + `the original intrinsic was left in place where the cache also lacked the value.`);
18163
- }
18280
+ const rewriteResult = await withPrintingSecrets(orphanPrintingBag(state), async () => {
18281
+ const result = await runWithStackAwsClients(scopedClients, () => rewriteResourceReferences(state, logicalIds, registry, { force: options.force }));
18282
+ printRewriteSummary(result.rewrites, logicalIds);
18283
+ if (result.unresolvable.length > 0 && !options.force) {
18284
+ printUnresolvable(result.unresolvable);
18285
+ throw new Error(`Orphan aborted: ${result.unresolvable.length} reference(s) could not be resolved.\nRe-run with --force to fall back to cached attribute values from state, or fix the underlying provider/AWS issue and retry.`);
18286
+ }
18287
+ if (result.unresolvable.length > 0) {
18288
+ printUnresolvable(result.unresolvable);
18289
+ logger.warn(safeMsg`--force: continuing despite ${result.unresolvable.length} unresolved reference(s); ` + `the original intrinsic was left in place where the cache also lacked the value.`);
18290
+ }
18291
+ return result;
18292
+ });
18164
18293
  const idList = logicalIds.map((id) => displayIdent(id)).join(", ");
18165
18294
  if (!options.yes && !options.force) {
18166
18295
  process.stdout.write(`\nWARNING: This removes cdkd's state record of ${logicalIds.length} resource(s) [${idList}] from ${describedStackRef(ref)} only. AWS resources will NOT be deleted, and cdkd stops managing them. The stack's other records are kept.` + (refIsDescribed(ref) ? ` ${STATE_LIST_POINTER}` : "") + `\n\n`);
@@ -18206,6 +18335,10 @@ async function stateDestroyCommand(stackArgs, options) {
18206
18335
  setResolvedResourceTimeouts(options.resourceTimeout);
18207
18336
  if (stackArgs.length === 0) throw new Error(`Stack name is required. Usage: cdkd state destroy ${commandHole("stacks...")}`);
18208
18337
  const setup = await setupStateBackend(options);
18338
+ if (options.region) {
18339
+ process.env["AWS_REGION"] = setup.region;
18340
+ process.env["AWS_DEFAULT_REGION"] = setup.region;
18341
+ }
18209
18342
  const providerRegistry = new ProviderRegistry();
18210
18343
  registerAllProviders(providerRegistry, providerClasses);
18211
18344
  providerRegistry.setCustomResourceResponseBucket(setup.bucket);
@@ -18792,7 +18925,8 @@ async function refreshObservedForStack(stackName, region, stateBackend, lockMana
18792
18925
  let refusedSticky = 0;
18793
18926
  const publicSsmProver = new PublicSsmProver(region, () => driftProducerRegionEvidence(state, stackName, region, stateBackend), logger);
18794
18927
  await withStackName(stackName, async () => {
18795
- const tasks = entries.map(async ([logicalId, resource]) => {
18928
+ const printingBagOf = secretNamePrintingBags(state.resources, void 0);
18929
+ const tasks = entries.map(([logicalId, resource]) => withPrintingSecrets(printingBagOf(logicalId), async () => {
18796
18930
  if (resource.observedBaselineRefused === true && logicalId !== acceptId) {
18797
18931
  refusedBaseline++;
18798
18932
  if (refusedBaselineRemedy(resource) !== void 0) refusedSticky++;
@@ -18837,7 +18971,7 @@ async function refreshObservedForStack(stackName, region, stateBackend, lockMana
18837
18971
  failed++;
18838
18972
  logger.warn(safeMsg` ✗ ${displayStackName(stackName)}/${displayIdent(logicalId)} ` + safeMsg`(${displayIdent(resource.resourceType)}): ` + safeMsg`readCurrentState failed — ${describeAwsFailure(err).detail}`);
18839
18973
  }
18840
- });
18974
+ }));
18841
18975
  await Promise.all(tasks);
18842
18976
  });
18843
18977
  if (accept !== void 0 && refreshed === 0) {
@@ -18983,7 +19117,9 @@ function actionLabel(item, skipFinalSnapshot) {
18983
19117
  case "orphan-retain": return ` - orphan ${safe(op.logicalId)} (${safe(op.resourceType)}) [DeletionPolicy Retain — left in AWS]`;
18984
19118
  case "orphan-flag": return ` - orphan ${safe(op.logicalId)} (${safe(op.resourceType)}) [--orphan]`;
18985
19119
  case "revert": return ` - revert ${safe(op.logicalId)} (${safe(op.resourceType)})${rep}`;
18986
- case "reverse-replacement": return item.retainsNewResource ? ` - reverse-replace ${safe(op.logicalId)} (${replacementTypes(op)}) [re-create old resource; new one RETAINED (UpdateReplacePolicy: Retain) and left untracked — REFUSED instead if the re-create collides with the name the retained resource still holds]` : ` - reverse-replace ${safe(op.logicalId)} (${replacementTypes(op)}) [re-create old resource, delete new]`;
19120
+ case "reverse-replacement":
19121
+ if (op.oldResourceMaySurvive !== void 0) return ` - reverse-replace ${safe(op.logicalId)} (${replacementTypes(op)}) [the deploy did not confirm deleting the old resource: re-create it if AWS reports it gone, ` + (op.oldResourceMaySurvive === "kept" ? `re-adopt it if AWS still has it (its delete was refused or never sent), ` : `REFUSED if AWS still has it (its delete may still be running, or only partly ran), `) + `REFUSED if cdkd cannot tell; ` + (item.retainsNewResource ? `new one RETAINED (UpdateReplacePolicy: Retain) and left untracked]` : `delete new]`);
19122
+ return item.retainsNewResource ? ` - reverse-replace ${safe(op.logicalId)} (${replacementTypes(op)}) [re-create old resource; new one RETAINED (UpdateReplacePolicy: Retain) and left untracked — REFUSED instead if the re-create collides with the name the retained resource still holds]` : ` - reverse-replace ${safe(op.logicalId)} (${replacementTypes(op)}) [re-create old resource, delete new]`;
18987
19123
  case "reverse-replacement-readopt": return item.retainsNewResource ? ` - reverse-replace ${safe(op.logicalId)} (${replacementTypes(op)}) [re-adopt retained old resource; new one RETAINED (UpdateReplacePolicy: Retain) and left untracked]` : ` - reverse-replace ${safe(op.logicalId)} (${replacementTypes(op)}) [delete new, re-adopt retained old resource]`;
18988
19124
  case "unrecoverable-delete": return ` - (cannot restore) ${safe(op.logicalId)} (${safe(op.resourceType)}) — was DELETED, unrecoverable`;
18989
19125
  case "skip-mismatch": return ` - skip ${safe(op.logicalId)} (${safe(op.resourceType)}) — physical id changed, needs manual attention`;
@@ -19084,305 +19220,307 @@ async function rollbackCommand(stackArg, options) {
19084
19220
  });
19085
19221
  setAwsClients(stackAwsClients);
19086
19222
  const finalSnapshotClients = stackAwsClients;
19087
- const providerRegistry = new ProviderRegistry();
19088
- registerAllProviders(providerRegistry, providerClasses);
19089
- providerRegistry.setCustomResourceResponseBucket(setup.bucket);
19090
- let interrupted = false;
19091
- let declinedDivergentRewrite = false;
19092
- let declinedDivergentReason = "";
19093
- const sigintHandler = () => {
19094
- process.stderr.write("\nInterrupted — stopping rollback after the current operation...\n");
19095
- interrupted = true;
19096
- };
19097
- process.on("SIGINT", sigintHandler);
19098
- const unforwardSigterm = forwardSigtermToSigint();
19099
- try {
19100
- await setup.lockManager.acquireLockWithRetry(stackName, region, void 0, "rollback");
19101
- } catch (error) {
19102
- process.removeListener("SIGINT", sigintHandler);
19103
- unforwardSigterm();
19104
- throw error;
19105
- }
19106
- try {
19107
- const stateData = await setup.stateBackend.getState(stackName, region);
19108
- let journal = await setup.stateBackend.loadRollbackJournal(stackName, region);
19109
- const orphanedPending = journal ? await judgeNestedPendingRecords(setup, stackName, region, journal.segments) : 0;
19110
- if (journal && orphanedPending > 0) journal = {
19111
- ...journal,
19112
- segments: journal.segments.filter((s) => s.reason !== NESTED_PENDING_PARENT_REASON)
19223
+ await runWithStackAwsClients(stackAwsClients, async () => {
19224
+ const providerRegistry = new ProviderRegistry();
19225
+ registerAllProviders(providerRegistry, providerClasses);
19226
+ providerRegistry.setCustomResourceResponseBucket(setup.bucket);
19227
+ let interrupted = false;
19228
+ let declinedDivergentRewrite = false;
19229
+ let declinedDivergentReason = "";
19230
+ const sigintHandler = () => {
19231
+ process.stderr.write("\nInterrupted — stopping rollback after the current operation...\n");
19232
+ interrupted = true;
19113
19233
  };
19114
- if (!journal || journal.segments.length === 0 && orphanedPending === 0) throw new Error(`Nothing to roll back for ${plainOrDescribed(stackName, "stack name")} (${plainOrDescribed(region, "region")}). Run 'cdkd deploy' to (re)deploy, or 'cdkd destroy' to clean up.`);
19115
- applyCrossPrefixScan(await crossPrefixScan, {
19116
- stackName,
19117
- region,
19118
- bucket: setup.bucket,
19119
- recovery: {
19120
- profile: options.profile,
19121
- stateBucket: setup.bucket
19234
+ process.on("SIGINT", sigintHandler);
19235
+ const unforwardSigterm = forwardSigtermToSigint();
19236
+ try {
19237
+ await setup.lockManager.acquireLockWithRetry(stackName, region, void 0, "rollback");
19238
+ } catch (error) {
19239
+ process.removeListener("SIGINT", sigintHandler);
19240
+ unforwardSigterm();
19241
+ throw error;
19242
+ }
19243
+ try {
19244
+ const stateData = await setup.stateBackend.getState(stackName, region);
19245
+ let journal = await setup.stateBackend.loadRollbackJournal(stackName, region);
19246
+ const orphanedPending = journal ? await judgeNestedPendingRecords(setup, stackName, region, journal.segments) : 0;
19247
+ if (journal && orphanedPending > 0) journal = {
19248
+ ...journal,
19249
+ segments: journal.segments.filter((s) => s.reason !== NESTED_PENDING_PARENT_REASON)
19250
+ };
19251
+ if (!journal || journal.segments.length === 0 && orphanedPending === 0) throw new Error(`Nothing to roll back for ${plainOrDescribed(stackName, "stack name")} (${plainOrDescribed(region, "region")}). Run 'cdkd deploy' to (re)deploy, or 'cdkd destroy' to clean up.`);
19252
+ applyCrossPrefixScan(await crossPrefixScan, {
19253
+ stackName,
19254
+ region,
19255
+ bucket: setup.bucket,
19256
+ recovery: {
19257
+ profile: options.profile,
19258
+ stateBucket: setup.bucket
19259
+ }
19260
+ }, "rollback", (message) => logger.warn(message), (message) => logger.info(message));
19261
+ if (!stateData) throw new Error(`Rollback journal exists for ${safeStack(stackName)} (${safe(region)}) but its state.json is missing (keys: ${safe(setup.prefix)}/${safeStack(stackName)}/${safe(region)}/state.json and .../rollback-journal.json). State appears corrupted — inspect the bucket manually.`);
19262
+ demoteSupersededOrphans(journal.segments, Array.isArray(stateData.state.orphans) ? stateData.state.orphans : []);
19263
+ if (!options.revertFailed) for (const segment of journal.segments) {
19264
+ const failedRows = splitImportedOps(segment.failedOperations ?? [], segment).replay;
19265
+ for (const logicalId of revertedNestedRowIds(failedRows)) {
19266
+ const child = nestedChildStackName$1(stackName, logicalId);
19267
+ if (((await setup.stateBackend.loadRollbackJournal(child, region).catch(() => null))?.segments ?? []).some((s) => s.runId === segment.runId && s.reason !== "nested-pending-parent" && splitImportedOps(s.operations, s).replay.length > 0)) throw new Error(`Nested stack ${plainOrDescribed(child, "nested stack name")} failed during a deploy this journal records, and its own journal still holds that deploy's completed operations. Re-run with --revert-failed so they are reverted in order with the parent's.`);
19268
+ }
19122
19269
  }
19123
- }, "rollback", (message) => logger.warn(message), (message) => logger.info(message));
19124
- if (!stateData) throw new Error(`Rollback journal exists for ${safeStack(stackName)} (${safe(region)}) but its state.json is missing (keys: ${safe(setup.prefix)}/${safeStack(stackName)}/${safe(region)}/state.json and .../rollback-journal.json). State appears corrupted — inspect the bucket manually.`);
19125
- demoteSupersededOrphans(journal.segments, Array.isArray(stateData.state.orphans) ? stateData.state.orphans : []);
19126
- if (!options.revertFailed) for (const segment of journal.segments) {
19127
- const failedRows = splitImportedOps(segment.failedOperations ?? [], segment).replay;
19128
- for (const logicalId of revertedNestedRowIds(failedRows)) {
19129
- const child = nestedChildStackName$1(stackName, logicalId);
19130
- if (((await setup.stateBackend.loadRollbackJournal(child, region).catch(() => null))?.segments ?? []).some((s) => s.runId === segment.runId && s.reason !== "nested-pending-parent" && splitImportedOps(s.operations, s).replay.length > 0)) throw new Error(`Nested stack ${plainOrDescribed(child, "nested stack name")} failed during a deploy this journal records, and its own journal still holds that deploy's completed operations. Re-run with --revert-failed so they are reverted in order with the parent's.`);
19270
+ const baseState = stateData.state;
19271
+ const refusalRecovery = {
19272
+ profile: options.profile,
19273
+ stateBucket: setup.bucket,
19274
+ statePrefix: options.statePrefix
19275
+ };
19276
+ refuseMalformedState(baseState, stackName, region, refusalRecovery);
19277
+ refuseMalformedOrphans(baseState, stackName, region, refusalRecovery);
19278
+ refuseMalformedOrphanRecords(baseState, stackName, region, refusalRecovery);
19279
+ refuseDivergentRecordRegionForRollback(baseState, stackName, region, stateData.divergentBodyRegion, journal.segments.flatMap((seg) => seg.failedOperations ?? []).filter((op) => op.physicalIdRecoveredFromError === true).length);
19280
+ const stateResources = { ...baseState.resources };
19281
+ const mintedOrphans = [];
19282
+ const orphanLogicalIds = new Set(options.orphan ?? []);
19283
+ const newestSegment = journal.segments[journal.segments.length - 1];
19284
+ if (newestSegment?.roleArn && !options.roleArn) {
19285
+ const roleArnIsPlain = isIamRoleArn(newestSegment.roleArn) && safeRoleArn(newestSegment.roleArn) === newestSegment.roleArn;
19286
+ logger.info((roleArnIsPlain ? `Note: the failed deploy ran with --role-arn ${safeRoleArn(newestSegment.roleArn)}; ` : "Note: the failed deploy ran with --role-arn and a role ARN that is not a plain identifier (read it from the rollback journal); ") + `this rollback is running with ambient credentials (pass --role-arn to match).`);
19131
19287
  }
19132
- }
19133
- const baseState = stateData.state;
19134
- const refusalRecovery = {
19135
- profile: options.profile,
19136
- stateBucket: setup.bucket,
19137
- statePrefix: options.statePrefix
19138
- };
19139
- refuseMalformedState(baseState, stackName, region, refusalRecovery);
19140
- refuseMalformedOrphans(baseState, stackName, region, refusalRecovery);
19141
- refuseMalformedOrphanRecords(baseState, stackName, region, refusalRecovery);
19142
- refuseDivergentRecordRegionForRollback(baseState, stackName, region, stateData.divergentBodyRegion, journal.segments.flatMap((seg) => seg.failedOperations ?? []).filter((op) => op.physicalIdRecoveredFromError === true).length);
19143
- const stateResources = { ...baseState.resources };
19144
- const mintedOrphans = [];
19145
- const orphanLogicalIds = new Set(options.orphan ?? []);
19146
- const newestSegment = journal.segments[journal.segments.length - 1];
19147
- if (newestSegment?.roleArn && !options.roleArn) {
19148
- const roleArnIsPlain = isIamRoleArn(newestSegment.roleArn) && safeRoleArn(newestSegment.roleArn) === newestSegment.roleArn;
19149
- logger.info((roleArnIsPlain ? `Note: the failed deploy ran with --role-arn ${safeRoleArn(newestSegment.roleArn)}; ` : "Note: the failed deploy ran with --role-arn and a role ARN that is not a plain identifier (read it from the rollback journal); ") + `this rollback is running with ambient credentials (pass --role-arn to match).`);
19150
- }
19151
- let fallbackSkipPrefix;
19152
- const legacySkipPrefix = () => fallbackSkipPrefix ??= resolveSkipPrefix({ quiet: true });
19153
- const legacySegments = journal.segments.filter((s) => s.skipPrefix === void 0).length;
19154
- if (legacySegments > 0) logger.warn(safeMsg`${legacySegments} of ${journal.segments.length} rollback journal segment(s) ` + "were recorded by a cdkd that did not record the user-supplied-name prefix setting; replaying them with the stack-name prefix " + (legacySkipPrefix() ? "SKIPPED" : "KEPT") + " on user-supplied physical names (CDKD_PREFIX_USER_SUPPLIED_NAMES / context.cdkd.prefixUserSuppliedNames in ./cdk.json / the default). If the failed deploy ran with --prefix-user-supplied-names, re-run with CDKD_PREFIX_USER_SUPPLIED_NAMES=true instead.");
19155
- const createTokenLedger = ledgerForStack(setup.stateBackend, stackName, region);
19156
- const inSegmentScope = (segment, fn) => withSkipPrefix(segment.skipPrefix ?? legacySkipPrefix(), () => withStackName(stackName, () => withCreateTokenLedger(createTokenLedger, fn)));
19157
- logger.info(`\nRollback plan for ${stackRegionShown(stackName, region)}:`);
19158
- if (!stackRegionIsPlain(stackName, region)) logger.info(STACK_REGION_DESCRIBED_NOTE);
19159
- if (orphanedPending > 0) logger.info(safeMsg`\n Discard ${orphanedPending} record(s) of nested deploys whose parent run no longer ` + `has a journal to replay them (nothing else would ever replay them).`);
19160
- const planStateView = { ...stateResources };
19161
- for (let s = journal.segments.length - 1; s >= 0; s--) {
19162
- const segment = journal.segments[s];
19163
- logger.info(`\n Segment ${s + 1}/${journal.segments.length} (${safe(segment.reason)}${segment.runId ? `, run ${safe(segment.runId)}` : ""}):`);
19164
- const failedOps = splitImportedOps(segment.failedOperations ?? [], segment);
19165
- const completedOps = splitImportedOps(segment.operations, segment, orphanLogicalIds);
19166
- for (const op of [...failedOps.imported, ...completedOps.imported]) logger.info(importedOpLabel(op));
19167
- for (const op of [...failedOps.displaced, ...completedOps.displaced]) logger.info(displacedOpLabel(op, segment));
19168
- const failedToReplay = failedOpsToReplay(failedOps.replay, options.revertFailed === true);
19169
- if (failedOps.replay.length > 0) {
19170
- if (failedToReplay.length > 0) {
19171
- const failedPlan = await inSegmentScope(segment, () => recheckFailedPlan(planFailedOps(failedToReplay, planStateView), planStateView, {
19172
- providerRegistry,
19173
- region,
19174
- logger
19175
- }));
19176
- for (const item of failedPlan) {
19177
- logger.info(failedActionLabel(item, options.skipFinalSnapshot === true));
19178
- if (revertedNestedRowIds([item.op]).length > 0) for (const line of await previewNestedChildRevert(setup.stateBackend, nestedChildStackName$1(stackName, item.op.logicalId), region, segment.runId, options.skipFinalSnapshot === true)) logger.info(line);
19288
+ let fallbackSkipPrefix;
19289
+ const legacySkipPrefix = () => fallbackSkipPrefix ??= resolveSkipPrefix({ quiet: true });
19290
+ const legacySegments = journal.segments.filter((s) => s.skipPrefix === void 0).length;
19291
+ if (legacySegments > 0) logger.warn(safeMsg`${legacySegments} of ${journal.segments.length} rollback journal segment(s) ` + "were recorded by a cdkd that did not record the user-supplied-name prefix setting; replaying them with the stack-name prefix " + (legacySkipPrefix() ? "SKIPPED" : "KEPT") + " on user-supplied physical names (CDKD_PREFIX_USER_SUPPLIED_NAMES / context.cdkd.prefixUserSuppliedNames in ./cdk.json / the default). If the failed deploy ran with --prefix-user-supplied-names, re-run with CDKD_PREFIX_USER_SUPPLIED_NAMES=true instead.");
19292
+ const createTokenLedger = ledgerForStack(setup.stateBackend, stackName, region);
19293
+ const inSegmentScope = (segment, fn) => withSkipPrefix(segment.skipPrefix ?? legacySkipPrefix(), () => withStackName(stackName, () => withCreateTokenLedger(createTokenLedger, fn)));
19294
+ logger.info(`\nRollback plan for ${stackRegionShown(stackName, region)}:`);
19295
+ if (!stackRegionIsPlain(stackName, region)) logger.info(STACK_REGION_DESCRIBED_NOTE);
19296
+ if (orphanedPending > 0) logger.info(safeMsg`\n Discard ${orphanedPending} record(s) of nested deploys whose parent run no longer ` + `has a journal to replay them (nothing else would ever replay them).`);
19297
+ const planStateView = { ...stateResources };
19298
+ for (let s = journal.segments.length - 1; s >= 0; s--) {
19299
+ const segment = journal.segments[s];
19300
+ logger.info(`\n Segment ${s + 1}/${journal.segments.length} (${safe(segment.reason)}${segment.runId ? `, run ${safe(segment.runId)}` : ""}):`);
19301
+ const failedOps = splitImportedOps(segment.failedOperations ?? [], segment);
19302
+ const completedOps = splitImportedOps(segment.operations, segment, orphanLogicalIds);
19303
+ for (const op of [...failedOps.imported, ...completedOps.imported]) logger.info(importedOpLabel(op));
19304
+ for (const op of [...failedOps.displaced, ...completedOps.displaced]) logger.info(displacedOpLabel(op, segment));
19305
+ const failedToReplay = failedOpsToReplay(failedOps.replay, options.revertFailed === true);
19306
+ if (failedOps.replay.length > 0) {
19307
+ if (failedToReplay.length > 0) {
19308
+ const failedPlan = await inSegmentScope(segment, () => recheckFailedPlan(planFailedOps(failedToReplay, planStateView), planStateView, {
19309
+ providerRegistry,
19310
+ region,
19311
+ logger
19312
+ }));
19313
+ for (const item of failedPlan) {
19314
+ logger.info(failedActionLabel(item, options.skipFinalSnapshot === true));
19315
+ if (revertedNestedRowIds([item.op]).length > 0) for (const line of await previewNestedChildRevert(setup.stateBackend, nestedChildStackName$1(stackName, item.op.logicalId), region, segment.runId, options.skipFinalSnapshot === true)) logger.info(line);
19316
+ }
19317
+ applyFailedPlanToPreview(failedPlan, planStateView, options.skipFinalSnapshot === true);
19179
19318
  }
19180
- applyFailedPlanToPreview(failedPlan, planStateView, options.skipFinalSnapshot === true);
19319
+ for (const fop of failedOps.replay.filter((op) => !failedToReplay.includes(op))) logger.info(` - (left as-is) ${logicalIdShown(fop.logicalId)} (${resourceTypeShown(fop.resourceType)}) — its ${plainOrDescribed(fop.changeType, "change type")} FAILED mid-deploy; pass --revert-failed to attempt reverting it`);
19181
19320
  }
19182
- for (const fop of failedOps.replay.filter((op) => !failedToReplay.includes(op))) logger.info(` - (left as-is) ${logicalIdShown(fop.logicalId)} (${resourceTypeShown(fop.resourceType)}) — its ${plainOrDescribed(fop.changeType, "change type")} FAILED mid-deploy; pass --revert-failed to attempt reverting it`);
19321
+ const plan = planRollback(completedOps.replay, planStateView, orphanLogicalIds);
19322
+ for (const item of plan) {
19323
+ logger.info(actionLabel(item, options.skipFinalSnapshot === true));
19324
+ if (revertedNestedRowIds([item.op]).length > 0) for (const line of await previewNestedChildRevert(setup.stateBackend, nestedChildStackName$1(stackName, item.op.logicalId), region, segment.runId, options.skipFinalSnapshot === true)) logger.info(line);
19325
+ }
19326
+ applyPlanToPreview(plan, planStateView, options.skipFinalSnapshot === true);
19183
19327
  }
19184
- const plan = planRollback(completedOps.replay, planStateView, orphanLogicalIds);
19185
- for (const item of plan) {
19186
- logger.info(actionLabel(item, options.skipFinalSnapshot === true));
19187
- if (revertedNestedRowIds([item.op]).length > 0) for (const line of await previewNestedChildRevert(setup.stateBackend, nestedChildStackName$1(stackName, item.op.logicalId), region, segment.runId, options.skipFinalSnapshot === true)) logger.info(line);
19328
+ logger.info("");
19329
+ if (!skipConfirmation) {
19330
+ if (!await confirm(`Roll back ${stackRegionShown(stackName, region)}` + (options.removeProtection === true ? ", TURNING DELETION PROTECTION OFF on the resources it deletes from this stack and the nested stacks it reverts?" : "?"))) {
19331
+ logger.info("Rollback cancelled");
19332
+ return;
19333
+ }
19188
19334
  }
19189
- applyPlanToPreview(plan, planStateView, options.skipFinalSnapshot === true);
19190
- }
19191
- logger.info("");
19192
- if (!skipConfirmation) {
19193
- if (!await confirm(`Roll back ${stackRegionShown(stackName, region)}` + (options.removeProtection === true ? ", TURNING DELETION PROTECTION OFF on the resources it deletes from this stack and the nested stacks it reverts?" : "?"))) {
19194
- logger.info("Rollback cancelled");
19195
- return;
19335
+ if (orphanedPending > 0) {
19336
+ const discarded = await setup.stateBackend.dropRollbackJournalSegments(stackName, region, (s) => s.reason === NESTED_PENDING_PARENT_REASON);
19337
+ logger.info(safeMsg`Discarded ${discarded} record(s) of nested deploys whose parent run no longer has a ` + `journal to replay them.`);
19196
19338
  }
19197
- }
19198
- if (orphanedPending > 0) {
19199
- const discarded = await setup.stateBackend.dropRollbackJournalSegments(stackName, region, (s) => s.reason === NESTED_PENDING_PARENT_REASON);
19200
- logger.info(safeMsg`Discarded ${discarded} record(s) of nested deploys whose parent run no longer has a ` + `journal to replay them.`);
19201
- }
19202
- const eventRecorder = startRunRecorder({
19203
- backend: setup.stateBackend,
19204
- stackName,
19205
- region,
19206
- command: "rollback"
19207
- });
19208
- const ctx = {
19209
- providerRegistry,
19210
- region,
19211
- logger: logger.child("rollback"),
19212
- recordEvent: (e) => eventRecorder.record(maskEventTextWithBoundBags(e)),
19213
- finalSnapshotClients,
19214
- skipFinalSnapshot: options.skipFinalSnapshot === true,
19215
- ...options.removeProtection === true && { removeProtection: true },
19216
- foreignHolder: makeForeignHolderScan(setup.stateBackend)({
19339
+ const eventRecorder = startRunRecorder({
19340
+ backend: setup.stateBackend,
19217
19341
  stackName,
19218
- region
19219
- }),
19220
- importedProducerRegions: producerRegionsFromState(baseState),
19221
- ...(stackName.includes("~") || baseState.parentStack !== void 0) && { producerRegionsIncomplete: true }
19222
- };
19223
- let currentEtag = stateData.etag;
19224
- const saveState = async () => {
19225
- if (declinedDivergentRewrite) return;
19226
- const { skippedOutputs: _droppedByRollback, ...carriedState } = baseState;
19227
- const next = () => ({
19228
- ...carriedState,
19229
- version: 12,
19230
19342
  region,
19231
- resources: { ...stateResources },
19232
- ...orphansAfterRollback(baseState, mintedOrphans),
19233
- lastModified: Date.now()
19343
+ command: "rollback"
19234
19344
  });
19235
- try {
19236
- currentEtag = await setup.stateBackend.saveState(stackName, region, next(), { ...currentEtag !== void 0 && { expectedEtag: currentEtag } });
19237
- } catch {
19345
+ const ctx = {
19346
+ providerRegistry,
19347
+ region,
19348
+ logger: logger.child("rollback"),
19349
+ recordEvent: (e) => eventRecorder.record(maskEventTextWithBoundBags(e)),
19350
+ finalSnapshotClients,
19351
+ skipFinalSnapshot: options.skipFinalSnapshot === true,
19352
+ ...options.removeProtection === true && { removeProtection: true },
19353
+ foreignHolder: makeForeignHolderScan(setup.stateBackend)({
19354
+ stackName,
19355
+ region
19356
+ }),
19357
+ importedProducerRegions: producerRegionsFromState(baseState),
19358
+ ...(stackName.includes("~") || baseState.parentStack !== void 0) && { producerRegionsIncomplete: true }
19359
+ };
19360
+ let currentEtag = stateData.etag;
19361
+ const saveState = async () => {
19362
+ if (declinedDivergentRewrite) return;
19363
+ const { skippedOutputs: _droppedByRollback, ...carriedState } = baseState;
19364
+ const next = () => ({
19365
+ ...carriedState,
19366
+ version: 12,
19367
+ region,
19368
+ resources: { ...stateResources },
19369
+ ...orphansAfterRollback(baseState, mintedOrphans),
19370
+ lastModified: Date.now()
19371
+ });
19238
19372
  try {
19239
- const fresh = await setup.stateBackend.getState(stackName, region);
19240
- if (fresh?.divergentBodyRegion !== void 0) {
19241
- declinedDivergentRewrite = true;
19242
- declinedDivergentReason = divergedDuringRollbackMessage(fresh.divergentBodyRegion);
19243
- throw new Error(declinedDivergentReason);
19244
- }
19245
- currentEtag = await setup.stateBackend.saveState(stackName, region, next(), { ...fresh?.etag !== void 0 && { expectedEtag: fresh.etag } });
19246
- } catch (retryError) {
19247
- if (declinedDivergentRewrite) {
19248
- logger.warn(`Did not persist state after a rollback operation: ${declinedDivergentReason}. The resource was reverted in AWS. Repair the record's region field to match the key it is stored under, then run the rollback again to reconcile state.`);
19249
- return;
19373
+ currentEtag = await setup.stateBackend.saveState(stackName, region, next(), { ...currentEtag !== void 0 && { expectedEtag: currentEtag } });
19374
+ } catch {
19375
+ try {
19376
+ const fresh = await setup.stateBackend.getState(stackName, region);
19377
+ if (fresh?.divergentBodyRegion !== void 0) {
19378
+ declinedDivergentRewrite = true;
19379
+ declinedDivergentReason = divergedDuringRollbackMessage(fresh.divergentBodyRegion);
19380
+ throw new Error(declinedDivergentReason);
19381
+ }
19382
+ currentEtag = await setup.stateBackend.saveState(stackName, region, next(), { ...fresh?.etag !== void 0 && { expectedEtag: fresh.etag } });
19383
+ } catch (retryError) {
19384
+ if (declinedDivergentRewrite) {
19385
+ logger.warn(`Did not persist state after a rollback operation: ${declinedDivergentReason}. The resource was reverted in AWS. Repair the record's region field to match the key it is stored under, then run the rollback again to reconcile state.`);
19386
+ return;
19387
+ }
19388
+ logger.warn(`Failed to persist state after a rollback operation: ${backendErrorText(retryError, stackName, region)}. The resource was reverted in AWS; re-run the rollback to reconcile state.` + rerunRollback(stackName));
19250
19389
  }
19251
- logger.warn(`Failed to persist state after a rollback operation: ${backendErrorText(retryError, stackName, region)}. The resource was reverted in AWS; re-run the rollback to reconcile state.` + rerunRollback(stackName));
19252
19390
  }
19253
- }
19254
- };
19255
- const oldestInitialDeploy = journal.segments[0]?.initialDeploy === true;
19256
- let totalFailures = 0;
19257
- let totalWarnings = 0;
19258
- const failedOrphanIds = [];
19259
- const inlinePolicyWriters = new RollbackInlinePolicyWriters();
19260
- const failedOpsPrinting = journaledOrphanPrintingBag(journal.segments.flatMap((s) => s.failedOperations ?? []), stateResources);
19261
- try {
19262
- while (journal.segments.length > 0) {
19263
- if (interrupted) break;
19264
- const segment = journal.segments[journal.segments.length - 1];
19265
- const completedSplit = splitImportedOps(segment.operations, segment, orphanLogicalIds);
19266
- const completedOps = completedSplit.replay;
19267
- const displaced = [...completedSplit.displaced, ...splitImportedOps(segment.failedOperations ?? [], segment).displaced];
19268
- for (const op of displaced) logger.warn(displacedOpLabel(op, segment).trim());
19269
- recordDisplacedSkips(ctx.recordEvent, stackName, displaced);
19270
- let nestedRun;
19271
- const result = await withNestedStackContext({
19272
- stateBackend: setup.stateBackend,
19273
- lockManager: setup.lockManager,
19274
- providerRegistry,
19275
- parentStackName: stackName,
19276
- parentRegion: region,
19277
- accountId: "unknown",
19278
- awsClients: setup.awsClients,
19279
- stateBucket: setup.bucket,
19280
- exportIndexStore: setup.exportIndexStore,
19281
- destroyOptions: {
19282
- ...options.profile && { profile: options.profile },
19283
- statePrefix: options.statePrefix,
19284
- ...options.skipFinalSnapshot === true && { skipFinalSnapshot: true },
19285
- ...options.removeProtection === true && { removeProtection: true }
19286
- }
19287
- }, () => withNestedRevertRun(segment.runId, (run) => {
19288
- nestedRun = run;
19289
- return inSegmentScope(segment, async () => {
19290
- let failedOpFailures = 0;
19291
- let failedOpWarnings = 0;
19292
- const failedOps = splitImportedOps(segment.failedOperations ?? [], segment);
19293
- const failedForGuard = segment.failedOperations ?? [];
19294
- const failedToReplay = failedOpsToReplay(failedOps.replay, options.revertFailed === true);
19295
- if (failedToReplay.length > 0) {
19296
- const failedResult = await withPrintingSecrets(failedOpsPrinting, () => withPrintingSecrets(journaledOrphanPrintingBag(failedToReplay, stateResources), () => replayFailedOperations(failedToReplay, stateResources, stackName, ctx, {
19391
+ };
19392
+ const oldestInitialDeploy = journal.segments[0]?.initialDeploy === true;
19393
+ let totalFailures = 0;
19394
+ let totalWarnings = 0;
19395
+ const failedOrphanIds = [];
19396
+ const inlinePolicyWriters = new RollbackInlinePolicyWriters();
19397
+ const failedOpsPrinting = journaledOrphanPrintingBag(journal.segments.flatMap((s) => s.failedOperations ?? []), stateResources);
19398
+ try {
19399
+ while (journal.segments.length > 0) {
19400
+ if (interrupted) break;
19401
+ const segment = journal.segments[journal.segments.length - 1];
19402
+ const completedSplit = splitImportedOps(segment.operations, segment, orphanLogicalIds);
19403
+ const completedOps = completedSplit.replay;
19404
+ const displaced = [...completedSplit.displaced, ...splitImportedOps(segment.failedOperations ?? [], segment).displaced];
19405
+ for (const op of displaced) logger.warn(displacedOpLabel(op, segment).trim());
19406
+ recordDisplacedSkips(ctx.recordEvent, stackName, displaced);
19407
+ let nestedRun;
19408
+ const result = await withNestedStackContext({
19409
+ stateBackend: setup.stateBackend,
19410
+ lockManager: setup.lockManager,
19411
+ providerRegistry,
19412
+ parentStackName: stackName,
19413
+ parentRegion: region,
19414
+ accountId: "unknown",
19415
+ awsClients: finalSnapshotClients,
19416
+ stateBucket: setup.bucket,
19417
+ exportIndexStore: setup.exportIndexStore,
19418
+ destroyOptions: {
19419
+ ...options.profile && { profile: options.profile },
19420
+ statePrefix: options.statePrefix,
19421
+ ...options.skipFinalSnapshot === true && { skipFinalSnapshot: true },
19422
+ ...options.removeProtection === true && { removeProtection: true }
19423
+ }
19424
+ }, () => withNestedRevertRun(segment.runId, (run) => {
19425
+ nestedRun = run;
19426
+ return inSegmentScope(segment, async () => {
19427
+ let failedOpFailures = 0;
19428
+ let failedOpWarnings = 0;
19429
+ const failedOps = splitImportedOps(segment.failedOperations ?? [], segment);
19430
+ const failedForGuard = segment.failedOperations ?? [];
19431
+ const failedToReplay = failedOpsToReplay(failedOps.replay, options.revertFailed === true);
19432
+ if (failedToReplay.length > 0) {
19433
+ const failedResult = await withPrintingSecrets(failedOpsPrinting, () => withPrintingSecrets(journaledOrphanPrintingBag(failedToReplay, stateResources), () => replayFailedOperations(failedToReplay, stateResources, stackName, ctx, {
19434
+ afterOp: saveState,
19435
+ isInterrupted: () => interrupted,
19436
+ emitEnvelope: completedOps.length === 0,
19437
+ onOrphan: (record) => mintedOrphans.push(record),
19438
+ inlinePolicyWriters
19439
+ })));
19440
+ failedOpFailures = failedResult.failures;
19441
+ failedOpWarnings = failedResult.warnings;
19442
+ for (const op of failedResult.remainingFailedOps) if (isJournaledOrphan(op) && op.physicalIdRecoveredFromError === true) failedOrphanIds.push(op.logicalId);
19443
+ const remaining = [
19444
+ ...failedOps.imported,
19445
+ ...failedOps.displaced,
19446
+ ...failedOps.replay.filter((op) => !failedToReplay.includes(op)),
19447
+ ...failedResult.remainingFailedOps,
19448
+ ...completedOps.length > 0 ? failedToReplay.filter((op) => seedsDeleteFirstGuard(op) && !failedResult.remainingFailedOps.includes(op)) : []
19449
+ ];
19450
+ if (!declinedDivergentRewrite && remaining.length !== (segment.failedOperations ?? []).length) try {
19451
+ await setup.stateBackend.setRollbackJournalFailedOperations(stackName, region, remaining);
19452
+ if (remaining.length === 0) delete segment.failedOperations;
19453
+ else segment.failedOperations = remaining;
19454
+ } catch (stripError) {
19455
+ logger.warn(safeMsg`Failed to strip replayed failed-ops from the journal: ${backendErrorText(stripError, stackName, region)}`);
19456
+ }
19457
+ if (failedResult.interrupted) return {
19458
+ failures: failedOpFailures,
19459
+ warnings: failedOpWarnings,
19460
+ interrupted: true
19461
+ };
19462
+ }
19463
+ const replayResult = await withPrintingSecrets(journaledOrphanPrintingBag(completedReplayEntries(completedOps), stateResources), () => replayRollback(completedOps, stateResources, stackName, ctx, {
19464
+ orphanLogicalIds,
19297
19465
  afterOp: saveState,
19298
19466
  isInterrupted: () => interrupted,
19299
- emitEnvelope: completedOps.length === 0,
19300
19467
  onOrphan: (record) => mintedOrphans.push(record),
19301
- inlinePolicyWriters
19302
- })));
19303
- failedOpFailures = failedResult.failures;
19304
- failedOpWarnings = failedResult.warnings;
19305
- for (const op of failedResult.remainingFailedOps) if (isJournaledOrphan(op) && op.physicalIdRecoveredFromError === true) failedOrphanIds.push(op.logicalId);
19306
- const remaining = [
19307
- ...failedOps.imported,
19308
- ...failedOps.displaced,
19309
- ...failedOps.replay.filter((op) => !failedToReplay.includes(op)),
19310
- ...failedResult.remainingFailedOps,
19311
- ...completedOps.length > 0 ? failedToReplay.filter((op) => seedsDeleteFirstGuard(op) && !failedResult.remainingFailedOps.includes(op)) : []
19312
- ];
19313
- if (!declinedDivergentRewrite && remaining.length !== (segment.failedOperations ?? []).length) try {
19314
- await setup.stateBackend.setRollbackJournalFailedOperations(stackName, region, remaining);
19315
- if (remaining.length === 0) delete segment.failedOperations;
19316
- else segment.failedOperations = remaining;
19317
- } catch (stripError) {
19318
- logger.warn(safeMsg`Failed to strip replayed failed-ops from the journal: ${backendErrorText(stripError, stackName, region)}`);
19319
- }
19320
- if (failedResult.interrupted) return {
19321
- failures: failedOpFailures,
19322
- warnings: failedOpWarnings,
19323
- interrupted: true
19468
+ inlinePolicyWriters,
19469
+ failedOperations: failedForGuard
19470
+ }));
19471
+ return {
19472
+ failures: replayResult.failures + failedOpFailures,
19473
+ warnings: replayResult.warnings + failedOpWarnings,
19474
+ interrupted: replayResult.interrupted
19324
19475
  };
19325
- }
19326
- const replayResult = await withPrintingSecrets(journaledOrphanPrintingBag(completedReplayEntries(completedOps), stateResources), () => replayRollback(completedOps, stateResources, stackName, ctx, {
19327
- orphanLogicalIds,
19328
- afterOp: saveState,
19329
- isInterrupted: () => interrupted,
19330
- onOrphan: (record) => mintedOrphans.push(record),
19331
- inlinePolicyWriters,
19332
- failedOperations: failedForGuard
19333
- }));
19334
- return {
19335
- failures: replayResult.failures + failedOpFailures,
19336
- warnings: replayResult.warnings + failedOpWarnings,
19337
- interrupted: replayResult.interrupted
19338
- };
19476
+ });
19477
+ }));
19478
+ totalFailures += result.failures;
19479
+ totalWarnings += result.warnings + (nestedRun?.warnings ?? 0) + displaced.length;
19480
+ if (declinedDivergentRewrite) break;
19481
+ if (result.interrupted) {
19482
+ interrupted = true;
19483
+ break;
19484
+ }
19485
+ if (result.failures > 0) break;
19486
+ await setup.stateBackend.popRollbackJournalSegment(stackName, region);
19487
+ journal.segments.pop();
19488
+ await dropSettledNestedJournals({
19489
+ stateBackend: setup.stateBackend,
19490
+ lockManager: setup.lockManager,
19491
+ parentStackName: stackName,
19492
+ region,
19493
+ settled: nestedRun?.settled ?? /* @__PURE__ */ new Map(),
19494
+ runId: segment.runId,
19495
+ logger
19339
19496
  });
19340
- }));
19341
- totalFailures += result.failures;
19342
- totalWarnings += result.warnings + (nestedRun?.warnings ?? 0) + displaced.length;
19343
- if (declinedDivergentRewrite) break;
19344
- if (result.interrupted) {
19345
- interrupted = true;
19346
- break;
19347
19497
  }
19348
- if (result.failures > 0) break;
19349
- await setup.stateBackend.popRollbackJournalSegment(stackName, region);
19350
- journal.segments.pop();
19351
- await dropSettledNestedJournals({
19352
- stateBackend: setup.stateBackend,
19353
- lockManager: setup.lockManager,
19354
- parentStackName: stackName,
19355
- region,
19356
- settled: nestedRun?.settled ?? /* @__PURE__ */ new Map(),
19357
- runId: segment.runId,
19358
- logger
19359
- });
19498
+ } finally {
19499
+ await eventRecorder.finalize(totalFailures > 0 || interrupted || declinedDivergentRewrite ? "FAILED" : "SUCCEEDED");
19360
19500
  }
19501
+ const survivingOrphans = orphansAfterRollback(baseState, mintedOrphans).orphans ?? [];
19502
+ if (journal.segments.length === 0 && oldestInitialDeploy && Object.keys(stateResources).length === 0 && survivingOrphans.length === 0) {
19503
+ await setup.stateBackend.deleteState(stackName, region);
19504
+ await recordRetainedForReadoption(setup.stateBackend, stackName, region, [], logger);
19505
+ await releaseRegistryMarkerQuietly(setup.stateBackend, stackName, region, logger);
19506
+ logger.info(`State for ${stackRegionShown(stackName, region)} removed (stack fully rolled back).`);
19507
+ }
19508
+ if (declinedDivergentRewrite) throw new PartialFailureError(`Rollback stopped: ${declinedDivergentReason}.` + (totalFailures > 0 ? ` ${totalFailures} operation(s) also failed.` : "") + " Journal preserved (this segment, any older ones, and their failed operations) — re-run the rollback once the record's region field matches its key.");
19509
+ if (interrupted) throw new PartialFailureError(`Rollback interrupted. Journal preserved — re-run the rollback to finish.` + rerunRollback(stackName));
19510
+ if (totalFailures > 0) throw new PartialFailureError(`Rollback completed with ${totalFailures} failed operation(s). Journal preserved — re-run the rollback to retry.` + dropFailedHint(stackName, region, failedOrphanIds) + rerunRollback(stackName));
19511
+ if (totalWarnings > 0) throw new PartialFailureError(`Rollback completed with ${totalWarnings} skipped/unrecoverable operation(s) (see warnings above).`);
19512
+ logger.info(`\nRollback of ${stackRegionShown(stackName, region)} complete.`);
19361
19513
  } finally {
19362
- await eventRecorder.finalize(totalFailures > 0 || interrupted || declinedDivergentRewrite ? "FAILED" : "SUCCEEDED");
19363
- }
19364
- const survivingOrphans = orphansAfterRollback(baseState, mintedOrphans).orphans ?? [];
19365
- if (journal.segments.length === 0 && oldestInitialDeploy && Object.keys(stateResources).length === 0 && survivingOrphans.length === 0) {
19366
- await setup.stateBackend.deleteState(stackName, region);
19367
- await recordRetainedForReadoption(setup.stateBackend, stackName, region, [], logger);
19368
- await releaseRegistryMarkerQuietly(setup.stateBackend, stackName, region, logger);
19369
- logger.info(`State for ${stackRegionShown(stackName, region)} removed (stack fully rolled back).`);
19370
- }
19371
- if (declinedDivergentRewrite) throw new PartialFailureError(`Rollback stopped: ${declinedDivergentReason}.` + (totalFailures > 0 ? ` ${totalFailures} operation(s) also failed.` : "") + " Journal preserved (this segment, any older ones, and their failed operations) — re-run the rollback once the record's region field matches its key.");
19372
- if (interrupted) throw new PartialFailureError(`Rollback interrupted. Journal preserved — re-run the rollback to finish.` + rerunRollback(stackName));
19373
- if (totalFailures > 0) throw new PartialFailureError(`Rollback completed with ${totalFailures} failed operation(s). Journal preserved — re-run the rollback to retry.` + dropFailedHint(stackName, region, failedOrphanIds) + rerunRollback(stackName));
19374
- if (totalWarnings > 0) throw new PartialFailureError(`Rollback completed with ${totalWarnings} skipped/unrecoverable operation(s) (see warnings above).`);
19375
- logger.info(`\nRollback of ${stackRegionShown(stackName, region)} complete.`);
19376
- } finally {
19377
- try {
19378
- await setup.lockManager.releaseLock(stackName, region).catch((err) => {
19379
- logger.warn(`Failed to release lock for ${quotedOrDescribed(stackName, "stack name")} (${plainOrDescribed(region, "region")}): ${backendErrorText(err, stackName, region)}`);
19380
- });
19381
- } finally {
19382
- process.removeListener("SIGINT", sigintHandler);
19383
- unforwardSigterm();
19514
+ try {
19515
+ await setup.lockManager.releaseLock(stackName, region).catch((err) => {
19516
+ logger.warn(`Failed to release lock for ${quotedOrDescribed(stackName, "stack name")} (${plainOrDescribed(region, "region")}): ${backendErrorText(err, stackName, region)}`);
19517
+ });
19518
+ } finally {
19519
+ process.removeListener("SIGINT", sigintHandler);
19520
+ unforwardSigterm();
19521
+ }
19384
19522
  }
19385
- }
19523
+ });
19386
19524
  } finally {
19387
19525
  if (stackAwsClients) {
19388
19526
  setAwsClients(setup.awsClients);
@@ -20452,7 +20590,7 @@ async function publishAssetsCommand(stacks, options) {
20452
20590
  }, (node) => assetPublisher.executeNode(node));
20453
20591
  logger.info(` ✓ Published ${assetCount} asset(s) in ${((Date.now() - startedAt) / 1e3).toFixed(2)}s`);
20454
20592
  } catch (err) {
20455
- error = err instanceof Error ? err : new Error(String(err));
20593
+ error = err instanceof Error ? err : new Error(safeStringify(err));
20456
20594
  logger.error(` ✗ ${stack.stackName}: ${error.message}`);
20457
20595
  }
20458
20596
  results.push({
@@ -21179,6 +21317,11 @@ async function resolvePseudoParameterIntrinsics(value, region) {
21179
21317
  };
21180
21318
  return walk(value);
21181
21319
  }
21320
+ function shownPhysicalId(physicalId, bag) {
21321
+ if (!hasMaskableValues(bag)) return {};
21322
+ const shown = maskSecretsInText(physicalId, bag);
21323
+ return shown === physicalId ? {} : { physicalIdShown: shown };
21324
+ }
21182
21325
  async function importOne(task) {
21183
21326
  const logger = getLogger();
21184
21327
  const { logicalId, resource, stackName, region, providerRegistry, override, overrides } = task;
@@ -21196,6 +21339,14 @@ async function importOne(task) {
21196
21339
  outcome: "skipped-no-impl",
21197
21340
  reason: `provider does not implement import (yet)`
21198
21341
  };
21342
+ const printingBagWith = (physicalId) => secretNamePrintingBag(logicalId, { [logicalId]: {
21343
+ resourceType: resource.Type,
21344
+ properties: resource.Properties ?? {},
21345
+ physicalId: physicalId ?? "",
21346
+ attributes: {},
21347
+ dependencies: []
21348
+ } });
21349
+ const readBag = printingBagWith(override);
21199
21350
  try {
21200
21351
  const properties = substituteOverrideRefs(await resolvePseudoParameterIntrinsics(resource.Properties ?? {}, region), overrides);
21201
21352
  const input = {
@@ -21206,7 +21357,7 @@ async function importOne(task) {
21206
21357
  properties,
21207
21358
  ...override !== void 0 && { knownPhysicalId: override }
21208
21359
  };
21209
- const result = await provider.import(input);
21360
+ const result = await withPrintingSecrets(readBag, () => provider.import(input));
21210
21361
  if (!result) return {
21211
21362
  logicalId,
21212
21363
  resourceType: resource.Type,
@@ -21218,11 +21369,12 @@ async function importOne(task) {
21218
21369
  resourceType: resource.Type,
21219
21370
  outcome: "imported",
21220
21371
  physicalId: result.physicalId,
21372
+ ...shownPhysicalId(result.physicalId, printingBagWith(result.physicalId)),
21221
21373
  ...result.attributes !== void 0 && { attributes: result.attributes },
21222
21374
  provisionedBy: route.provisionedBy
21223
21375
  };
21224
21376
  } catch (error) {
21225
- const msg = describeAwsFailure(error).detail;
21377
+ const msg = maskSecretsInText(describeAwsFailure(error).detail, readBag);
21226
21378
  logger.error(`Failed to import ${logicalIdShown(logicalId)} (${resourceTypeShown(resource.Type)}): ${msg}`);
21227
21379
  return {
21228
21380
  logicalId,
@@ -21726,7 +21878,7 @@ function printSummary(rows) {
21726
21878
  for (const r of rows) {
21727
21879
  counts[r.outcome]++;
21728
21880
  const tag = formatOutcome(r.outcome);
21729
- const detail = r.outcome === "imported" ? ` (${r.physicalId})` : r.reason ? ` — ${r.reason}` : "";
21881
+ const detail = r.outcome === "imported" ? ` (${r.physicalIdShown ?? r.physicalId})` : r.reason ? ` — ${r.reason}` : "";
21730
21882
  logger.info(` ${tag} ${logicalIdShown(r.logicalId)} (${resourceTypeShown(r.resourceType)})${detail}`);
21731
21883
  }
21732
21884
  logger.info("");
@@ -21761,7 +21913,8 @@ const NO_RECORDED_SECRETS = /* @__PURE__ */ new Map();
21761
21913
  async function captureObservedForImportedResources(stackState, providerRegistry, logger, unsafeObservedBaselineLogicalIds, rebuiltLogicalIds) {
21762
21914
  const entries = Object.entries(stackState.resources ?? {});
21763
21915
  if (entries.length === 0) return;
21764
- await Promise.all(entries.map(async ([logicalId, resource]) => {
21916
+ const printingBagOf = secretNamePrintingBags(stackState.resources ?? {}, void 0);
21917
+ await Promise.all(entries.map(([logicalId, resource]) => withPrintingSecrets(printingBagOf(logicalId), async () => {
21765
21918
  if (resource.observedBaselineRefused === true && !rebuiltLogicalIds.has(logicalId)) {
21766
21919
  delete resource.observedProperties;
21767
21920
  logger.debug(`observedProperties capture SKIPPED for preserved ${logicalIdShown(logicalId)} (${resourceTypeShown(resource.resourceType)}): a previous 'cdkd import' run refused this record's baseline and this run did not re-import it, so its recorded properties are still the ones that refusal distrusted. Re-import it, or deploy a change to it, to restore a baseline — unless its refusal is an unverifiable-parameter one, which only a replacement or a proving re-import discharges.`);
@@ -21792,7 +21945,7 @@ async function captureObservedForImportedResources(stackState, providerRegistry,
21792
21945
  } catch (err) {
21793
21946
  logger.debug(`observedProperties capture for imported ${logicalId} (${resource.resourceType}) failed: ${err instanceof Error ? err.name : typeof err} — drift will fall back to template properties for this resource until the next successful deploy.`);
21794
21947
  }
21795
- }));
21948
+ })));
21796
21949
  }
21797
21950
  function synthesizeNestedStackArn(childRegion, accountId, parentStackName, logicalId) {
21798
21951
  return `arn:cdkd-local:${childRegion}:${accountId}:nested-stack/${parentStackName}/${logicalId}`;
@@ -22057,7 +22210,7 @@ async function loadBootstrapContainerRepo(synthRegion, opts) {
22057
22210
  try {
22058
22211
  stateBucket = await resolveStateBucketWithDefault(opts.stateBucket, region);
22059
22212
  } catch (err) {
22060
- logger.debug(`${prefix}: could not resolve state bucket for the bootstrap-marker read: ${err instanceof Error ? err.message : String(err)}. Falling back to conventional asset-repo names.`);
22213
+ logger.debug(`${prefix}: could not resolve state bucket for the bootstrap-marker read: ${describeAwsFailure(err).detail}. Falling back to conventional asset-repo names.`);
22061
22214
  return;
22062
22215
  }
22063
22216
  const clientRegion = canonicalizeRegion(opts.region) || void 0;
@@ -22085,7 +22238,7 @@ async function loadBootstrapContainerRepo(synthRegion, opts) {
22085
22238
  logger.debug(`${prefix}: bootstrap marker for ${region} names container repo '${marker.containerRepo}'.`);
22086
22239
  return marker.containerRepo;
22087
22240
  } catch (err) {
22088
- logger.debug(`${prefix}: bootstrap-marker read failed: ${err instanceof Error ? err.message : String(err)}. Falling back to conventional asset-repo names.`);
22241
+ logger.debug(`${prefix}: bootstrap-marker read failed: ${describeAwsFailure(err).detail}. Falling back to conventional asset-repo names.`);
22089
22242
  return;
22090
22243
  } finally {
22091
22244
  resetAwsClients();
@@ -22140,13 +22293,13 @@ async function buildCrossStackResolver(consumerRegion, opts) {
22140
22293
  return JSON.stringify(value);
22141
22294
  }
22142
22295
  } catch (err) {
22143
- logger.debug(`${prefix}: exports index lookup failed for '${exportName}': ${err instanceof Error ? err.message : String(err)}; falling back to per-stack state scan`);
22296
+ logger.debug(`${prefix}: exports index lookup failed for '${exportName}': ${describeAwsFailure(err).detail}; falling back to per-stack state scan`);
22144
22297
  }
22145
22298
  let refs;
22146
22299
  try {
22147
22300
  refs = await stateBackend.listStacks();
22148
22301
  } catch (err) {
22149
- logger.debug(`${prefix}: failed to list stacks during Fn::ImportValue fallback for '${exportName}': ${err instanceof Error ? err.message : String(err)}`);
22302
+ logger.debug(`${prefix}: failed to list stacks during Fn::ImportValue fallback for '${exportName}': ${describeAwsFailure(err).detail}`);
22150
22303
  return;
22151
22304
  }
22152
22305
  const canonicalConsumerRegion = canonicalizeRegion(consumerRegion);
@@ -22163,7 +22316,7 @@ async function buildCrossStackResolver(consumerRegion, opts) {
22163
22316
  return JSON.stringify(value);
22164
22317
  }
22165
22318
  } catch (err) {
22166
- logger.debug(`${prefix}: state read failed for ${ref.stackName} (${region}) during Fn::ImportValue fallback: ${err instanceof Error ? err.message : String(err)}`);
22319
+ logger.debug(`${prefix}: state read failed for ${ref.stackName} (${region}) during Fn::ImportValue fallback: ${describeAwsFailure(err).detail}`);
22167
22320
  continue;
22168
22321
  }
22169
22322
  }
@@ -22205,7 +22358,7 @@ async function buildCrossStackResolver(consumerRegion, opts) {
22205
22358
  }
22206
22359
  return;
22207
22360
  } catch (err) {
22208
- logger.debug(`${prefix}: state read failed for Fn::GetStackOutput '${producerStack}.${outputName}' (${producerRegion}): ${err instanceof Error ? err.message : String(err)}`);
22361
+ logger.debug(`${prefix}: state read failed for Fn::GetStackOutput '${producerStack}.${outputName}' (${producerRegion}): ${describeAwsFailure(err).detail}`);
22209
22362
  return;
22210
22363
  }
22211
22364
  }
@@ -24229,7 +24382,7 @@ function attachWebSocketServer(opts) {
24229
24382
  }
24230
24383
  wss.handleUpgrade(req, socket, head, (ws) => {
24231
24384
  onConnect(ws, req, cfg).catch((err) => {
24232
- logger.error(`WebSocket $connect dispatch failed: ${err instanceof Error ? err.stack ?? err.message : String(err)}`);
24385
+ logger.error(`WebSocket $connect dispatch failed: ${err instanceof Error ? err.stack ?? err.message : safeStringify(err)}`);
24233
24386
  try {
24234
24387
  ws.close(1011, "internal error");
24235
24388
  } catch {}
@@ -24299,7 +24452,7 @@ function attachWebSocketServer(opts) {
24299
24452
  const { body, isBase64Encoded } = bufferToBody$1(raw, isBinary);
24300
24453
  logger.debug(`WebSocket message received for connection ${connectionId}: ${body.slice(0, 200)}`);
24301
24454
  enqueueDispatch(connectionId, () => dispatchMessage(connectionId, cfg, body, isBase64Encoded, handshakeSnapshot).catch((err) => {
24302
- logger.error(`WebSocket message dispatch failed (connection ${connectionId}): ${err instanceof Error ? err.stack ?? err.message : String(err)}`);
24455
+ logger.error(`WebSocket message dispatch failed (connection ${connectionId}): ${err instanceof Error ? err.stack ?? err.message : safeStringify(err)}`);
24303
24456
  try {
24304
24457
  ws.send(JSON.stringify({
24305
24458
  message: "Internal server error",
@@ -24312,7 +24465,7 @@ function attachWebSocketServer(opts) {
24312
24465
  ws.on("close", (code, reason) => {
24313
24466
  const reasonText = reason.toString("utf-8");
24314
24467
  const disconnectPromise = enqueueDispatch(connectionId, () => onDisconnect(connectionId, cfg, handshakeSnapshot, code, reasonText).catch((err) => {
24315
- logger.warn(`WebSocket $disconnect dispatch failed (connection ${connectionId}): ${err instanceof Error ? err.message : String(err)}`);
24468
+ logger.warn(`WebSocket $disconnect dispatch failed (connection ${connectionId}): ${describeAwsFailure(err).detail}`);
24316
24469
  }));
24317
24470
  inFlightDisconnects.add(disconnectPromise);
24318
24471
  disconnectPromise.finally(() => {
@@ -24325,7 +24478,7 @@ function attachWebSocketServer(opts) {
24325
24478
  for (const frame of preVerdictFrames) {
24326
24479
  const { body, isBase64Encoded } = bufferToBody$1(frame.raw, frame.isBinary);
24327
24480
  enqueueDispatch(connectionId, () => dispatchMessage(connectionId, cfg, body, isBase64Encoded, handshakeSnapshot).catch((err) => {
24328
- logger.error(`WebSocket buffered-message dispatch failed (connection ${connectionId}): ${err instanceof Error ? err.stack ?? err.message : String(err)}`);
24481
+ logger.error(`WebSocket buffered-message dispatch failed (connection ${connectionId}): ${err instanceof Error ? err.stack ?? err.message : safeStringify(err)}`);
24329
24482
  }));
24330
24483
  }
24331
24484
  preVerdictFrames.length = 0;
@@ -24674,12 +24827,12 @@ function createContainerPool(specs, options) {
24674
24827
  try {
24675
24828
  handle.stopLogStream();
24676
24829
  } catch (err) {
24677
- logger.debug(`stopLogStream(${handle.containerName}) failed: ${err instanceof Error ? err.message : String(err)}`);
24830
+ logger.debug(`stopLogStream(${handle.containerName}) failed: ${describeAwsFailure(err).detail}`);
24678
24831
  }
24679
24832
  try {
24680
24833
  await removeContainer(handle.containerId);
24681
24834
  } catch (err) {
24682
- logger.warn(`Failed to remove container ${handle.containerName}: ${err instanceof Error ? err.message : String(err)}. Continuing cleanup.`);
24835
+ logger.warn(`Failed to remove container ${handle.containerName}: ${describeAwsFailure(err).detail}. Continuing cleanup.`);
24683
24836
  }
24684
24837
  }
24685
24838
  async function removedIfDisposedOnFailure(name, run) {
@@ -24799,7 +24952,7 @@ function createContainerPool(specs, options) {
24799
24952
  name
24800
24953
  }), IN_FLIGHT_START_TIMEOUT_MS);
24801
24954
  })]).catch((err) => {
24802
- logger.debug(`In-flight startOne rejected during dispose: ${err instanceof Error ? err.message : String(err)}`);
24955
+ logger.debug(`In-flight startOne rejected during dispose: ${describeAwsFailure(err).detail}`);
24803
24956
  return { kind: "rejected" };
24804
24957
  }).finally(() => clearTimeout(timer));
24805
24958
  });
@@ -25296,15 +25449,18 @@ async function localStartApiCommand(target, options) {
25296
25449
  process.on("SIGTERM", () => {
25297
25450
  shutdown("SIGTERM", 0);
25298
25451
  });
25452
+ installFatalShutdownHandlers(logger, shutdown);
25453
+ await new Promise(() => void 0);
25454
+ }
25455
+ function installFatalShutdownHandlers(logger, shutdown) {
25299
25456
  process.on("uncaughtException", (err) => {
25300
- logger.error(`Uncaught exception: ${err instanceof Error ? err.stack ?? err.message : String(err)}`);
25457
+ logger.error(`Uncaught exception: ${err instanceof Error ? err.stack ?? err.message : safeStringify(err)}`);
25301
25458
  shutdown("uncaughtException", 1);
25302
25459
  });
25303
25460
  process.on("unhandledRejection", (reason) => {
25304
- logger.error(`Unhandled rejection: ${reason instanceof Error ? reason.stack ?? reason.message : String(reason)}`);
25461
+ logger.error(`Unhandled rejection: ${reason instanceof Error ? reason.stack ?? reason.message : safeStringify(reason)}`);
25305
25462
  shutdown("unhandledRejection", 1);
25306
25463
  });
25307
- await new Promise(() => void 0);
25308
25464
  }
25309
25465
  function targetStackHint(target, stacks) {
25310
25466
  if (target?.includes("/") !== true) return void 0;
@@ -25917,7 +26073,7 @@ async function reloadAllServers(args) {
25917
26073
  try {
25918
26074
  material = await synthesizeAndBuild();
25919
26075
  } catch (err) {
25920
- logger.warn(`cdk synth failed during reload; keeping previous version. (${err instanceof Error ? err.message : String(err)})`);
26076
+ logger.warn(`cdk synth failed during reload; keeping previous version. (${describeAwsFailure(err).detail})`);
25921
26077
  return;
25922
26078
  }
25923
26079
  if (isClosing?.()) return;
@@ -26333,7 +26489,7 @@ async function runAfterContainersStopped(hook, logger) {
26333
26489
  try {
26334
26490
  await hook();
26335
26491
  } catch (err) {
26336
- logger.debug(safeMsg`afterContainersStopped hook failed: ${err instanceof Error ? err.message : String(err)}`);
26492
+ logger.debug(safeMsg`afterContainersStopped hook failed: ${describeAwsFailure(err).detail}`);
26337
26493
  }
26338
26494
  }
26339
26495
  async function settleInFlightStep(state, logger) {
@@ -26350,7 +26506,7 @@ async function settleInFlightStep(state, logger) {
26350
26506
  try {
26351
26507
  await step.abandon();
26352
26508
  } catch (err) {
26353
- logger.debug(safeMsg`in-flight step removal failed: ${err instanceof Error ? err.message : String(err)}`);
26509
+ logger.debug(safeMsg`in-flight step removal failed: ${describeAwsFailure(err).detail}`);
26354
26510
  }
26355
26511
  logger.warn(safeMsg`The in-flight docker command did not finish within ${IN_FLIGHT_STEP_TIMEOUT_MS / 1e3}s; removed ${step.subject.what} if it existed, but a docker command that completes later can still create it -- run '${step.subject.remedy}' if it appears.`);
26356
26512
  }
@@ -26404,7 +26560,7 @@ async function cleanupEcsRun(state, options) {
26404
26560
  for (const { stream } of logStreams) try {
26405
26561
  stream.stop();
26406
26562
  } catch (err) {
26407
- logger.debug(`log stream stop failed: ${err instanceof Error ? err.message : String(err)}`);
26563
+ logger.debug(`log stream stop failed: ${describeAwsFailure(err).detail}`);
26408
26564
  }
26409
26565
  await runAfterContainersStopped(options.afterContainersStopped, logger);
26410
26566
  } else {
@@ -26421,7 +26577,7 @@ async function cleanupEcsRun(state, options) {
26421
26577
  try {
26422
26578
  await stream.drain(CONTAINER_LOG_DRAIN_TIMEOUT_MS);
26423
26579
  } catch (err) {
26424
- logger.debug(safeMsg`log stream drain failed: ${err instanceof Error ? err.message : String(err)}`);
26580
+ logger.debug(safeMsg`log stream drain failed: ${describeAwsFailure(err).detail}`);
26425
26581
  }
26426
26582
  }));
26427
26583
  for (const c of state.startedContainers) try {
@@ -27495,7 +27651,7 @@ async function runAgentCoreWatchLoop(args) {
27495
27651
  verdict = classifySourceChange(changedPaths, assetCtx);
27496
27652
  logger.info(`Detected source change (${changedPaths.length} path(s)); verdict=${verdict.kind} (${verdict.reason}).`);
27497
27653
  } catch (err) {
27498
- logger.warn(`Reload: classifier context unavailable (${err instanceof Error ? err.message : String(err)}); falling back to rebuild.`);
27654
+ logger.warn(`Reload: classifier context unavailable (${describeAwsFailure(err).detail}); falling back to rebuild.`);
27499
27655
  verdict = {
27500
27656
  kind: "rebuild",
27501
27657
  reason: "classifier context unavailable; falling back to rebuild"
@@ -27522,12 +27678,12 @@ async function runAgentCoreWatchLoop(args) {
27522
27678
  currentAbort?.abort();
27523
27679
  return;
27524
27680
  }
27525
- logger.error(`Reload failed: ${err instanceof Error ? err.message : String(err)}. The previous container may already be torn down; exiting --watch loop. Re-run cdkd local invoke-agentcore --watch to recover.`);
27681
+ logger.error(`Reload failed: ${describeAwsFailure(err).detail}. The previous container may already be torn down; exiting --watch loop. Re-run cdkd local invoke-agentcore --watch to recover.`);
27526
27682
  reloadFailed = true;
27527
27683
  currentAbort?.abort();
27528
27684
  }
27529
27685
  }).catch((err) => {
27530
- logger.error(`Reload chain threw: ${err instanceof Error ? err.message : String(err)}`);
27686
+ logger.error(`Reload chain threw: ${describeAwsFailure(err).detail}`);
27531
27687
  });
27532
27688
  });
27533
27689
  try {
@@ -27559,7 +27715,7 @@ async function runAgentCoreWatchLoop(args) {
27559
27715
  try {
27560
27716
  await watcher.close();
27561
27717
  } catch (err) {
27562
- logger.warn(`Watcher close failed: ${err instanceof Error ? err.message : String(err)}`);
27718
+ logger.warn(`Watcher close failed: ${describeAwsFailure(err).detail}`);
27563
27719
  }
27564
27720
  }
27565
27721
  }
@@ -29449,4 +29605,4 @@ function collectVerbFlags(program) {
29449
29605
 
29450
29606
  //#endregion
29451
29607
  export { resolveSecretDerivedPrincipals as a, buildProgram, isResolvableSecretPrincipalList as i, runDestroyForStack as n, canonicalizeIpProtocolValue as o, holdsUnprovenSecretPrincipalToken as r, resolvedResourceTimeoutMs as s, canonicalizeIpv4Cidr as t };
29452
- //# sourceMappingURL=program-C87Q8YFK.js.map
29608
+ //# sourceMappingURL=program-DVPHKsxv.js.map