@go-to-k/cdkd 0.296.12 → 0.296.14

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 (29) hide show
  1. package/dist/{asg-provider-DoaukzYL.js → asg-provider-eXsnCQh2.js} +4 -4
  2. package/dist/{asg-provider-DoaukzYL.js.map → asg-provider-eXsnCQh2.js.map} +1 -1
  3. package/dist/{logger-DAaB7GFO.js → aws-failure-text-BaWeCWRz.js} +45 -2
  4. package/dist/aws-failure-text-BaWeCWRz.js.map +1 -0
  5. package/dist/cli.js +2 -2
  6. package/dist/{deploy-engine-CrYi7ta5.js → deploy-engine-Z_zHC0jz.js} +546 -483
  7. package/dist/deploy-engine-Z_zHC0jz.js.map +1 -0
  8. package/dist/{iam-policy-targets-elNafvpb.js → iam-policy-targets-BoZuWtxK.js} +43 -49
  9. package/dist/iam-policy-targets-BoZuWtxK.js.map +1 -0
  10. package/dist/{iam-role-provider-ClAgHnkh.js → iam-role-provider-BTYPRrDe.js} +4 -4
  11. package/dist/{iam-role-provider-ClAgHnkh.js.map → iam-role-provider-BTYPRrDe.js.map} +1 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +4 -4
  14. package/dist/{neptune-provider-ppi8nIX-.js → neptune-provider-ZYVwKq6K.js} +4 -4
  15. package/dist/{neptune-provider-ppi8nIX-.js.map → neptune-provider-ZYVwKq6K.js.map} +1 -1
  16. package/dist/{program-epAinsMQ.js → program-CKV6Kn8Q.js} +150 -112
  17. package/dist/program-CKV6Kn8Q.js.map +1 -0
  18. package/dist/{provider-classes-D76dAHvV.js → provider-classes-Dz2gVtOZ.js} +131 -70
  19. package/dist/provider-classes-Dz2gVtOZ.js.map +1 -0
  20. package/dist/{rds-provider-V_uJHUSX.js → rds-provider-6YeZRRfW.js} +4 -4
  21. package/dist/{rds-provider-V_uJHUSX.js.map → rds-provider-6YeZRRfW.js.map} +1 -1
  22. package/dist/{version-B8WzrPJT.js → version-1NhJbqzi.js} +2 -2
  23. package/dist/{version-B8WzrPJT.js.map → version-1NhJbqzi.js.map} +1 -1
  24. package/package.json +1 -1
  25. package/dist/deploy-engine-CrYi7ta5.js.map +0 -1
  26. package/dist/iam-policy-targets-elNafvpb.js.map +0 -1
  27. package/dist/logger-DAaB7GFO.js.map +0 -1
  28. package/dist/program-epAinsMQ.js.map +0 -1
  29. package/dist/provider-classes-D76dAHvV.js.map +0 -1
@@ -1,9 +1,9 @@
1
1
  import { a as runWithStackAwsClients, i as resetAwsClients, o as setAwsClients, t as AwsClients } from "./aws-clients-CnmtbrxD.js";
2
- import { A as displayIdent, D as UNRENDERABLE, E as STACK_REF_MAX_CODE_POINTS, F as plainIdentOr, I as safeMsg, L as stringifyJsonPayload, M as displayStackName, N as isPasteableIdent, O as cutMarker, R as truncateCodePoints, S as withStackName, T as SECRET_REF_MAX_CODE_POINTS, d as PATTERN_B_NAME_PROPERTIES, f as PATTERN_B_RESOURCE_TYPES, g as generateResourceName, h as explicitNamePropertyFor, i as reserveStdoutForPayload, j as displaySafe, k as displayAwsMessage, l as getLiveRenderer, m as derivesPatternBName, n as getLogger, o as runStackBuffered, r as isStdoutReservedForPayload, u as PATTERN_B_NAME_OPTIONS, w as SAFE_MSG_ALTERED_CHAR, x as withSkipPrefix } from "./logger-DAaB7GFO.js";
3
- import { $ as endCommandInterruptScope, $n as retryClassificationText, An as pasteableCommand, At as UNREPRODUCIBLE_LOCK_CLAUSE, Bt as injectiveKey, C as assertRegionMatch, Cn as TIMEOUT_FLAG_RESOURCE_TYPE, Dn as commandHole, Fn as shellQuote, Ft as formatLockOperation, Gt as withPasteableAwsProfile, H as runDeleteAttempt, Ht as producerCoordinateKey, In as withheldTargetClause, It as formatLockOwner, J as isAwsCliLiteral, Jt as clientDefaultsFor, Kt as ambientClientDefaults, Ln as setPasteableRunFlags, Mn as plainOrDescribed, Mt as buildLockContentionMessage, Nn as quotedOrDescribed, Nt as forceQuitRecoveryClause, Pn as shellBoundedDisplay, Pt as formatLockExpiry, Q as beginCommandInterruptScope, Qn as isTransientServerError, Qt as CdkdError, Rn as setPasteableVerbFlags, Rt as CUSTOM_RESOURCE_RESPONSE_PREFIX, S as RESOURCE_NOT_FOUND, Sn as withErrorHandling, Tn as SHELL_ACTIVE_WHY, Ut as producerRecordKey, Wt as setPasteableAwsProfile, Xt as AccountIdUnavailableError, Yn as isAmbiguousOutcomeError, Yt as credentialFingerprint, Zn as isRetryableTransientError, an as LocalInvokeBuildError$1, ar as isThrottlingError, dn as PartialFailureError, dt as resourceTypeShown, en as CrossAccountSecretRefusalError, er as describeAwsFailure, et as interruptWatchListenerCount, fn as ProvisioningError, gn as StackTerminationProtectionError, hn as StackHasActiveImportsError, in as IntrinsicResolutionRefusalError, ir as isMarkedNonRetryable, j as remedyLogicalId, jt as buildForceUnlockCommand, kn as isInertUnquoted, ln as MalformedProducerRecordRefusalError, lt as logicalIdShown, mn as ResourceUpdateNotSupportedError, n as RESOLVED_PREVIOUS_PRINCIPAL_KEYS, nn as DeployCancelledError, nr as safeStringify, on as LocalStartServiceError, or as markNonRetryable, pn as ResourceTimeoutError, qt as ambientCredentialConfig, rn as DynamicReferenceRegionAmbiguousError, s as readRecordedPrincipals, t as IAM_PRINCIPAL_NAME, tt as isInterruptedWaitError, un as NestedStackChildDirectDestroyError, vn as SynthesisError, w as VALUE_NOT_SHOWN, xn as normalizeAwsError, zt as DEFAULT_STATE_PREFIX } from "./iam-policy-targets-elNafvpb.js";
2
+ import { A as UNRENDERABLE, B as stringifyJsonPayload, D as SAFE_MSG_ALTERED_CHAR, F as displayStackName, I as isPasteableIdent, M as displayAwsMessage, N as displayIdent, O as SECRET_REF_MAX_CODE_POINTS, P as displaySafe, R as plainIdentOr, T as withStackName, V as truncateCodePoints, _ as derivesPatternBName, a as getLogger, f as getLiveRenderer, h as PATTERN_B_RESOURCE_TYPES, j as cutMarker, 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 safeMsg } from "./aws-failure-text-BaWeCWRz.js";
3
+ import { $t as AccountIdUnavailableError, An as commandHole, Bn as setPasteableRunFlags, D as VALUE_NOT_SHOWN, E as assertRegionMatch, En as TIMEOUT_FLAG_RESOURCE_TYPE, Fn as plainOrDescribed, Ft as buildLockContentionMessage, G as runDeleteAttempt, Gt as producerCoordinateKey, Ht as DEFAULT_STATE_PREFIX, In as quotedOrDescribed, It as forceQuitRecoveryClause, Jt as withPasteableAwsProfile, Kt as producerRecordKey, Ln as shellBoundedDisplay, Lt as formatLockExpiry, Mn as isInertUnquoted, Nn as pasteableCommand, Nt as UNREPRODUCIBLE_LOCK_CLAUSE, On as SHELL_ACTIVE_WHY, P as remedyLogicalId, Pt as buildForceUnlockCommand, Qn as isAmbiguousOutcomeError, Qt as credentialFingerprint, Rn as shellQuote, Rt as formatLockOperation, T as RESOURCE_NOT_FOUND, Tn as withErrorHandling, Ut as injectiveKey, Vn as setPasteableVerbFlags, Vt as CUSTOM_RESOURCE_RESPONSE_PREFIX, Xt as ambientCredentialConfig, Yt as ambientClientDefaults, Z as isAwsCliLiteral, Zt as clientDefaultsFor, _n as ResourceUpdateNotSupportedError, an as DeployCancelledError, ar as isThrottlingError, cn as LocalInvokeBuildError$1, er as isRetryableTransientError, fn as MalformedProducerRecordRefusalError, ft as logicalIdShown, gn as ResourceTimeoutError, hn as ProvisioningError, ir as isMarkedNonRetryable, it as isInterruptedWaitError, ln as LocalStartServiceError, mn as PartialFailureError, mt as resourceTypeShown, n as RESOLVED_PREVIOUS_PRINCIPAL_KEYS, nr as retryClassificationText, nt as endCommandInterruptScope, on as DynamicReferenceRegionAmbiguousError, or as markNonRetryable, pn as NestedStackChildDirectDestroyError, qt as setPasteableAwsProfile, rn as CrossAccountSecretRefusalError, rt as interruptWatchListenerCount, s as readRecordedPrincipals, sn as IntrinsicResolutionRefusalError, t as IAM_PRINCIPAL_NAME, tn as CdkdError, tr as isTransientServerError, tt as beginCommandInterruptScope, vn as StackHasActiveImportsError, wn as normalizeAwsError, xn as SynthesisError, yn as StackTerminationProtectionError, zn as withheldTargetClause, zt as formatLockOwner } from "./iam-policy-targets-BoZuWtxK.js";
4
4
  import { n as awsClientDefaults, r as getAssumedRoleCredentials, u as formatAuthority } from "./aws-client-defaults-D0q0z4dG.js";
