@go-to-k/cdkd 0.298.8 → 0.299.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/{asg-provider-B8N6UPAH.js → asg-provider-BxW2FkQz.js} +4 -4
  2. package/dist/{asg-provider-B8N6UPAH.js.map → asg-provider-BxW2FkQz.js.map} +1 -1
  3. package/dist/{aws-client-defaults-D0q0z4dG.js → aws-client-defaults-DBXBcg0J.js} +79 -3
  4. package/dist/aws-client-defaults-DBXBcg0J.js.map +1 -0
  5. package/dist/{aws-clients-CnmtbrxD.js → aws-clients-Bj7qH5Ph.js} +2 -2
  6. package/dist/{aws-clients-CnmtbrxD.js.map → aws-clients-Bj7qH5Ph.js.map} +1 -1
  7. package/dist/cli.js +2 -2
  8. package/dist/{deploy-engine-HKmcD4Kn.js → deploy-engine-CZUhJ1IZ.js} +932 -207
  9. package/dist/deploy-engine-CZUhJ1IZ.js.map +1 -0
  10. package/dist/{iam-policy-targets-CwKiK9nS.js → iam-policy-targets-Pn2m0R67.js} +3 -3
  11. package/dist/{iam-policy-targets-CwKiK9nS.js.map → iam-policy-targets-Pn2m0R67.js.map} +1 -1
  12. package/dist/{iam-role-provider-BiCib2zp.js → iam-role-provider-C24I_FvR.js} +47 -7
  13. package/dist/iam-role-provider-C24I_FvR.js.map +1 -0
  14. package/dist/index.d.ts +24 -1
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +4 -4
  17. package/dist/{neptune-provider-D3Qcci3J.js → neptune-provider-D7sAjt4U.js} +4 -4
  18. package/dist/{neptune-provider-D3Qcci3J.js.map → neptune-provider-D7sAjt4U.js.map} +1 -1
  19. package/dist/{program-MMwB_CTT.js → program-w-kAH85e.js} +272 -97
  20. package/dist/program-w-kAH85e.js.map +1 -0
  21. package/dist/{provider-classes--iMwAb7q.js → provider-classes-Xrt4DIC7.js} +89 -16
  22. package/dist/provider-classes-Xrt4DIC7.js.map +1 -0
  23. package/dist/{rds-provider-BdUme0V8.js → rds-provider-Bz8JUYBp.js} +4 -4
  24. package/dist/{rds-provider-BdUme0V8.js.map → rds-provider-Bz8JUYBp.js.map} +1 -1
  25. package/dist/{version-n6UXfuUI.js → version-DMqEiJIt.js} +2 -2
  26. package/dist/{version-n6UXfuUI.js.map → version-DMqEiJIt.js.map} +1 -1
  27. package/package.json +1 -1
  28. package/dist/aws-client-defaults-D0q0z4dG.js.map +0 -1
  29. package/dist/deploy-engine-HKmcD4Kn.js.map +0 -1
  30. package/dist/iam-role-provider-BiCib2zp.js.map +0 -1
  31. package/dist/program-MMwB_CTT.js.map +0 -1
  32. package/dist/provider-classes--iMwAb7q.js.map +0 -1