5
- import { $ as recordDisplacedSkips, $a as noEchoLeavesOf, $i as refuseMalformedResourcesForDeploy, $n as withPrintingSecrets, $o as importableOutputs, $s as resolveStateBucketWithDefault, $t as secretNamePrintingBag, A as gray, Ac as resolveBucketRegion, Ai as malformedScrubResourceEntriesRefusalMessage, An as findDestructiveChanges, Ao as recordMaskOnlyValue, Ar as envCredentialsAreAssumedRole, As as formatDockerLoginError, At as removeProtectionTypeList, B as isHandledOrphan, Ba as prefetchCreateOnlyPropertyPaths, Bi as refuseMalformedOutputs, Bo as isSingleDynamicReferenceToken, Br as getAccountInfo, Bs as escapeRegExp, Bt as findNestedStackTypeChanges, C as recordedProtectionNote, Ca as isStatefulRecreateTargetSync, Cc as ownValue, Ci as malformedOrphansWarning, Cn as collectPublishedOutputNames, Co as pathCrossesDottedKey, Cr as assertSendableRoleArn, Cs as buildDockerImage, D as createReadOnlyAttributeHealerFactory, Dc as renderAssemblyPathEscape, Di as malformedResourceEntriesWarning, Dn as DEFAULT_RESOURCE_WARN_AFTER_MS, Do as identityKeyFor, Dr as AWS_CREDENTIAL_ENV_KEYS, Ds as describeDockerFailure, E as formatResourceLine, Ec as displayAssemblyPath, Ei as malformedRenderedContainersWarning, En as DEFAULT_RESOURCE_TIMEOUT_MS, Er as sendableAssumeRoleCommand, Es as describeDockerExecFailure, F as namesAnyDeclaredParameter, Fi as refuseMalformedOrphanRecords, Fo as STATE_SOURCED_BASELINE_RULES, Fs as redactDockerArgvValues, Ft as isReplacementOrphan, G as makeSiblingClaimReader, Gi as refuseMalformedResourceEntriesForDestroy, Go as splitImportedOps, Gr as keepsSecretReferenceToken, Gs as synthesisStatusMessage, H as loadJournaledOrphans, Ha as describeTypeWithThrottleRetry, Hi as refuseMalformedResourceAttributesForOrphan, Ho as isLockInfoExpired, Hr as carriesDynamicReference, Hs as AssetManifestLoader, Ht as inheritProducerRegions, I as reachableDivergentParameters, Ii as refuseMalformedOrphanRecordsForDestroy, In as withCreateTokenLedger, Io as STATE_SOURCED_CROSS_GENERATION_RULES, Is as redactedDockerCause, It as planFailedOps, J as displacedOpClause, Ja as TemplateParser, Ji as refuseMalformedResourceEntriesForOrphan, Jn as ProviderRegistry, Jo as exportNamesCarriedFrom, Jr as isStalePlaceholderArnAttribute, Js as loadCdkJson, Jt as updatePartialReason, K as planOrphanAdoption, Ki as refuseMalformedResourceEntriesForImport, Ko as acceptedCreateOnlyDropsOf, Kr as AWS_NO_VALUE, Ks as getDefaultStateBucketName, L as resourcesNamingDeclaredParameter, Li as refuseMalformedOrphans, Lo as STATE_SOURCED_READBACK_RULES, Lr as coerceParameterTypedValue, Ls as runDockerForeground, Lt as planRollback, M as red, Mi as previewableOrphanRecords, Mn as RollbackInlinePolicyWriters, Mo as recordNoEchoAttributeValues, Ms as isDockerClientEnvKey, Mt as recordAfterRollbackUpdate, N as yellow, Ni as refuseDivergentRecordRegionForDestroy, No as recordProvenPublicExpression, Ns as isMalformedEnvKey, Nt as demoteSupersededOrphans, O as bold, Oc as resolveAssemblyPath, Oi as malformedResourcePropertiesWarning, On as maskingRetryLogger, Oo as carriesSecretMask, Or as applyCallerIdentityCredentials, Os as dockerSpawnEnvWithSensitive, P as computeParameterTaint, Pn as ledgerForStack, Po as wholeStringLeavesOf, Ps as partitionSensitiveEnv, Pt as isJournaledOrphan, Q as nestedChildStackName$1, Qa as maskedLeafCoordinatesOf, Qi as refuseMalformedResourcePropertiesForOrphan, Qo as importableOutputKeys, Qr as parameterInputsFor, Qs as resolveSkipPrefix, Qt as orphanRecordsPrintingBag, R as deleteJournaledOrphans, Ri as refuseMalformedOrphansForDestroy, Ro as TEMPLATE_SOURCED_RULES, Rr as isUnboundTemplateParameter, Rs as runDockerStreaming, Rt as replacementNeverSwapped, S as recordedProtectionEvidence, Sa as isStatefulRecreateTargetForReplace, Sc as nullPrototypeRecord, Si as malformedOrphansRefusalMessage, Sn as collectDeclaredOutputNames, So as isUncertifiedBaselineMaskPosition, Sr as assertFlagRoleArn, Ss as buildDenyExternalAccessPolicy, Tc as describeFileReadFailure, Ti as malformedOutputsWarning, Tn as bindingSkippedOutputs, To as recordNestedStackParameterExpressions, Tr as isIamRoleArn, Ts as describeDockerCapturedOutput, U as makeForeignHolderScan, Ua as withRetry, Ui as refuseMalformedResourceEntries, Uo as S3StateBackend, Ur as carriesFetchableDynamicReference, Us as getDockerImageBySourceHash, V as journaledOrphanLines, Va as templateResourceTypes, Vi as refuseMalformedOutputsForDestroy, Vo as LockManager, Vr as isImpossibleEmptyStoredAttribute, Vs as stripControlChars, W as sameJournaledOrphans, Wi as refuseMalformedResourceEntriesForDeploy, Wo as rebuildClientForBucketRegion, Wr as isNamelessDynamicReferenceError, Ws as Synthesizer, X as dropSettledNestedJournals, Xa as maskReadbackAtCoordinates, Xi as refuseMalformedResourcePropertiesForDrift, Xn as wouldReturnToSdkProvider, Xo as hasReasonlessBaselineRefusal, Xs as resolveAutoAssetStorage, Xt as journaledOrphanPrintingBag, Y as displacedPhysicalIdShown, Ya as isMarkedCoordinate, Yi as refuseMalformedResourcePropertiesForDestroy, Yn as ccBrokenReason, Yo as hasReadableExportSet, Yr as refStateLookupFromResource, Ys as resolveApp, Yt as completedReplayEntries, Za as maskWholeValue, Zi as refuseMalformedResourcePropertiesForExport, Zn as isCustomResourceType$1, Zo as hasUnverifiableParameterRefusal, Zr as withSharedDrainBudget, Zs as resolveCaptureObservedState, Zt as maskEventTextWithBoundBags, _ as makeCanonicalizePropertiesFn, _a as NO_CC_HANDLERS_REASON, _c as StageLoadError, _i as malformedLocalResourceEntriesWarning, _n as secretBearingStateKeyWarning, _o as markSameGenerationBag, _r as IntrinsicFunctionResolver, _s as isCrossRegionRedirect, a as findNestedTemplateTreeDefect, aa as repairMalformedOutputsForReadOnly, ac as CFN_TEMPLATE_BODY_LIMIT, ai as accountArgs, an as createPreDeleteFinalSnapshot, ao as createUnionSecretMasker, ar as deleteSkipReason, as as isSensitiveAttributeName, at as replayFailedOperations, b as noEchoParameterNamesOf, ba as shownType, bc as hasOwnKey, bi as malformedOrphanRecordsWarning, bn as isWholeDynamicReferenceValue, bo as DYNAMIC_REFERENCE_TOKEN_SCAN, br as regionLessSecretName, bs as validateAssetBucketName, c as renderNestedTemplateTreeDefect, ca as repairMalformedResourcesForReadOnly, cc as findLargeInlineResources, ci as hasReadableOrphans, cn as refusesFinalSnapshot, co as logOnlyValueCount, cs as buildAssetRedirectMap, ct as destroyStackRecordsView, d as conditionInputsFrom, da as unreadableResourceEntries, dc as decodeListingKey, di as isReadableOrphanRecord, dn as DeploymentEventsStore, do as recordLogOnlyValue, ds as rewriteTemplateAssetReferences, dt as PROTECTION_PROPERTY_BY_TYPE, ea as refuseMalformedResourcesForDestroy, ec as resolveStateBucketWithDefaultAndSource, ei as JSON_LISTING_HOLE_VALUE, en as stateSecretNameNeedles, eo as noEchoOutputsComparison, er as CloudControlProvider, es as isReadableBag, f as parentSuppliedValues, fa as withheldAccountClause, fc as expectedOwnerParam, fi as isReadableResourceEntry, fn as extractDeploymentEventError, fo as shareLogOnlyValues, fs as AssetModeResolver, ft as isProtectionValueActive, g as mergeNoChangeOutputs, gc as AssemblyReader, gi as malformedLocalOutputsWarning, gn as secretBearing, go as maskSecretsInText, gr as INTRINSIC_KEYS, gs as getBootstrapMarkerKey, h as keptWholeReasonText, ha as unwrittenCreateOnlyReplacement, hc as derivePartitionAndUrlSuffix, hi as malformedExportSourceWarning, hn as exportAliasCollisionScrubWarning, ho as maskSecretsInError, hr as DiffCalculator, hs as ensureAssetStorage, i as childTemplateLoader, ia as repairMalformedOrphansForReadOnly, ic as ssmResolvedValueType, ii as UNREADABLE_RESOURCES_MAP_ROW, in as ccRoutedFinalSnapshotError, io as carryLogOnlyValues, ir as deleteIndeterminateGuards, is as AssetPublisher, it as withNestedStackContext, j as green, ji as malformedStateRefusalMessage, jn as formatDestructiveChange, jo as recordMaskOnlyValuesIn, js as getDockerCmd, jt as orphanDeleteNeedsIdentity, k as cyan, ki as malformedResourcesWarning, kn as constructPathOf, ko as provenPublicValue, kr as callerEnvCredentials, ks as finchSecretArgvRefusal, l as templateIdentity, la as unpreviewableOrphanRecords, lc as uploadCfnTemplate, li as hasReadableOutputs, ln as unsupportedFinalSnapshotError, lo as printingCorpusOf, ls as createAssetRedirectResolver, m as isSecretBearingReferenceString, mc as canonicalizeRegion, mi as malformedExportNamesWarning, mn as displayTextOrWithheld, mo as errorCauseChain, ms as assertAssetBucketRegion, mt as readProtection, n as IMPLICIT_DELETE_DEPENDENCIES, na as refuseMalformedState, nc as stateBucketExistenceConfirmed, ni as STATE_RESOURCES_MALFORMED, nn as PRE_DELETE_SNAPSHOT_TYPES, no as readsNoEchoSource, ns as orphansCarriedFrom, nt as withNestedRevertRun, o as isAbsoluteAssetPath, oa as repairMalformedResourceEntriesForReadOnly, oc as CFN_TEMPLATE_URL_LIMIT, oi as deployRefusesOrphanRowsReason, on as effectiveDeletionPolicy, oo as hasMaskableValues, os as stringifyValue, ot as replayRollback, p as readRecordedConditionVerdicts, pa as findActionableSilentDrops, pc as PARTITION_TABLE, pi as malformedDriftResourcePropertiesWarning, pn as WITHHELD_NAME_DISPLAY, po as createSecretMasker, ps as BOOTSTRAP_MARKER_PREFIX, pt as perType, q as NESTED_PENDING_PARENT_REASON, qa as DagBuilder, qi as refuseMalformedResourceEntriesForImportSave, qn as CC_BROKEN_REASON, qo as describeRegionValueKind, qr as cfnRefValueFromPhysicalId, qs as getLegacyStateBucketName, qt as updatePartialMessage, r as computeImplicitDeleteEdges, ra as repairMalformedOrphanRecordsForReadOnly, rc as warnDeprecatedNoPrefixCliFlag, ri as UNREADABLE_ORPHANS_CONTAINER_ROW, rn as buildFinalSnapshotIdentifier, ro as liveMatchesUnresolvedTokenFrame, rr as UNSPECIFIED_SKIP_REASON, rs as shouldRetainResource, s as listNestedTemplateRows, sa as repairMalformedResourcePropertiesForReadOnly, sc as MIGRATE_TMP_PREFIX, si as displayLogicalId, sn as isFinalSnapshotError, so as literalSplitDelimitersOf, sr as isWaitAbandonedError, ss as WorkGraph, t as DeployEngine, ta as refuseMalformedResourcesForExport, tc as resolveUseCdkBootstrapAssets, ti as STATE_REGION_DIVERGED, tn as ATOMIC_FINAL_SNAPSHOT_TYPES, tr as slowCcOperationTimeoutMs, ts as orphansAfterRollback, tt as revertedNestedRowIds, u as conditionFingerprint, ua as unreadableOrphanRecords, uc as CUSTOM_RESOURCE_RESPONSE_OBJECT_DESCRIPTION, ui as hasReadableResources, un as DeploymentEventsReader, uo as recordLogOnlyParameterValue, us as loadPublishableAssetManifest, ut as withStackRecords, v as noEchoAttributeNamesOf, va as hasNoCloudControlHandlers, vc as processStackMessages, vi as malformedLocalResourcesWarning, vn as secretSafeKeyDisplay, vo as redactSecretsForState, vr as classifyReplaySecretRegion, vs as parseBootstrapMarker, wa as renderStatefulReason, wc as absoluteAssemblyPathEscape, wi as malformedOutputsRefusalMessage, wn as isExportAliasCollision, wo as inheritNestedStackParameterAssociations, wr as explicitRoleArnOrThrow, ws as resolveDockerContextDirectory, x as withResourceDeadline, xa as MULTI_REGION_RECREATE_BLOCKED_TYPES, xc as hasPlainPrototype, xi as malformedOrphanRowsKeptWarning, xn as noEchoParameterValueSeed, xo as dynamicReferenceTokens, xr as applyRoleArnIfSet, xs as validateContainerRepoName, y as noEchoComparisonForTemplate, ya as findReplacedReadersOfRecreateTargets, yc as defineOwnKey, yi as malformedOrphanRecordsRefusalMessage, yn as exportNameSecretExposure, yo as scrubResourceRecord, yr as producerRegionsFromState, ys as readBootstrapMarkerBody, z as dropFailedHint, zi as refuseMalformedOrphansForOrphan, zo as WHOLE_DYNAMIC_REFERENCE_PATTERN, zr as parameterTypeMayLoseSecretIdentity, zs as warnFinchArgvExposure, zt as resolveReplacementOldType } from "./deploy-engine-CrYi7ta5.js";
6
- import { t as getCdkdVersion } from "./version-B8WzrPJT.js";
5
+ import { $ as dropFailedHint, $a as maskedLeafCoordinatesOf, $i as refuseMalformedResourcePropertiesForOrphan, $o as importableOutputKeys, $r as parameterInputsFor, $s as resolveSkipPrefix, $t as secretNamePrintingBag, A as gray, Ai as malformedResourcesWarning, An as findDestructiveChanges, Ao as provenPublicValue, Ar as callerEnvCredentials, As as finchSecretArgvRefusal, At as removeProtectionTypeList, B as NESTED_PENDING_PARENT_REASON, Bi as refuseMalformedOrphansForOrphan, Bo as WHOLE_DYNAMIC_REFERENCE_PATTERN, Br as parameterTypeMayLoseSecretIdentity, Bs as warnFinchArgvExposure, Bt as findNestedStackTypeChanges, C as recordedProtectionNote, Ca as isStatefulRecreateTargetForReplace, Cc as nullPrototypeRecord, Ci as malformedOrphansRefusalMessage, Cn as collectPublishedOutputNames, Co as isUncertifiedBaselineMaskPosition, Cr as assertFlagRoleArn, Cs as buildDenyExternalAccessPolicy, D as createReadOnlyAttributeHealerFactory, Dc as displayAssemblyPath, Di as malformedRenderedContainersWarning, Dn as DEFAULT_RESOURCE_WARN_AFTER_MS, Dr as sendableAssumeRoleCommand, Ds as describeDockerExecFailure, E as formatResourceLine, Ec as describeFileReadFailure, Ei as malformedOutputsWarning, En as DEFAULT_RESOURCE_TIMEOUT_MS, Eo as recordNestedStackParameterExpressions, Er as isIamRoleArn, Es as describeDockerCapturedOutput, F as namesAnyDeclaredParameter, Fo as wholeStringLeavesOf, Fs as partitionSensitiveEnv, Ft as isReplacementOrphan, G as nestedChildStackName$1, Gi as refuseMalformedResourceEntriesForDeploy, Go as rebuildClientForBucketRegion, Gr as isNamelessDynamicReferenceError, Gs as Synthesizer, H as displacedPhysicalIdShown, Ha as templateResourceTypes, Hi as refuseMalformedOutputsForDestroy, Ho as LockManager, Hr as isImpossibleEmptyStoredAttribute, Hs as stripControlChars, Ht as inheritProducerRegions, I as reachableDivergentParameters, Ii as refuseMalformedOrphanRecords, In as withCreateTokenLedger, Io as STATE_SOURCED_BASELINE_RULES, Is as redactDockerArgvValues, It as planFailedOps, J as revertedNestedRowIds, Ja as DagBuilder, Ji as refuseMalformedResourceEntriesForImportSave, Jn as ProviderRegistry, Jo as describeRegionValueKind, Jr as cfnRefValueFromPhysicalId, Js as getLegacyStateBucketName, Jt as updatePartialReason, K as recordDisplacedSkips, Ki as refuseMalformedResourceEntriesForDestroy, Ko as splitImportedOps, Kr as keepsSecretReferenceToken, Ks as synthesisStatusMessage, L as resourcesNamingDeclaredParameter, Li as refuseMalformedOrphanRecordsForDestroy, Lo as STATE_SOURCED_CROSS_GENERATION_RULES, Ls as redactedDockerCause, Lt as planRollback, M as red, Mi as malformedStateRefusalMessage, Mn as RollbackInlinePolicyWriters, Mo as recordMaskOnlyValuesIn, Ms as getDockerCmd, Mt as recordAfterRollbackUpdate, N as yellow, Ni as previewableOrphanRecords, No as recordNoEchoAttributeValues, Ns as isDockerClientEnvKey, Nt as demoteSupersededOrphans, O as bold, Oc as renderAssemblyPathEscape, Oi as malformedResourceEntriesWarning, On as maskingRetryLogger, Oo as identityKeyFor, Or as AWS_CREDENTIAL_ENV_KEYS, Os as describeDockerFailure, P as computeParameterTaint, Pi as refuseDivergentRecordRegionForDestroy, Pn as ledgerForStack, Po as recordProvenPublicExpression, Ps as isMalformedEnvKey, Pt as isJournaledOrphan, Q as deleteJournaledOrphans, Qa as maskWholeValue, Qi as refuseMalformedResourcePropertiesForExport, Qn as isCustomResourceType$1, Qo as hasUnverifiableParameterRefusal, Qr as withSharedDrainBudget, Qs as resolveCaptureObservedState, Qt as orphanRecordsPrintingBag, R as makeSiblingClaimReader, Ri as refuseMalformedOrphans, Ro as STATE_SOURCED_READBACK_RULES, Rr as coerceParameterTypedValue, Rs as runDockerForeground, Rt as replacementNeverSwapped, S as recordedProtectionEvidence, Sa as MULTI_REGION_RECREATE_BLOCKED_TYPES, Sc as hasPlainPrototype, Si as malformedOrphanRowsKeptWarning, Sn as collectDeclaredOutputNames, So as dynamicReferenceTokens, Sr as applyRoleArnIfSet, Ss as validateContainerRepoName, Ta as renderStatefulReason, Tc as absoluteAssemblyPathEscape, Ti as malformedOutputsRefusalMessage, Tn as bindingSkippedOutputs, To as inheritNestedStackParameterAssociations, Tr as explicitRoleArnOrThrow, Ts as resolveDockerContextDirectory, U as dropSettledNestedJournals, Ua as describeTypeWithThrottleRetry, Ui as refuseMalformedResourceAttributesForOrphan, Uo as isLockInfoExpired, Ur as carriesDynamicReference, Us as AssetManifestLoader, V as displacedOpClause, Va as prefetchCreateOnlyPropertyPaths, Vi as refuseMalformedOutputs, Vo as isSingleDynamicReferenceToken, Vr as getAccountInfo, Vs as escapeRegExp, Wa as withRetry, Wi as refuseMalformedResourceEntries, Wo as S3StateBackend, Wr as carriesFetchableDynamicReference, Ws as getDockerImageBySourceHash, Xa as isMarkedCoordinate, Xi as refuseMalformedResourcePropertiesForDestroy, Xn as isCustomResource, Xo as hasReadableExportSet, Xr as refStateLookupFromResource, Xs as resolveApp, Xt as journaledOrphanPrintingBag, Y as withNestedRevertRun, Ya as TemplateParser, Yi as refuseMalformedResourceEntriesForOrphan, Yn as ccBrokenReason, Yo as exportNamesCarriedFrom, Yr as isStalePlaceholderArnAttribute, Ys as loadCdkJson, Yt as completedReplayEntries, Z as withNestedStackContext, Za as maskReadbackAtCoordinates, Zi as refuseMalformedResourcePropertiesForDrift, Zn as wouldReturnToSdkProvider, Zo as hasReasonlessBaselineRefusal, Zs as resolveAutoAssetStorage, Zt as maskEventTextWithBoundBags, _ as makeCanonicalizePropertiesFn, _c as AssemblyReader, _i as malformedLocalOutputsWarning, _n as secretBearingStateKeyWarning, _o as maskSecretsInText, _r as INTRINSIC_KEYS, _s as getBootstrapMarkerKey, a as findNestedTemplateTreeDefect, aa as repairMalformedOrphansForReadOnly, ac as ssmResolvedValueType, ai as UNREADABLE_RESOURCES_MAP_ROW, an as createPreDeleteFinalSnapshot, ao as carryLogOnlyValues, ar as deleteIndeterminateGuards, as as AssetPublisher, at as replayFailedOperations, b as noEchoParameterNamesOf, ba as findReplacedReadersOfRecreateTargets, bc as defineOwnKey, bi as malformedOrphanRecordsRefusalMessage, bn as isWholeDynamicReferenceValue, bo as scrubResourceRecord, br as producerRegionsFromState, bs as readBootstrapMarkerBody, c as renderNestedTemplateTreeDefect, ca as repairMalformedResourcePropertiesForReadOnly, cc as MIGRATE_TMP_PREFIX, ci as displayLogicalId, cn as refusesFinalSnapshot, co as literalSplitDelimitersOf, cr as isWaitAbandonedError, cs as WorkGraph, ct as destroyStackRecordsView, d as conditionInputsFrom, da as unreadableOrphanRecords, dc as CUSTOM_RESOURCE_RESPONSE_OBJECT_DESCRIPTION, di as hasReadableResources, dn as DeploymentEventsStore, do as recordLogOnlyParameterValue, ds as loadPublishableAssetManifest, dt as PROTECTION_PROPERTY_BY_TYPE, ea as refuseMalformedResourcesForDeploy, ec as resolveStateBucketWithDefault, en as stateSecretNameNeedles, eo as noEchoLeavesOf, er as withPrintingSecrets, es as importableOutputs, et as isHandledOrphan, f as parentSuppliedValues, fa as unreadableResourceEntries, fc as decodeListingKey, fi as isReadableOrphanRecord, fn as extractDeploymentEventError, fo as recordLogOnlyValue, fs as rewriteTemplateAssetReferences, ft as isProtectionValueActive, g as mergeNoChangeOutputs, ga as unwrittenCreateOnlyReplacement, gc as derivePartitionAndUrlSuffix, gi as malformedExportSourceWarning, gn as secretBearing, go as maskSecretsInError, gr as DiffCalculator, gs as ensureAssetStorage, h as keptWholeReasonText, hc as canonicalizeRegion, hi as malformedExportNamesWarning, hn as exportAliasCollisionScrubWarning, ho as errorCauseChain, hs as assertAssetBucketRegion, i as childTemplateLoader, ia as repairMalformedOrphanRecordsForReadOnly, ic as warnDeprecatedNoPrefixCliFlag, ii as UNREADABLE_ORPHANS_CONTAINER_ROW, in as ccRoutedFinalSnapshotError, io as liveMatchesUnresolvedTokenFrame, ir as UNSPECIFIED_SKIP_REASON, is as shouldRetainResource, it as sameJournaledOrphans, j as green, jc as resolveBucketRegion, ji as malformedScrubResourceEntriesRefusalMessage, jn as formatDestructiveChange, jo as recordMaskOnlyValue, jr as envCredentialsAreAssumedRole, js as formatDockerLoginError, jt as orphanDeleteNeedsIdentity, k as cyan, kc as resolveAssemblyPath, ki as malformedResourcePropertiesWarning, kn as constructPathOf, ko as carriesSecretMask, kr as applyCallerIdentityCredentials, ks as dockerSpawnEnvWithSensitive, l as templateIdentity, la as repairMalformedResourcesForReadOnly, lc as findLargeInlineResources, li as hasReadableOrphans, ln as unsupportedFinalSnapshotError, lo as logOnlyValueCount, ls as buildAssetRedirectMap, m as isSecretBearingReferenceString, ma as findActionableSilentDrops, mc as PARTITION_TABLE, mi as malformedDriftResourcePropertiesWarning, mn as displayTextOrWithheld, mo as createSecretMasker, ms as BOOTSTRAP_MARKER_PREFIX, mt as readProtection, n as IMPLICIT_DELETE_DEPENDENCIES, na as refuseMalformedResourcesForExport, nc as resolveUseCdkBootstrapAssets, ni as STATE_REGION_DIVERGED, nn as PRE_DELETE_SNAPSHOT_TYPES, nr as slowCcOperationTimeoutMs, ns as orphansAfterRollback, nt as loadJournaledOrphans, o as isAbsoluteAssetPath, oa as repairMalformedOutputsForReadOnly, oc as CFN_TEMPLATE_BODY_LIMIT, oi as accountArgs, on as effectiveDeletionPolicy, oo as createUnionSecretMasker, or as deleteSkipReason, os as isSensitiveAttributeName, ot as replayRollback, p as readRecordedConditionVerdicts, pa as withheldAccountClause, pc as expectedOwnerParam, pi as isReadableResourceEntry, pn as WITHHELD_NAME_DISPLAY, po as shareLogOnlyValues, ps as AssetModeResolver, pt as perType, qi as refuseMalformedResourceEntriesForImport, qn as CC_BROKEN_REASON, qo as acceptedCreateOnlyDropsOf, qr as AWS_NO_VALUE, qs as getDefaultStateBucketName, qt as updatePartialMessage, r as computeImplicitDeleteEdges, ra as refuseMalformedState, rc as stateBucketExistenceConfirmed, ri as STATE_RESOURCES_MALFORMED, rn as buildFinalSnapshotIdentifier, ro as readsNoEchoSource, rs as orphansCarriedFrom, rt as makeForeignHolderScan, s as listNestedTemplateRows, sa as repairMalformedResourceEntriesForReadOnly, sc as CFN_TEMPLATE_URL_LIMIT, si as deployRefusesOrphanRowsReason, sn as isFinalSnapshotError, so as hasMaskableValues, ss as stringifyValue, t as DeployEngine, ta as refuseMalformedResourcesForDestroy, tc as resolveStateBucketWithDefaultAndSource, ti as JSON_LISTING_HOLE_VALUE, tn as ATOMIC_FINAL_SNAPSHOT_TYPES, to as noEchoOutputsComparison, tr as CloudControlProvider, ts as isReadableBag, tt as journaledOrphanLines, u as conditionFingerprint, ua as unpreviewableOrphanRecords, uc as uploadCfnTemplate, ui as hasReadableOutputs, un as DeploymentEventsReader, uo as printingCorpusOf, us as createAssetRedirectResolver, ut as withStackRecords, v as noEchoAttributeNamesOf, va as NO_CC_HANDLERS_REASON, vc as StageLoadError, vi as malformedLocalResourceEntriesWarning, vn as secretSafeKeyDisplay, vo as markSameGenerationBag, vr as IntrinsicFunctionResolver, vs as isCrossRegionRedirect, wa as isStatefulRecreateTargetSync, wc as ownValue, wi as malformedOrphansWarning, wn as isExportAliasCollision, wo as pathCrossesDottedKey, wr as assertSendableRoleArn, ws as buildDockerImage, x as withResourceDeadline, xa as shownType, xc as hasOwnKey, xi as malformedOrphanRecordsWarning, xn as noEchoParameterValueSeed, xo as DYNAMIC_REFERENCE_TOKEN_SCAN, xr as regionLessSecretName, xs as validateAssetBucketName, y as noEchoComparisonForTemplate, ya as hasNoCloudControlHandlers, yc as processStackMessages, yi as malformedLocalResourcesWarning, yn as exportNameSecretExposure, yo as redactSecretsForState, yr as classifyReplaySecretRegion, ys as parseBootstrapMarker, z as planOrphanAdoption, zi as refuseMalformedOrphansForDestroy, zo as TEMPLATE_SOURCED_RULES, zr as isUnboundTemplateParameter, zs as runDockerStreaming, zt as resolveReplacementOldType } from "./deploy-engine-Z_zHC0jz.js";
6
+ import { t as getCdkdVersion } from "./version-1NhJbqzi.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";
@@ -1449,7 +1449,8 @@ function validateRecreateTargets(input) {
1449
1449
  property
1450
1450
  });
1451
1451
  }
1452
- if (recordedResource.provisionedBy === "cc-api" && ccBrokenReason(templateResource.Type) === void 0) blockedAlreadyCcApi.push(target);
1452
+ const onCcAnyway = input.hasSdkProvider !== void 0 && !nestedStackRow && noCcRoute === void 0 && !isCustomResource(resourceType) && !isCustomResource(templateResource.Type) && !input.hasSdkProvider(resourceType) && !input.hasSdkProvider(templateResource.Type);
1453
+ if ((recordedResource.provisionedBy === "cc-api" || onCcAnyway) && ccBrokenReason(templateResource.Type) === void 0) blockedAlreadyCcApi.push(target);
1453
1454
  } else {
1454
1455
  const actionableDrops = findActionableSilentDrops(resourceType, templateResource.Properties, input.allowUnsupportedProperties, recordedResource.properties, { unresolvedAs: "changed" });
1455
1456
  for (const { property } of actionableDrops) ambiguousIntentSdk.push({
@@ -1543,7 +1544,7 @@ function renderRecreateTargetsErrors(validation) {
1543
1544
  }
1544
1545
  if (validation.blockedAlreadyCcApi.length > 0) {
1545
1546
  if (lines.length > 0) lines.push("");
1546
- lines.push(`--recreate-via-cc-api named ${validation.blockedAlreadyCcApi.length} resource(s) that are ALREADY sticky on Cloud Control API (the migration is a no-op):`);
1547
+ lines.push(`--recreate-via-cc-api named ${validation.blockedAlreadyCcApi.length} resource(s) that are ALREADY sticky on Cloud Control API, or whose type has no SDK provider (the migration is a no-op):`);
1547
1548
  for (const blocked of validation.blockedAlreadyCcApi) lines.push(` - ${blocked.logicalId} (${recordedTypeShown(blocked.resourceType)})`);
1548
1549
  lines.push(" Fix: drop these logical ids from --recreate-via-cc-api. They are already CC-managed; a destroy + recreate cycle would produce the same end state at the cost of unnecessary downtime.");
1549
1550
  }
@@ -1621,7 +1622,7 @@ async function probeStatefulRecreateTargetsAsync(targets, clients, logger = getL
1621
1622
  promoted.push({ ...target });
1622
1623
  continue;
1623
1624
  }
1624
- logger.warn(`--recreate-via-cc-api / --recreate-via-sdk-provider: live S3 probe failed for ${target.logicalId} (bucket ${target.physicalId}); leaving stateful guard at the sync result. If the bucket might be non-empty, re-run with --force-stateful-recreation. Underlying error: ${e instanceof Error ? e.message : String(e)}`);
1625
+ logger.warn(`--recreate-via-cc-api / --recreate-via-sdk-provider: live S3 probe failed for ${target.logicalId} (bucket ${target.physicalId}); leaving stateful guard at the sync result. If the bucket might be non-empty, re-run with --force-stateful-recreation. Underlying error: ${describeAwsFailure(e).detail}`);
1625
1626
  promoted.push({
1626
1627
  ...target,
1627
1628
  probeUnresolved: true
@@ -1678,7 +1679,7 @@ async function probeStatefulRecreateTargetsAsync(targets, clients, logger = getL
1678
1679
  });
1679
1680
  continue;
1680
1681
  }
1681
- logger.warn(`--recreate-via-cc-api / --recreate-via-sdk-provider: live CloudWatch Logs probe failed for ${target.logicalId} (log group ${target.physicalId}); treating the log group as NOT provably empty. An unset or zero RetentionInDays is CloudWatch Logs' "never expire", so an unprovable emptiness must not read as empty. Fixes, cheapest first: grant logs:DescribeLogStreams and re-run, or re-run as-is if this was transient (CloudWatch Logs throttles this API aggressively). Only if the log group really is disposable, re-run with --force-stateful-recreation — that flag has NO per-resource granularity and clears the guard for every target in the run. Underlying error: ${e instanceof Error ? e.message : String(e)}`);
1682
+ logger.warn(`--recreate-via-cc-api / --recreate-via-sdk-provider: live CloudWatch Logs probe failed for ${target.logicalId} (log group ${target.physicalId}); treating the log group as NOT provably empty. An unset or zero RetentionInDays is CloudWatch Logs' "never expire", so an unprovable emptiness must not read as empty. Fixes, cheapest first: grant logs:DescribeLogStreams and re-run, or re-run as-is if this was transient (CloudWatch Logs throttles this API aggressively). Only if the log group really is disposable, re-run with --force-stateful-recreation — that flag has NO per-resource granularity and clears the guard for every target in the run. Underlying error: ${describeAwsFailure(e).detail}`);
1682
1683
  promoted.push({
1683
1684
  ...target,
1684
1685
  statefulReason: "has-log-events"
@@ -2209,7 +2210,7 @@ var ExportIndexStore = class {
2209
2210
  state: (await this.stateBackend.getState(ref.stackName, ref.region ?? this.region))?.state
2210
2211
  };
2211
2212
  } catch (err) {
2212
- this.logger.warn(`Failed to read state for ${ref.stackName} (${ref.region ?? ""}) during index rebuild: ${err instanceof Error ? err.message : String(err)}`);
2213
+ this.logger.warn(`Failed to read state for ${ref.stackName} (${ref.region ?? ""}) during index rebuild: ${describeAwsFailure(err).detail}`);
2213
2214
  return {
2214
2215
  ref,
2215
2216
  state: null
@@ -2322,10 +2323,10 @@ var ExportIndexStore = class {
2322
2323
  await new Promise((resolve) => setTimeout(resolve, backoff));
2323
2324
  continue;
2324
2325
  }
2325
- this.logger.warn(`Exports index ${label} failed (non-retryable): ${err instanceof Error ? err.message : String(err)}; continuing without index update`);
2326
+ this.logger.warn(`Exports index ${label} failed (non-retryable): ${describeAwsFailure(err).detail}; continuing without index update`);
2326
2327
  return false;
2327
2328
  }
2328
- this.logger.warn(`Exports index ${label} exhausted ${this.opts.maxWriteRetries} retries due to concurrent writers; continuing without index update. Last error: ${lastErr instanceof Error ? lastErr.message : String(lastErr)}`);
2329
+ this.logger.warn(`Exports index ${label} exhausted ${this.opts.maxWriteRetries} retries due to concurrent writers; continuing without index update. Last error: ${describeAwsFailure(lastErr).detail}`);
2329
2330
  return false;
2330
2331
  }
2331
2332
  isNoSuchKey(err) {
@@ -2395,7 +2396,7 @@ function collectCrossStackRefs(node, onRef) {
2395
2396
  //#region src/provisioning/register-providers.ts
2396
2397
  let providerClasses;
2397
2398
  function loadProviderClasses() {
2398
- providerClasses ??= import("./provider-classes-D76dAHvV.js");
2399
+ providerClasses ??= import("./provider-classes-Dz2gVtOZ.js");
2399
2400
  return providerClasses;
2400
2401
  }
2401
2402
  function registerAllProviders(registry, classes) {
@@ -3734,7 +3735,7 @@ async function drainTemplateUploads(cleanups, stateBucket, labels) {
3734
3735
  for (const cleanup of cleanups) try {
3735
3736
  await cleanup();
3736
3737
  } catch (cleanupErr) {
3737
- const msg = cleanupErr instanceof Error ? cleanupErr.message : String(cleanupErr);
3738
+ const msg = describeAwsFailure(cleanupErr).detail;
3738
3739
  logger.warn(`Failed to delete ${labels.what} from '${stateBucket}'${labels.when ? ` ${labels.when}` : ""}. Clean up manually under prefix '${MIGRATE_TMP_PREFIX}/'. Cause: ${msg}`);
3739
3740
  }
3740
3741
  }
@@ -3830,7 +3831,7 @@ async function retireCloudFormationStack(options) {
3830
3831
  }));
3831
3832
  updateRan = true;
3832
3833
  } catch (err) {
3833
- const msg = err instanceof Error ? err.message : String(err);
3834
+ const msg = describeAwsFailure(err).detail;
3834
3835
  if (/No updates are to be performed/i.test(msg)) logger.info(` CloudFormation reports no updates needed — proceeding to delete.`);
3835
3836
  else throw err;
3836
3837
  }
@@ -3920,7 +3921,7 @@ async function injectRetainPoliciesRecursive(rootTemplateBody, rootCfnStackName,
3920
3921
  cleanups
3921
3922
  };
3922
3923
  } catch (err) {
3923
- throw new RecursiveRetainInjectionError(err instanceof Error ? err.message : String(err), cleanups, err instanceof Error ? err : void 0);
3924
+ throw new RecursiveRetainInjectionError(describeAwsFailure(err).detail, cleanups, err instanceof Error ? err : void 0);
3924
3925
  }
3925
3926
  }
3926
3927
  var RecursiveRetainInjectionError = class extends Error {
@@ -4020,7 +4021,7 @@ async function tryGetCloudFormationResourceMap(stackName, cfnClient) {
4020
4021
  logger.debug(`No CloudFormation stack named '${stackName}'.`);
4021
4022
  return null;
4022
4023
  }
4023
- const reason = err instanceof Error ? err.message : String(err);
4024
+ const reason = describeAwsFailure(err).detail;
4024
4025
  const subject = isPasteableIdent(stackName) ? `CloudFormation stack '${stackName}'` : "a CloudFormation stack whose name is not a plain identifier";
4025
4026
  logger.warn(`Could not read ${subject} to resolve physical IDs (${reason}).\nFalling back to per-resource lookup; resources whose physical name CloudFormation generated may be reported as not found. Grant cloudformation:DescribeStackResources, or pass --resource ${commandHole("LogicalId")}=${commandHole("physicalId")} for those resources.`);
4026
4027
  return null;
@@ -5554,7 +5555,7 @@ var ScrubRefusalError = class ScrubRefusalError extends CdkdError {
5554
5555
  }
5555
5556
  };
5556
5557
  function describeFailure(err) {
5557
- if (!(err instanceof Error)) return String(err);
5558
+ if (!(err instanceof Error)) return safeStringify(err);
5558
5559
  return errorCauseChain(err).map((link, i) => i === 0 ? link.message : `\n Caused by: ${link.message}`).join("");
5559
5560
  }
5560
5561
  function scrubStacksFailedError(failures) {
@@ -5667,7 +5668,7 @@ async function saveScrubbedState(stateBackend, stackName, region, state, loaded)
5667
5668
  try {
5668
5669
  survives = await stateBackend.getRawObject(legacyKey) !== null;
5669
5670
  } catch (err) {
5670
- throw new ScrubRefusalError(safeMsg`${displayStackName(stackName)} was rewritten to the region-scoped state key, ` + safeMsg`but whether its legacy key ${legacyKey} still holds the pre-scrub record ` + safeMsg`could not be verified (${err instanceof Error ? err.message : String(err)}). ` + "Check that key yourself and, if it exists, delete it (aws s3api delete-object --bucket <state-bucket> --key <that key>), then purge its earlier versions as docs/cli-scrub.md describes. A re-run will not check it again.", "SCRUB_LEGACY_STATE_KEY_UNVERIFIED");
5671
+ throw new ScrubRefusalError(safeMsg`${displayStackName(stackName)} was rewritten to the region-scoped state key, ` + safeMsg`but whether its legacy key ${legacyKey} still holds the pre-scrub record ` + safeMsg`could not be verified (${describeAwsFailure(err).detail}). ` + "Check that key yourself and, if it exists, delete it (aws s3api delete-object --bucket <state-bucket> --key <that key>), then purge its earlier versions as docs/cli-scrub.md describes. A re-run will not check it again.", "SCRUB_LEGACY_STATE_KEY_UNVERIFIED");
5671
5672
  }
5672
5673
  if (survives) throw new ScrubRefusalError(safeMsg`${displayStackName(stackName)} was rewritten to the region-scoped state key, ` + safeMsg`but its legacy key ${legacyKey} could not be deleted and still holds the ` + "pre-scrub record as its CURRENT object. Delete it (aws s3api delete-object --bucket <state-bucket> --key <that key>), then purge its earlier versions as docs/cli-scrub.md describes.", "SCRUB_LEGACY_STATE_KEY_SURVIVES");
5673
5674
  }
@@ -5811,7 +5812,7 @@ async function repairParentOutputAttributes(parentRow, region, stateBackend, loc
5811
5812
  };
5812
5813
  } finally {
5813
5814
  await lockManager.releaseLock(parentRow.stackName, region).catch((err) => {
5814
- logger.warn(safeMsg`Failed to release lock for ${displayStackName(parentRow.stackName)}: ${err instanceof Error ? err.message : String(err)}`);
5815
+ logger.warn(safeMsg`Failed to release lock for ${displayStackName(parentRow.stackName)}: ${describeAwsFailure(err).detail}`);
5815
5816
  });
5816
5817
  }
5817
5818
  }