@@ -1,9 +1,9 @@
1
- import { a as runWithStackAwsClients, i as resetAwsClients, o as setAwsClients, t as AwsClients } from "./aws-clients-CnmtbrxD.js";
1
+ import { a as runWithStackAwsClients, i as resetAwsClients, o as setAwsClients, t as AwsClients } from "./aws-clients-Bj7qH5Ph.js";
2
2
  import { A as UNRENDERABLE, B as stringifyJsonPayload, D as SAFE_MSG_ALTERED_CHAR, F as displayStackName, H as truncateCodePoints, 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, _ 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-DtvlUugx.js";
3
- import { $n as isAmbiguousOutcomeError, $t as credentialFingerprint, Bn as withheldTargetClause, D as VALUE_NOT_SHOWN, Dn as TIMEOUT_FLAG_RESOURCE_TYPE, E as assertRegionMatch, En as withErrorHandling, Ft as buildLockContentionMessage, G as runDeleteAttempt, Hn as setPasteableVerbFlags, Ht as CUSTOM_RESOURCE_RESPONSE_PREFIX, In as plainOrDescribed, It as forceQuitRecoveryClause, Jt as setPasteableAwsProfile, Kt as producerCoordinateKey, Ln as quotedOrDescribed, Lt as formatLockExpiry, Nn as isInertUnquoted, Nt as UNREPRODUCIBLE_LOCK_CLAUSE, P as remedyLogicalId, Pn as pasteableCommand, Pt as buildForceUnlockCommand, Qt as clientDefaultsFor, Rn as shellBoundedDisplay, Rt as formatLockOperation, Sn as SynthesisError, T as RESOURCE_NOT_FOUND, Tn as normalizeAwsError, Ut as DEFAULT_STATE_PREFIX, Vn as setPasteableRunFlags, Wt as injectiveKey, Xt as ambientClientDefaults, Yt as withPasteableAwsProfile, Z as isAwsCliLiteral, Zt as ambientCredentialConfig, _n as ResourceTimeoutError, ar as isMarkedNonRetryable, bn as StackTerminationProtectionError, cn as IntrinsicResolutionRefusalError, en as AccountIdUnavailableError, ft as logicalIdShown, gn as ProvisioningError, hn as PartialFailureError, in as CrossAccountSecretRefusalError, it as isInterruptedWaitError, jn as commandHole, kn as SHELL_ACTIVE_WHY, ln as LocalInvokeBuildError$1, mn as NestedStackChildDirectDestroyError, mt as resourceTypeShown, n as RESOLVED_PREVIOUS_PRINCIPAL_KEYS, nn as CdkdError, nr as isTransientServerError, nt as endCommandInterruptScope, on as DeployCancelledError, or as isThrottlingError, pn as MalformedProducerRecordRefusalError, qt as producerRecordKey, rr as retryClassificationText, rt as interruptWatchListenerCount, s as readRecordedPrincipals, sn as DynamicReferenceRegionAmbiguousError, sr as markNonRetryable, t as IAM_PRINCIPAL_NAME, tr as isRetryableTransientError, tt as beginCommandInterruptScope, un as LocalStartServiceError, vn as ResourceUpdateNotSupportedError, xn as StateError, yn as StackHasActiveImportsError, zn as shellQuote, zt as formatLockOwner } from "./iam-policy-targets-CwKiK9nS.js";
4
- import { a as setAssumedRoleCredentials, n as awsClientDefaults, r as getAssumedRoleCredentials, u as formatAuthority } from "./aws-client-defaults-D0q0z4dG.js";
5
- import { $a as isStatefulRecreateTargetForReplace, $c as stateBucketExistenceConfirmed, $i as malformedOrphansRefusalMessage, $n as ledgerForStack, $o as markSameGenerationBag, $r as sendableAssumeRoleCommand, $s as AssetPublisher, $t as seedsDeleteFirstGuard, A as noEchoComparisonForTemplate, Aa as refuseMalformedResourcesForDeploy, Ac as redactDockerArgvValues, Ai as declaresNoEcho, An as journaledOrphanPrintingBag, Ao as maskWholeValue, Ar as deleteIndeterminateGuards, As as LockManager, At as dropFailedHint, Ba as unpreviewableOrphanRecords, Bc as getDockerImageBySourceHash, Bi as hasReadableOutputs, Bn as PRE_DELETE_SNAPSHOT_TYPES, Bo as carryLogOnlyValues, Bs as splitImportedOps, C as recordRetainedForReadoption, Ca as refuseMalformedResourceEntriesForImport, Cc as dockerSpawnEnvWithSensitive, Ci as cfnRefValueFromPhysicalId, Cl as displayAssemblyPath, Cn as collectDeclaredOutputNames, Cr as applyCustomResourceResponseExpiration, Cs as wholeStringLeavesOf, D as withResourceDeadline, Da as refuseMalformedResourcePropertiesForDrift, Dc as isDockerClientEnvKey, Di as withSharedDrainBudget, Dl as injectedAwsRegionValue, Dn as DEFAULT_RESOURCE_TIMEOUT_MS, Do as isMarkedCoordinate, Ds as TEMPLATE_SOURCED_RULES, E as serviceTokenBlockingReason, Ea as refuseMalformedResourcePropertiesForDestroy, Ec as getDockerCmd, El as injectAwsRegion, En as bindingSkippedOutputs, Eo as canonicalCoordinates, Er as slowCcOperationTimeoutMs, Es as STATE_SOURCED_READBACK_RULES, Et as collectNestedChildUnaddressed, F as PROTECTION_PROPERTY_BY_TYPE, Fa as repairMalformedOrphansForReadOnly, Fc as warnFinchArgvExposure, Fi as UNREADABLE_RESOURCES_MAP_ROW, Fn as secretNamedRecordNeedles, Fs as CrossPrefixScanCache, Ft as sameJournaledOrphans, Gc as loadCdkJson, Gi as malformedExportNamesWarning, Gn as isFinalSnapshotError, Go as printingCorpusOf, Gr as poisonRenderedSpellingsCollidingIn, Gs as hasReasonlessBaselineRefusal, Gt as isJournaledOrphan, Ha as unreadableResourceEntries, Hc as synthesisStatusMessage, Hi as isReadableOrphanRecord, Hn as ccRoutedFinalSnapshotError, Ho as hasMaskableValues, Hr as DiffCalculator, Hs as describeRegionValueKind, Ht as removeProtectionTypeList, I as isProtectionValueActive, Ia as repairMalformedOutputsForReadOnly, Ic as escapeRegExp, Ii as accountArgs, In as stateSecretNameNeedles, Io as readbackPathFor, Is as applyCrossPrefixScan, It as replayFailedOperations, Ja as NO_CC_HANDLERS_REASON, Jc as resolveCaptureObservedState, Ji as malformedLocalResourceEntriesWarning, Jn as maskingRetryLogger, Jo as shareLogOnlyValues, Jr as applyRoleArnIfSet, Js as importableOutputs, Jt as planRollback, Ka as unwrittenCreateOnlyReplacement, Kc as resolveApp, Ki as malformedExportSourceWarning, Kn as refusesFinalSnapshot, Ko as recordLogOnlyParameterValue, Kr as producerLookupOver, Ks as hasUnverifiableParameterRefusal, Kt as isReplacementOrphan, L as perType, La as repairMalformedResourceEntriesForReadOnly, Lc as stripControlChars, Li as deployRefusesOrphanRowsReason, Ln as storedSecretNameNeedles, Lo as readsNoEchoSource, Ls as crossPrefixDeniedWarning, Lt as replayRollback, M as noEchoParameterNamesOf, Ma as refuseMalformedResourcesForExport, Mc as redactedDockerCause, Mi as STATE_REGION_DIVERGED, Mn as orphanRecordsPrintingBag, Mo as noEchoCoordinatesOf, Mr as deleteSkipReason, Ms as S3StateBackend, Mt as journaledOrphanLines, N as recordedProtectionEvidence, Na as refuseMalformedState, Nc as runDockerForeground, Ni as STATE_RESOURCES_MALFORMED, Nn as secretNamePrintingBag, No as noEchoLeavesOf, Ns as rebuildClientForBucketRegion, Nt as loadJournaledOrphans, O as diffSecurity, Oa as refuseMalformedResourcePropertiesForExport, Oc as isMalformedEnvKey, Oi as parameterInputsFor, On as DEFAULT_RESOURCE_WARN_AFTER_MS, Oo as maskAtCoordinates, Or as RollbackInlinePolicyWriters, Os as WHOLE_DYNAMIC_REFERENCE_PATTERN, Ot as withNestedStackContext, P as recordedProtectionNote, Pa as repairMalformedOrphanRecordsForReadOnly, Pc as runDockerStreaming, Pi as UNREADABLE_ORPHANS_CONTAINER_ROW, Pn as secretNamePrintingBags, Po as noEchoOutputsComparison, Pr as isWaitAbandonedError, Ps as CrossPrefixReadError, Pt as makeForeignHolderScan, Qa as MULTI_REGION_RECREATE_BLOCKED_TYPES, Qc as resolveUseCdkBootstrapAssets, Qi as malformedOrphanRowsKeptWarning, Qo as maskSecretsInText, Qr as isIamRoleArn, Qs as shouldRetainResource, Qt as resolveReplacementOldType, R as readProtection, Ra as repairMalformedResourcePropertiesForReadOnly, Rc as stripForDisplay, Ri as displayLogicalId, Rn as extractDeploymentEventError, Ro as valueAtCoordinate, Rs as isAccessDenied, S as keptForReadoption, Sa as refuseMalformedResourceEntriesForDestroy, Sc as describeDockerFailure, Si as AWS_NO_VALUE, Sl as describeFileReadFailure, Sn as noEchoParameterValueSeed, Sr as CUSTOM_RESOURCE_RESPONSE_LIFECYCLE_RULE_ID, Ss as recordProvenPublicExpression, St as recordDisplacedSkips, T as findServiceTokenRefusals, Ta as refuseMalformedResourceEntriesForOrphan, Tc as formatDockerLoginError, Ti as refStateLookupFromResource, Tl as resolveAssemblyPath, Tn as isExportAliasCollision, To as TemplateParser, Tr as CloudControlProvider, Ts as STATE_SOURCED_CROSS_GENERATION_RULES, Tt as withNestedRevertRun, Ua as withheldAccountClause, Uc as getDefaultStateBucketName, Ui as isReadableResourceEntry, Un as createPreDeleteFinalSnapshot, Uo as literalSplitDelimitersOf, Ur as INTRINSIC_KEYS, Us as exportNamesCarriedFrom, Ut as recordAfterRollbackUpdate, Va as unreadableOrphanRecords, Vc as Synthesizer, Vi as hasReadableResources, Vn as buildFinalSnapshotIdentifier, Vo as createUnionSecretMasker, Vs as acceptedCreateOnlyDropsOf, Vt as withStackRecords, Wa as findActionableSilentDrops, Wc as getLegacyStateBucketName, Wi as malformedDriftResourcePropertiesWarning, Wn as effectiveDeletionPolicy, Wo as logOnlyValueCount, Wr as IntrinsicFunctionResolver, Ws as hasReadableExportSet, Wt as demoteSupersededOrphans, Xa as findReplacedReadersOfRecreateTargets, Xc as resolveStateBucketWithDefault, Xi as malformedOrphanRecordsRefusalMessage, Xn as findDestructiveChanges, Xo as errorCauseChain, Xr as assertSendableRoleArn, Xs as orphansAfterRollback, Xt as recordUnderIdIsNotOwn, Ya as hasNoCloudControlHandlers, Yc as resolveSkipPrefix, Yi as malformedLocalResourcesWarning, Yn as constructPathOf, Yo as createSecretMasker, Yr as assertFlagRoleArn, Ys as isReadableBag, Yt as recheckFailedPlan, Za as shownType, Zc as resolveStateBucketWithDefaultAndSource, Zi as malformedOrphanRecordsWarning, Zn as formatDestructiveChange, Zo as maskSecretsInError, Zr as explicitRoleArnOrThrow, Zs as orphansCarriedFrom, Zt as replacementNeverSwapped, _ as makeCanonicalizePropertiesFn, _a as refuseMalformedOutputs, _c as buildDenyExternalAccessPolicy, _i as isImpossibleEmptyStoredAttribute, _l as hasOwnKey, _n as secretSafeKeyDisplay, _o as prefetchCreateOnlyPropertyPaths, _r as TemplateNoEchoReresolver, _s as provenPublicValue, _t as displacedOpClause, a as findNestedTemplateTreeDefect, aa as malformedResourcePropertiesWarning, ac as loadPublishableAssetManifest, al as findLargeInlineResources, as as dynamicReferenceTokens, at as cyan, ba as refuseMalformedResourceEntries, bc as describeDockerCapturedOutput, bi as isNamelessDynamicReferenceError, bl as ownValue, bn as exportNameSecretExposure, bo as withRetry, bs as recordNoEchoAttributeValues, c as renderNestedTemplateTreeDefect, ca as malformedStateRefusalMessage, cc as BOOTSTRAP_MARKER_PREFIX, cl as decodeListingKey, cn as updatePartialMessage, cs as identityKeyFor, ct as red, d as conditionInputsFrom, dc as getBootstrapMarkerKey, di as producerRegionsFromState, dl as canonicalizeRegion, dn as DeploymentEventsStore, dt as namesAnyDeclaredParameter, ea as malformedOrphansWarning, ec as isSensitiveAttributeName, ei as AWS_CREDENTIAL_ENV_KEYS, el as warnDeprecatedNoPrefixCliFlag, en as orphanDeleteNeedsIdentity, eo as isStatefulRecreateTargetSync, es as redactSecretsForState, f as parentSuppliedValues, fa as refuseMalformedOrphanRecords, fc as isCrossRegionRedirect, fi as regionLessSecretName, fl as derivePartitionAndUrlSuffix, fn as WITHHELD_NAME_DISPLAY, fr as CC_BROKEN_REASON, fs as physicalNameCopiesOf, ft as reachableDivergentParameters, g as mergeNoChangeOutputs, ga as refuseMalformedOrphansForOrphan, gc as validateContainerRepoName, gi as getAccountInfo, gl as defineOwnKey, gn as secretBearingStateKeyWarning, gr as wouldReturnToSdkProvider, gs as carriesSecretMask, gt as NESTED_PENDING_PARENT_REASON, h as keptWholeReasonText, ha as refuseMalformedOrphansForDestroy, hc as validateAssetBucketName, hi as parameterTypeMayLoseSecretIdentity, hl as processStackMessages, hn as secretBearing, hr as isCustomResource, hs as splitGetAttStringForm, ht as planOrphanAdoption, i as childTemplateLoader, ia as malformedResourceEntriesWarning, ic as createAssetRedirectResolver, il as MIGRATE_TMP_PREFIX, is as DYNAMIC_REFERENCE_TOKEN_SCAN, it as bold, j as noEchoExactEchoLeavesOf, ja as refuseMalformedResourcesForDestroy, jc as redactedCause, ji as JSON_LISTING_HOLE_VALUE, jn as maskEventTextWithBoundBags, jo as maskedLeafCoordinatesOf, jr as deleteLeftInPlace, js as isLockInfoExpired, jt as isHandledOrphan, k as noEchoAttributeNamesOf, ka as refuseMalformedResourcePropertiesForOrphan, kc as partitionSensitiveEnv, kl as resolveBucketRegion, kn as completedReplayEntries, ko as maskReadbackAtCoordinates, kr as UNSPECIFIED_SKIP_REASON, ks as isSingleDynamicReferenceToken, kt as deleteJournaledOrphans, l as templateIdentity, la as previewableOrphanRecords, lc as assertAssetBucketRegion, ll as expectedOwnerParam, ln as updatePartialReason, ls as inheritNestedStackParameterAssociations, lt as yellow, m as isSecretBearingReferenceString, ma as refuseMalformedOrphans, mc as readBootstrapMarkerBody, mi as isUnboundTemplateParameter, ml as StageLoadError, mn as exportAliasCollisionScrubWarning, mr as ccBrokenReason, ms as recordPhysicalNameCopy, mt as makeSiblingClaimReader, n as IMPLICIT_DELETE_DEPENDENCIES, na as malformedOutputsWarning, nc as WorkGraph, ni as callerEnvCredentials, nl as CFN_TEMPLATE_BODY_LIMIT, ns as withPhysicalNameCopies, nt as formatResourceLine, o as isAbsoluteAssetPath, oa as malformedResourcesWarning, oc as rewriteTemplateAssetReferences, ol as uploadCfnTemplate, os as isUncertifiedBaselineMaskPosition, ot as gray, p as readRecordedConditionVerdicts, pa as refuseMalformedOrphanRecordsForDestroy, pc as parseBootstrapMarker, pi as coerceParameterTypedValue, pl as AssemblyReader, pn as displayTextOrWithheld, pr as ProviderRegistry, pt as resourcesNamingDeclaredParameter, qc as resolveAutoAssetStorage, qi as malformedLocalOutputsWarning, qn as unsupportedFinalSnapshotError, qo as recordLogOnlyValue, qr as refuseUnreadableCdkCrossAccountRefs, qs as importableOutputKeys, qt as planFailedOps, r as computeImplicitDeleteEdges, ra as malformedRenderedContainersWarning, rc as buildAssetRedirectMap, ri as envCredentialsAreAssumedRole, rl as CFN_TEMPLATE_URL_LIMIT, rn as inheritProducerRegions, rt as createReadOnlyAttributeHealerFactory, s as listNestedTemplateRows, sa as malformedScrubResourceEntriesRefusalMessage, sc as AssetModeResolver, sl as CUSTOM_RESOURCE_RESPONSE_OBJECT_DESCRIPTION, ss as pathCrossesDottedKey, st as green, t as DeployEngine, ta as malformedOutputsRefusalMessage, tc as stringifyValue, ti as applyCallerIdentityCredentials, tl as ssmResolvedValueType, tn as findNestedStackTypeChanges, to as renderStatefulReason, tr as withCreateTokenLedger, ts as scrubResourceRecord, u as conditionFingerprint, ua as refuseDivergentRecordRegionForDestroy, uc as ensureAssetStorage, ui as classifyReplaySecretRegion, ul as PARTITION_TABLE, un as DeploymentEventsReader, us as recordNestedStackParameterExpressions, ut as computeParameterTaint, va as refuseMalformedOutputsForDestroy, vc as buildDockerImage, vi as carriesDynamicReference, vl as hasPlainPrototype, vn as carriedExportAliasExposure, vo as templateResourceTypes, vr as readsNoEchoDeleteValues, vs as recordMaskOnlyValue, vt as displacedPhysicalIdShown, w as deferredServiceTokenWarning, wa as refuseMalformedResourceEntriesForImportSave, wc as finchSecretArgvRefusal, wi as isStalePlaceholderArnAttribute, wl as renderAssemblyPathEscape, wn as collectPublishedOutputNames, wo as DagBuilder, wr as customResourceResponseExpirationWarning, ws as STATE_SOURCED_BASELINE_RULES, wt as revertedNestedRowIds, xa as refuseMalformedResourceEntriesForDeploy, xc as describeDockerExecFailure, xi as keepsSecretReferenceToken, xl as absoluteAssemblyPathEscape, xn as isWholeDynamicReferenceValue, xr as withPrintingSecrets, xs as recordNoEchoParameterFreshValue, xt as nestedChildStackName$1, ya as refuseMalformedResourceAttributesForOrphan, yc as resolveDockerContextDirectory, yi as carriesFetchableDynamicReference, yl as nullPrototypeRecord, yn as exportNameNoEchoParameters, yo as describeTypeWithThrottleRetry, yr as isCustomResourceType$1, ys as recordMaskOnlyValuesIn, yt as dropSettledNestedJournals, za as repairMalformedResourcesForReadOnly, zc as AssetManifestLoader, zi as hasReadableOrphans, zn as ATOMIC_FINAL_SNAPSHOT_TYPES, zo as liveMatchesUnresolvedTokenFrame, zs as isNotImplemented, zt as destroyStackRecordsView } from "./deploy-engine-HKmcD4Kn.js";
6
- import { t as getCdkdVersion } from "./version-n6UXfuUI.js";
3
+ import { $n as isAmbiguousOutcomeError, $t as credentialFingerprint, Bn as withheldTargetClause, D as VALUE_NOT_SHOWN, Dn as TIMEOUT_FLAG_RESOURCE_TYPE, E as assertRegionMatch, En as withErrorHandling, Ft as buildLockContentionMessage, G as runDeleteAttempt, Hn as setPasteableVerbFlags, Ht as CUSTOM_RESOURCE_RESPONSE_PREFIX, In as plainOrDescribed, It as forceQuitRecoveryClause, Jt as setPasteableAwsProfile, Kt as producerCoordinateKey, Ln as quotedOrDescribed, Lt as formatLockExpiry, Nn as isInertUnquoted, Nt as UNREPRODUCIBLE_LOCK_CLAUSE, P as remedyLogicalId, Pn as pasteableCommand, Pt as buildForceUnlockCommand, Qt as clientDefaultsFor, Rn as shellBoundedDisplay, Rt as formatLockOperation, Sn as SynthesisError, T as RESOURCE_NOT_FOUND, Tn as normalizeAwsError, Ut as DEFAULT_STATE_PREFIX, Vn as setPasteableRunFlags, Wt as injectiveKey, Xt as ambientClientDefaults, Yt as withPasteableAwsProfile, Z as isAwsCliLiteral, Zt as ambientCredentialConfig, _n as ResourceTimeoutError, ar as isMarkedNonRetryable, bn as StackTerminationProtectionError, cn as IntrinsicResolutionRefusalError, en as AccountIdUnavailableError, ft as logicalIdShown, gn as ProvisioningError, hn as PartialFailureError, in as CrossAccountSecretRefusalError, it as isInterruptedWaitError, jn as commandHole, kn as SHELL_ACTIVE_WHY, ln as LocalInvokeBuildError$1, mn as NestedStackChildDirectDestroyError, mt as resourceTypeShown, n as RESOLVED_PREVIOUS_PRINCIPAL_KEYS, nn as CdkdError, nr as isTransientServerError, nt as endCommandInterruptScope, on as DeployCancelledError, or as isThrottlingError, pn as MalformedProducerRecordRefusalError, qt as producerRecordKey, rr as retryClassificationText, rt as interruptWatchListenerCount, s as readRecordedPrincipals, sn as DynamicReferenceRegionAmbiguousError, sr as markNonRetryable, t as IAM_PRINCIPAL_NAME, tr as isRetryableTransientError, tt as beginCommandInterruptScope, un as LocalStartServiceError, vn as ResourceUpdateNotSupportedError, xn as StateError, yn as StackHasActiveImportsError, zn as shellQuote, zt as formatLockOwner } from "./iam-policy-targets-Pn2m0R67.js";
4
+ import { a as setAssumedRoleCredentials, n as awsClientDefaults, r as getAssumedRoleCredentials, u as formatAuthority } from "./aws-client-defaults-DBXBcg0J.js";
5
+ import { $a as NO_CC_HANDLERS_REASON, $c as resolveApp, $i as malformedLocalResourceEntriesWarning, $n as ledgerForStack, $o as shareLogOnlyValues, $r as sendableAssumeRoleCommand, $s as hasUnverifiableParameterRefusal, $t as seedsDeleteFirstGuard, A as noEchoComparisonForTemplate, Aa as refuseMalformedResourceEntriesForOrphan, Ac as dockerSpawnEnvWithSensitive, Ai as refStateLookupFromResource, Al as displayAssemblyPath, An as journaledOrphanPrintingBag, Ao as TemplateParser, Ar as deleteIndeterminateGuards, As as wholeStringLeavesOf, At as dropFailedHint, Ba as repairMalformedOrphansForReadOnly, Bc as runDockerForeground, Bi as UNREADABLE_RESOURCES_MAP_ROW, Bn as PRE_DELETE_SNAPSHOT_TYPES, Bs as rebuildClientForBucketRegion, C as recordRetainedForReadoption, Ca as refuseMalformedOutputsForDestroy, Cc as validateContainerRepoName, Ci as carriesDynamicReference, Cl as defineOwnKey, Cn as collectDeclaredOutputNames, Co as templateResourceTypes, Cr as applyCustomResourceResponseExpiration, Cs as carriesSecretMask, D as withResourceDeadline, Da as refuseMalformedResourceEntriesForDestroy, Dc as describeDockerCapturedOutput, Di as AWS_NO_VALUE, Dl as ownValue, Dn as DEFAULT_RESOURCE_TIMEOUT_MS, Ds as recordNoEchoAttributeValues, E as serviceTokenBlockingReason, Ea as refuseMalformedResourceEntriesForDeploy, Ec as resolveDockerContextDirectory, Ei as keepsSecretReferenceToken, El as nullPrototypeRecord, En as bindingSkippedOutputs, Er as slowCcOperationTimeoutMs, Es as recordMaskOnlyValuesIn, Et as collectNestedChildUnaddressed, F as PROTECTION_PROPERTY_BY_TYPE, Fa as refuseMalformedResourcesForDeploy, Fc as isMalformedEnvKey, Fi as declaresNoEcho, Fn as secretNamedRecordNeedles, Fo as maskWholeValue, Fs as WHOLE_DYNAMIC_REFERENCE_PATTERN, Ft as sameJournaledOrphans, Ga as unpreviewableOrphanRecords, Gc as stripForDisplay, Gi as hasReadableOutputs, Gn as isFinalSnapshotError, Go as carryLogOnlyValues, Gr as poisonRenderedSpellingsCollidingIn, Gs as isAccessDenied, Gt as isJournaledOrphan, Ha as repairMalformedResourceEntriesForReadOnly, Hc as warnFinchArgvExposure, Hi as deployRefusesOrphanRowsReason, Hn as ccRoutedFinalSnapshotError, Ho as readsNoEchoSource, Hr as DiffCalculator, Hs as CrossPrefixScanCache, Ht as removeProtectionTypeList, I as isProtectionValueActive, Ia as refuseMalformedResourcesForDestroy, Ic as partitionSensitiveEnv, Ii as JSON_LISTING_HOLE_VALUE, Il as resolveBucketRegion, In as stateSecretNameNeedles, Io as maskedLeafCoordinatesOf, Is as isSingleDynamicReferenceToken, It as replayFailedOperations, Ja as withheldAccountClause, Jc as Synthesizer, Ji as isReadableResourceEntry, Jn as maskingRetryLogger, Jo as literalSplitDelimitersOf, Jr as applyRoleArnIfSet, Js as acceptedCreateOnlyDropsOf, Jt as planRollback, Ka as unreadableOrphanRecords, Kc as AssetManifestLoader, Ki as hasReadableResources, Kn as refusesFinalSnapshot, Ko as createUnionSecretMasker, Kr as producerLookupOver, Ks as isNotImplemented, Kt as isReplacementOrphan, L as perType, La as refuseMalformedResourcesForExport, Lc as redactDockerArgvValues, Li as STATE_REGION_DIVERGED, Ln as storedSecretNameNeedles, Lo as noEchoCoordinatesOf, Ls as LockManager, Lt as replayRollback, M as noEchoParameterNamesOf, Ma as refuseMalformedResourcePropertiesForDrift, Mc as formatDockerLoginError, Mi as withSharedDrainBudget, Ml as resolveAssemblyPath, Mn as orphanRecordsPrintingBag, Mo as isMarkedCoordinate, Mr as deleteSkipReason, Ms as STATE_SOURCED_CROSS_GENERATION_RULES, Mt as journaledOrphanLines, N as recordedProtectionEvidence, Na as refuseMalformedResourcePropertiesForExport, Nc as getDockerCmd, Ni as parameterInputsFor, Nl as injectAwsRegion, Nn as secretNamePrintingBag, No as maskAtCoordinates, Ns as STATE_SOURCED_READBACK_RULES, Nt as loadJournaledOrphans, O as diffSecurity, Oa as refuseMalformedResourceEntriesForImport, Oc as describeDockerExecFailure, Oi as cfnRefValueFromPhysicalId, Ol as absoluteAssemblyPathEscape, On as DEFAULT_RESOURCE_WARN_AFTER_MS, Or as RollbackInlinePolicyWriters, Os as recordNoEchoParameterFreshValue, Ot as withNestedStackContext, P as recordedProtectionNote, Pa as refuseMalformedResourcePropertiesForOrphan, Pc as isDockerClientEnvKey, Pl as injectedAwsRegionValue, Pn as secretNamePrintingBags, Po as maskReadbackAtCoordinates, Pr as isWaitAbandonedError, Ps as TEMPLATE_SOURCED_RULES, Pt as makeForeignHolderScan, Qc as loadCdkJson, Qi as malformedLocalOutputsWarning, Qo as recordLogOnlyValue, Qr as isIamRoleArn, Qs as hasReasonlessBaselineRefusal, Qt as resolveReplacementOldType, R as readProtection, Ra as refuseMalformedState, Rc as redactedCause, Ri as STATE_RESOURCES_MALFORMED, Rn as extractDeploymentEventError, Ro as noEchoLeavesOf, Rs as isLockInfoExpired, S as keptForReadoption, Sa as refuseMalformedOutputs, Sc as validateAssetBucketName, Si as isImpossibleEmptyStoredAttribute, Sl as processStackMessages, Sn as noEchoParameterValueSeed, So as prefetchCreateOnlyPropertyPaths, Sr as CUSTOM_RESOURCE_RESPONSE_LIFECYCLE_RULE_ID, Ss as splitGetAttStringForm, St as recordDisplacedSkips, T as findServiceTokenRefusals, Ta as refuseMalformedResourceEntries, Tc as buildDockerImage, Ti as isNamelessDynamicReferenceError, Tl as hasPlainPrototype, Tn as isExportAliasCollision, To as withRetry, Tr as CloudControlProvider, Ts as recordMaskOnlyValue, Tt as withNestedRevertRun, Ua as repairMalformedResourcePropertiesForReadOnly, Uc as escapeRegExp, Ui as displayLogicalId, Un as createPreDeleteFinalSnapshot, Uo as valueAtCoordinate, Ur as INTRINSIC_KEYS, Us as applyCrossPrefixScan, Ut as recordAfterRollbackUpdate, Va as repairMalformedOutputsForReadOnly, Vc as runDockerStreaming, Vi as accountArgs, Vn as buildFinalSnapshotIdentifier, Vo as readbackPathFor, Vs as CrossPrefixReadError, Vt as withStackRecords, Wa as repairMalformedResourcesForReadOnly, Wc as stripControlChars, Wi as hasReadableOrphans, Wn as effectiveDeletionPolicy, Wo as liveMatchesUnresolvedTokenFrame, Wr as IntrinsicFunctionResolver, Ws as crossPrefixDeniedWarning, Wt as demoteSupersededOrphans, Xc as getDefaultStateBucketName, Xi as malformedExportNamesWarning, Xn as findDestructiveChanges, Xo as printingCorpusOf, Xr as assertSendableRoleArn, Xs as exportNamesCarriedFrom, Xt as recordUnderIdIsNotOwn, Ya as findActionableSilentDrops, Yc as synthesisStatusMessage, Yi as malformedDriftResourcePropertiesWarning, Yn as constructPathOf, Yo as logOnlyValueCount, Yr as assertFlagRoleArn, Ys as describeRegionValueKind, Yt as recheckFailedPlan, Za as unwrittenCreateOnlyReplacement, Zc as getLegacyStateBucketName, Zi as malformedExportSourceWarning, Zn as formatDestructiveChange, Zo as recordLogOnlyParameterValue, Zr as explicitRoleArnOrThrow, Zs as hasReadableExportSet, Zt as replacementNeverSwapped, _ as makeCanonicalizePropertiesFn, _a as refuseMalformedOrphanRecords, _c as ensureAssetStorage, _i as regionLessSecretName, _l as PARTITION_TABLE, _n as secretSafeKeyDisplay, _r as TemplateNoEchoReresolver, _s as recordNestedStackParameterExpressions, _t as displacedOpClause, a as findNestedTemplateTreeDefect, aa as malformedOrphansWarning, ac as shouldRetainResource, ai as keepHeldTokenProvenance, al as resolveUseCdkBootstrapAssets, ao as isStatefulRecreateTargetSync, at as cyan, ba as refuseMalformedOrphansForDestroy, bc as parseBootstrapMarker, bi as parameterTypeMayLoseSecretIdentity, bl as AssemblyReader, bn as exportNameSecretExposure, c as renderNestedTemplateTreeDefect, ca as malformedRenderedContainersWarning, cc as stringifyValue, ci as recordedReferenceRegions, cl as ssmResolvedValueType, cn as updatePartialMessage, cs as scrubResourceRecord, ct as red, d as conditionInputsFrom, da as malformedResourcesWarning, dc as createAssetRedirectResolver, dl as MIGRATE_TMP_PREFIX, dn as DeploymentEventsStore, ds as DYNAMIC_REFERENCE_TOKEN_SCAN, dt as namesAnyDeclaredParameter, ea as malformedLocalResourcesWarning, ec as importableOutputKeys, ei as AWS_CREDENTIAL_ENV_KEYS, el as resolveAutoAssetStorage, en as orphanDeleteNeedsIdentity, eo as hasNoCloudControlHandlers, es as createSecretMasker, f as parentSuppliedValues, fa as malformedScrubResourceEntriesRefusalMessage, fc as loadPublishableAssetManifest, fl as findLargeInlineResources, fn as WITHHELD_NAME_DISPLAY, fr as CC_BROKEN_REASON, fs as dynamicReferenceTokens, ft as reachableDivergentParameters, g as mergeNoChangeOutputs, gc as assertAssetBucketRegion, gi as producerRegionsFromState, gl as expectedOwnerParam, gn as secretBearingStateKeyWarning, gr as wouldReturnToSdkProvider, gs as inheritNestedStackParameterAssociations, gt as NESTED_PENDING_PARENT_REASON, h as keptWholeReasonText, ha as refuseDivergentRecordRegionForDestroy, hc as BOOTSTRAP_MARKER_PREFIX, hi as classifyReplaySecretRegion, hl as decodeListingKey, hn as secretBearing, hr as isCustomResource, hs as identityKeyFor, ht as planOrphanAdoption, i as childTemplateLoader, ia as malformedOrphansRefusalMessage, ic as orphansCarriedFrom, il as resolveStateBucketWithDefaultAndSource, io as isStatefulRecreateTargetForReplace, is as markSameGenerationBag, it as bold, j as noEchoExactEchoLeavesOf, ja as refuseMalformedResourcePropertiesForDestroy, jc as finchSecretArgvRefusal, jl as renderAssemblyPathEscape, jn as maskEventTextWithBoundBags, jo as canonicalCoordinates, jr as deleteLeftInPlace, js as STATE_SOURCED_BASELINE_RULES, jt as isHandledOrphan, k as noEchoAttributeNamesOf, ka as refuseMalformedResourceEntriesForImportSave, kc as describeDockerFailure, ki as isStalePlaceholderArnAttribute, kl as describeFileReadFailure, kn as completedReplayEntries, ko as DagBuilder, kr as UNSPECIFIED_SKIP_REASON, ks as recordProvenPublicExpression, kt as deleteJournaledOrphans, l as templateIdentity, la as malformedResourceEntriesWarning, lc as WorkGraph, ll as CFN_TEMPLATE_BODY_LIMIT, ln as updatePartialReason, ls as withPhysicalNameCopies, lt as yellow, m as isSecretBearingReferenceString, ma as previewableOrphanRecords, mc as AssetModeResolver, mi as classifyRecordedSecretRegion, ml as CUSTOM_RESOURCE_RESPONSE_OBJECT_DESCRIPTION, mn as exportAliasCollisionScrubWarning, mr as ccBrokenReason, ms as pathCrossesDottedKey, mt as makeSiblingClaimReader, n as IMPLICIT_DELETE_DEPENDENCIES, na as malformedOrphanRecordsWarning, nc as isReadableBag, ni as callerEnvCredentials, nl as resolveSkipPrefix, no as shownType, ns as maskSecretsInError, nt as formatResourceLine, o as isAbsoluteAssetPath, oa as malformedOutputsRefusalMessage, oc as AssetPublisher, ol as stateBucketExistenceConfirmed, oo as renderStatefulReason, ot as gray, p as readRecordedConditionVerdicts, pa as malformedStateRefusalMessage, pc as rewriteTemplateAssetReferences, pl as uploadCfnTemplate, pn as displayTextOrWithheld, pr as ProviderRegistry, ps as isUncertifiedBaselineMaskPosition, pt as resourcesNamingDeclaredParameter, qa as unreadableResourceEntries, qc as getDockerImageBySourceHash, qi as isReadableOrphanRecord, qn as unsupportedFinalSnapshotError, qo as hasMaskableValues, qr as refuseUnreadableCdkCrossAccountRefs, qs as splitImportedOps, qt as planFailedOps, r as computeImplicitDeleteEdges, ra as malformedOrphanRowsKeptWarning, rc as orphansAfterRollback, ri as envCredentialsAreAssumedRole, rl as resolveStateBucketWithDefault, rn as inheritProducerRegions, ro as MULTI_REGION_RECREATE_BLOCKED_TYPES, rs as maskSecretsInText, rt as createReadOnlyAttributeHealerFactory, s as listNestedTemplateRows, sa as malformedOutputsWarning, sc as isSensitiveAttributeName, si as recordedOutputReferenceRegions, sl as warnDeprecatedNoPrefixCliFlag, ss as redactSecretsForState, st as green, t as DeployEngine, ta as malformedOrphanRecordsRefusalMessage, tc as importableOutputs, ti as applyCallerIdentityCredentials, tl as resolveCaptureObservedState, tn as findNestedStackTypeChanges, to as findReplacedReadersOfRecreateTargets, tr as withCreateTokenLedger, ts as errorCauseChain, u as conditionFingerprint, ua as malformedResourcePropertiesWarning, uc as buildAssetRedirectMap, ul as CFN_TEMPLATE_URL_LIMIT, un as DeploymentEventsReader, ut as computeParameterTaint, va as refuseMalformedOrphanRecordsForDestroy, vc as getBootstrapMarkerKey, vi as coerceParameterTypedValue, vl as canonicalizeRegion, vn as carriedExportAliasExposure, vr as readsNoEchoDeleteValues, vt as displacedPhysicalIdShown, w as deferredServiceTokenWarning, wa as refuseMalformedResourceAttributesForOrphan, wc as buildDenyExternalAccessPolicy, wi as carriesFetchableDynamicReference, wl as hasOwnKey, wn as collectPublishedOutputNames, wo as describeTypeWithThrottleRetry, wr as customResourceResponseExpirationWarning, ws as provenPublicValue, wt as revertedNestedRowIds, xa as refuseMalformedOrphansForOrphan, xc as readBootstrapMarkerBody, xi as getAccountInfo, xl as StageLoadError, xn as isWholeDynamicReferenceValue, xr as withPrintingSecrets, xs as recordPhysicalNameCopy, xt as nestedChildStackName$1, ya as refuseMalformedOrphans, yc as isCrossRegionRedirect, yi as isUnboundTemplateParameter, yl as derivePartitionAndUrlSuffix, yn as exportNameNoEchoParameters, yr as isCustomResourceType$1, ys as physicalNameCopiesOf, yt as dropSettledNestedJournals, za as repairMalformedOrphanRecordsForReadOnly, zc as redactedDockerCause, zi as UNREADABLE_ORPHANS_CONTAINER_ROW, zn as ATOMIC_FINAL_SNAPSHOT_TYPES, zo as noEchoOutputsComparison, zs as S3StateBackend, zt as destroyStackRecordsView } from "./deploy-engine-CZUhJ1IZ.js";
6
+ import { t as getCdkdVersion } from "./version-DMqEiJIt.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";
@@ -2561,7 +2561,7 @@ function collectCrossStackRefs(node, onRef, unconditional) {
2561
2561
  //#region src/provisioning/register-providers.ts
2562
2562
  let providerClasses;
2563
2563
  function loadProviderClasses() {
2564
- providerClasses ??= import("./provider-classes--iMwAb7q.js");
2564
+ providerClasses ??= import("./provider-classes-Xrt4DIC7.js");
2565
2565
  return providerClasses;
2566
2566
  }
2567
2567
  function registerAllProviders(registry, classes) {
@@ -3386,7 +3386,7 @@ Force-quit: stack locks may not be released. If the next run reports a lock, run
3386
3386
  const syncValidation = validateRecreateTargets({
3387
3387
  template: stackInfo.template,
3388
3388
  state: stateForRecreateCheck?.state ?? {
3389
- version: 11,
3389
+ version: 12,
3390
3390
  stackName: stackInfo.stackName,
3391
3391
  region: stackRegion,
3392
3392
  resources: {},
@@ -3421,7 +3421,7 @@ Force-quit: stack locks may not be released. If the next run reports a lock, run
3421
3421
  const replacedReaders = await findReplacedReadersOfRecreateTargets({
3422
3422
  template: stackInfo.template,
3423
3423
  state: stateForRecreateCheck?.state ?? {
3424
- version: 11,
3424
+ version: 12,
3425
3425
  stackName: stackInfo.stackName,
3426
3426
  region: stackRegion,
3427
3427
  resources: {},
@@ -4238,10 +4238,10 @@ async function drainTemplateUploads(cleanups, stateBucket, labels) {
4238
4238
  logger.warn(`Failed to delete ${labels.what} from '${stateBucket}'${labels.when ? ` ${labels.when}` : ""}. Clean up manually under prefix '${MIGRATE_TMP_PREFIX}/'. Cause: ${msg}`);
4239
4239
  }
4240
4240
  }
4241
- async function retireCloudFormationStack(options) {
4241
+ async function prepareCloudFormationStackRetirement(options) {
4242
4242
  const logger = getLogger();
4243
4243
  const { cfnStackName, cfnClient, yes, stateBucket, s3ClientOpts, resourceTree } = options;
4244
- if (resourceTree && resourceTree.stackName !== cfnStackName) throw new Error(`retireCloudFormationStack: caller-supplied resourceTree.stackName='${resourceTree.stackName}' does not match cfnStackName='${cfnStackName}'. The tree's root must be the stack being retired.`);
4244
+ if (resourceTree && resourceTree.stackName !== cfnStackName) throw new Error(`prepareCloudFormationStackRetirement: caller-supplied resourceTree.stackName='${resourceTree.stackName}' does not match cfnStackName='${cfnStackName}'. The tree's root must be the stack being retired.`);
4245
4245
  logger.info(`[1/4] Inspecting CloudFormation stack '${cfnStackName}'...`);
4246
4246
  const stack = (await cfnClient.send(new DescribeStacksCommand({ StackName: cfnStackName }))).Stacks?.[0];
4247
4247
  if (!stack) throw new Error(`CloudFormation stack '${cfnStackName}' not found.`);
@@ -4281,7 +4281,7 @@ async function retireCloudFormationStack(options) {
4281
4281
  if (!yes) {
4282
4282
  let proceed = false;
4283
4283
  try {
4284
- proceed = await confirmPrompt$6(`Set DeletionPolicy=Retain and UpdateReplacePolicy=Retain on every resource in CloudFormation stack '${cfnStackName}', then delete the stack? AWS resources will NOT be deleted (cdkd state has been written).`);
4284
+ proceed = await confirmPrompt$6(`Set DeletionPolicy=Retain and UpdateReplacePolicy=Retain on every resource in CloudFormation stack '${cfnStackName}', and delete the stack once cdkd state is written? AWS resources will NOT be deleted.`);
4285
4285
  } finally {
4286
4286
  if (!proceed) await drainTemplateUploads(nestedCleanups, stateBucket, {
4287
4287
  what: "temporary nested-template upload",
@@ -4289,16 +4289,17 @@ async function retireCloudFormationStack(options) {
4289
4289
  });
4290
4290
  }
4291
4291
  if (!proceed) {
4292
- logger.info("CloudFormation stack retirement cancelled. cdkd state is unaffected.");
4292
+ logger.info("CloudFormation stack retirement cancelled. The stack is unchanged and will not be deleted.");
4293
4293
  return { outcome: "cancelled" };
4294
4294
  }
4295
4295
  }
4296
+ let templateUpdated = false;
4296
4297
  if (!modified) {
4297
4298
  logger.info(`[2/4] Template already has Retain on every resource — skipping UpdateStack.`);
4298
4299
  await drainTemplateUploads(nestedCleanups, stateBucket, { what: "temporary nested-template upload" });
4299
4300
  } else {
4300
4301
  logger.info(`[2/4] Injected DeletionPolicy=Retain and UpdateReplacePolicy=Retain.`);
4301
- if (newBody.length > TEMPLATE_URL_LIMIT) throw new Error(`Modified template is ${newBody.length} bytes, exceeds the CloudFormation UpdateStack TemplateURL limit (${TEMPLATE_URL_LIMIT}). cdkd state has already been written; retire the stack manually with (1) shrink the template, then (2) UpdateStack with Retain policies, (3) DeleteStack — or split the stack and retry.`);
4302
+ if (newBody.length > TEMPLATE_URL_LIMIT) throw new Error(`Modified template is ${newBody.length} bytes, exceeds the CloudFormation UpdateStack TemplateURL limit (${TEMPLATE_URL_LIMIT}). cdkd state has not been written; shrink or split the template and retry. ` + MANUAL_RETIREMENT_ROUTE);
4302
4303
  let updateInput;
4303
4304
  let s3Cleanup;
4304
4305
  if (newBody.length <= TEMPLATE_BODY_LIMIT) updateInput = { TemplateBody: newBody };
@@ -4331,29 +4332,100 @@ async function retireCloudFormationStack(options) {
4331
4332
  updateRan = true;
4332
4333
  } catch (err) {
4333
4334
  const msg = describeAwsFailure(err).detail;
4334
- if (/No updates are to be performed/i.test(msg)) logger.info(` CloudFormation reports no updates needed — proceeding to delete.`);
4335
- else throw err;
4335
+ if (/No updates are to be performed/i.test(msg)) logger.info(` CloudFormation reports no updates needed.`);
4336
+ else throw new RetainUpdateFailedError(cfnStackName, "rejected", err);
4337
+ }
4338
+ if (updateRan) {
4339
+ try {
4340
+ await waitUntilStackUpdateComplete({
4341
+ client: cfnClient,
4342
+ maxWaitTime: 1800,
4343
+ minDelay: 5,
4344
+ maxDelay: 10
4345
+ }, { StackName: cfnStackName });
4346
+ } catch (err) {
4347
+ throw new RetainUpdateFailedError(cfnStackName, "unfinished", err);
4348
+ }
4349
+ templateUpdated = true;
4336
4350
  }
4337
- if (updateRan) await waitUntilStackUpdateComplete({
4338
- client: cfnClient,
4339
- maxWaitTime: 1800,
4340
- minDelay: 5,
4341
- maxDelay: 10
4342
- }, { StackName: cfnStackName });
4343
4351
  } finally {
4344
4352
  await drainTemplateUploads([...s3Cleanup ? [s3Cleanup] : [], ...nestedCleanups], stateBucket, { what: "temporary template upload" });
4345
4353
  }
4346
4354
  }
4355
+ return {
4356
+ outcome: "ready",
4357
+ templateUpdated
4358
+ };
4359
+ }
4360
+ const SUPERSEDED_COPY_HINT = "If that update completes (now or later), CloudFormation may have replaced resources; each superseded copy is RETAINED and managed by neither CloudFormation nor cdkd. Find them in the stack's events: rows whose reason reads \"Requested update requires the creation of a new physical resource\" name the old physical id. A re-run does not report them, because the template then already carries the Retain policies and no update runs.";
4361
+ const MANUAL_RETIREMENT_ROUTE = "To retire the stack by hand: (1) UpdateStack with DeletionPolicy=Retain and UpdateReplacePolicy=Retain on every resource, (2) `cdkd import` without --migrate-from-cloudformation (it reads the physical ids from a same-named CloudFormation stack), (3) DeleteStack. The import must adopt every resource before you delete the stack: check its summary.";
4362
+ function describeStackWaiterFailure(error) {
4363
+ if (!(error instanceof Error)) return void 0;
4364
+ let parsed;
4365
+ try {
4366
+ parsed = JSON.parse(error.message);
4367
+ } catch {
4368
+ return;
4369
+ }
4370
+ if (typeof parsed !== "object" || parsed === null || !("state" in parsed)) return void 0;
4371
+ const result = parsed;
4372
+ const state = typeof result.state === "string" ? result.state : "FAILURE";
4373
+ const reason = result.reason;
4374
+ const stacks = typeof reason === "object" && reason !== null && "Stacks" in reason ? reason.Stacks : void 0;
4375
+ const stack = Array.isArray(stacks) && typeof stacks[0] === "object" ? stacks[0] : void 0;
4376
+ const status = typeof stack?.StackStatus === "string" ? stack.StackStatus : void 0;
4377
+ const statusReason = typeof stack?.StackStatusReason === "string" ? stack.StackStatusReason : void 0;
4378
+ return `waiter ${state}` + (status ? `, stack status ${status}` : typeof reason === "string" ? `: ${reason}` : "") + (statusReason ? ` (${statusReason})` : "");
4379
+ }
4380
+ function cfnFailureText(error) {
4381
+ const waiter = describeStackWaiterFailure(error);
4382
+ if (waiter !== void 0 && error instanceof Error) {
4383
+ try {
4384
+ Object.defineProperty(error, "message", {
4385
+ value: waiter,
4386
+ writable: true,
4387
+ configurable: true,
4388
+ enumerable: false
4389
+ });
4390
+ Object.defineProperty(error, "stack", {
4391
+ value: `${error.name}: ${waiter}`,
4392
+ writable: true,
4393
+ configurable: true,
4394
+ enumerable: false
4395
+ });
4396
+ } catch {}
4397
+ return waiter;
4398
+ }
4399
+ const failure = describeAwsFailure(error);
4400
+ if (failure.redacted) getLogger().debug(safeMsg`CloudFormation failure detail: ${failure.detail}`);
4401
+ return failure.summary.replace(/\.+$/, "");
4402
+ }
4403
+ var RetainUpdateFailedError = class extends Error {
4404
+ cause;
4405
+ constructor(cfnStackName, kind, cause) {
4406
+ const text = cfnFailureText(cause);
4407
+ super(safeMsg`The Retain-policy UpdateStack on CloudFormation stack ${displaySafe(cfnStackName)} ` + (kind === "rejected" ? "was rejected" : "did not complete") + safeMsg`: ${text}. cdkd state has not been written. ` + (kind === "unfinished" ? `${SUPERSEDED_COPY_HINT} ` : "") + "Re-run the same command once the cause is fixed. When the cause is a replacement CloudFormation cannot perform (a custom-named resource whose update requires replacing it), the same update by hand fails too: give that resource no custom name or a new one, or take it out of the stack, then re-run. To retire the stack by hand: (1) UpdateStack with DeletionPolicy=Retain and UpdateReplacePolicy=Retain on every resource, (2) `cdkd import` without --migrate-from-cloudformation (it reads the physical ids from a same-named CloudFormation stack), (3) DeleteStack. The import must adopt every resource before you delete the stack: check its summary.");
4408
+ this.name = "RetainUpdateFailedError";
4409
+ this.cause = cause;
4410
+ }
4411
+ };
4412
+ async function deleteRetiredCloudFormationStack(cfnStackName, cfnClient) {
4413
+ const logger = getLogger();
4347
4414
  logger.info(`[4/4] Deleting CloudFormation stack '${cfnStackName}' (resources retained)...`);
4348
- await cfnClient.send(new DeleteStackCommand({ StackName: cfnStackName }));
4349
- await waitUntilStackDeleteComplete({
4350
- client: cfnClient,
4351
- maxWaitTime: 1800,
4352
- minDelay: 5,
4353
- maxDelay: 10
4354
- }, { StackName: cfnStackName });
4415
+ try {
4416
+ await cfnClient.send(new DeleteStackCommand({ StackName: cfnStackName }));
4417
+ await waitUntilStackDeleteComplete({
4418
+ client: cfnClient,
4419
+ maxWaitTime: 1800,
4420
+ minDelay: 5,
4421
+ maxDelay: 10
4422
+ }, { StackName: cfnStackName });
4423
+ } catch (err) {
4424
+ const error = /* @__PURE__ */ new Error(safeMsg`CloudFormation stack ${displaySafe(cfnStackName)} was NOT confirmed deleted: ` + safeMsg`${cfnFailureText(err)}. cdkd state is written and correct, and every resource ` + "carries DeletionPolicy=Retain, so deleting the stack deletes no resource. Delete the stack by hand once its cause is resolved (for example an export another stack still imports).");
4425
+ error.cause = err;
4426
+ throw error;
4427
+ }
4355
4428
  logger.info(`✓ CloudFormation stack '${cfnStackName}' retired. AWS resources are now solely managed by cdkd.`);
4356
- return { outcome: modified ? "retired" : "no-template-change" };
4357
4429
  }
4358
4430
  async function uploadTemplateForUpdateStack(args) {
4359
4431
  return uploadCfnTemplate({
@@ -4457,7 +4529,7 @@ async function injectRetainPoliciesRecursiveInternal(templateBody, cfnStackName,
4457
4529
  if (!childTpl.TemplateBody) throw new Error(`GetTemplate returned no body for nested stack '${logicalId}' (physicalId='${childNode.physicalId}', parent='${cfnStackName}').`);
4458
4530
  const childResult = await injectRetainPoliciesRecursiveInternal(childTpl.TemplateBody, childNode.stackName, childNode, deps, cleanups);
4459
4531
  if (childResult.modified) {
4460
- if (childResult.body.length > TEMPLATE_URL_LIMIT) throw new Error(`Modified nested-stack template for '${logicalId}' is ${childResult.body.length} bytes, exceeds the CloudFormation TemplateURL limit (${TEMPLATE_URL_LIMIT}). cdkd state has already been written for the root parent; retire the stack manually with (1) shrink the child template, then (2) UpdateStack with Retain policies on the parent and each child, (3) DeleteStack on the parent.`);
4532
+ if (childResult.body.length > TEMPLATE_URL_LIMIT) throw new Error(`Modified nested-stack template for '${logicalId}' is ${childResult.body.length} bytes, exceeds the CloudFormation TemplateURL limit (${TEMPLATE_URL_LIMIT}). cdkd state has not been written; shrink the child template and retry, or retire the stack manually: (1) UpdateStack with Retain policies on the parent and each child, (2) cdkd import, (3) DeleteStack on the parent.`);
4461
4533
  const uploaded = await uploadCfnTemplate({
4462
4534
  bucket: deps.stateBucket,
4463
4535
  body: childResult.body,
@@ -4507,8 +4579,25 @@ async function walkCfnStackTree(stackName, physicalId, cfnClient) {
4507
4579
  nested
4508
4580
  };
4509
4581
  }
4582
+ function findReplacedCfnResources(before, after, nestedPath = []) {
4583
+ const replaced = [];
4584
+ for (const [logicalId, beforeId] of before.resources) {
4585
+ const afterId = after.resources.get(logicalId);
4586
+ if (afterId !== void 0 && afterId !== beforeId) replaced.push({
4587
+ nestedPath,
4588
+ logicalId,
4589
+ before: beforeId,
4590
+ after: afterId
4591
+ });
4592
+ }
4593
+ for (const [childLogicalId, beforeChild] of before.nested) {
4594
+ const afterChild = after.nested.get(childLogicalId);
4595
+ if (afterChild) replaced.push(...findReplacedCfnResources(beforeChild, afterChild, [...nestedPath, childLogicalId]));
4596
+ }
4597
+ return replaced;
4598
+ }
4510
4599
  async function confirmPrompt$6(prompt) {
4511
- return confirmOrRefuse(prompt, { refusal: "The CloudFormation stack retirement confirmation prompt cannot run in a non-interactive environment. Pass -y / --yes on cdkd import --migrate-from-cloudformation. Alternatively, run it from a real terminal. NOTE cdkd state has already been written: the resources are recorded in cdkd state while the CloudFormation stack is still live, so re-run with -y / --yes (or retire the stack by hand) to finish the migration." });
4600
+ return confirmOrRefuse(prompt, { refusal: "The CloudFormation stack retirement confirmation prompt cannot run in a non-interactive environment. Pass -y / --yes on cdkd import --migrate-from-cloudformation. Alternatively, run it from a real terminal. Nothing has been written yet: cdkd state and the CloudFormation stack are unchanged, so re-running with -y / --yes is the whole recovery." });
4512
4601
  }
4513
4602
  async function tryGetCloudFormationResourceMap(stackName, cfnClient) {
4514
4603
  const logger = getLogger();
@@ -4707,7 +4796,7 @@ async function loadStateOrEmpty(stackName, region, stateBackend, refusalRecovery
4707
4796
  region,
4708
4797
  resources: {},
4709
4798
  outputs: {},
4710
- version: 11,
4799
+ version: 12,
4711
4800
  lastModified: Date.now()
4712
4801
  },
4713
4802
  unreadable: [],
@@ -6994,12 +7083,15 @@ var ScrubResolvers = class {
6994
7083
  this.pinned.set(target, scoped);
6995
7084
  return scoped;
6996
7085
  }
7086
+ forRecordedRegion(region) {
7087
+ return this.primary.resolverForRecordedRegion(region);
7088
+ }
6997
7089
  };
6998
7090
  function regionAmbiguousScrubSecretError(origin, stackName, secretName, foreignProducerRegions, stackRegion, secrets) {
6999
7091
  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");
7000
7092
  }
7001
- function unresolvableForeignScrubSecretError(origin, stackName, secretName, region, cause, secrets) {
7002
- 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");
7093
+ function unresolvableForeignScrubSecretError(origin, stackName, secretName, region, cause, secrets, recorded = false) {
7094
+ return new ScrubRefusalError(`Scrub of ${displayStackName(stackName)} could not resolve the secret reference ${maskedIdent(secretName, secrets)} in ${origin} in ${recorded ? "the region its state record names" : "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");
7003
7095
  }
7004
7096
  const DYNAMIC_REFERENCE_OPENING = "{{resolve:";
7005
7097
  const SECRET_REFERENCE_OPENINGS = [
@@ -7023,7 +7115,16 @@ async function resolveForeignRegionTokens(leaf, stackName, ctx) {
7023
7115
  const shownStackName = displayStackName(stackName);
7024
7116
  const tokens = dynamicReferenceTokens(leaf);
7025
7117
  if (isAssembledSecretReference(leaf, tokens.filter(isSecretReferenceToken))) return leaf;
7026
- const verdicts = tokens.map((token) => [token, classifyReplaySecretRegion(token, ctx.stackRegion, ctx.producerRegions)]);
7118
+ const verdicts = tokens.map((token) => {
7119
+ const verdict = classifyReplaySecretRegion(token, ctx.stackRegion, ctx.producerRegions);
7120
+ const recorded = regionLessSecretName(token) === void 0 ? void 0 : ctx.recordedRegions?.get(token);
7121
+ return [token, !(recorded !== void 0 && (canonicalizeRegion(recorded) !== canonicalizeRegion(ctx.stackRegion) || verdict.kind === "ambiguous")) ? verdict : {
7122
+ kind: "named-region",
7123
+ secretName: regionLessSecretName(token),
7124
+ region: recorded,
7125
+ recorded: true
7126
+ }];
7127
+ });
7027
7128
  for (const [, verdict] of verdicts) if (verdict.kind === "ambiguous") throw regionAmbiguousScrubSecretError(ctx.origin, stackName, verdict.secretName, verdict.foreignProducerRegions, ctx.stackRegion, ctx.recordedSecretValues);
7028
7129
  if (!verdicts.some(([, verdict]) => verdict.kind === "named-region")) return leaf;
7029
7130
  const localTokens = [];
@@ -7034,7 +7135,7 @@ async function resolveForeignRegionTokens(leaf, stackName, ctx) {
7034
7135
  if (at < 0) throw new ScrubRefusalError(`Scrub of ${shownStackName} could not locate a scanned dynamic reference in ${ctx.origin}, in the value it was scanned from. Refusing rather than resolving it in ${displayIdent(ctx.stackRegion)}, which would be the wrong region for a reference that names another one. This is an internal invariant failure — please report it with the resource type and property path.`, "SCRUB_SECRET_TOKEN_SCAN_MISMATCH");
7035
7136
  out += leaf.slice(cursor, at);
7036
7137
  if (verdict.kind === "named-region") {
7037
- const resolver = ctx.resolvers.forRegion(verdict.region);
7138
+ const resolver = "recorded" in verdict ? ctx.resolvers.forRecordedRegion(verdict.region) : ctx.resolvers.forRegion(verdict.region);
7038
7139
  try {
7039
7140
  out += await resolver.resolveDynamicReferences(token, {
7040
7141
  template: { Resources: {} },
@@ -7042,7 +7143,7 @@ async function resolveForeignRegionTokens(leaf, stackName, ctx) {
7042
7143
  recordedSecretValues: ctx.recordedSecretValues
7043
7144
  });
7044
7145
  } catch (err) {
7045
- throw unresolvableForeignScrubSecretError(ctx.origin, stackName, verdict.secretName, verdict.region, err, ctx.recordedSecretValues);
7146
+ throw unresolvableForeignScrubSecretError(ctx.origin, stackName, verdict.secretName, verdict.region, err, ctx.recordedSecretValues, "recorded" in verdict);
7046
7147
  }
7047
7148
  } else {
7048
7149
  out += token;
@@ -7955,7 +8056,8 @@ async function scrubStack(stack, region, stateBackend, lockManager, opts) {
7955
8056
  producerRegions,
7956
8057
  resolvers,
7957
8058
  recordedSecretValues,
7958
- origin: `resource ${maskedIdent(logicalId, recordedSecretValues)}`
8059
+ origin: `resource ${maskedIdent(logicalId, recordedSecretValues)}`,
8060
+ recordedRegions: recordedReferenceRegions(state.resources?.[logicalId])
7959
8061
  });
7960
8062
  const resourceContext = resolverContext(recordedSecretValues);
7961
8063
  await resolveCrossStackReads(resolveInput, resourceContext, crossStackReadOrigin("resource", "logical id", logicalId, recordedSecretValues));
@@ -8012,7 +8114,8 @@ async function scrubStack(stack, region, stateBackend, lockManager, opts) {
8012
8114
  producerRegions,
8013
8115
  resolvers,
8014
8116
  recordedSecretValues,
8015
- origin: `orphan record ${maskedIdent(record.logicalId, recordedSecretValues)}`
8117
+ origin: `orphan record ${maskedIdent(record.logicalId, recordedSecretValues)}`,
8118
+ recordedRegions: recordedReferenceRegions(record.state)
8016
8119
  });
8017
8120
  const orphanContext = resolverContext(recordedSecretValues);
8018
8121
  for (const [bagName, bagValue] of Object.entries(resolveInput)) {
@@ -8096,7 +8199,8 @@ async function scrubStack(stack, region, stateBackend, lockManager, opts) {
8096
8199
  producerRegions,
8097
8200
  resolvers,
8098
8201
  recordedSecretValues: outputSecrets,
8099
- origin: `output ${maskedIdent(name, outputSecrets)}`
8202
+ origin: `output ${maskedIdent(name, outputSecrets)}`,
8203
+ recordedRegions: recordedOutputReferenceRegions(state, name)
8100
8204
  });
8101
8205
  const valueContext = resolverContext(outputSecrets);
8102
8206
  await resolveCrossStackReads(valueSource, valueContext, crossStackReadOrigin("output", "output name", name, outputSecrets), { canRefuse: !isOutputSuppressed(name, output, conditions, state.outputs ?? {}) });
@@ -8238,7 +8342,8 @@ async function scrubStack(stack, region, stateBackend, lockManager, opts) {
8238
8342
  const scrubbed = secrets || templateProps ? scrubResourceRecord(positioned, ownSecrets, void 0, STATE_SOURCED_CROSS_GENERATION_RULES) : record;
8239
8343
  const plan = noEchoPlans.byLogicalId.get(logicalId);
8240
8344
  const migrationNeedles = scrubMigrationNeedles(plan, noEchoPublicTokens);
8241
- const written = applyScrubNoEcho(migrationNeedles === void 0 ? scrubbed : scrubResourceRecord(scrubbed, migrationNeedles, void 0, STATE_SOURCED_CROSS_GENERATION_RULES), record, plan);
8345
+ const migrated = migrationNeedles === void 0 ? scrubbed : scrubResourceRecord(scrubbed, migrationNeedles, void 0, STATE_SOURCED_CROSS_GENERATION_RULES);
8346
+ const written = keepHeldTokenProvenance(applyScrubNoEcho(migrated, record, plan));
8242
8347
  if (JSON.stringify(written) !== JSON.stringify(record)) recordsChanged++;
8243
8348
  newResources[logicalId] = written;
8244
8349
  }
@@ -8247,7 +8352,7 @@ async function scrubStack(stack, region, stateBackend, lockManager, opts) {
8247
8352
  const needles = new Map(allRecordedSecrets(outputSecrets, perResourceSecrets, orphanSecrets));
8248
8353
  for (const [plaintext, expression] of own ?? []) needles.set(plaintext, expression);
8249
8354
  if (needles.size === 0) return record;
8250
- const scrubbed = scrubResourceRecord(record.state, needles, void 0, STATE_SOURCED_CROSS_GENERATION_RULES);
8355
+ const scrubbed = keepHeldTokenProvenance(scrubResourceRecord(record.state, needles, void 0, STATE_SOURCED_CROSS_GENERATION_RULES));
8251
8356
  if (JSON.stringify(scrubbed) === JSON.stringify(record.state)) return record;
8252
8357
  recordsChanged++;
8253
8358
  return {
@@ -9551,6 +9656,9 @@ var DriftSecretResolvers = class {
9551
9656
  this.pinned.set(target, scoped);
9552
9657
  return scoped;
9553
9658
  }
9659
+ forRecordedRegion(region) {
9660
+ return this.primary.resolverForRecordedRegion(region);
9661
+ }
9554
9662
  };
9555
9663
  var DriftSecretRefusalError = class DriftSecretRefusalError extends CdkdError {
9556
9664
  driftSecretRefusal = true;
@@ -9602,9 +9710,10 @@ function regionAmbiguousDriftSecretError(logicalId, propertyPath, secretName, fo
9602
9710
  const where = propertyPath === "" ? "" : ` property '${propertyPath}'`;
9603
9711
  return new DriftSecretRefusalError(`${logicalId}${where}: the secret reference '${secretName}' carries no region of its own, and this stack read across a region boundary (producer region(s) on record: ${foreignProducerRegions.join(", ")}), so it may have been resolved in one of those rather than in '${consumerRegion}'. A secret of the same name in two regions is two independent values, so cdkd would compare against — and with --revert WRITE — the WRONG secret. Refusing instead. Spell the reference as a full ARN, which names its region and is resolved there, then re-run 'cdkd drift'.`, "DRIFT_SECRET_REGION_AMBIGUOUS");
9604
9712
  }
9605
- function refuseUnprovenDriftSecret(leaf, propertyPath, logicalId, consumerRegion, evidence) {
9713
+ function refuseUnprovenDriftSecret(leaf, propertyPath, logicalId, consumerRegion, evidence, recordedRegions) {
9606
9714
  if (evidence.complete) return;
9607
9715
  for (const token of dynamicReferenceTokens(leaf)) {
9716
+ if (recordedRegions?.has(token) === true) continue;
9608
9717
  const name = classifyReplaySecretRegion(token, consumerRegion, evidence.regions).kind === "local" ? regionLessSecretName(token) : void 0;
9609
9718
  if (name === void 0) continue;
9610
9719
  const where = propertyPath === "" ? "" : ` property '${propertyPath}'`;
@@ -9658,17 +9767,17 @@ async function driftProducerRegionEvidence(state, stackName, region, stateBacken
9658
9767
  const inherited = await driftProducerRegionEvidence(parent.state, parentName, parentRegion, stateBackend, depth + 1);
9659
9768
  return inheritProducerRegions(own, inherited);
9660
9769
  }
9661
- async function resolveDriftLeafByRegion(leaf, propertyPath, logicalId, consumerRegion, producerRegions, resolvers, ctx) {
9662
- const verdicts = dynamicReferenceTokens(leaf).map((token) => [token, classifyReplaySecretRegion(token, consumerRegion, producerRegions)]);
9770
+ async function resolveDriftLeafByRegion(leaf, propertyPath, logicalId, consumerRegion, producerRegions, resolvers, ctx, recordedRegions) {
9771
+ const verdicts = dynamicReferenceTokens(leaf).map((token) => [token, classifyRecordedSecretRegion(token, consumerRegion, producerRegions, recordedRegions)]);
9663
9772
  for (const [, verdict] of verdicts) if (verdict.kind === "ambiguous") throw regionAmbiguousDriftSecretError(logicalId, propertyPath, verdict.secretName, verdict.foreignProducerRegions, consumerRegion);
9664
- if (!verdicts.some(([, verdict]) => verdict.kind === "named-region")) return await resolvers.primary.resolveDynamicReferences(leaf, ctx);
9773
+ if (!verdicts.some(([, verdict]) => verdict.kind === "named-region" || verdict.kind === "recorded-region")) return await resolvers.primary.resolveDynamicReferences(leaf, ctx);
9665
9774
  let out = "";
9666
9775
  let cursor = 0;
9667
9776
  for (const [token, verdict] of verdicts) {
9668
9777
  const at = leaf.indexOf(token, cursor);
9669
9778
  if (at < 0) throw new DriftSecretRefusalError(`${logicalId}${propertyPath === "" ? "" : ` property '${propertyPath}'`}: could not locate a scanned dynamic reference in the value it was scanned from. Refusing rather than resolving it in '${consumerRegion}', which would be the wrong region for a reference that names another one. This is an internal invariant failure — please report it with the resource type and property path.`, "DRIFT_SECRET_TOKEN_SCAN_MISMATCH");
9670
9779
  out += leaf.slice(cursor, at);
9671
- const resolver = verdict.kind === "named-region" ? resolvers.forRegion(verdict.region) : resolvers.primary;
9780
+ const resolver = verdict.kind === "named-region" ? resolvers.forRegion(verdict.region) : verdict.kind === "recorded-region" ? resolvers.forRecordedRegion(verdict.region) : resolvers.primary;
9672
9781
  out += await resolver.resolveDynamicReferences(token, ctx);
9673
9782
  cursor = at + token.length;
9674
9783
  }
@@ -9677,6 +9786,7 @@ async function resolveDriftLeafByRegion(leaf, propertyPath, logicalId, consumerR
9677
9786
  async function resolveStateSecretExpressions(props, resolvers, secrets, options) {
9678
9787
  if (!containsDynamicReference$1(props)) return props;
9679
9788
  const { secretPaths, onUnresolved, producerRegions, logicalId, consumerRegion } = options;
9789
+ const recordedRegions = recordedReferenceRegions(options.record);
9680
9790
  const ctx = {
9681
9791
  template: { Resources: {} },
9682
9792
  resources: {},
@@ -9685,8 +9795,8 @@ async function resolveStateSecretExpressions(props, resolvers, secrets, options)
9685
9795
  const walk = async (v, path) => {
9686
9796
  if (typeof v === "string") {
9687
9797
  if (!v.includes("{{resolve:")) return v;
9688
- refuseUnprovenDriftSecret(v, path, logicalId, consumerRegion, producerRegions);
9689
- const resolved = await resolveDriftLeafByRegion(v, path, logicalId, consumerRegion, producerRegions.regions, resolvers, ctx);
9798
+ refuseUnprovenDriftSecret(v, path, logicalId, consumerRegion, producerRegions, recordedRegions);
9799
+ const resolved = await resolveDriftLeafByRegion(v, path, logicalId, consumerRegion, producerRegions.regions, resolvers, ctx, recordedRegions);
9690
9800
  const survivors = survivingDynamicReferences(resolved).filter((t) => v.includes(t));
9691
9801
  if (survivors.length > 0) onUnresolved?.(survivors, path);
9692
9802
  if (carriesRecordedSecret(resolved, secrets)) secretPaths?.add(path);
@@ -10008,6 +10118,7 @@ async function runDriftForStack(stackName, region, stateBackend, providerRegistr
10008
10118
  onUnresolved: noteUnresolved,
10009
10119
  logicalId,
10010
10120
  consumerRegion: region,
10121
+ record: resource,
10011
10122
  producerRegions
10012
10123
  });
10013
10124
  if (useObserved) await resolveStateSecretExpressions(resource.properties ?? {}, secretResolvers, secrets, {
@@ -10015,6 +10126,7 @@ async function runDriftForStack(stackName, region, stateBackend, providerRegistr
10015
10126
  onUnresolved: noteUnresolved,
10016
10127
  logicalId,
10017
10128
  consumerRegion: region,
10129
+ record: resource,
10018
10130
  producerRegions
10019
10131
  });
10020
10132
  } catch (err) {
@@ -10753,12 +10865,14 @@ async function runRevert(reports, regionScope, stateBackend, stateConfig, awsCli
10753
10865
  onUnresolved: noteUnresolved,
10754
10866
  logicalId: outcome.logicalId,
10755
10867
  consumerRegion: report.region,
10868
+ record: stateResource,
10756
10869
  producerRegions: revertProducerRegions
10757
10870
  });
10758
10871
  if (stateResource.observedProperties !== void 0) await resolveStateSecretExpressions(stateResource.properties ?? {}, revertSecretResolvers, secrets, {
10759
10872
  onUnresolved: noteUnresolved,
10760
10873
  logicalId: outcome.logicalId,
10761
10874
  consumerRegion: report.region,
10875
+ record: stateResource,
10762
10876
  producerRegions: revertProducerRegions
10763
10877
  });
10764
10878
  } catch (err) {
@@ -19031,7 +19145,7 @@ async function rollbackCommand(stackArg, options) {
19031
19145
  const { skippedOutputs: _droppedByRollback, ...carriedState } = baseState;
19032
19146
  const next = () => ({
19033
19147
  ...carriedState,
19034
- version: 11,
19148
+ version: 12,
19035
19149
  region,
19036
19150
  resources: { ...stateResources },
19037
19151
  ...orphansAfterRollback(baseState, mintedOrphans),
@@ -20656,46 +20770,54 @@ async function importCommand(stackArg, options) {
20656
20770
  }
20657
20771
  }));
20658
20772
  try {
20659
- const rows = [];
20660
- for (const { logicalId, resource } of resources) {
20661
- if (selectiveMode && !overrides.has(logicalId)) {
20662
- rows.push({
20663
- logicalId,
20664
- resourceType: resource.Type,
20665
- outcome: "skipped-out-of-scope",
20666
- reason: "not in --resource / --resource-mapping (use --auto to include)"
20667
- });
20668
- continue;
20669
- }
20670
- if (resource.Type === "AWS::CloudFormation::Stack" && migrationTree && migrationTree.nested.has(logicalId) && accountIdForNestedSynth) {
20671
- rows.push({
20773
+ const collectRows = async () => {
20774
+ const collected = [];
20775
+ for (const { logicalId, resource } of resources) {
20776
+ if (selectiveMode && !overrides.has(logicalId)) {
20777
+ collected.push({
20778
+ logicalId,
20779
+ resourceType: resource.Type,
20780
+ outcome: "skipped-out-of-scope",
20781
+ reason: "not in --resource / --resource-mapping (use --auto to include)"
20782
+ });
20783
+ continue;
20784
+ }
20785
+ if (resource.Type === "AWS::CloudFormation::Stack" && migrationTree && migrationTree.nested.has(logicalId) && accountIdForNestedSynth) {
20786
+ collected.push({
20787
+ logicalId,
20788
+ resourceType: resource.Type,
20789
+ outcome: "imported",
20790
+ physicalId: synthesizeNestedStackArn(targetRegion, accountIdForNestedSynth, stackInfo.stackName, logicalId)
20791
+ });
20792
+ continue;
20793
+ }
20794
+ const outcome = await importOne({
20672
20795
  logicalId,
20673
- resourceType: resource.Type,
20674
- outcome: "imported",
20675
- physicalId: synthesizeNestedStackArn(targetRegion, accountIdForNestedSynth, stackInfo.stackName, logicalId)
20796
+ resource,
20797
+ stackName: stackInfo.stackName,
20798
+ region: targetRegion,
20799
+ providerRegistry,
20800
+ override: overrides.get(logicalId),
20801
+ overrides
20676
20802
  });
20677
- continue;
20803
+ collected.push(outcome);
20678
20804
  }
20679
- const outcome = await importOne({
20680
- logicalId,
20681
- resource,
20682
- stackName: stackInfo.stackName,
20683
- region: targetRegion,
20684
- providerRegistry,
20685
- override: overrides.get(logicalId),
20686
- overrides
20687
- });
20688
- rows.push(outcome);
20689
- }
20805
+ return collected;
20806
+ };
20807
+ let rows = await collectRows();
20690
20808
  printSummary(rows);
20691
20809
  if (options.recordResourceMapping) writeRecordedMapping(options.recordResourceMapping, rows);
20692
- const stackState = buildStackState(stackInfo.stackName, targetRegion, rows, templateParser, stateTemplate, existingState, selectiveMode);
20693
- refuseMalformedResourceEntriesForImportSave(stackState, stackInfo.stackName, targetRegion, lockRecovery);
20810
+ const assembleStackState = () => {
20811
+ const assembled = buildStackState(stackInfo.stackName, targetRegion, rows, templateParser, stateTemplate, existingState, selectiveMode);
20812
+ refuseMalformedResourceEntriesForImportSave(assembled, stackInfo.stackName, targetRegion, lockRecovery);
20813
+ return assembled;
20814
+ };
20815
+ let stackState = assembleStackState();
20694
20816
  if (options.dryRun) {
20695
20817
  logger.info("--dry-run: state will NOT be written. Re-run without --dry-run to apply.");
20696
20818
  return;
20697
20819
  }
20698
- const importedRows = rows.filter((r) => r.outcome === "imported");
20820
+ let importedRows = rows.filter((r) => r.outcome === "imported");
20699
20821
  if (importedRows.length === 0) {
20700
20822
  logger.warn("No resources were successfully imported. State will not be written.");
20701
20823
  return;
@@ -20710,8 +20832,54 @@ async function importCommand(stackArg, options) {
20710
20832
  return;
20711
20833
  }
20712
20834
  }
20835
+ let retireCfnStack = false;
20836
+ let nestedReplaced = [];
20837
+ if (migrationCfnStackName) {
20838
+ warnMigrationOrphans(logger, resources.length, importedRows.length);
20839
+ const preparation = await prepareCloudFormationStackRetirement({
20840
+ cfnStackName: migrationCfnStackName,
20841
+ cfnClient: regionClients.cloudFormation,
20842
+ yes: options.yes,
20843
+ stateBucket,
20844
+ ...options.profile && { s3ClientOpts: { profile: options.profile } },
20845
+ ...migrationTree && { resourceTree: migrationTree }
20846
+ });
20847
+ retireCfnStack = preparation.outcome === "ready";
20848
+ if (preparation.outcome === "ready" && preparation.templateUpdated && migrationTree) {
20849
+ let updatedTree;
20850
+ try {
20851
+ updatedTree = await getCloudFormationResourceTree(migrationCfnStackName, regionClients.cloudFormation);
20852
+ } catch (err) {
20853
+ throw new Error(safeMsg`--migrate-from-cloudformation: the Retain-policy update completed, but ` + safeMsg`re-reading the stack's resources failed: ${cfnFailureText(err)}. ` + `cdkd state was not written and the CloudFormation stack was not deleted. ` + SUPERSEDED_COPY_HINT);
20854
+ }
20855
+ const replaced = findReplacedCfnResources(migrationTree, updatedTree).filter((r) => r.nestedPath.length > 0 || templateLogicalIds.has(r.logicalId) && template.Resources[r.logicalId]?.Type !== "AWS::CloudFormation::Stack");
20856
+ migrationTree = updatedTree;
20857
+ nestedReplaced = replaced.filter((r) => r.nestedPath.length > 0);
20858
+ for (const r of replaced) {
20859
+ const where = r.nestedPath.length > 0 ? safeMsg`nested stack ${r.nestedPath.map((p) => logicalIdShown(p)).join(" > ")}: ` : "";
20860
+ const pinned = r.nestedPath.length === 0 && overrides.has(r.logicalId) && overrides.get(r.logicalId) !== r.before;
20861
+ if (r.nestedPath.length === 0 && overrides.get(r.logicalId) === r.before) overrides.set(r.logicalId, r.after);
20862
+ logger.warn(safeMsg`CloudFormation replaced ${where}${logicalIdShown(r.logicalId)} while applying ` + safeMsg`the Retain policies: the stack now holds ${displaySafe(r.after)}` + (pinned ? safeMsg`; cdkd keeps the physical id you passed with --resource, so ${displaySafe(r.after)} ` + `(kept by DeletionPolicy=Retain) is managed by neither CloudFormation nor cdkd either. ` : `, which cdkd adopts. `) + safeMsg`The replaced ${displaySafe(r.before)} is RETAINED and managed by neither ` + `CloudFormation nor cdkd; delete it yourself once you no longer need it.`);
20863
+ }
20864
+ if (replaced.some((r) => r.nestedPath.length === 0)) {
20865
+ rows = await collectRows();
20866
+ printSummary(rows);
20867
+ stackState = assembleStackState();
20868
+ const adoptedBefore = importedRows.map((r) => r.logicalId);
20869
+ importedRows = rows.filter((r) => r.outcome === "imported");
20870
+ const adoptedNow = new Set(importedRows.map((r) => r.logicalId));
20871
+ if (options.recordResourceMapping) writeRecordedMapping(options.recordResourceMapping, rows);
20872
+ refuseLostReplacedRows(adoptedBefore.filter((id) => !adoptedNow.has(id)), "cdkd state was not written and the CloudFormation stack was not deleted.");
20873
+ if (importedRows.length !== adoptedBefore.length) {
20874
+ logger.warn(safeMsg`--migrate-from-cloudformation: the re-import after the replacement adopts ` + safeMsg`${importedRows.length} resource(s); ${adoptedBefore.length} were confirmed.`);
20875
+ warnMigrationOrphans(logger, resources.length, importedRows.length);
20876
+ }
20877
+ }
20878
+ }
20879
+ }
20713
20880
  const deployedParameters = !namesAnyDeclaredParameter(stateTemplate) ? void 0 : migrationCfnStackName !== void 0 ? await readDeployedParameters(migrationCfnStackName, regionClients.cloudFormation, logger, displaySafe(migrationCfnStackName)) : await readDeployedParameters(stackInfo.stackName, regionClients.cloudFormation, logger, displaySafe(stackInfo.stackName), { absentStackIsNoSource: true });
20714
- await captureObservedForImportedResources(stackState, providerRegistry, logger, await withSharedDrainBudget(() => resolveImportedProperties(stackState, stateTemplate, targetRegion, stateBackend, logger, deployedParameters)), rebuiltLogicalIdsFrom(rows, stateTemplate));
20881
+ const unsafeObservedBaselineLogicalIds = await withSharedDrainBudget(() => resolveImportedProperties(stackState, stateTemplate, targetRegion, stateBackend, logger, deployedParameters));
20882
+ await captureObservedForImportedResources(stackState, providerRegistry, logger, unsafeObservedBaselineLogicalIds, rebuiltLogicalIdsFrom(rows, stateTemplate));
20715
20883
  const saveOptions = {};
20716
20884
  if (existingEtag) saveOptions.expectedEtag = existingEtag;
20717
20885
  if (migrationPending) saveOptions.migrateLegacy = true;
@@ -20726,6 +20894,8 @@ async function importCommand(stackArg, options) {
20726
20894
  parentRegion: targetRegion,
20727
20895
  parentNestedTemplates: stackInfo.nestedTemplates ?? nullPrototypeRecord(),
20728
20896
  parentTree: migrationTree,
20897
+ nestedPath: [],
20898
+ replaced: nestedReplaced,
20729
20899
  stateBackend,
20730
20900
  lockManager,
20731
20901
  providerRegistry,
@@ -20736,18 +20906,7 @@ async function importCommand(stackArg, options) {
20736
20906
  assetRedirect,
20737
20907
  cfnClient: regionClients.cloudFormation
20738
20908
  });
20739
- if (migrationCfnStackName) {
20740
- const orphaned = resources.length - importedRows.length;
20741
- if (orphaned > 0) logger.warn(`--migrate-from-cloudformation: ${orphaned} of ${resources.length} template resource(s) were NOT imported into cdkd. After the CloudFormation stack is retired, those resources remain in AWS but are unmanaged by both CloudFormation and cdkd.`);
20742
- await retireCloudFormationStack({
20743
- cfnStackName: migrationCfnStackName,
20744
- cfnClient: regionClients.cloudFormation,
20745
- yes: options.yes,
20746
- stateBucket,
20747
- ...options.profile && { s3ClientOpts: { profile: options.profile } },
20748
- ...migrationTree && { resourceTree: migrationTree }
20749
- });
20750
- }
20909
+ if (migrationCfnStackName && retireCfnStack) await deleteRetiredCloudFormationStack(migrationCfnStackName, regionClients.cloudFormation);
20751
20910
  } finally {
20752
20911
  await lockManager.releaseLock(stackInfo.stackName, targetRegion).catch((err) => {
20753
20912
  logger.warn(`Failed to release lock: ${describeAwsFailure(err).detail}`);
@@ -21178,12 +21337,13 @@ function buildStackState(stackName, region, rows, templateParser, template, exis
21178
21337
  }
21179
21338
  if (namesParameter?.failedClosed !== void 0) getLogger().debug(`The template's parameter dependence could not be judged (${namesParameter.failedClosed}): every prior observed-baseline refusal recorded without a reason is carried as an unverifiable-parameter refusal.`);
21180
21339
  return {
21181
- version: 11,
21340
+ version: 12,
21182
21341
  stackName,
21183
21342
  region,
21184
21343
  resources,
21185
21344
  outputs: existingState?.outputs ?? {},
21186
21345
  ...existingState ? exportNamesCarriedFrom(existingState) : { exportNames: [] },
21346
+ ...existingState?.outputReferenceProvenance !== void 0 && { outputReferenceProvenance: existingState.outputReferenceProvenance },
21187
21347
  ...existingState ? orphansCarriedFrom(existingState) : {},
21188
21348
  lastModified: Date.now()
21189
21349
  };
@@ -21462,6 +21622,15 @@ function resolveDiscardsNonInertSubtree(node, conditions, mappings) {
21462
21622
  }
21463
21623
  return keys.some((key) => resolveDiscardsNonInertSubtree(record[key], conditions, mappings));
21464
21624
  }
21625
+ function warnMigrationOrphans(logger, total, imported, where) {
21626
+ const orphaned = total - imported;
21627
+ if (orphaned <= 0) return;
21628
+ logger.warn(`--migrate-from-cloudformation: ${orphaned} of ${total} template resource(s)${where ? safeMsg` in ${where}` : ""} were NOT imported into cdkd. After the CloudFormation stack is retired, those resources remain in AWS but are unmanaged by both CloudFormation and cdkd.`);
21629
+ }
21630
+ function refuseLostReplacedRows(lost, written) {
21631
+ if (lost.length === 0) return;
21632
+ throw new Error(safeMsg`--migrate-from-cloudformation: after CloudFormation replaced resources, ` + safeMsg`${lost.map((id) => logicalIdShown(id)).join(", ")} could no longer be imported. ` + `${written} Re-run the same command once the new resource is readable: the re-run runs no update, so it cannot tell the resource was replaced, and a resource it still cannot import is left managed by neither tool after the stack is retired.`);
21633
+ }
21465
21634
  function printSummary(rows) {
21466
21635
  const logger = getLogger();
21467
21636
  const counts = {
@@ -21495,7 +21664,7 @@ async function confirmPrompt(prompt) {
21495
21664
  return confirmOrRefuse(prompt, { refusal: "The cdkd import confirmation prompt cannot run in a non-interactive environment. Pass -y / --yes to confirm the state write, or run the command from a real terminal." });
21496
21665
  }
21497
21666
  function createImportCommand() {
21498
- const cmd = new Command("import").description("Adopt already-deployed AWS resources into cdkd state. Reads the CDK app to find logical IDs, resource types, and dependencies. With no flags, imports every resource, resolving each physical id from the template's physical-name property and then from a same-named CloudFormation stack's DescribeStackResources. With --resource / --resource-mapping, only the listed resources are imported (CDK CLI parity); pass --auto to auto-resolve the rest.").argument("[stack]", "Stack to import. Optional when the synthesized app contains exactly one stack.").option("--resource <id=physical>", "Explicit physical-id override for one logical ID. Repeatable. When at least one --resource is given, only listed resources are imported (CDK CLI parity). Pass --auto to also auto-resolve everything else.", collectMultiple, []).option("--resource-mapping <file>", "Path to a JSON file of {logicalId: physicalId} overrides (CDK CLI `cdk import --resource-mapping` compatible). Implies selective mode unless --auto is set. Mutually exclusive with --resource-mapping-inline.").option("--resource-mapping-inline <json>", "Inline JSON object of {logicalId: physicalId} overrides (CDK CLI `cdk import --resource-mapping-inline` compatible). Same shape as --resource-mapping but supplied as a string — useful for non-TTY CI scripts that do not want a separate file. Implies selective mode unless --auto is set. Mutually exclusive with --resource-mapping.").option("--record-resource-mapping <file>", "After cdkd resolves every logical ID (via --resource / --resource-mapping / auto-resolution), write the resulting {logicalId: physicalId} map to <file> as JSON. Useful in auto / hybrid mode for capturing the auto-resolved mapping and feeding it back as --resource-mapping in non-interactive CI re-runs. Written before the confirmation prompt (so the user can review the file before saying \"yes\") and even when the user says \"no\". Mirrors `cdk import --record-resource-mapping`.").option("--auto", "Hybrid mode: when explicit overrides are supplied, ALSO auto-resolve every other resource in the template. Without this flag, --resource / --resource-mapping behave as a whitelist (CDK CLI parity).", false).option("--dry-run", "Show planned imports without writing state", false).option("--force", "Confirm a destructive write to existing state. Required for auto / whole-stack import when state already exists (rebuilds the entire resource map). Also required in selective mode if a listed override would overwrite a resource already in state. Not needed for a pure selective merge (adding new resources without touching unlisted entries).", false).option("--migrate-from-cloudformation [cfn-stack-name]", "After cdkd state is written, retire the named CloudFormation stack (deletes the CFn stack record; AWS resources are NOT deleted): inject DeletionPolicy=Retain and UpdateReplacePolicy=Retain on every resource via UpdateStack, then DeleteStack. cdkd takes over management. Pass without a value to use the cdkd stack name as the CFn stack name (the typical case for a CDK app that was previously deployed via `cdk deploy`); pass an explicit value when the CFn stack name differs.").addOption(useCdkBootstrapAssetsOption).action(withErrorHandling(importCommand));
21667
+ const cmd = new Command("import").description("Adopt already-deployed AWS resources into cdkd state. Reads the CDK app to find logical IDs, resource types, and dependencies. With no flags, imports every resource, resolving each physical id from the template's physical-name property and then from a same-named CloudFormation stack's DescribeStackResources. With --resource / --resource-mapping, only the listed resources are imported (CDK CLI parity); pass --auto to auto-resolve the rest.").argument("[stack]", "Stack to import. Optional when the synthesized app contains exactly one stack.").option("--resource <id=physical>", "Explicit physical-id override for one logical ID. Repeatable. When at least one --resource is given, only listed resources are imported (CDK CLI parity). Pass --auto to also auto-resolve everything else.", collectMultiple, []).option("--resource-mapping <file>", "Path to a JSON file of {logicalId: physicalId} overrides (CDK CLI `cdk import --resource-mapping` compatible). Implies selective mode unless --auto is set. Mutually exclusive with --resource-mapping-inline.").option("--resource-mapping-inline <json>", "Inline JSON object of {logicalId: physicalId} overrides (CDK CLI `cdk import --resource-mapping-inline` compatible). Same shape as --resource-mapping but supplied as a string — useful for non-TTY CI scripts that do not want a separate file. Implies selective mode unless --auto is set. Mutually exclusive with --resource-mapping.").option("--record-resource-mapping <file>", "After cdkd resolves every logical ID (via --resource / --resource-mapping / auto-resolution), write the resulting {logicalId: physicalId} map to <file> as JSON. Useful in auto / hybrid mode for capturing the auto-resolved mapping and feeding it back as --resource-mapping in non-interactive CI re-runs. Written before the confirmation prompt (so the user can review the file before saying \"yes\") and even when the user says \"no\". Mirrors `cdk import --record-resource-mapping`.").option("--auto", "Hybrid mode: when explicit overrides are supplied, ALSO auto-resolve every other resource in the template. Without this flag, --resource / --resource-mapping behave as a whitelist (CDK CLI parity).", false).option("--dry-run", "Show planned imports without writing state", false).option("--force", "Confirm a destructive write to existing state. Required for auto / whole-stack import when state already exists (rebuilds the entire resource map). Also required in selective mode if a listed override would overwrite a resource already in state. Not needed for a pure selective merge (adding new resources without touching unlisted entries).", false).option("--migrate-from-cloudformation [cfn-stack-name]", "Retire the named CloudFormation stack (deletes the CFn stack record; AWS resources are NOT deleted): inject DeletionPolicy=Retain and UpdateReplacePolicy=Retain on every resource via UpdateStack, write cdkd state from the physical IDs the stack holds after that update, then DeleteStack. cdkd takes over management. Pass without a value to use the cdkd stack name as the CFn stack name (the typical case for a CDK app that was previously deployed via `cdk deploy`); pass an explicit value when the CFn stack name differs.").addOption(useCdkBootstrapAssetsOption).action(withErrorHandling(importCommand));
21499
21668
  [
21500
21669
  ...commonOptions,
21501
21670
  ...appOptions,
@@ -21617,6 +21786,10 @@ async function importNestedStackChildrenRecursive(args) {
21617
21786
  });
21618
21787
  rows.push(outcome);
21619
21788
  }
21789
+ const childPath = [...args.nestedPath, childLogicalId];
21790
+ const childImported = new Set(rows.filter((r) => r.outcome === "imported").map((r) => r.logicalId));
21791
+ refuseLostReplacedRows(args.replaced.filter((r) => r.nestedPath.length === childPath.length && r.nestedPath.every((p, i) => p === childPath[i]) && childTemplateLogicalIds.has(r.logicalId) && !childImported.has(r.logicalId)).map((r) => r.logicalId), safeMsg`cdkd state for nested stack ${displaySafe(childStackName)} was not written ` + "(the parent's and earlier nested stacks' were), and the CloudFormation stack was not deleted; the re-run needs --force.");
21792
+ warnMigrationOrphans(logger, childResources.length, childImported.size, childStackName);
21620
21793
  const childStackState = buildStackState(childStackName, childRegion, rows, templateParser, childStateTemplate, null, false);
21621
21794
  childStackState.parentStack = parentStackName;
21622
21795
  childStackState.parentLogicalId = childLogicalId;
@@ -21632,6 +21805,8 @@ async function importNestedStackChildrenRecursive(args) {
21632
21805
  parentRegion: childRegion,
21633
21806
  parentNestedTemplates: indexGrandchildTemplatePaths(childStateTemplate, childTemplatePath),
21634
21807
  parentTree: childTreeNode,
21808
+ nestedPath: [...args.nestedPath, childLogicalId],
21809
+ replaced: args.replaced,
21635
21810
  stateBackend,
21636
21811
  lockManager,
21637
21812
  providerRegistry,
@@ -29193,4 +29368,4 @@ function collectVerbFlags(program) {
29193
29368
 
29194
29369
  //#endregion
29195
29370
  export { canonicalizeIpProtocolValue as a, buildProgram, resolveSecretDerivedPrincipals as i, runDestroyForStack as n, resolvedResourceTimeoutMs as o, isResolvableSecretPrincipalList as r, canonicalizeIpv4Cidr as t };
29196
- //# sourceMappingURL=program-MMwB_CTT.js.map
29371
+ //# sourceMappingURL=program-w-kAH85e.js.map