@@ -6062,7 +6063,7 @@ async function scrubCommand(stacks, options) {
6062
6063
  } catch (err) {
6063
6064
  if (err instanceof ScrubIndexInvariantError) throw err;
6064
6065
  if (!indexUnreadable.some((u) => u.region === stackRegion)) {
6065
- const reason = displaySafe(err instanceof Error ? err.message : String(err));
6066
+ const reason = displaySafe(describeAwsFailure(err).detail);
6066
6067
  indexUnreadable.push({
6067
6068
  region: stackRegion,
6068
6069
  reason
@@ -6129,7 +6130,7 @@ async function scrubCommand(stacks, options) {
6129
6130
  try {
6130
6131
  entries = await store.readPersistedEntries();
6131
6132
  } catch (err) {
6132
- const reason = displaySafe(err instanceof Error ? err.message : String(err));
6133
+ const reason = displaySafe(describeAwsFailure(err).detail);
6133
6134
  indexUnreadable.push({
6134
6135
  region: indexRegion,
6135
6136
  reason
@@ -6354,7 +6355,7 @@ function regionAmbiguousScrubSecretError(origin, stackName, secretName, foreignP
6354
6355
  return new ScrubRefusalError(`Scrub of ${displayStackName(stackName)} cannot re-resolve the secret reference ${maskedIdent(secretName, secrets)} in ${origin}: the reference carries no region of its own, and this stack read across a region boundary (producer region(s) on record: ${foreignProducerRegions.map((r) => displayIdent(r)).join(", ")}), so it may have been resolved in one of those rather than in ${displayIdent(stackRegion)}. A secret of the same name in two regions is two independent values, so scrub would look for the WRONG plaintext — leaving the real one in state while reporting the stack clean, and using the foreign value as a needle that can rewrite an unrelated literal. Refusing instead. Spell the reference as a full ARN, which names its region and is resolved there, then re-run 'cdkd scrub'.`, "SCRUB_SECRET_REGION_AMBIGUOUS");
6355
6356
  }
6356
6357
  function unresolvableForeignScrubSecretError(origin, stackName, secretName, region, cause, secrets) {
6357
- return new ScrubRefusalError(`Scrub of ${displayStackName(stackName)} could not resolve the secret reference ${maskedIdent(secretName, secrets)} in ${origin} in the region its ARN names (${displayIdent(region)}): ${maskSecretsInText(cause instanceof Error ? cause.message : String(cause), secrets)}. Refusing rather than resolving it in the stack's own region, which would look for a different secret's value and report the stack clean over state that still holds the plaintext.`, "SCRUB_CROSS_REGION_SECRET_UNRESOLVED");
6358
+ return new ScrubRefusalError(`Scrub of ${displayStackName(stackName)} could not resolve the secret reference ${maskedIdent(secretName, secrets)} in ${origin} in the region its ARN names (${displayIdent(region)}): ${maskSecretsInText(describeAwsFailure(cause).detail, secrets)}. Refusing rather than resolving it in the stack's own region, which would look for a different secret's value and report the stack clean over state that still holds the plaintext.`, "SCRUB_CROSS_REGION_SECRET_UNRESOLVED");
6358
6359
  }
6359
6360
  const DYNAMIC_REFERENCE_OPENING = "{{resolve:";
6360
6361
  const SECRET_REFERENCE_OPENINGS = [
@@ -6527,7 +6528,7 @@ function effectiveIntrinsicKey(node) {
6527
6528
  return RESOLVER_INTRINSIC_PRECEDENCE.find((key) => key in node);
6528
6529
  }
6529
6530
  function unresolvableCrossStackReadError(origin, stackName, intrinsic, path, cause, secrets) {
6530
- return new ScrubRefusalError(`Scrub of ${displayStackName(stackName)} could not resolve the ${intrinsic} in ${origin}${path ? ` at ${maskedIdent(path, secrets)}` : ""}: ${maskSecretsInText(cause instanceof Error ? cause.message : String(cause), secrets)}. Refusing rather than continuing: the value that reference carries may be a secret, and scrub would then have no plaintext to look for — reporting the stack clean over state that still holds it. Deploy the producer stack (or correct the reference) and re-run 'cdkd scrub'.`, "SCRUB_CROSS_STACK_READ_UNRESOLVED");
6531
+ return new ScrubRefusalError(`Scrub of ${displayStackName(stackName)} could not resolve the ${intrinsic} in ${origin}${path ? ` at ${maskedIdent(path, secrets)}` : ""}: ${maskSecretsInText(describeAwsFailure(cause).detail, secrets)}. Refusing rather than continuing: the value that reference carries may be a secret, and scrub would then have no plaintext to look for — reporting the stack clean over state that still holds it. Deploy the producer stack (or correct the reference) and re-run 'cdkd scrub'.`, "SCRUB_CROSS_STACK_READ_UNRESOLVED");
6531
6532
  }
6532
6533
  function scrubRefusalWording(verdict, loggedExportKey, loggedProducerStack, loggedVia, maskedNames = /* @__PURE__ */ new Set()) {
6533
6534
  const chain = dedupePreservingOrder(loggedVia, "first");
@@ -6938,7 +6939,7 @@ function makeCrossStackPrePass(deps) {
6938
6939
  try {
6939
6940
  loaded = await backend.getState(producer.stack, producer.region);
6940
6941
  } catch (err) {
6941
- logger.debug(`Scrub of ${shownStackName}: could not re-read producer ${shownProducer} (${displayIdent(producer.region)}) to classify its stored value: ${maskSecretsInText(err instanceof Error ? err.message : String(err), secrets)}`);
6942
+ logger.debug(`Scrub of ${shownStackName}: could not re-read producer ${shownProducer} (${displayIdent(producer.region)}) to classify its stored value: ${maskSecretsInText(describeAwsFailure(err).detail, secrets)}`);
6942
6943
  return;
6943
6944
  }
6944
6945
  const outputs = loaded?.state?.outputs;
@@ -6972,17 +6973,17 @@ function makeCrossStackPrePass(deps) {
6972
6973
  await resolver.resolve({ [key]: node[key] }, probe);
6973
6974
  } catch (err) {
6974
6975
  if (!nodeCanRefuse) {
6975
- logger.debug(`Scrub of ${shownStackName}: ${where} could not be resolved, and this position cannot refuse: ${maskSecretsInText(err instanceof Error ? err.message : String(err), secrets)}`);
6976
+ logger.debug(`Scrub of ${shownStackName}: ${where} could not be resolved, and this position cannot refuse: ${maskSecretsInText(describeAwsFailure(err).detail, secrets)}`);
6976
6977
  return;
6977
6978
  }
6978
6979
  if (isByDesignRefusal(err)) {
6979
- const detail = `${where}: ${maskSecretsInText(err instanceof Error ? err.message : String(err), secrets)}`;
6980
+ const detail = `${where}: ${maskSecretsInText(describeAwsFailure(err).detail, secrets)}`;
6980
6981
  findings.unverifiable.push(detail);
6981
6982
  logger.warn(`Scrub of ${shownStackName} cannot verify ${detail} — cdkd declines this read by design, so no re-run can change it. The rest of the stack is still scrubbed; this stack is NOT reported clean.`);
6982
6983
  return;
6983
6984
  }
6984
6985
  if (isMalformedProducerRefusal(err)) {
6985
- const detail = `${where}: ${maskSecretsInText(err instanceof Error ? err.message : String(err), secrets)}`;
6986
+ const detail = `${where}: ${maskSecretsInText(describeAwsFailure(err).detail, secrets)}`;
6986
6987
  findings.unverifiable.push(detail);
6987
6988
  findings.damagedProducerRecords.push(detail);
6988
6989
  logger.warn(`Scrub of ${shownStackName} cannot verify ${detail} — the PRODUCER's state record is malformed or truncated, so this run cannot tell whether that producer still holds the plaintext. The rest of the stack is still scrubbed; this stack is NOT reported clean. Repair the producer's record and scrub it first, then re-run.`);
@@ -7079,7 +7080,7 @@ async function bindDefaultedParametersOneByOne(resolver, template, shownStack, l
7079
7080
  });
7080
7081
  if (Object.hasOwn(one, name)) bound[name] = one[name];
7081
7082
  } catch (err) {
7082
- logger.debug(safeMsg`Parameter ${name} of ${shownStack} left unbound: ${err instanceof Error ? err.message : String(err)}`);
7083
+ logger.debug(safeMsg`Parameter ${name} of ${shownStack} left unbound: ${describeAwsFailure(err).detail}`);
7083
7084
  }
7084
7085
  }
7085
7086
  return bound;
@@ -7233,10 +7234,10 @@ async function scrubStack(stack, region, stateBackend, lockManager, opts) {
7233
7234
  parameters = await resolver.resolveParameters(stack.template, nestedInput?.parameters, inheritedSecrets && { inheritedSecrets });
7234
7235
  } catch (err) {
7235
7236
  if (opts.nestedChild) {
7236
- const reason = maskSecretsInText(err instanceof Error ? err.message : String(err), inheritedSecrets ?? outputSecrets);
7237
+ const reason = maskSecretsInText(describeAwsFailure(err).detail, inheritedSecrets ?? outputSecrets);
7237
7238
  throw new ScrubRefusalError(`Nested stack ${shownStack}: its Parameters could not be resolved against its own template (${reason}), so its secrets cannot be identified. Its record was NOT examined and may still hold plaintext.`, "SCRUB_NESTED_CHILD_UNRESOLVABLE");
7238
7239
  }
7239
- logger.debug(`Parameter resolution skipped for ${shownStack}: ${maskSecretsInText(err instanceof Error ? err.message : String(err), outputSecrets)}`);
7240
+ logger.debug(`Parameter resolution skipped for ${shownStack}: ${maskSecretsInText(describeAwsFailure(err).detail, outputSecrets)}`);
7240
7241
  parameters = await bindDefaultedParametersOneByOne(resolver, stack.template, shownStack, logger);
7241
7242
  }
7242
7243
  const resolverStateBackend = memoizeCrossStackStateReads(stateBackend);
@@ -7282,7 +7283,7 @@ async function scrubStack(stack, region, stateBackend, lockManager, opts) {
7282
7283
  });
7283
7284
  }
7284
7285
  } catch (err) {
7285
- logger.debug(`Condition evaluation skipped for ${shownStack}: ${maskSecretsInText(err instanceof Error ? err.message : String(err), outputSecrets)}`);
7286
+ logger.debug(`Condition evaluation skipped for ${shownStack}: ${maskSecretsInText(describeAwsFailure(err).detail, outputSecrets)}`);
7286
7287
  }
7287
7288
  const templateResources = stack.template.Resources ?? {};
7288
7289
  const templateOutputs = stack.template.Outputs ?? {};
@@ -7342,7 +7343,7 @@ async function scrubStack(stack, region, stateBackend, lockManager, opts) {
7342
7343
  else ungateableAbandonedScans++;
7343
7344
  logger.warn(maskSecretsInText(abandonedScanWarning(propertyName ? `resource ${maskedIdent(logicalId, recordedSecretValues)} property ${maskedIdent(propertyName, recordedSecretValues)}` : `resource ${maskedIdent(logicalId, recordedSecretValues)}`, leafVerdict), recordedSecretValues));
7344
7345
  }
7345
- logger.debug(maskSecretsInText(`Resolution of ${maskedIdent(logicalId, recordedSecretValues)}${propertyName ? `.${maskedIdent(propertyName, recordedSecretValues)}` : ""} during scrub was partial: ${err instanceof Error ? err.message : String(err)}`, recordedSecretValues));
7346
+ logger.debug(maskSecretsInText(`Resolution of ${maskedIdent(logicalId, recordedSecretValues)}${propertyName ? `.${maskedIdent(propertyName, recordedSecretValues)}` : ""} during scrub was partial: ${describeAwsFailure(err).detail}`, recordedSecretValues));
7346
7347
  }
7347
7348
  }
7348
7349
  perResourceTemplateProps.set(logicalId, templateResource.Properties);
@@ -7380,7 +7381,7 @@ async function scrubStack(stack, region, stateBackend, lockManager, opts) {
7380
7381
  else ungateableAbandonedScans++;
7381
7382
  logger.warn(maskSecretsInText(abandonedScanWarning(`orphan record ${maskedIdent(record.logicalId, recordedSecretValues)} ${bagName}`, leafVerdict), recordedSecretValues));
7382
7383
  }
7383
- logger.debug(maskSecretsInText(`Resolution of orphan record ${maskedIdent(record.logicalId, recordedSecretValues)} ${bagName} during scrub was partial: ${err instanceof Error ? err.message : String(err)}`, recordedSecretValues));
7384
+ logger.debug(maskSecretsInText(`Resolution of orphan record ${maskedIdent(record.logicalId, recordedSecretValues)} ${bagName} during scrub was partial: ${describeAwsFailure(err).detail}`, recordedSecretValues));
7384
7385
  }
7385
7386
  }
7386
7387
  }
@@ -7416,7 +7417,7 @@ async function scrubStack(stack, region, stateBackend, lockManager, opts) {
7416
7417
  }
7417
7418
  if (nameFailed) {
7418
7419
  outputsSourceUntrusted = true;
7419
- logger.warn(`Export.Name of output ${maskedIdent(name, outputSecrets)} could not be resolved during scrub (${maskSecretsInText(nameError instanceof Error ? nameError.message : String(nameError), outputSecrets)}) — redacting this stack's outputs by value match instead of by template position, since state may be keyed under a name this run cannot reproduce.`);
7420
+ logger.warn(`Export.Name of output ${maskedIdent(name, outputSecrets)} could not be resolved during scrub (${maskSecretsInText(describeAwsFailure(nameError).detail, outputSecrets)}) — redacting this stack's outputs by value match instead of by template position, since state may be keyed under a name this run cannot reproduce.`);
7420
7421
  }
7421
7422
  }
7422
7423
  if (declaredExportName !== void 0 && typeof exportName !== "string") outputsSourceUntrusted = true;
@@ -7462,7 +7463,7 @@ async function scrubStack(stack, region, stateBackend, lockManager, opts) {
7462
7463
  else ungateableAbandonedScans++;
7463
7464
  logger.warn(maskSecretsInText(abandonedScanWarning(`output ${maskedIdent(name, outputSecrets)}`, leafVerdict), outputSecrets));
7464
7465
  }
7465
- logger.debug(`Resolution of output ${maskedIdent(name, outputSecrets)} during scrub was partial: ${maskSecretsInText(err instanceof Error ? err.message : String(err), outputSecrets)}`);
7466
+ logger.debug(`Resolution of output ${maskedIdent(name, outputSecrets)} during scrub was partial: ${maskSecretsInText(describeAwsFailure(err).detail, outputSecrets)}`);
7466
7467
  }
7467
7468
  }
7468
7469
  });
@@ -7655,7 +7656,7 @@ async function scrubStack(stack, region, stateBackend, lockManager, opts) {
7655
7656
  readers = findDroppedOutputReaders(stack.stackName, region, dropping, await (opts.readConsumerRecords ?? (() => readConsumerRecords(stateBackend, region)))());
7656
7657
  } catch (err) {
7657
7658
  droppedOutputReadersUnverified = true;
7658
- logger.warn(safeMsg`${shownStack}'s template no longer declares output key(s) ${shownKeys(dropping)}, ` + `but the other stacks' state could not be read to confirm none of them still ` + safeMsg`reads one (${maskSecretsInText(err instanceof Error ? err.message : String(err), corpus)}), ` + "so NONE was dropped and this stack is not reported clean. Fix the read and re-run cdkd scrub.");
7659
+ logger.warn(safeMsg`${shownStack}'s template no longer declares output key(s) ${shownKeys(dropping)}, ` + `but the other stacks' state could not be read to confirm none of them still ` + safeMsg`reads one (${maskSecretsInText(describeAwsFailure(err).detail, corpus)}), ` + "so NONE was dropped and this stack is not reported clean. Fix the read and re-run cdkd scrub.");
7659
7660
  dropping = /* @__PURE__ */ new Set();
7660
7661
  }
7661
7662
  if (readers !== void 0 && readers.length > 0) {
@@ -7734,7 +7735,7 @@ async function scrubStack(stack, region, stateBackend, lockManager, opts) {
7734
7735
  throw maskSecretsInError(err, boundaryNeedles);
7735
7736
  } finally {
7736
7737
  if (acquired) await lockManager.releaseLock(stack.stackName, region).catch((err) => {
7737
- logger.warn(`Failed to release lock for ${shownStack}: ${err instanceof Error ? err.message : String(err)}`);
7738
+ logger.warn(`Failed to release lock for ${shownStack}: ${describeAwsFailure(err).detail}`);
7738
7739
  });
7739
7740
  }
7740
7741
  }
@@ -8609,7 +8610,7 @@ function createIamPrincipalUniqueIdResolver(awsClients) {
8609
8610
  if (entityArn !== void 0 && entityArn.toLowerCase() === arn.toLowerCase()) uniqueId = entityId;
8610
8611
  else getLogger().debug(`Principal ${displayIdent(arn, { maxCodePoints: 613 })} resolved to ${entityArn === void 0 ? "no entity" : displayIdent(entityArn, { maxCodePoints: 613 })} — same name in this account or under another IAM path; leaving the policy principal comparison untouched.`);
8611
8612
  } catch (error) {
8612
- const message = error instanceof Error ? error.message : String(error);
8613
+ const message = describeAwsFailure(error).detail;
8613
8614
  const name = error instanceof Error ? error.name : "";
8614
8615
  const status = error?.$metadata?.httpStatusCode;
8615
8616
  const denied = /^AccessDenied|^NotAuthorized/i.test(name) || status === 403;
@@ -8776,7 +8777,7 @@ async function driftProducerRegionEvidence(state, stackName, region, stateBacken
8776
8777
  try {
8777
8778
  parent = await stateBackend.getState(parentName, parentRegion);
8778
8779
  } catch (error) {
8779
- noteUnreadableAncestor(parentName, parentRegion, `it could not be read (${error instanceof Error ? error.message : String(error)})`);
8780
+ noteUnreadableAncestor(parentName, parentRegion, `it could not be read (${describeAwsFailure(error).detail})`);
8780
8781
  return inheritProducerRegions(own, void 0);
8781
8782
  }
8782
8783
  if (!parent || parent.divergentBodyRegion !== void 0 || typeof parent.state !== "object" || parent.state === null) {
@@ -9148,7 +9149,7 @@ async function runDriftForStack(stackName, region, stateBackend, providerRegistr
9148
9149
  secretResolutionFailed = true;
9149
9150
  comparisonBaseline = baseline;
9150
9151
  const refused = isDriftSecretRefusal(err);
9151
- 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(err instanceof Error ? err.message : String(err), secrets)}`);
9152
+ 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)}`);
9152
9153
  for (const plaintext of secrets.keys()) recordLogOnlyValue(secrets, plaintext);
9153
9154
  secrets.clear();
9154
9155
  }
@@ -9196,7 +9197,7 @@ async function runDriftForStack(stackName, region, stateBackend, providerRegistr
9196
9197
  });
9197
9198
  } catch (err) {
9198
9199
  if (isNoReadHandlerError(err)) {
9199
- logger.debug(`${logicalId} (${resource.resourceType}): read threw with a no-READ-handler signature, reported as drift unknown — ${maskSecretsInText(err instanceof Error ? err.message : String(err), secrets)}`);
9200
+ logger.debug(`${logicalId} (${resource.resourceType}): read threw with a no-READ-handler signature, reported as drift unknown — ${maskSecretsInText(describeAwsFailure(err).detail, secrets)}`);
9200
9201
  noteReadReturned();
9201
9202
  outcomes.push({
9202
9203
  kind: "unsupported",
@@ -9219,7 +9220,7 @@ async function runDriftForStack(stackName, region, stateBackend, providerRegistr
9219
9220
  breakerTripped = true;
9220
9221
  }
9221
9222
  }
9222
- 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(err instanceof Error ? err.message : String(err), secrets)}`);
9223
+ 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)}`);
9223
9224
  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.");
9224
9225
  if (err instanceof Error && err.stack) logger.debug(`${logicalId} (${resource.resourceType}): comparison failure detail`, maskSecretsInError(err, secrets).stack);
9225
9226
  continue;
@@ -9405,7 +9406,7 @@ async function runAccept(reports, stateBackend, stateConfig, awsClients, options
9405
9406
  logger.info(`✓ State updated for ${report.stackName} (${report.region}): ` + (acceptedResourceCount === 0 ? "0 resource(s) accepted — no drifted change was recorded, and this write carried only the positioned re-redaction." : `accepted drift on ${acceptedResourceCount} resource(s).`));
9406
9407
  } finally {
9407
9408
  await lockManager.releaseLock(report.stackName, report.region).catch((err) => {
9408
- logger.warn(`Failed to release lock for ${report.stackName} (${report.region}): ` + (err instanceof Error ? err.message : String(err)));
9409
+ logger.warn(`Failed to release lock for ${report.stackName} (${report.region}): ` + describeAwsFailure(err).detail);
9409
9410
  });
9410
9411
  }
9411
9412
  }
@@ -9808,7 +9809,7 @@ async function runRevert(reports, regionScope, stateBackend, stateConfig, awsCli
9808
9809
  stateBucket: stateConfig.bucket,
9809
9810
  statePrefix: stateConfig.prefix
9810
9811
  };
9811
- printRevertPlan(reports, out);
9812
+ printRevertPlan(reports, out, lockRecovery);
9812
9813
  if (options.dryRun) {
9813
9814
  logger.info("--dry-run: AWS will NOT be modified. Re-run without --dry-run to apply.");
9814
9815
  return;
@@ -9887,7 +9888,7 @@ async function runRevert(reports, regionScope, stateBackend, stateConfig, awsCli
9887
9888
  });
9888
9889
  } catch (err) {
9889
9890
  totalUnresolvable++;
9890
- logger.error(` ✗ ${report.stackName}/${outcome.logicalId} (${outcome.resourceType}): ` + (isDriftSecretRefusal(err) ? `refused to re-resolve a dynamic reference this resource's state records — ` : `could not re-resolve the dynamic reference(s) this resource's state records — `) + `${maskSecretsInText(err instanceof Error ? err.message : String(err), secrets)}`);
9891
+ logger.error(` ✗ ${report.stackName}/${outcome.logicalId} (${outcome.resourceType}): ` + (isDriftSecretRefusal(err) ? `refused to re-resolve a dynamic reference this resource's state records — ` : `could not re-resolve the dynamic reference(s) this resource's state records — `) + `${maskSecretsInText(describeAwsFailure(err).detail, secrets)}`);
9891
9892
  return;
9892
9893
  }
9893
9894
  const unrevertablePaths = outcome.changes.map((c) => c.path).filter((path) => (path.split(".", 1)[0] ?? "").includes("***"));
@@ -9928,7 +9929,7 @@ async function runRevert(reports, regionScope, stateBackend, stateConfig, awsCli
9928
9929
  newProperties = maskPreserved.properties;
9929
9930
  } catch (err) {
9930
9931
  totalFailed++;
9931
- logger.error(` ✗ ${report.stackName}/${outcome.logicalId} (${outcome.resourceType}): could not build the revert payload — ${maskSecretsInText(err instanceof Error ? err.message : String(err), secrets)}`);
9932
+ logger.error(` ✗ ${report.stackName}/${outcome.logicalId} (${outcome.resourceType}): could not build the revert payload — ${maskSecretsInText(describeAwsFailure(err).detail, secrets)}`);
9932
9933
  return;
9933
9934
  }
9934
9935
  try {
@@ -9949,7 +9950,7 @@ async function runRevert(reports, regionScope, stateBackend, stateConfig, awsCli
9949
9950
  if (Object.keys(delta).length > 0) narrowedByLogicalId.set(outcome.logicalId, keepBaselineAtUncertifiedPaths(redactSecretsForState(delta, secrets, revertBaseline, stateResource.observedProperties !== void 0 ? STATE_SOURCED_BASELINE_RULES : STATE_SOURCED_READBACK_RULES), [...outcome.uncertifiedPaths, ...outcome.noEchoParameterPaths ?? []], revertBaseline));
9950
9951
  }
9951
9952
  } catch (captureErr) {
9952
- logger.warn(` ${report.stackName}/${outcome.logicalId} (${outcome.resourceType}): reverted, but the provider's reported effective properties could not be read — ${maskSecretsInText(captureErr instanceof Error ? captureErr.message : String(captureErr), secrets)}`);
9953
+ logger.warn(` ${report.stackName}/${outcome.logicalId} (${outcome.resourceType}): reverted, but the provider's reported effective properties could not be read — ${maskSecretsInText(describeAwsFailure(captureErr).detail, secrets)}`);
9953
9954
  }
9954
9955
  try {
9955
9956
  if (updateResult !== void 0) {
@@ -9964,7 +9965,7 @@ async function runRevert(reports, regionScope, stateBackend, stateConfig, awsCli
9964
9965
  });
9965
9966
  }
9966
9967
  } catch (recordErr) {
9967
- logger.warn(safeMsg` ${report.stackName}/${outcome.logicalId} (${outcome.resourceType}): reverted, but the attributes the provider returned could not be recorded — ${maskSecretsInText(recordErr instanceof Error ? recordErr.message : String(recordErr), secrets)}`);
9968
+ logger.warn(safeMsg` ${report.stackName}/${outcome.logicalId} (${outcome.resourceType}): reverted, but the attributes the provider returned could not be recorded — ${maskSecretsInText(describeAwsFailure(recordErr).detail, secrets)}`);
9968
9969
  }
9969
9970
  } catch (err) {
9970
9971
  if (err instanceof ResourceUpdateNotSupportedError) {
@@ -9973,7 +9974,7 @@ async function runRevert(reports, regionScope, stateBackend, stateConfig, awsCli
9973
9974
  return;
9974
9975
  }
9975
9976
  totalFailed++;
9976
- const msg = maskSecretsInText(err instanceof Error ? err.message : String(err), secrets);
9977
+ const msg = maskSecretsInText(describeAwsFailure(err).detail, secrets);
9977
9978
  logger.error(` ✗ ${report.stackName}/${outcome.logicalId} (${outcome.resourceType}): AWS update failed — ${msg}`);
9978
9979
  }
9979
9980
  })), concurrency);
@@ -10039,12 +10040,12 @@ async function runRevert(reports, regionScope, stateBackend, stateConfig, awsCli
10039
10040
  } catch (err) {
10040
10041
  const revertAgain = revertCommandLine(report.stackName, report.region);
10041
10042
  const unrecorded = [...recordedCount > 0 ? ["the value the provider actually applied"] : [], ...reRecordedCount > 0 ? ["the identity the revert returned"] : []].join(" and ");
10042
- logger.warn(`Reverted ${report.stackName} (${report.region}), but could not record ${unrecorded}: ${err instanceof Error ? err.message : String(err)}.` + (reRecordedCount > 0 ? " The state record still holds the physical id and attributes from before the revert, which a later 'Fn::GetAtt' and 'cdkd export' read. Re-running the revert does not repair it, since the revert landed; a later deploy that updates this resource records the identity its update returns." : "") + (recordedCount > 0 ? ` The next 'cdkd drift' will report the same difference — ` + (revertAgain === void 0 ? `re-run 'cdkd drift --revert' for this stack once the state write can succeed.` : `re-run the command below once the state write can succeed.\nRevert with: ${revertAgain}`) : ""));
10043
+ logger.warn(`Reverted ${report.stackName} (${report.region}), but could not record ${unrecorded}: ${describeAwsFailure(err).detail}.` + (reRecordedCount > 0 ? " The state record still holds the physical id and attributes from before the revert, which a later 'Fn::GetAtt' and 'cdkd export' read. Re-running the revert does not repair it, since the revert landed; a later deploy that updates this resource records the identity its update returns." : "") + (recordedCount > 0 ? ` The next 'cdkd drift' will report the same difference — ` + (revertAgain === void 0 ? `re-run 'cdkd drift --revert' for this stack once the state write can succeed.` : `re-run the command below once the state write can succeed.\nRevert with: ${revertAgain}`) : ""));
10043
10044
  }
10044
10045
  }
10045
10046
  } finally {
10046
10047
  await lockManager.releaseLock(report.stackName, report.region).catch((err) => {
10047
- logger.warn(`Failed to release lock for ${report.stackName} (${report.region}): ` + (err instanceof Error ? err.message : String(err)));
10048
+ logger.warn(`Failed to release lock for ${report.stackName} (${report.region}): ` + describeAwsFailure(err).detail);
10048
10049
  });
10049
10050
  }
10050
10051
  });
@@ -10117,7 +10118,7 @@ function revertCommandLine(stackName, region) {
10117
10118
  hole: "region"
10118
10119
  }]).command} --revert`;
10119
10120
  }
10120
- function printRevertPlan(reports, out) {
10121
+ function printRevertPlan(reports, out, recovery) {
10121
10122
  for (const report of reports) {
10122
10123
  const drifted = report.outcomes.flatMap((o) => matchOutcome(o, {
10123
10124
  drifted: (d) => [d],
@@ -10156,15 +10157,20 @@ function printRevertPlan(reports, out) {
10156
10157
  const word = unbaselined.length === 1 ? "value" : "values";
10157
10158
  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`);
10158
10159
  for (const path of unbaselined) out.write(` ${reportPath(maskSecretsInText(path, o.secrets))}\n`);
10159
- const refresh = mayNameTarget(report.stackName, report.region) ? pasteableCommand("cdkd state refresh-observed", [{
10160
- value: report.stackName,
10161
- hole: "stack"
10162
- }, {
10163
- flag: "--stack-region",
10164
- value: report.region,
10165
- hole: "region"
10166
- }]) : void 0;
10167
- out.write(" The template does not declare these, so cdkd cannot tell an AWS-authored value from an out-of-band change and will not reset either (issue #1626). " + (refresh === void 0 ? "Re-deploy if you want them reverted too; this record's identity cannot be named safely in a command, so none is offered.\n" : "Populate observedProperties with the command below, or re-deploy, if you want them reverted too.\n"));
10160
+ const refresh = mayNameTarget(report.stackName, report.region) ? pasteableCommand("cdkd state refresh-observed", [
10161
+ {
10162
+ value: report.stackName,
10163
+ hole: "stack"
10164
+ },
10165
+ {
10166
+ flag: "--stack-region",
10167
+ value: report.region,
10168
+ hole: "region"
10169
+ },
10170
+ ...accountArgs(recovery)
10171
+ ]) : void 0;
10172
+ const refreshAccountNote = refresh === void 0 ? "" : withheldAccountClause(recovery, "the command below prints").trimEnd();
10173
+ out.write(" The template does not declare these, so cdkd cannot tell an AWS-authored value from an out-of-band change and will not reset either (issue #1626). " + (refresh === void 0 ? "Re-deploy if you want them reverted too; this record's identity cannot be named safely in a command, so none is offered.\n" : `Populate observedProperties with the command below, or re-deploy, if you want them reverted too.${refreshAccountNote === "" ? "" : ` ${refreshAccountNote}`}\n`));
10168
10174
  if (refresh !== void 0) out.write(` Populate with: ${refresh.command}\n`);
10169
10175
  }
10170
10176
  }
@@ -11934,7 +11940,7 @@ var AttributeFetcher = class {
11934
11940
  value: chosen
11935
11941
  };
11936
11942
  } catch (err) {
11937
- return this.cacheFallback(orphanLogicalId, attribute, err instanceof Error ? err.message : String(err));
11943
+ return this.cacheFallback(orphanLogicalId, attribute, describeAwsFailure(err).detail);
11938
11944
  }
11939
11945
  }
11940
11946
  cacheFallback(orphanLogicalId, attribute, reason) {
@@ -12331,7 +12337,7 @@ async function orphanCommand(pathArgs, options) {
12331
12337
  logger.info(`Orphaned ${orphanLogicalIds.length} resource(s) from state: ${displayStackName(stackInfo.stackName)} (${displayIdent(targetRegion)}). AWS resources are still in AWS; cdkd will no longer manage them.`);
12332
12338
  } finally {
12333
12339
  if (!options.dryRun) await lockManager.releaseLock(stackInfo.stackName, targetRegion).catch((err) => {
12334
- logger.warn(`Failed to release lock: ${displayAwsMessage(err instanceof Error ? err.message : String(err))}`);
12340
+ logger.warn(`Failed to release lock: ${displayAwsMessage(describeAwsFailure(err).detail)}`);
12335
12341
  });
12336
12342
  }
12337
12343
  } finally {
@@ -13533,7 +13539,7 @@ async function exportCommand(stackArg, options) {
13533
13539
  }
13534
13540
  try {
13535
13541
  if (nestedStackRows.length > 0) {
13536
- const nestedStackTree = await buildCdkdStateStackTree(resolvedStackName, targetRegion, stateBackend, state);
13542
+ const nestedStackTree = await buildCdkdStateStackTree(resolvedStackName, targetRegion, stateBackend, state, lockRecovery);
13537
13543
  reportDriftBaselineGaps(state, logger, {
13538
13544
  stackName: resolvedStackName,
13539
13545
  region: migrationPending ? void 0 : targetRegion
@@ -13659,7 +13665,7 @@ async function exportCommand(stackArg, options) {
13659
13665
  logger.info(` ${preDeletedLine(entry.physicalId)}`);
13660
13666
  } catch (err) {
13661
13667
  const msg = err instanceof Error ? err.message : String(err);
13662
- const orphan = orphanCommandFor(resolvedStackName, targetRegion);
13668
+ const orphan = orphanCommandFor(resolvedStackName, targetRegion, lockRecovery);
13663
13669
  throw new Error(`Phase 1 (IMPORT) succeeded; pre-delete of ${plainOrNotShown(entry.logicalId)} (${plainOrNotShown(entry.resourceType)}, physicalId: ${recordValueOrNotShown(entry.physicalId)}) failed: ${displayAwsMessage(msg)}\n\nThe CloudFormation stack ${quotedOrNotShown(cfnStackName)} contains the phase-1 imports but the IMPORT-unsupported resources (${recreateBeforePhase2.length} total) still exist in AWS unmanaged. cdkd state is UNCHANGED. Re-running \`cdkd export\` does NOT work — the existing-stack check rejects it. To recover manually:\n 1. Fix the failure cause (typically IAM permissions for the underlying AWS API — iam:Delete{Role,User,Group}Policy for an inline policy).\n 2. Delete the remaining AWS-side IMPORT-unsupported resources by hand:\n` + preDeleteManualCommands(recreateBeforePhase2).map((line) => ` ${line}\n`).join("") + ` (one per entry in the pre-delete list logged above).
13664
13670
  3. Run the phase-2 UPDATE manually with the full synth template:
13665
13671
  ${phase2RetryCommand(cfnStackName)}\n 4. Once phase 2 succeeds, clean up cdkd's stale state record.${orphan.note}\n Run: ${orphan.command}`);
@@ -13679,7 +13685,7 @@ async function exportCommand(stackArg, options) {
13679
13685
  } catch (err) {
13680
13686
  const msg = err instanceof Error ? err.message : String(err);
13681
13687
  const recreateNote = recreateBeforePhase2.length > 0 ? ` - cdkd deleted ${recreateBeforePhase2.length} AWS resource(s) before phase 2 (Stage etc.). They are gone in AWS but absent from the CFn stack. Running phase 2 UPDATE manually will CFn-CREATE them fresh.\n` : "";
13682
- const orphan = orphanCommandFor(resolvedStackName, targetRegion);
13688
+ const orphan = orphanCommandFor(resolvedStackName, targetRegion, lockRecovery);
13683
13689
  throw new Error(`Phase 1 (IMPORT) succeeded; phase 2 (UPDATE) failed: ${displayAwsMessage(msg)}\n\nThe CloudFormation stack ${quotedOrNotShown(cfnStackName)} now contains the imported resources but is missing ${phase2Count} resource(s) (${phase2Creates.length} Custom Resource(s) + ${recreateBeforePhase2.length} IMPORT-unsupported). cdkd state is UNCHANGED so you can inspect what's in it, but DO NOT run \`cdkd deploy\` against this stack (the imported resources are now CFn-managed). To recover:\n` + recreateNote + ` 1. Fix the failure cause (typically an onCreate Lambda error).
13684
13690
  2. Re-run the phase 2 UPDATE manually with the full synth template:
13685
13691
  ${phase2RetryCommand(cfnStackName)}\n 3. Once phase 2 succeeds, clean up cdkd's stale state record.${orphan.note}\n Run: ${orphan.command}`);
@@ -13980,8 +13986,10 @@ function preDeleteListingLines(entry) {
13980
13986
  if (entry.unconfirmedPrincipals && entry.unconfirmedPrincipals.length > 0) lines.push(" phase 2 cannot be confirmed to re-attach it to " + entry.unconfirmedPrincipals.map((p) => `${p.kind} ${showRecordValue(p.name)}`).join(", ") + ": the template names its principals through a value cdkd cannot resolve");
13981
13987
  return lines;
13982
13988
  }
13983
- function orphanCommandFor(stackName, region) {
13984
- const built = pasteableCommand("cdkd state orphan", [{
13989
+ function orphanCommandFor(stackName, region, recovery) {
13990
+ const account = accountArgs(recovery);
13991
+ const accountNote = spacedAccountClause(recovery, "the next line's command prints");
13992
+ const identity = [{
13985
13993
  value: stackName,
13986
13994
  hole: "stack",
13987
13995
  opts: { plainIdent: true }
@@ -13990,16 +13998,24 @@ function orphanCommandFor(stackName, region) {
13990
13998
  value: region,
13991
13999
  hole: "region",
13992
14000
  opts: { plainIdent: true }
13993
- }]);
14001
+ }];
14002
+ const built = pasteableCommand("cdkd state orphan", identity);
13994
14003
  if (built.exact) return {
13995
- command: built.command,
13996
- note: ""
14004
+ command: pasteableCommand("cdkd state orphan", [...identity, ...account]).command,
14005
+ note: accountNote
13997
14006
  };
13998
14007
  const reasons = [orphanWithheldPart("stack name", stackName, built, "stack"), orphanWithheldPart("region", region, built, "region")].filter((part) => part !== "");
13999
14008
  const dashName = typeof stackName === "string" && stackName.startsWith("-");
14000
14009
  return {
14001
- command: `cdkd state orphan ${commandHole("stack")} --stack-region ${commandHole("region")}`,
14002
- note: ` The next line's command names neither value, because its record's ${reasons.join("; and its ")}. List the records with 'cdkd state list --json' and ` + (dashName ? "repair or remove the one whose stackName and region match by hand — this stack name begins with a '-' and could parse as an option in that position, so do not fill a hole with it." : `act on the one whose stackName and region match, replacing each quoted hole, quotes included, with ${JSON_LISTING_HOLE_VALUE}.`)
14010
+ command: pasteableCommand("cdkd state orphan", [
14011
+ { hole: "stack" },
14012
+ {
14013
+ flag: "--stack-region",
14014
+ hole: "region"
14015
+ },
14016
+ ...account
14017
+ ]).command,
14018
+ note: ` The next line's command names neither value, because its record's ${reasons.join("; and its ")}. List the records with ` + (account.length > 0 ? `'cdkd state list --json' run with the same account flags as the next line's command, and ` : `'cdkd state list --json' and `) + (dashName ? "repair or remove the one whose stackName and region match by hand — this stack name begins with a '-' and could parse as an option in that position, so do not fill a hole with it." : `act on the one whose stackName and region match, replacing each quoted hole, quotes included, with ${JSON_LISTING_HOLE_VALUE}.`) + accountNote
14003
14019
  };
14004
14020
  }
14005
14021
  function orphanWithheldPart(what, raw, built, hole) {
@@ -14020,7 +14036,7 @@ function orphanWithholdWhy(reason, positional) {
14020
14036
  default: throw new Error(`orphanWithholdWhy: unhandled WithholdReason ${String(reason)}`);
14021
14037
  }
14022
14038
  }
14023
- async function buildCdkdStateStackTree(rootStackName, region, stateBackend, prefetchedRootState) {
14039
+ async function buildCdkdStateStackTree(rootStackName, region, stateBackend, prefetchedRootState, recovery) {
14024
14040
  let rootState;
14025
14041
  if (prefetchedRootState !== void 0) rootState = prefetchedRootState;
14026
14042
  else {
@@ -14028,9 +14044,9 @@ async function buildCdkdStateStackTree(rootStackName, region, stateBackend, pref
14028
14044
  if (!rootResult) throw new Error(`No cdkd state found for stack ${quotedOrNotShown(rootStackName)} (${quotedRegion(region)}). Cannot build nested-stack tree.`);
14029
14045
  rootState = rootResult.state;
14030
14046
  }
14031
- return walkCdkdStateStackTree(rootStackName, region, rootState, stateBackend);
14047
+ return walkCdkdStateStackTree(rootStackName, region, rootState, stateBackend, recovery);
14032
14048
  }
14033
- async function walkCdkdStateStackTree(stackName, region, state, stateBackend) {
14049
+ async function walkCdkdStateStackTree(stackName, region, state, stateBackend, recovery) {
14034
14050
  const nestedChildren = /* @__PURE__ */ new Map();
14035
14051
  if (!hasReadableResources(state)) return {
14036
14052
  stackName,
@@ -14043,11 +14059,11 @@ async function walkCdkdStateStackTree(stackName, region, state, stateBackend) {
14043
14059
  const childStackName = `${stackName}~${logicalId}`;
14044
14060
  const childResult = await stateBackend.getState(childStackName, region);
14045
14061
  if (!childResult) {
14046
- const orphan = orphanCommandFor(stackName, region);
14062
+ const orphan = orphanCommandFor(stackName, region, recovery);
14047
14063
  throw new Error(`cdkd state is missing nested-child ${quotedOrNotShown(childStackName)} (${quotedRegion(region)}). Parent stack ${quotedOrNotShown(stackName)} lists ${quotedOrNotShown(logicalId)} as an ${NESTED_STACK_RESOURCE_TYPE} row but no child state file exists at ${quotedOrNotShown(`cdkd/${childStackName}/${region}/state.json`)}. The cdkd state tree is inconsistent — re-deploy the parent stack to refresh, or drop the parent's record and re-import.${orphan.note}\nDrop it with: ${orphan.command}`);
14048
14064
  }
14049
14065
  if (childResult.divergentBodyRegion !== void 0) throw new Error(`cdkd state region mismatch: nested-child ${quotedOrNotShown(childStackName)} has state.region=${quotedOrNotShown(childResult.divergentBodyRegion)} but its parent ${quotedOrNotShown(stackName)} is being walked against region=${quotedOrNotShown(region)}. AWS does not support cross-region nested stacks; the state tree appears corrupt — re-deploy the parent stack to refresh.`);
14050
- nestedChildren.set(logicalId, await walkCdkdStateStackTree(childStackName, region, childResult.state, stateBackend));
14066
+ nestedChildren.set(logicalId, await walkCdkdStateStackTree(childStackName, region, childResult.state, stateBackend, recovery));
14051
14067
  }
14052
14068
  return {
14053
14069
  stackName,
@@ -14135,7 +14151,7 @@ function indexNestedTemplatePaths(template, templateDir) {
14135
14151
  }
14136
14152
  return result;
14137
14153
  }
14138
- function buildPerStackImportNodes(rootStackName, rootTemplate, rootNestedTemplatePaths, rootTemplateFormat, tree) {
14154
+ function buildPerStackImportNodes(rootStackName, rootTemplate, rootNestedTemplatePaths, rootTemplateFormat, tree, recovery) {
14139
14155
  if (tree.stackName !== rootStackName) throw new Error(`buildPerStackImportNodes: tree root ${quotedOrNotShown(tree.stackName)} does not match expected root stack name ${quotedOrNotShown(rootStackName)}.`);
14140
14156
  const out = /* @__PURE__ */ new Map();
14141
14157
  walk(tree, rootTemplate, rootNestedTemplatePaths, rootTemplateFormat);
@@ -14151,7 +14167,7 @@ function buildPerStackImportNodes(rootStackName, rootTemplate, rootNestedTemplat
14151
14167
  for (const [childLogicalId, childNode] of node.nestedChildren) {
14152
14168
  const childTemplatePath = nodeNestedTemplatePaths[childLogicalId];
14153
14169
  if (!childTemplatePath) {
14154
- const orphan = orphanCommandFor(childNode.stackName, childNode.region);
14170
+ const orphan = orphanCommandFor(childNode.stackName, childNode.region, recovery);
14155
14171
  throw new Error(`cdkd export: nested-stack child ${quotedOrNotShown(childLogicalId)} under parent ${quotedOrNotShown(node.stackName)} has cdkd state but no Metadata['aws:asset:path'] in the parent template's ${quotedOrNotShown(childLogicalId)} row. The synth output and the cdkd state tree are out of sync — re-deploy the parent stack to refresh, or remove the cdkd state for the orphaned child.${orphan.note}\nRemove it with: ${orphan.command}`);
14156
14172
  }
14157
14173
  const { template: childTemplate, format: childFormat } = readNestedChildTemplateFile(childTemplatePath, childLogicalId);
@@ -14758,29 +14774,37 @@ function reportDriftBaselineGaps(state, logger, loaded, template, recovery) {
14758
14774
  maxCodePoints: 128
14759
14775
  }
14760
14776
  }];
14777
+ const account = accountArgs(recovery);
14778
+ const accountNote = (where) => withheldAccountClause(recovery, where);
14761
14779
  const refresh = pasteableCommand("cdkd state refresh-observed", refArgs);
14762
- const refreshCommand = region !== void 0 && refresh.exact ? refresh.command : void 0;
14780
+ const refreshCommand = region !== void 0 && refresh.exact ? pasteableCommand("cdkd state refresh-observed", [...refArgs, ...account]).command : void 0;
14781
+ const refreshNote = refreshCommand === void 0 ? "" : accountNote("the command at the end of this line prints");
14763
14782
  const refreshWithheld = region === void 0 ? "'cdkd state refresh-observed' for this stack once it is migrated: this record has no region, the legacy layout that command refuses, so migrate it first with any cdkd write, such as a deploy." : `'cdkd state refresh-observed' for this stack. The command is not printed: ${refreshWithheldReason(refresh)}`;
14764
14783
  const readable = entries.filter((entry) => isReadableResourceEntry(entry[1]));
14765
14784
  const unreadableCount = entries.length - readable.length;
14766
14785
  if (unreadableCount > 0) {
14767
14786
  const inspect = pasteableCommand("cdkd state show", refArgs);
14787
+ const inspectCommand = pasteableCommand("cdkd state show", [
14788
+ ...refArgs,
14789
+ { literal: "--json" },
14790
+ ...account
14791
+ ]).command;
14768
14792
  const unreadable = entries.filter(([, r]) => !isReadableResourceEntry(r)).map(([logicalId]) => logicalId);
14769
- logger.warn(`${unreadable.length} of ${entries.length} resource(s) in cdkd state have a record that is not readable as a resource — not an object, or carrying no resource type — so their drift baseline cannot be reported on. The state record is malformed or truncated. ` + (inspect.exact ? "" : `A quoted '<...>' hole in the command after the list below stands for a value cdkd could not ` + (stackName.startsWith("-") ? "print safely. This stack name begins with '-', which the CLI could read as an option however it is quoted, so do not fill the stack hole with it: repair or remove the record by hand. " : `print safely; fill it from 'cdkd state list --json', replacing the hole, quotes included, with ${JSON_LISTING_HOLE_VALUE}. `)) + `Inspect it with the command after the list below.`);
14793
+ logger.warn(`${unreadable.length} of ${entries.length} resource(s) in cdkd state have a record that is not readable as a resource — not an object, or carrying no resource type — so their drift baseline cannot be reported on. The state record is malformed or truncated. ` + (inspect.exact ? "" : `A quoted '<...>' hole in the command after the list below stands for a value cdkd could not ` + (stackName.startsWith("-") ? "print safely. This stack name begins with '-', which the CLI could read as an option however it is quoted, so do not fill the stack hole with it: repair or remove the record by hand. " : `print safely; fill it from 'cdkd state list --json'` + (account.length > 0 ? ` run with the same account flags as the command after the list below` : "") + `, replacing the hole, quotes included, with ${JSON_LISTING_HOLE_VALUE}. `)) + accountNote("the command after the list below prints") + `Inspect it with the command after the list below.`);
14770
14794
  for (const logicalId of unreadable.slice(0, NAMED_BASELINE_IDS)) logger.warn(` ${displayLogicalId(logicalId)}`);
14771
14795
  if (unreadable.length > NAMED_BASELINE_IDS) logger.warn(` ... and ${unreadable.length - NAMED_BASELINE_IDS} more`);
14772
- logger.warn(safeMsg`Inspect it with: ${inspect.command} --json`);
14796
+ logger.warn(safeMsg`Inspect it with: ${inspectCommand}`);
14773
14797
  }
14774
14798
  const missing = readable.filter(([, r]) => r.observedProperties === void 0);
14775
14799
  if (missing.length === 0) return;
14776
14800
  if (state.version !== void 0 && state.version < 3) {
14777
- logger.warn(`cdkd state schema is v${state.version} (pre-observedProperties). cdkd drift cannot reliably compare against AWS for this stack; the next 'cdk deploy' after migration may surface spurious changes if AWS has drifted from the ` + (unreadableCount > 0 ? `template. Repair the ${unreadableCount} unreadable record(s) named above first — 'cdkd state refresh-observed' refuses a record that holds one — then capture an AWS-current baseline before export.` : `template. Capture an AWS-current baseline before export — any redeploy does ` + (refreshCommand !== void 0 ? `it, or run: ${refreshCommand}` : `it, or run ${refreshWithheld}`)));
14801
+ logger.warn(`cdkd state schema is v${state.version} (pre-observedProperties). cdkd drift cannot reliably compare against AWS for this stack; the next 'cdk deploy' after migration may surface spurious changes if AWS has drifted from the ` + (unreadableCount > 0 ? `template. Repair the ${unreadableCount} unreadable record(s) named above first — 'cdkd state refresh-observed' refuses a record that holds one — then capture an AWS-current baseline before export.` : `template. ${refreshNote}Capture an AWS-current baseline before export — any redeploy does ` + (refreshCommand !== void 0 ? `it, or run: ${refreshCommand}` : `it, or run ${refreshWithheld}`)));
14778
14802
  return;
14779
14803
  }
14780
14804
  const refused = missing.filter(([, r]) => r.observedBaselineRefused === true);
14781
14805
  const refreshable = missing.filter(([, r]) => r.observedBaselineRefused !== true);
14782
14806
  if (refreshable.length > 0) {
14783
- logger.warn(`${refreshable.length} of ${entries.length} resource(s) in cdkd state lack an AWS-current baseline (observedProperties). cdkd drift may produce false positives for them; the next 'cdk deploy' after migration may surface unexpected changes. ` + (unreadableCount > 0 ? `Repair the ${unreadableCount} unreadable record(s) named above first — 'cdkd state refresh-observed' refuses a record that holds one. Then capture a baseline and run 'cdkd drift' to verify the stack matches AWS.` : refreshCommand !== void 0 ? `Capture a baseline before export, then run 'cdkd drift' to verify the stack matches AWS, with: ${refreshCommand}` : `Capture a baseline before export with ${refreshWithheld} Then run 'cdkd drift' to verify the stack matches AWS.`));
14807
+ logger.warn(`${refreshable.length} of ${entries.length} resource(s) in cdkd state lack an AWS-current baseline (observedProperties). cdkd drift may produce false positives for them; the next 'cdk deploy' after migration may surface unexpected changes. ` + (unreadableCount > 0 ? `Repair the ${unreadableCount} unreadable record(s) named above first — 'cdkd state refresh-observed' refuses a record that holds one. Then capture a baseline and run 'cdkd drift' to verify the stack matches AWS.` : refreshCommand !== void 0 ? `${refreshNote}Capture a baseline before export, then run 'cdkd drift' to verify the stack matches AWS, with: ${refreshCommand}` : `Capture a baseline before export with ${refreshWithheld} Then run 'cdkd drift' to verify the stack matches AWS.`));
14784
14808
  for (const [logicalId] of refreshable.slice(0, NAMED_BASELINE_IDS)) logger.warn(` ${displayLogicalId(logicalId)}`);
14785
14809
  if (refreshable.length > NAMED_BASELINE_IDS) logger.warn(` ... and ${refreshable.length - NAMED_BASELINE_IDS} more`);
14786
14810
  }
@@ -15265,7 +15289,7 @@ async function runPerStackImportLoop(args) {
15265
15289
  if (cdkdName === rootStackName) return cfnStackNameOverrides.root ?? cdkd2cfnStackName(cdkdName);
15266
15290
  return cfnStackNameOverrides.childMap.get(cdkdName) ?? cdkd2cfnStackName(cdkdName);
15267
15291
  };
15268
- const nodesByCdkdName = buildPerStackImportNodes(rootStackName, rootTemplate, rootStackInfoNestedTemplates, rootTemplateFormat, tree);
15292
+ const nodesByCdkdName = buildPerStackImportNodes(rootStackName, rootTemplate, rootStackInfoNestedTemplates, rootTemplateFormat, tree, args.lockRecovery);
15269
15293
  const leafFirst = flattenCdkdStateTreeLeafFirst(tree);
15270
15294
  for (const n of leafFirst) if (!nodesByCdkdName.has(n.stackName)) throw new Error(`runPerStackImportLoop: missing per-stack template for ${quotedOrNotShown(n.stackName)} — tree node has cdkd state but no synth template was loaded. This is a cdkd bug.`);
15271
15295
  for (const n of leafFirst) {
@@ -15402,7 +15426,7 @@ async function runPerStackImportLoop(args) {
15402
15426
  const completed = perStackPlans.slice(0, i);
15403
15427
  const notYetImported = perStackPlans.slice(i + 1).map((p) => quotedOrNotShown(p.cdkdName)).join(", ");
15404
15428
  const orphanLines = (plans) => plans.map((p) => {
15405
- const orphan = orphanCommandFor(p.cdkdName, p.region);
15429
+ const orphan = orphanCommandFor(p.cdkdName, p.region, args.lockRecovery);
15406
15430
  const target = isPasteableIdent(p.cfnName) ? `CloudFormation stack ${p.cfnName}` : "a CloudFormation stack whose name is not a plain identifier";
15407
15431
  return `${orphan.note ? `\n For the record targeting ${target}:${orphan.note}` : ""}\n ${orphan.command}`;
15408
15432
  }).join("");
@@ -15543,12 +15567,19 @@ async function runPerStackImportLoop(args) {
15543
15567
  region: node.region,
15544
15568
  reason: err instanceof Error ? err.message : String(err)
15545
15569
  });
15546
- const orphan = orphanCommandFor(node.stackName, node.region);
15570
+ const orphan = orphanCommandFor(node.stackName, node.region, args.lockRecovery);
15547
15571
  logger.warn(`Failed to delete cdkd state for ${quotedOrNotShown(node.stackName)} (${quotedRegion(node.region)}): ${safeDetail(err)}. The stack IS CFn-managed; clean up its state record.${orphan.note}\nClean up with: ${orphan.command}`);
15548
15572
  }
15549
15573
  if (stateDeletionFailures.length > 0) {
15550
15574
  const lines = stateDeletionFailures.map((f) => ` - ${quotedOrNotShown(`cdkd/${f.stackName}/${f.region}/state.json`)}: ${safeDetail(f.reason)}`).join("\n");
15551
- throw new Error(`${stateDeletionFailures.length} cdkd state record(s) could not be deleted after a successful per-stack IMPORT loop. Every stack in the tree IS CFn-managed (the migration succeeded AWS-side); orphan state remains under:\n${lines}\nRecover with the command below, once per record.\nRecover with: cdkd state orphan ${commandHole("stack")} --stack-region ${commandHole("region")}`);
15575
+ throw new Error(`${stateDeletionFailures.length} cdkd state record(s) could not be deleted after a successful per-stack IMPORT loop. Every stack in the tree IS CFn-managed (the migration succeeded AWS-side); orphan state remains under:\n${lines}\nRecover with the command below, once per record.` + spacedAccountClause(args.lockRecovery, "the command below prints") + `\nRecover with: ${pasteableCommand("cdkd state orphan", [
15576
+ { hole: "stack" },
15577
+ {
15578
+ flag: "--stack-region",
15579
+ hole: "region"
15580
+ },
15581
+ ...accountArgs(args.lockRecovery)
15582
+ ]).command}`);
15552
15583
  }
15553
15584
  if (sessionIntrinsicSkipped.size > 0) {
15554
15585
  const detail = [...sessionIntrinsicSkipped.entries()].map(([cdkdName, params]) => `${quotedOrNotShown(cdkdName)} (${params.map((n) => quotedOrNotShown(n)).join(", ")})`).join("; ");
@@ -15734,6 +15765,10 @@ function replaceAtCoordinate(node, coordinate, replacement) {
15734
15765
  }
15735
15766
  return node;
15736
15767
  }
15768
+ function spacedAccountClause(recovery, where) {
15769
+ const clause = withheldAccountClause(recovery, where).trimEnd();
15770
+ return clause === "" ? "" : ` ${clause}`;
15771
+ }
15737
15772
 
15738
15773
  //#endregion
15739
15774
  //#region src/cli/commands/state.ts
@@ -16099,7 +16134,7 @@ async function stateShowCommand(stackName, options) {
16099
16134
  const [stateResult, lockInfo] = await Promise.all([setup.stateBackend.getState(stackName, ref.region), setup.lockManager.getLockInfo(stackName, ref.region)]);
16100
16135
  if (!stateResult) throw new Error(`No state found for stack ${formatStackRefSafe(ref)} in s3://${setup.bucket}/${setup.prefix}/. Run 'cdkd state list' to see available stacks.`);
16101
16136
  if (options.showNested) {
16102
- const treeWithLocks = await loadLocksForTree(await buildCdkdStateStackTree(stackName, ref.region, setup.stateBackend, stateResult.state), setup.lockManager, lockInfo);
16137
+ const treeWithLocks = await loadLocksForTree(await buildCdkdStateStackTree(stackName, ref.region, setup.stateBackend, stateResult.state, renderRecovery(options, setup)), setup.lockManager, lockInfo);
16103
16138
  if (options.json) {
16104
16139
  warnUnreadableTreeNodes(treeWithLocks, logger, renderRecovery(options, setup));
16105
16140
  process.stdout.write(`${stringifyJsonPayload(treeToShowJson(treeWithLocks))}\n`);
@@ -16473,7 +16508,7 @@ async function stateOrphanResources(stackName, requested, options) {
16473
16508
  logger.info(safeMsg`✓ Removed ${logicalIds.length} resource record(s) from state: ${idList} ` + safeMsg`(${describedStackRef(ref)}). AWS resources are still in AWS; cdkd will no longer manage them.`);
16474
16509
  } finally {
16475
16510
  await setup.lockManager.releaseLock(stackName, region).catch((err) => {
16476
- logger.warn(safeMsg`Failed to release lock: ${displayAwsMessage(err instanceof Error ? err.message : String(err))}`);
16511
+ logger.warn(safeMsg`Failed to release lock: ${displayAwsMessage(describeAwsFailure(err).detail)}`);
16477
16512
  });
16478
16513
  }
16479
16514
  } finally {
@@ -17069,7 +17104,7 @@ async function refreshObservedForStack(stackName, region, stateBackend, lockMana
17069
17104
  refreshed++;
17070
17105
  } catch (err) {
17071
17106
  failed++;
17072
- logger.warn(safeMsg` ✗ ${displayStackName(stackName)}/${displayIdent(logicalId)} ` + safeMsg`(${displayIdent(resource.resourceType)}): ` + safeMsg`readCurrentState failed — ${err instanceof Error ? err.message : String(err)}`);
17107
+ logger.warn(safeMsg` ✗ ${displayStackName(stackName)}/${displayIdent(logicalId)} ` + safeMsg`(${displayIdent(resource.resourceType)}): ` + safeMsg`readCurrentState failed — ${describeAwsFailure(err).detail}`);
17073
17108
  }
17074
17109
  });
17075
17110
  await Promise.all(tasks);
@@ -17090,7 +17125,7 @@ async function refreshObservedForStack(stackName, region, stateBackend, lockMana
17090
17125
  };
17091
17126
  } finally {
17092
17127
  await lockManager.releaseLock(stackName, region).catch((err) => {
17093
- logger.warn(safeMsg`Failed to release lock for ${ref}: ${err instanceof Error ? err.message : String(err)}`);
17128
+ logger.warn(safeMsg`Failed to release lock for ${ref}: ${describeAwsFailure(err).detail}`);
17094
17129
  });
17095
17130
  }
17096
17131
  }
@@ -17398,7 +17433,7 @@ async function rollbackCommand(stackArg, options) {
17398
17433
  }
17399
17434
  logger.info("");
17400
17435
  if (!skipConfirmation) {
17401
- if (!await confirm(`Roll back ${stackRegionShown(stackName, region)}` + (options.removeProtection === true ? ", TURNING DELETION PROTECTION OFF on resources a failed CREATE left?" : "?"))) {
17436
+ 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?" : "?"))) {
17402
17437
  logger.info("Rollback cancelled");
17403
17438
  return;
17404
17439
  }
@@ -17491,7 +17526,8 @@ async function rollbackCommand(stackArg, options) {
17491
17526
  destroyOptions: {
17492
17527
  ...options.profile && { profile: options.profile },
17493
17528
  statePrefix: options.statePrefix,
17494
- ...options.skipFinalSnapshot === true && { skipFinalSnapshot: true }
17529
+ ...options.skipFinalSnapshot === true && { skipFinalSnapshot: true },
17530
+ ...options.removeProtection === true && { removeProtection: true }
17495
17531
  }
17496
17532
  }, () => withNestedRevertRun(segment.runId, (run) => {
17497
17533
  nestedRun = run;
@@ -17687,7 +17723,7 @@ function applyFailedPlanToPreview(plan, previewState, skipFinalSnapshot) {
17687
17723
  }
17688
17724
  }
17689
17725
  function createRollbackCommand() {
17690
- const cmd = new Command("rollback").description("Revert a stack to its pre-deploy state after a failed --no-rollback / interrupted deploy or a partially-failed automatic rollback (state-driven, no synth needed).").argument("[stack]", "Stack name to roll back (defaults to the single journaled stack)").addOption(new Option("--force", "Skip the confirmation prompt").default(false)).addOption(new Option("--orphan <logicalId>", "Skip the given resource during replay (repeatable). Mirrors cdk rollback --orphan.").argParser((value, previous) => [...previous ?? [], value])).addOption(new Option("--revert-failed", "Also attempt to revert the resource whose operation FAILED mid-deploy. Off by default: the remote state of the failed resource is unknown, so force-applying its previous state is opt-in.").default(false)).addOption(new Option("--drop-failed <logicalId>", "Remove ONE journaled failed CREATE (a resource cdkd proved it made, journaled as its only record) from the rollback journal, after checking that resource by hand. Replays nothing and deletes nothing in AWS; every other entry is kept.")).addOption(skipFinalSnapshotOption).addOption(new Option("--remove-protection", `Turn deletion protection off before deleting a resource a failed CREATE left behind (a journaled orphan, or under --revert-failed the failed CREATE itself), when cdkd can prove it is that resource and no other stack holds it. On a failed nested stack it cascades to that child's resources. Covers ${removeProtectionTypeList()}.`).default(false)).addOption(stackRegionOption()).addHelpText("after", [
17726
+ const cmd = new Command("rollback").description("Revert a stack to its pre-deploy state after a failed --no-rollback / interrupted deploy or a partially-failed automatic rollback (state-driven, no synth needed).").argument("[stack]", "Stack name to roll back (defaults to the single journaled stack)").addOption(new Option("--force", "Skip the confirmation prompt").default(false)).addOption(new Option("--orphan <logicalId>", "Skip the given resource during replay (repeatable). Mirrors cdk rollback --orphan.").argParser((value, previous) => [...previous ?? [], value])).addOption(new Option("--revert-failed", "Also attempt to revert the resource whose operation FAILED mid-deploy. Off by default: the remote state of the failed resource is unknown, so force-applying its previous state is opt-in.").default(false)).addOption(new Option("--drop-failed <logicalId>", "Remove ONE journaled failed CREATE (a resource cdkd proved it made, journaled as its only record) from the rollback journal, after checking that resource by hand. Replays nothing and deletes nothing in AWS; every other entry is kept.")).addOption(skipFinalSnapshotOption).addOption(new Option("--remove-protection", `Turn deletion protection off before this stack's rollback deletes a resource the failed deploy left: one its state records from a completed CREATE, or one a failed CREATE left behind (a journaled orphan, or under --revert-failed the failed CREATE itself) when cdkd can prove it is that resource and no other stack holds it. A nested stack it deletes cascades the flag to that child's resources, and a nested stack it reverts carries it into that child's revert. Covers ${removeProtectionTypeList()}.`).default(false)).addOption(stackRegionOption()).addHelpText("after", [
17691
17727
  "",
17692
17728
  "Examples:",
17693
17729
  " cdkd rollback MyStack",
@@ -17696,7 +17732,7 @@ function createRollbackCommand() {
17696
17732
  " cdkd rollback MyStack --orphan MyBucket --orphan MyTable",
17697
17733
  " cdkd rollback MyStack --revert-failed # also revert the failed in-flight resource",
17698
17734
  " cdkd rollback MyStack --skip-final-snapshot # DeletionPolicy Snapshot → delete without the snapshot",
17699
- " cdkd rollback MyStack --remove-protection # clear a protected resource a failed CREATE left",
17735
+ " cdkd rollback MyStack --remove-protection # also delete protected resources the failed deploy left",
17700
17736
  " cdkd rollback MyStack --stack-region us-west-2",
17701
17737
  " cdkd rollback MyStack --drop-failed MyQueuePolicy # forget one undeletable failed CREATE",
17702
17738
  "",
@@ -18457,12 +18493,12 @@ async function gcCommand(options) {
18457
18493
  try {
18458
18494
  await stateBackend.deleteRawObjects(responseCandidates.map((c) => c.key));
18459
18495
  } catch (deleteError) {
18460
- throw new CdkdError(`Failed to delete abandoned custom-resource response placeholder(s) from ${bucketName}: ${deleteError instanceof Error ? deleteError.message : String(deleteError)}`, "GC_DELETE_FAILED");
18496
+ throw new CdkdError(`Failed to delete abandoned custom-resource response placeholder(s) from ${bucketName}: ${describeAwsFailure(deleteError).detail}`, "GC_DELETE_FAILED");
18461
18497
  } finally {
18462
18498
  await stateBackend.purgeNoncurrentVersions(responseCandidates.map((c) => c.key), {
18463
18499
  listPrefix: `${CUSTOM_RESOURCE_RESPONSE_PREFIX}/`,
18464
18500
  objectDescription: CUSTOM_RESOURCE_RESPONSE_OBJECT_DESCRIPTION
18465
- }).catch((purgeError) => logger.warn(`Could not purge noncurrent versions of the collected custom-resource response placeholder(s) in ${bucketName}; their previous versions survive and remain readable via GetObject with a VersionId. Underlying error: ${purgeError instanceof Error ? purgeError.message : String(purgeError)}`));
18501
+ }).catch((purgeError) => logger.warn(`Could not purge noncurrent versions of the collected custom-resource response placeholder(s) in ${bucketName}; their previous versions survive and remain readable via GetObject with a VersionId. Underlying error: ${describeAwsFailure(purgeError).detail}`));
18466
18502
  }
18467
18503
  logger.info(`✓ Deleted ${responseCandidates.length} abandoned custom-resource response placeholder(s) (${formatBytes(responseBytes)}) from ${bucketName}`);
18468
18504
  }
@@ -18720,7 +18756,7 @@ async function forceUnlockCommand(stackArgs, options) {
18720
18756
  await lockManager.forceReleaseLock(stackName, r);
18721
18757
  logger.info(`✓ Lock released for stack: ${where}`);
18722
18758
  } catch (error) {
18723
- const message = error instanceof Error ? error.message : String(error);
18759
+ const message = describeAwsFailure(error).detail;
18724
18760
  if (message.includes("No lock found") || message.includes("NoSuchKey")) logger.info(`No lock found for stack: ${where}`);
18725
18761
  else {
18726
18762
  const detail = displaySafe(message, { asciiOnly: true }) || "<unrenderable>";
@@ -19079,7 +19115,7 @@ async function importCommand(stackArg, options) {
19079
19115
  }
19080
19116
  } finally {
19081
19117
  await lockManager.releaseLock(stackInfo.stackName, targetRegion).catch((err) => {
19082
- logger.warn(`Failed to release lock: ${err instanceof Error ? err.message : String(err)}`);
19118
+ logger.warn(`Failed to release lock: ${describeAwsFailure(err).detail}`);
19083
19119
  });
19084
19120
  }
19085
19121
  } finally {
@@ -19104,7 +19140,7 @@ async function recordImportOnRollbackJournal(stateBackend, stackName, region, lo
19104
19140
  try {
19105
19141
  marked = await stateBackend.markRollbackJournalImported(stackName, region, marks);
19106
19142
  } catch (error) {
19107
- throw new Error(`Could not record this import on the rollback journal of ${stackShown(stackName)}, so state was NOT written: a later cdkd rollback could otherwise delete what was imported. Cause: ${displaySafe(error instanceof Error ? error.message : String(error))}`);
19143
+ throw new Error(`Could not record this import on the rollback journal of ${stackShown(stackName)}, so state was NOT written: a later cdkd rollback could otherwise delete what was imported. Cause: ${displaySafe(describeAwsFailure(error).detail)}`);
19108
19144
  }
19109
19145
  if (marked.length > 0) logger.info(safeMsg` The rollback journal of ${stackShown(stackName)} records ` + safeMsg`${marked.map((id) => logicalIdShown(id)).join(", ")} as imported: ` + "cdkd rollback leaves those resources as they are.");
19110
19146
  }
@@ -19276,7 +19312,8 @@ async function importOne(task) {
19276
19312
  outcome: "skipped-no-impl",
19277
19313
  reason: "no provider registered"
19278
19314
  };
19279
- const provider = providerRegistry.getProvider(resource.Type);
19315
+ const route = providerRegistry.getProviderFor({ resourceType: resource.Type });
19316
+ const provider = route.provider;
19280
19317
  if (!provider.import) return {
19281
19318
  logicalId,
19282
19319
  resourceType: resource.Type,
@@ -19305,10 +19342,11 @@ async function importOne(task) {
19305
19342
  resourceType: resource.Type,
19306
19343
  outcome: "imported",
19307
19344
  physicalId: result.physicalId,
19308
- ...result.attributes !== void 0 && { attributes: result.attributes }
19345
+ ...result.attributes !== void 0 && { attributes: result.attributes },
19346
+ provisionedBy: route.provisionedBy
19309
19347
  };
19310
19348
  } catch (error) {
19311
- const msg = error instanceof Error ? error.message : String(error);
19349
+ const msg = describeAwsFailure(error).detail;
19312
19350
  logger.error(`Failed to import ${logicalIdShown(logicalId)} (${resourceTypeShown(resource.Type)}): ${msg}`);
19313
19351
  return {
19314
19352
  logicalId,
@@ -19448,7 +19486,7 @@ function buildStackState(stackName, region, rows, templateParser, template, exis
19448
19486
  deletionPolicy: tmplResource.DeletionPolicy,
19449
19487
  updateReplacePolicy: tmplResource.UpdateReplacePolicy,
19450
19488
  ...constructPathField(constructPathOf(template, row.logicalId)),
19451
- provisionedBy: "sdk",
19489
+ provisionedBy: row.provisionedBy ?? "sdk",
19452
19490
  ...prior && prior.physicalId === row.physicalId && (hasUnverifiableParameterRefusal(prior) || hasReasonlessBaselineRefusal(prior) && (namesParameter ??= resourcesNamingDeclaredParameter(template))(row.logicalId)) && {
19453
19491
  observedBaselineRefused: true,
19454
19492
  observedBaselineRefusalReason: "unverifiable-parameter"
@@ -19487,12 +19525,12 @@ async function resolveImportedProperties(stackState, template, region, stateBack
19487
19525
  try {
19488
19526
  parameters = await resolver.resolveParameters(template);
19489
19527
  } catch (err) {
19490
- logger.debug(`Template parameter resolution failed during import-time property resolution: ${err instanceof Error ? err.message : String(err)} — retrying with the template's 'Default'-carrying parameters only; resources referencing an unbindable parameter will still be skipped per-resource.`);
19528
+ logger.debug(`Template parameter resolution failed during import-time property resolution: ${describeAwsFailure(err).detail} — retrying with the template's 'Default'-carrying parameters only; resources referencing an unbindable parameter will still be skipped per-resource.`);
19491
19529
  try {
19492
19530
  parameters = await resolver.resolveParameters(defaultOnlyParameterTemplate(template));
19493
19531
  } catch (defaultsErr) {
19494
19532
  parameters = {};
19495
- logger.debug(`'Default'-only template parameter resolution also failed during import-time property resolution: ${defaultsErr instanceof Error ? defaultsErr.message : String(defaultsErr)} — continuing without parameters; resources referencing them will be skipped per-resource.`);
19533
+ logger.debug(`'Default'-only template parameter resolution also failed during import-time property resolution: ${describeAwsFailure(defaultsErr).detail} — continuing without parameters; resources referencing them will be skipped per-resource.`);
19496
19534
  }
19497
19535
  }
19498
19536
  try {
@@ -19502,7 +19540,7 @@ async function resolveImportedProperties(stackState, template, region, stateBack
19502
19540
  parameters
19503
19541
  });
19504
19542
  } catch (err) {
19505
- logger.debug(`Template condition evaluation failed during import-time property resolution: ${err instanceof Error ? err.message : String(err)} — continuing without conditions.`);
19543
+ logger.debug(`Template condition evaluation failed during import-time property resolution: ${describeAwsFailure(err).detail} — continuing without conditions.`);
19506
19544
  }
19507
19545
  const unboundParameterNames = Object.keys(template.Parameters ?? {}).filter((name) => isUnboundTemplateParameter(name, template, parameters));
19508
19546
  let divergentParameters;
@@ -19544,7 +19582,7 @@ async function resolveImportedProperties(stackState, template, region, stateBack
19544
19582
  });
19545
19583
  resource.properties = recordedSecretValues.size > 0 ? redactSecretsForState(markSameGenerationBag(resolved), recordedSecretValues, unresolvedProperties) : resolved;
19546
19584
  } catch (err) {
19547
- logger.warn(`Failed to resolve intrinsics in Properties for imported resource ${logicalIdShown(logicalId)} (${resourceTypeShown(resource.resourceType)}): ${maskSecretsInText(err instanceof Error ? err.message : String(err), recordedSecretValues)}.\nState will be written with the raw intrinsic shape, which may cause 'cdkd destroy' to fail on this resource — re-import once every referenced sibling is in state, or remove this resource from state with 'cdkd orphan <StackPath>/<Path/To/Resource>'.` + (unboundParameterNames.length > 0 ? ` This template also declares parameter(s) with no 'Default' that an import cannot bind (${unboundParameterNames.map((name) => plainOrDescribed(name, "parameter name")).join(", ")}), and 'cdkd import' accepts no parameter values — if this property was built from one of those, re-importing a sibling will not change it: give the parameter a 'Default' in the template and re-import, or correct the recorded properties before the next 'cdkd deploy'.` : ""));
19585
+ logger.warn(`Failed to resolve intrinsics in Properties for imported resource ${logicalIdShown(logicalId)} (${resourceTypeShown(resource.resourceType)}): ${maskSecretsInText(describeAwsFailure(err).detail, recordedSecretValues)}.\nState will be written with the raw intrinsic shape, which may cause 'cdkd destroy' to fail on this resource — re-import once every referenced sibling is in state, or remove this resource from state with 'cdkd orphan <StackPath>/<Path/To/Resource>'.` + (unboundParameterNames.length > 0 ? ` This template also declares parameter(s) with no 'Default' that an import cannot bind (${unboundParameterNames.map((name) => plainOrDescribed(name, "parameter name")).join(", ")}), and 'cdkd import' accepts no parameter values — if this property was built from one of those, re-importing a sibling will not change it: give the parameter a 'Default' in the template and re-import, or correct the recorded properties before the next 'cdkd deploy'.` : ""));
19548
19586
  threw = true;
19549
19587
  }
19550
19588
  if (recordedSecretValues.size > 0 && resource.attributes !== void 0) resource.attributes = redactSecretsForState(resource.attributes, recordedSecretValues);
@@ -19828,7 +19866,7 @@ async function importNestedStackChildrenRecursive(args) {
19828
19866
  });
19829
19867
  } finally {
19830
19868
  await lockManager.releaseLock(childStackName, childRegion).catch((err) => {
19831
- logger.warn(`Failed to release lock for nested stack '${childStackName}' (${childRegion}): ${err instanceof Error ? err.message : String(err)}`);
19869
+ logger.warn(`Failed to release lock for nested stack '${childStackName}' (${childRegion}): ${describeAwsFailure(err).detail}`);
19832
19870
  });
19833
19871
  }
19834
19872
  }
@@ -27278,4 +27316,4 @@ function collectVerbFlags(program) {
27278
27316
 
27279
27317
  //#endregion
27280
27318
  export { canonicalizeIpProtocolValue as a, buildProgram, resolveSecretDerivedPrincipals as i, runDestroyForStack as n, resolvedResourceTimeoutMs as o, isResolvableSecretPrincipalList as r, canonicalizeIpv4Cidr as t };
27281
- //# sourceMappingURL=program-epAinsMQ.js.map
27319
+ //# sourceMappingURL=program-CKV6Kn8Q.js.map