@go-to-k/cdkd 0.298.7 → 0.299.0

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-zprmW9pl.js → asg-provider-CGN1a3d3.js} +4 -4
  2. package/dist/{asg-provider-zprmW9pl.js.map → asg-provider-CGN1a3d3.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-CO0EOAem.js → deploy-engine-4K_B3N08.js} +685 -178
  9. package/dist/deploy-engine-4K_B3N08.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-B0v-Lm_f.js → iam-role-provider-BKnf387o.js} +47 -7
  13. package/dist/iam-role-provider-BKnf387o.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-Bq25rRgt.js → neptune-provider-CR19ID_J.js} +4 -4
  18. package/dist/{neptune-provider-Bq25rRgt.js.map → neptune-provider-CR19ID_J.js.map} +1 -1
  19. package/dist/{program-BgDt3OZh.js → program-BgsCaZFy.js} +300 -100
  20. package/dist/program-BgsCaZFy.js.map +1 -0
  21. package/dist/{provider-classes-BEIwSimv.js → provider-classes-DxHQcC1K.js} +79 -14
  22. package/dist/provider-classes-DxHQcC1K.js.map +1 -0
  23. package/dist/{rds-provider-Cyb9LwFv.js → rds-provider-BO3U39K0.js} +4 -4
  24. package/dist/{rds-provider-Cyb9LwFv.js.map → rds-provider-BO3U39K0.js.map} +1 -1
  25. package/dist/{version-B3Ymd4cN.js → version-DUCWZskc.js} +2 -2
  26. package/dist/{version-B3Ymd4cN.js.map → version-DUCWZskc.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-CO0EOAem.js.map +0 -1
  30. package/dist/iam-role-provider-B0v-Lm_f.js.map +0 -1
  31. package/dist/program-BgDt3OZh.js.map +0 -1
  32. package/dist/provider-classes-BEIwSimv.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, 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 warnDeprecatedNoPrefixCliFlag, $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 Synthesizer, 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 renderAssemblyPathEscape, Cn as collectDeclaredOutputNames, Cr as applyCustomResourceResponseExpiration, Cs as wholeStringLeavesOf, D as withResourceDeadline, Da as refuseMalformedResourcePropertiesForDrift, Dc as isDockerClientEnvKey, Di as withSharedDrainBudget, 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 injectedAwsRegionValue, 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 escapeRegExp, Fi as UNREADABLE_RESOURCES_MAP_ROW, Fn as secretNamedRecordNeedles, Fs as CrossPrefixScanCache, Ft as sameJournaledOrphans, Gc as resolveApp, Gi as malformedExportNamesWarning, Gn as isFinalSnapshotError, Go as printingCorpusOf, Gr as poisonRenderedSpellingsCollidingIn, Gs as hasReasonlessBaselineRefusal, Gt as isJournaledOrphan, Ha as unreadableResourceEntries, Hc as getDefaultStateBucketName, 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 stripControlChars, Ii as accountArgs, In as stateSecretNameNeedles, Io as readbackPathFor, Is as applyCrossPrefixScan, It as replayFailedOperations, Ja as NO_CC_HANDLERS_REASON, Jc as resolveSkipPrefix, Ji as malformedLocalResourceEntriesWarning, Jn as maskingRetryLogger, Jo as shareLogOnlyValues, Jr as applyRoleArnIfSet, Js as importableOutputs, Jt as planRollback, Ka as unwrittenCreateOnlyReplacement, Kc as resolveAutoAssetStorage, 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 stripForDisplay, Li as deployRefusesOrphanRowsReason, Ln as storedSecretNameNeedles, Lo as readsNoEchoSource, Ls as crossPrefixDeniedWarning, Lt as replayRollback, M as noEchoParameterNamesOf, Ma as refuseMalformedResourcesForExport, Mc as runDockerForeground, 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 runDockerStreaming, 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, Ol as resolveBucketRegion, 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 warnFinchArgvExposure, 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 stateBucketExistenceConfirmed, Qi as malformedOrphanRowsKeptWarning, Qo as maskSecretsInText, Qr as isIamRoleArn, Qs as shouldRetainResource, Qt as resolveReplacementOldType, R as readProtection, Ra as repairMalformedResourcePropertiesForReadOnly, Rc as AssetManifestLoader, 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 displayAssemblyPath, 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 injectAwsRegion, Tn as isExportAliasCollision, To as TemplateParser, Tr as CloudControlProvider, Ts as STATE_SOURCED_CROSS_GENERATION_RULES, Tt as withNestedRevertRun, Ua as withheldAccountClause, Uc as getLegacyStateBucketName, Ui as isReadableResourceEntry, Un as createPreDeleteFinalSnapshot, Uo as literalSplitDelimitersOf, Ur as INTRINSIC_KEYS, Us as exportNamesCarriedFrom, Ut as recordAfterRollbackUpdate, Va as unreadableOrphanRecords, Vc as synthesisStatusMessage, Vi as hasReadableResources, Vn as buildFinalSnapshotIdentifier, Vo as createUnionSecretMasker, Vs as acceptedCreateOnlyDropsOf, Vt as withStackRecords, Wa as findActionableSilentDrops, Wc as loadCdkJson, Wi as malformedDriftResourcePropertiesWarning, Wn as effectiveDeletionPolicy, Wo as logOnlyValueCount, Wr as IntrinsicFunctionResolver, Ws as hasReadableExportSet, Wt as demoteSupersededOrphans, Xa as findReplacedReadersOfRecreateTargets, Xc as resolveStateBucketWithDefaultAndSource, Xi as malformedOrphanRecordsRefusalMessage, Xn as findDestructiveChanges, Xo as errorCauseChain, Xr as assertSendableRoleArn, Xs as orphansAfterRollback, Xt as recordUnderIdIsNotOwn, Ya as hasNoCloudControlHandlers, Yc as resolveStateBucketWithDefault, Yi as malformedLocalResourcesWarning, Yn as constructPathOf, Yo as createSecretMasker, Yr as assertFlagRoleArn, Ys as isReadableBag, Yt as recheckFailedPlan, Za as shownType, Zc as resolveUseCdkBootstrapAssets, 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 hasPlainPrototype, _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 uploadCfnTemplate, as as dynamicReferenceTokens, at as cyan, ba as refuseMalformedResourceEntries, bc as describeDockerCapturedOutput, bi as isNamelessDynamicReferenceError, bl as absoluteAssemblyPathEscape, bn as exportNameSecretExposure, bo as withRetry, bs as recordNoEchoAttributeValues, c as renderNestedTemplateTreeDefect, ca as malformedStateRefusalMessage, cc as BOOTSTRAP_MARKER_PREFIX, cl as expectedOwnerParam, cn as updatePartialMessage, cs as identityKeyFor, ct as red, d as conditionInputsFrom, dc as getBootstrapMarkerKey, di as producerRegionsFromState, dl as derivePartitionAndUrlSuffix, dn as DeploymentEventsStore, dt as namesAnyDeclaredParameter, ea as malformedOrphansWarning, ec as isSensitiveAttributeName, ei as AWS_CREDENTIAL_ENV_KEYS, el as ssmResolvedValueType, en as orphanDeleteNeedsIdentity, eo as isStatefulRecreateTargetSync, es as redactSecretsForState, f as parentSuppliedValues, fa as refuseMalformedOrphanRecords, fc as isCrossRegionRedirect, fi as regionLessSecretName, fl as AssemblyReader, 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 hasOwnKey, 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 defineOwnKey, hn as secretBearing, hr as isCustomResource, hs as splitGetAttStringForm, ht as planOrphanAdoption, i as childTemplateLoader, ia as malformedResourceEntriesWarning, ic as createAssetRedirectResolver, il as findLargeInlineResources, is as DYNAMIC_REFERENCE_TOKEN_SCAN, it as bold, j as noEchoExactEchoLeavesOf, ja as refuseMalformedResourcesForDestroy, jc as redactedDockerCause, 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, 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 PARTITION_TABLE, ln as updatePartialReason, ls as inheritNestedStackParameterAssociations, lt as yellow, m as isSecretBearingReferenceString, ma as refuseMalformedOrphans, mc as readBootstrapMarkerBody, mi as isUnboundTemplateParameter, ml as processStackMessages, 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_URL_LIMIT, ns as withPhysicalNameCopies, nt as formatResourceLine, o as isAbsoluteAssetPath, oa as malformedResourcesWarning, oc as rewriteTemplateAssetReferences, ol as CUSTOM_RESOURCE_RESPONSE_OBJECT_DESCRIPTION, os as isUncertifiedBaselineMaskPosition, ot as gray, p as readRecordedConditionVerdicts, pa as refuseMalformedOrphanRecordsForDestroy, pc as parseBootstrapMarker, pi as coerceParameterTypedValue, pl as StageLoadError, pn as displayTextOrWithheld, pr as ProviderRegistry, pt as resourcesNamingDeclaredParameter, qc as resolveCaptureObservedState, 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 MIGRATE_TMP_PREFIX, rn as inheritProducerRegions, rt as createReadOnlyAttributeHealerFactory, s as listNestedTemplateRows, sa as malformedScrubResourceEntriesRefusalMessage, sc as AssetModeResolver, sl as decodeListingKey, ss as pathCrossesDottedKey, st as green, t as DeployEngine, ta as malformedOutputsRefusalMessage, tc as stringifyValue, ti as applyCallerIdentityCredentials, tl as CFN_TEMPLATE_BODY_LIMIT, 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 canonicalizeRegion, un as DeploymentEventsReader, us as recordNestedStackParameterExpressions, ut as computeParameterTaint, va as refuseMalformedOutputsForDestroy, vc as buildDockerImage, vi as carriesDynamicReference, vl as nullPrototypeRecord, 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 resolveAssemblyPath, 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 describeFileReadFailure, xn as isWholeDynamicReferenceValue, xr as withPrintingSecrets, xs as recordNoEchoParameterFreshValue, xt as nestedChildStackName$1, ya as refuseMalformedResourceAttributesForOrphan, yc as resolveDockerContextDirectory, yi as carriesFetchableDynamicReference, yl as ownValue, yn as exportNameNoEchoParameters, yo as describeTypeWithThrottleRetry, yr as isCustomResourceType$1, ys as recordMaskOnlyValuesIn, yt as dropSettledNestedJournals, za as repairMalformedResourcesForReadOnly, zc as getDockerImageBySourceHash, zi as hasReadableOrphans, zn as ATOMIC_FINAL_SNAPSHOT_TYPES, zo as liveMatchesUnresolvedTokenFrame, zs as isNotImplemented, zt as destroyStackRecordsView } from "./deploy-engine-CO0EOAem.js";
6
- import { t as getCdkdVersion } from "./version-B3Ymd4cN.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 MULTI_REGION_RECREATE_BLOCKED_TYPES, $c as resolveStateBucketWithDefault, $i as malformedOrphanRowsKeptWarning, $o as maskSecretsInText, $r as isIamRoleArn, $s as orphansAfterRollback, $t as seedsDeleteFirstGuard, A as noEchoComparisonForTemplate, Aa as refuseMalformedResourcePropertiesForOrphan, Ac as isDockerClientEnvKey, Al as injectedAwsRegionValue, An as journaledOrphanPrintingBag, Ao as maskReadbackAtCoordinates, Ar as UNSPECIFIED_SKIP_REASON, As as TEMPLATE_SOURCED_RULES, At as dropFailedHint, Ba as repairMalformedResourcesForReadOnly, Bc as stripControlChars, Bi as hasReadableOrphans, Bn as PRE_DELETE_SNAPSHOT_TYPES, Bo as liveMatchesUnresolvedTokenFrame, Bs as crossPrefixDeniedWarning, C as recordRetainedForReadoption, Ca as refuseMalformedResourceEntriesForDestroy, Cc as describeDockerCapturedOutput, Ci as AWS_NO_VALUE, Cl as ownValue, Cn as collectDeclaredOutputNames, Cr as CUSTOM_RESOURCE_RESPONSE_LIFECYCLE_RULE_ID, Cs as recordNoEchoAttributeValues, D as withResourceDeadline, Da as refuseMalformedResourcePropertiesForDestroy, Dc as finchSecretArgvRefusal, Dl as renderAssemblyPathEscape, Dn as DEFAULT_RESOURCE_TIMEOUT_MS, Do as canonicalCoordinates, Dr as slowCcOperationTimeoutMs, Ds as STATE_SOURCED_BASELINE_RULES, E as serviceTokenBlockingReason, Ea as refuseMalformedResourceEntriesForOrphan, Ec as dockerSpawnEnvWithSensitive, Ei as refStateLookupFromResource, El as displayAssemblyPath, En as bindingSkippedOutputs, Eo as TemplateParser, Er as CloudControlProvider, Es as wholeStringLeavesOf, Et as collectNestedChildUnaddressed, F as PROTECTION_PROPERTY_BY_TYPE, Fa as repairMalformedOrphanRecordsForReadOnly, Fc as redactedDockerCause, Fi as UNREADABLE_ORPHANS_CONTAINER_ROW, Fn as secretNamedRecordNeedles, Fo as noEchoOutputsComparison, Fr as isWaitAbandonedError, Fs as S3StateBackend, Ft as sameJournaledOrphans, Ga as findActionableSilentDrops, Gc as synthesisStatusMessage, Gi as malformedDriftResourcePropertiesWarning, Gn as isFinalSnapshotError, Go as logOnlyValueCount, Gr as IntrinsicFunctionResolver, Gs as describeRegionValueKind, Gt as isJournaledOrphan, Ha as unreadableOrphanRecords, Hc as AssetManifestLoader, Hi as hasReadableResources, Hn as ccRoutedFinalSnapshotError, Ho as createUnionSecretMasker, Hs as isNotImplemented, Ht as removeProtectionTypeList, I as isProtectionValueActive, Ia as repairMalformedOrphansForReadOnly, Ic as runDockerForeground, Ii as UNREADABLE_RESOURCES_MAP_ROW, In as stateSecretNameNeedles, Is as rebuildClientForBucketRegion, It as replayFailedOperations, Jc as loadCdkJson, Ji as malformedLocalOutputsWarning, Jn as maskingRetryLogger, Jo as recordLogOnlyValue, Jr as refuseUnreadableCdkCrossAccountRefs, Js as hasReasonlessBaselineRefusal, Jt as planRollback, Kc as getDefaultStateBucketName, Ki as malformedExportNamesWarning, Kn as refusesFinalSnapshot, Ko as printingCorpusOf, Kr as poisonRenderedSpellingsCollidingIn, Ks as exportNamesCarriedFrom, Kt as isReplacementOrphan, L as perType, La as repairMalformedOutputsForReadOnly, Lc as runDockerStreaming, Li as accountArgs, Ln as storedSecretNameNeedles, Lo as readbackPathFor, Ls as CrossPrefixReadError, Lt as replayRollback, M as noEchoParameterNamesOf, Ma as refuseMalformedResourcesForDestroy, Mc as partitionSensitiveEnv, Mi as JSON_LISTING_HOLE_VALUE, Ml as resolveBucketRegion, Mn as orphanRecordsPrintingBag, Mo as maskedLeafCoordinatesOf, Mr as deleteLeftInPlace, Ms as isSingleDynamicReferenceToken, Mt as journaledOrphanLines, N as recordedProtectionEvidence, Na as refuseMalformedResourcesForExport, Nc as redactDockerArgvValues, Ni as STATE_REGION_DIVERGED, Nn as secretNamePrintingBag, No as noEchoCoordinatesOf, Nr as deleteSkipReason, Ns as LockManager, Nt as loadJournaledOrphans, O as diffSecurity, Oa as refuseMalformedResourcePropertiesForDrift, Oc as formatDockerLoginError, Oi as withSharedDrainBudget, Ol as resolveAssemblyPath, On as DEFAULT_RESOURCE_WARN_AFTER_MS, Oo as isMarkedCoordinate, Os as STATE_SOURCED_CROSS_GENERATION_RULES, Ot as withNestedStackContext, P as recordedProtectionNote, Pa as refuseMalformedState, Pc as redactedCause, Pi as STATE_RESOURCES_MALFORMED, Pn as secretNamePrintingBags, Po as noEchoLeavesOf, Ps as isLockInfoExpired, Pt as makeForeignHolderScan, Qa as shownType, Qc as resolveSkipPrefix, Qi as malformedOrphanRecordsWarning, Qo as maskSecretsInError, Qr as explicitRoleArnOrThrow, Qs as isReadableBag, Qt as resolveReplacementOldType, R as readProtection, Ra as repairMalformedResourceEntriesForReadOnly, Rc as warnFinchArgvExposure, Ri as deployRefusesOrphanRowsReason, Rn as extractDeploymentEventError, Ro as readsNoEchoSource, Rs as CrossPrefixScanCache, S as keptForReadoption, Sa as refuseMalformedResourceEntriesForDeploy, Sc as resolveDockerContextDirectory, Si as keepsSecretReferenceToken, Sl as nullPrototypeRecord, Sn as noEchoParameterValueSeed, Sr as withPrintingSecrets, Ss as recordMaskOnlyValuesIn, St as recordDisplacedSkips, T as findServiceTokenRefusals, Ta as refuseMalformedResourceEntriesForImportSave, Tc as describeDockerFailure, Ti as isStalePlaceholderArnAttribute, Tl as describeFileReadFailure, Tn as isExportAliasCollision, To as DagBuilder, Tr as customResourceResponseExpirationWarning, Ts as recordProvenPublicExpression, Tt as withNestedRevertRun, Ua as unreadableResourceEntries, Uc as getDockerImageBySourceHash, Ui as isReadableOrphanRecord, Un as createPreDeleteFinalSnapshot, Uo as hasMaskableValues, Ur as DiffCalculator, Us as splitImportedOps, Ut as recordAfterRollbackUpdate, Va as unpreviewableOrphanRecords, Vc as stripForDisplay, Vi as hasReadableOutputs, Vn as buildFinalSnapshotIdentifier, Vo as carryLogOnlyValues, Vs as isAccessDenied, Vt as withStackRecords, Wa as withheldAccountClause, Wc as Synthesizer, Wi as isReadableResourceEntry, Wn as effectiveDeletionPolicy, Wo as literalSplitDelimitersOf, Wr as INTRINSIC_KEYS, Ws as acceptedCreateOnlyDropsOf, Wt as demoteSupersededOrphans, Xa as hasNoCloudControlHandlers, Xc as resolveAutoAssetStorage, Xi as malformedLocalResourcesWarning, Xn as findDestructiveChanges, Xo as createSecretMasker, Xr as assertFlagRoleArn, Xs as importableOutputKeys, Xt as recordUnderIdIsNotOwn, Ya as NO_CC_HANDLERS_REASON, Yc as resolveApp, Yi as malformedLocalResourceEntriesWarning, Yn as constructPathOf, Yo as shareLogOnlyValues, Yr as applyRoleArnIfSet, Ys as hasUnverifiableParameterRefusal, Yt as recheckFailedPlan, Za as findReplacedReadersOfRecreateTargets, Zc as resolveCaptureObservedState, Zi as malformedOrphanRecordsRefusalMessage, Zn as formatDestructiveChange, Zo as errorCauseChain, Zr as assertSendableRoleArn, Zs as importableOutputs, Zt as replacementNeverSwapped, _ as makeCanonicalizePropertiesFn, _a as refuseMalformedOrphansForOrphan, _c as readBootstrapMarkerBody, _i as getAccountInfo, _l as StageLoadError, _n as secretSafeKeyDisplay, _r as wouldReturnToSdkProvider, _s as recordPhysicalNameCopy, _t as displacedOpClause, a as findNestedTemplateTreeDefect, aa as malformedResourceEntriesWarning, ac as WorkGraph, al as CFN_TEMPLATE_BODY_LIMIT, as as withPhysicalNameCopies, at as cyan, ba as refuseMalformedResourceAttributesForOrphan, bc as buildDenyExternalAccessPolicy, bi as carriesFetchableDynamicReference, bl as hasOwnKey, bn as exportNameSecretExposure, bo as describeTypeWithThrottleRetry, br as isCustomResourceType$1, bs as provenPublicValue, c as renderNestedTemplateTreeDefect, ca as malformedScrubResourceEntriesRefusalMessage, cc as loadPublishableAssetManifest, cl as findLargeInlineResources, cn as updatePartialMessage, cs as dynamicReferenceTokens, ct as red, d as conditionInputsFrom, da as refuseDivergentRecordRegionForDestroy, dc as BOOTSTRAP_MARKER_PREFIX, di as classifyReplaySecretRegion, dl as decodeListingKey, dn as DeploymentEventsStore, ds as identityKeyFor, dt as namesAnyDeclaredParameter, ea as malformedOrphansRefusalMessage, ec as orphansCarriedFrom, ei as sendableAssumeRoleCommand, el as resolveStateBucketWithDefaultAndSource, en as orphanDeleteNeedsIdentity, eo as isStatefulRecreateTargetForReplace, er as ledgerForStack, es as markSameGenerationBag, f as parentSuppliedValues, fc as assertAssetBucketRegion, fi as producerRegionsFromState, fl as expectedOwnerParam, fn as WITHHELD_NAME_DISPLAY, fs as inheritNestedStackParameterAssociations, ft as reachableDivergentParameters, g as mergeNoChangeOutputs, ga as refuseMalformedOrphansForDestroy, gc as parseBootstrapMarker, gi as parameterTypeMayLoseSecretIdentity, gl as AssemblyReader, gn as secretBearingStateKeyWarning, gr as isCustomResource, gt as NESTED_PENDING_PARENT_REASON, h as keptWholeReasonText, ha as refuseMalformedOrphans, hc as isCrossRegionRedirect, hi as isUnboundTemplateParameter, hl as derivePartitionAndUrlSuffix, hn as secretBearing, hr as ccBrokenReason, hs as physicalNameCopiesOf, ht as planOrphanAdoption, i as childTemplateLoader, ia as malformedRenderedContainersWarning, ic as stringifyValue, ii as envCredentialsAreAssumedRole, il as ssmResolvedValueType, is as scrubResourceRecord, it as bold, j as noEchoExactEchoLeavesOf, ja as refuseMalformedResourcesForDeploy, jc as isMalformedEnvKey, ji as declaresNoEcho, jn as maskEventTextWithBoundBags, jo as maskWholeValue, jr as deleteIndeterminateGuards, js as WHOLE_DYNAMIC_REFERENCE_PATTERN, jt as isHandledOrphan, k as noEchoAttributeNamesOf, ka as refuseMalformedResourcePropertiesForExport, kc as getDockerCmd, ki as parameterInputsFor, kl as injectAwsRegion, kn as completedReplayEntries, ko as maskAtCoordinates, kr as RollbackInlinePolicyWriters, ks as STATE_SOURCED_READBACK_RULES, kt as deleteJournaledOrphans, l as templateIdentity, la as malformedStateRefusalMessage, lc as rewriteTemplateAssetReferences, ll as uploadCfnTemplate, ln as updatePartialReason, ls as isUncertifiedBaselineMaskPosition, lt as yellow, m as isSecretBearingReferenceString, ma as refuseMalformedOrphanRecordsForDestroy, mc as getBootstrapMarkerKey, mi as coerceParameterTypedValue, ml as canonicalizeRegion, mn as exportAliasCollisionScrubWarning, mr as ProviderRegistry, mt as makeSiblingClaimReader, n as IMPLICIT_DELETE_DEPENDENCIES, na as malformedOutputsRefusalMessage, nc as AssetPublisher, ni as applyCallerIdentityCredentials, nl as stateBucketExistenceConfirmed, no as renderStatefulReason, nr as withCreateTokenLedger, nt as formatResourceLine, o as isAbsoluteAssetPath, oa as malformedResourcePropertiesWarning, oc as buildAssetRedirectMap, ol as CFN_TEMPLATE_URL_LIMIT, ot as gray, p as readRecordedConditionVerdicts, pa as refuseMalformedOrphanRecords, pc as ensureAssetStorage, pi as regionLessSecretName, pl as PARTITION_TABLE, pn as displayTextOrWithheld, pr as CC_BROKEN_REASON, ps as recordNestedStackParameterExpressions, pt as resourcesNamingDeclaredParameter, qa as unwrittenCreateOnlyReplacement, qc as getLegacyStateBucketName, qi as malformedExportSourceWarning, qn as unsupportedFinalSnapshotError, qo as recordLogOnlyParameterValue, qr as producerLookupOver, qs as hasReadableExportSet, qt as planFailedOps, r as computeImplicitDeleteEdges, ra as malformedOutputsWarning, rc as isSensitiveAttributeName, ri as callerEnvCredentials, rl as warnDeprecatedNoPrefixCliFlag, rn as inheritProducerRegions, rs as redactSecretsForState, rt as createReadOnlyAttributeHealerFactory, s as listNestedTemplateRows, sa as malformedResourcesWarning, sc as createAssetRedirectResolver, sl as MIGRATE_TMP_PREFIX, ss as DYNAMIC_REFERENCE_TOKEN_SCAN, st as green, t as DeployEngine, ta as malformedOrphansWarning, tc as shouldRetainResource, ti as AWS_CREDENTIAL_ENV_KEYS, tl as resolveUseCdkBootstrapAssets, tn as findNestedStackTypeChanges, to as isStatefulRecreateTargetSync, u as conditionFingerprint, ua as previewableOrphanRecords, uc as AssetModeResolver, ul as CUSTOM_RESOURCE_RESPONSE_OBJECT_DESCRIPTION, un as DeploymentEventsReader, us as pathCrossesDottedKey, ut as computeParameterTaint, va as refuseMalformedOutputs, vc as validateAssetBucketName, vi as isImpossibleEmptyStoredAttribute, vl as processStackMessages, vn as carriedExportAliasExposure, vo as prefetchCreateOnlyPropertyPaths, vr as TemplateNoEchoReresolver, vs as splitGetAttStringForm, vt as displacedPhysicalIdShown, w as deferredServiceTokenWarning, wa as refuseMalformedResourceEntriesForImport, wc as describeDockerExecFailure, wi as cfnRefValueFromPhysicalId, wl as absoluteAssemblyPathEscape, wn as collectPublishedOutputNames, wr as applyCustomResourceResponseExpiration, ws as recordNoEchoParameterFreshValue, wt as revertedNestedRowIds, xa as refuseMalformedResourceEntries, xc as buildDockerImage, xi as isNamelessDynamicReferenceError, xl as hasPlainPrototype, xn as isWholeDynamicReferenceValue, xo as withRetry, xs as recordMaskOnlyValue, xt as nestedChildStackName$1, ya as refuseMalformedOutputsForDestroy, yc as validateContainerRepoName, yi as carriesDynamicReference, yl as defineOwnKey, yn as exportNameNoEchoParameters, yo as templateResourceTypes, yr as readsNoEchoDeleteValues, ys as carriesSecretMask, yt as dropSettledNestedJournals, za as repairMalformedResourcePropertiesForReadOnly, zc as escapeRegExp, zi as displayLogicalId, zn as ATOMIC_FINAL_SNAPSHOT_TYPES, zo as valueAtCoordinate, zs as applyCrossPrefixScan, zt as destroyStackRecordsView } from "./deploy-engine-4K_B3N08.js";
6
+ import { t as getCdkdVersion } from "./version-DUCWZskc.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-BEIwSimv.js");
2564
+ providerClasses ??= import("./provider-classes-DxHQcC1K.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: [],
@@ -19031,7 +19120,7 @@ async function rollbackCommand(stackArg, options) {
19031
19120
  const { skippedOutputs: _droppedByRollback, ...carriedState } = baseState;
19032
19121
  const next = () => ({
19033
19122
  ...carriedState,
19034
- version: 11,
19123
+ version: 12,
19035
19124
  region,
19036
19125
  resources: { ...stateResources },
19037
19126
  ...orphansAfterRollback(baseState, mintedOrphans),
@@ -20656,46 +20745,54 @@ async function importCommand(stackArg, options) {
20656
20745
  }
20657
20746
  }));
20658
20747
  try {
20659
- const rows = [];
20660
- for (const { logicalId, resource } of resources) {
20661
- if (selectiveMode && !overrides.has(logicalId)) {
20662
- rows.push({
20748
+ const collectRows = async () => {
20749
+ const collected = [];
20750
+ for (const { logicalId, resource } of resources) {
20751
+ if (selectiveMode && !overrides.has(logicalId)) {
20752
+ collected.push({
20753
+ logicalId,
20754
+ resourceType: resource.Type,
20755
+ outcome: "skipped-out-of-scope",
20756
+ reason: "not in --resource / --resource-mapping (use --auto to include)"
20757
+ });
20758
+ continue;
20759
+ }
20760
+ if (resource.Type === "AWS::CloudFormation::Stack" && migrationTree && migrationTree.nested.has(logicalId) && accountIdForNestedSynth) {
20761
+ collected.push({
20762
+ logicalId,
20763
+ resourceType: resource.Type,
20764
+ outcome: "imported",
20765
+ physicalId: synthesizeNestedStackArn(targetRegion, accountIdForNestedSynth, stackInfo.stackName, logicalId)
20766
+ });
20767
+ continue;
20768
+ }
20769
+ const outcome = await importOne({
20663
20770
  logicalId,
20664
- resourceType: resource.Type,
20665
- outcome: "skipped-out-of-scope",
20666
- reason: "not in --resource / --resource-mapping (use --auto to include)"
20771
+ resource,
20772
+ stackName: stackInfo.stackName,
20773
+ region: targetRegion,
20774
+ providerRegistry,
20775
+ override: overrides.get(logicalId),
20776
+ overrides
20667
20777
  });
20668
- continue;
20778
+ collected.push(outcome);
20669
20779
  }
20670
- if (resource.Type === "AWS::CloudFormation::Stack" && migrationTree && migrationTree.nested.has(logicalId) && accountIdForNestedSynth) {
20671
- rows.push({
20672
- logicalId,
20673
- resourceType: resource.Type,
20674
- outcome: "imported",
20675
- physicalId: synthesizeNestedStackArn(targetRegion, accountIdForNestedSynth, stackInfo.stackName, logicalId)
20676
- });
20677
- continue;
20678
- }
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
- }
20780
+ return collected;
20781
+ };
20782
+ let rows = await collectRows();
20690
20783
  printSummary(rows);
20691
20784
  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);
20785
+ const assembleStackState = () => {
20786
+ const assembled = buildStackState(stackInfo.stackName, targetRegion, rows, templateParser, stateTemplate, existingState, selectiveMode);
20787
+ refuseMalformedResourceEntriesForImportSave(assembled, stackInfo.stackName, targetRegion, lockRecovery);
20788
+ return assembled;
20789
+ };
20790
+ let stackState = assembleStackState();
20694
20791
  if (options.dryRun) {
20695
20792
  logger.info("--dry-run: state will NOT be written. Re-run without --dry-run to apply.");
20696
20793
  return;
20697
20794
  }
20698
- const importedRows = rows.filter((r) => r.outcome === "imported");
20795
+ let importedRows = rows.filter((r) => r.outcome === "imported");
20699
20796
  if (importedRows.length === 0) {
20700
20797
  logger.warn("No resources were successfully imported. State will not be written.");
20701
20798
  return;
@@ -20710,8 +20807,54 @@ async function importCommand(stackArg, options) {
20710
20807
  return;
20711
20808
  }
20712
20809
  }
20810
+ let retireCfnStack = false;
20811
+ let nestedReplaced = [];
20812
+ if (migrationCfnStackName) {
20813
+ warnMigrationOrphans(logger, resources.length, importedRows.length);
20814
+ const preparation = await prepareCloudFormationStackRetirement({
20815
+ cfnStackName: migrationCfnStackName,
20816
+ cfnClient: regionClients.cloudFormation,
20817
+ yes: options.yes,
20818
+ stateBucket,
20819
+ ...options.profile && { s3ClientOpts: { profile: options.profile } },
20820
+ ...migrationTree && { resourceTree: migrationTree }
20821
+ });
20822
+ retireCfnStack = preparation.outcome === "ready";
20823
+ if (preparation.outcome === "ready" && preparation.templateUpdated && migrationTree) {
20824
+ let updatedTree;
20825
+ try {
20826
+ updatedTree = await getCloudFormationResourceTree(migrationCfnStackName, regionClients.cloudFormation);
20827
+ } catch (err) {
20828
+ 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);
20829
+ }
20830
+ const replaced = findReplacedCfnResources(migrationTree, updatedTree).filter((r) => r.nestedPath.length > 0 || templateLogicalIds.has(r.logicalId) && template.Resources[r.logicalId]?.Type !== "AWS::CloudFormation::Stack");
20831
+ migrationTree = updatedTree;
20832
+ nestedReplaced = replaced.filter((r) => r.nestedPath.length > 0);
20833
+ for (const r of replaced) {
20834
+ const where = r.nestedPath.length > 0 ? safeMsg`nested stack ${r.nestedPath.map((p) => logicalIdShown(p)).join(" > ")}: ` : "";
20835
+ const pinned = r.nestedPath.length === 0 && overrides.has(r.logicalId) && overrides.get(r.logicalId) !== r.before;
20836
+ if (r.nestedPath.length === 0 && overrides.get(r.logicalId) === r.before) overrides.set(r.logicalId, r.after);
20837
+ 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.`);
20838
+ }
20839
+ if (replaced.some((r) => r.nestedPath.length === 0)) {
20840
+ rows = await collectRows();
20841
+ printSummary(rows);
20842
+ stackState = assembleStackState();
20843
+ const adoptedBefore = importedRows.map((r) => r.logicalId);
20844
+ importedRows = rows.filter((r) => r.outcome === "imported");
20845
+ const adoptedNow = new Set(importedRows.map((r) => r.logicalId));
20846
+ if (options.recordResourceMapping) writeRecordedMapping(options.recordResourceMapping, rows);
20847
+ refuseLostReplacedRows(adoptedBefore.filter((id) => !adoptedNow.has(id)), "cdkd state was not written and the CloudFormation stack was not deleted.");
20848
+ if (importedRows.length !== adoptedBefore.length) {
20849
+ logger.warn(safeMsg`--migrate-from-cloudformation: the re-import after the replacement adopts ` + safeMsg`${importedRows.length} resource(s); ${adoptedBefore.length} were confirmed.`);
20850
+ warnMigrationOrphans(logger, resources.length, importedRows.length);
20851
+ }
20852
+ }
20853
+ }
20854
+ }
20713
20855
  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));
20856
+ const unsafeObservedBaselineLogicalIds = await withSharedDrainBudget(() => resolveImportedProperties(stackState, stateTemplate, targetRegion, stateBackend, logger, deployedParameters));
20857
+ await captureObservedForImportedResources(stackState, providerRegistry, logger, unsafeObservedBaselineLogicalIds, rebuiltLogicalIdsFrom(rows, stateTemplate));
20715
20858
  const saveOptions = {};
20716
20859
  if (existingEtag) saveOptions.expectedEtag = existingEtag;
20717
20860
  if (migrationPending) saveOptions.migrateLegacy = true;
@@ -20726,6 +20869,8 @@ async function importCommand(stackArg, options) {
20726
20869
  parentRegion: targetRegion,
20727
20870
  parentNestedTemplates: stackInfo.nestedTemplates ?? nullPrototypeRecord(),
20728
20871
  parentTree: migrationTree,
20872
+ nestedPath: [],
20873
+ replaced: nestedReplaced,
20729
20874
  stateBackend,
20730
20875
  lockManager,
20731
20876
  providerRegistry,
@@ -20736,18 +20881,7 @@ async function importCommand(stackArg, options) {
20736
20881
  assetRedirect,
20737
20882
  cfnClient: regionClients.cloudFormation
20738
20883
  });
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
- }
20884
+ if (migrationCfnStackName && retireCfnStack) await deleteRetiredCloudFormationStack(migrationCfnStackName, regionClients.cloudFormation);
20751
20885
  } finally {
20752
20886
  await lockManager.releaseLock(stackInfo.stackName, targetRegion).catch((err) => {
20753
20887
  logger.warn(`Failed to release lock: ${describeAwsFailure(err).detail}`);
@@ -21178,12 +21312,13 @@ function buildStackState(stackName, region, rows, templateParser, template, exis
21178
21312
  }
21179
21313
  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
21314
  return {
21181
- version: 11,
21315
+ version: 12,
21182
21316
  stackName,
21183
21317
  region,
21184
21318
  resources,
21185
21319
  outputs: existingState?.outputs ?? {},
21186
21320
  ...existingState ? exportNamesCarriedFrom(existingState) : { exportNames: [] },
21321
+ ...existingState?.outputReferenceProvenance !== void 0 && { outputReferenceProvenance: existingState.outputReferenceProvenance },
21187
21322
  ...existingState ? orphansCarriedFrom(existingState) : {},
21188
21323
  lastModified: Date.now()
21189
21324
  };
@@ -21462,6 +21597,15 @@ function resolveDiscardsNonInertSubtree(node, conditions, mappings) {
21462
21597
  }
21463
21598
  return keys.some((key) => resolveDiscardsNonInertSubtree(record[key], conditions, mappings));
21464
21599
  }
21600
+ function warnMigrationOrphans(logger, total, imported, where) {
21601
+ const orphaned = total - imported;
21602
+ if (orphaned <= 0) return;
21603
+ 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.`);
21604
+ }
21605
+ function refuseLostReplacedRows(lost, written) {
21606
+ if (lost.length === 0) return;
21607
+ 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.`);
21608
+ }
21465
21609
  function printSummary(rows) {
21466
21610
  const logger = getLogger();
21467
21611
  const counts = {
@@ -21495,7 +21639,7 @@ async function confirmPrompt(prompt) {
21495
21639
  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
21640
  }
21497
21641
  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));
21642
+ 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
21643
  [
21500
21644
  ...commonOptions,
21501
21645
  ...appOptions,
@@ -21617,6 +21761,10 @@ async function importNestedStackChildrenRecursive(args) {
21617
21761
  });
21618
21762
  rows.push(outcome);
21619
21763
  }
21764
+ const childPath = [...args.nestedPath, childLogicalId];
21765
+ const childImported = new Set(rows.filter((r) => r.outcome === "imported").map((r) => r.logicalId));
21766
+ 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.");
21767
+ warnMigrationOrphans(logger, childResources.length, childImported.size, childStackName);
21620
21768
  const childStackState = buildStackState(childStackName, childRegion, rows, templateParser, childStateTemplate, null, false);
21621
21769
  childStackState.parentStack = parentStackName;
21622
21770
  childStackState.parentLogicalId = childLogicalId;
@@ -21632,6 +21780,8 @@ async function importNestedStackChildrenRecursive(args) {
21632
21780
  parentRegion: childRegion,
21633
21781
  parentNestedTemplates: indexGrandchildTemplatePaths(childStateTemplate, childTemplatePath),
21634
21782
  parentTree: childTreeNode,
21783
+ nestedPath: [...args.nestedPath, childLogicalId],
21784
+ replaced: args.replaced,
21635
21785
  stateBackend,
21636
21786
  lockManager,
21637
21787
  providerRegistry,
@@ -21681,12 +21831,24 @@ function constructPathField(path) {
21681
21831
  }
21682
21832
 
21683
21833
  //#endregion
21684
- //#region src/cli/commands/local-aws-failure.ts
21834
+ //#region src/utils/local-aws-failure.ts
21685
21835
  function describeLocalAwsFailureForWarn(err, operation) {
21686
- if (err instanceof CdkdError) return displaySafe(err.message);
21836
+ if (err instanceof CdkdError) return withoutTrailingPeriod(displaySafe(err.message));
21687
21837
  const rendered = describeAwsFailureForWarn(err, operation);
21688
21838
  if (rendered === describeCredentialLoadFailure(err)) getLogger().debug(safeMsg`${operation}: the AWS SDK's own failure message was: ${thrownText(err)}`);
21689
- return displaySafe(rendered);
21839
+ return withoutTrailingPeriod(displaySafe(rendered));
21840
+ }
21841
+ function withoutTrailingPeriod(text) {
21842
+ return text.endsWith(".") && !text.endsWith("..") ? text.slice(0, -1) : text;
21843
+ }
21844
+ function redactedAwsCause(err, message) {
21845
+ if (!(err instanceof Error)) return void 0;
21846
+ let source = err;
21847
+ if (err instanceof CdkdError) for (let depth = 0; depth < 3 && source.cause instanceof Error && !hasSdkMetadata(source); depth++) source = source.cause;
21848
+ return redactedCause(source, message);
21849
+ }
21850
+ function hasSdkMetadata(error) {
21851
+ return error.$metadata !== void 0;
21690
21852
  }
21691
21853
  function thrownText(err) {
21692
21854
  try {
@@ -21707,7 +21869,7 @@ async function loadStateForStack(stackName, synthRegion, opts) {
21707
21869
  try {
21708
21870
  stateBucket = await resolveStateBucketWithDefault(opts.stateBucket, region);
21709
21871
  } catch (err) {
21710
- logger.warn(`${prefix}: could not resolve state bucket: ${err instanceof Error ? err.message : String(err)}. Falling back.`);
21872
+ logger.warn(`${prefix}: could not resolve state bucket: ${describeLocalAwsFailureForWarn(err, "state bucket resolution")}. Falling back.`);
21711
21873
  return;
21712
21874
  }
21713
21875
  const awsClients = new AwsClients({
@@ -21724,7 +21886,11 @@ async function loadStateForStack(stackName, synthRegion, opts) {
21724
21886
  ...clientRegion !== void 0 && { region: clientRegion },
21725
21887
  ...opts.profile !== void 0 && { profile: opts.profile }
21726
21888
  });
21727
- await stateBackend.verifyBucketExists();
21889
+ try {
21890
+ await stateBackend.verifyBucketExists();
21891
+ } catch (err) {
21892
+ throw new StateError(`${prefix}: could not access state bucket ${displayIdent(stateBucket)}: ${describeStateBucketAccessFailure(err)}.`, redactedAwsCause(err, "S3 HeadBucket (state bucket) failed"));
21893
+ }
21728
21894
  const refs = (await stateBackend.listStacks()).filter((r) => r.stackName === stackName);
21729
21895
  if (refs.length === 0) {
21730
21896
  logger.warn(`${prefix}: no cdkd state found for stack '${stackName}' in bucket '${stateBucket}'. Was it deployed via 'cdkd deploy'? Falling back.`);
@@ -21827,7 +21993,7 @@ async function buildCrossStackResolver(consumerRegion, opts) {
21827
21993
  try {
21828
21994
  stateBucket = await resolveStateBucketWithDefault(opts.stateBucket, canonicalizeRegion(consumerRegion));
21829
21995
  } catch (err) {
21830
- logger.warn(`${prefix}: cross-stack resolver could not resolve state bucket: ${err instanceof Error ? err.message : String(err)}. Fn::ImportValue / Fn::GetStackOutput env entries will warn-and-drop.`);
21996
+ logger.warn(`${prefix}: cross-stack resolver could not resolve state bucket: ${describeLocalAwsFailureForWarn(err, "state bucket resolution")}. Fn::ImportValue / Fn::GetStackOutput env entries will warn-and-drop.`);
21831
21997
  return;
21832
21998
  }
21833
21999
  const clientRegion = canonicalizeRegion(opts.region) || void 0;
@@ -21847,7 +22013,7 @@ async function buildCrossStackResolver(consumerRegion, opts) {
21847
22013
  await stateBackend.verifyBucketExists();
21848
22014
  } catch (err) {
21849
22015
  awsClients.destroy();
21850
- logger.warn(`${prefix}: cross-stack resolver could not access state bucket '${stateBucket}': ${err instanceof Error ? err.message : String(err)}. Fn::ImportValue / Fn::GetStackOutput env entries will warn-and-drop.`);
22016
+ logger.warn(`${prefix}: cross-stack resolver could not access state bucket ${displayIdent(stateBucket)}: ${describeStateBucketAccessFailure(err)}. Fn::ImportValue / Fn::GetStackOutput env entries will warn-and-drop.`);
21851
22017
  return;
21852
22018
  }
21853
22019
  const exportIndex = new ExportIndexStore(awsClients.s3, stateBucket, opts.statePrefix, consumerRegion, stateBackend, { profile: opts.profile });
@@ -21943,6 +22109,15 @@ async function buildCrossStackResolver(consumerRegion, opts) {
21943
22109
  }
21944
22110
  };
21945
22111
  }
22112
+ function describeStateBucketAccessFailure(err) {
22113
+ const operation = "S3 HeadBucket (state bucket)";
22114
+ if (!(err instanceof CdkdError) || err.cause === void 0) return describeLocalAwsFailureForWarn(err, operation);
22115
+ const cause = err.cause;
22116
+ if (cause.name === "NotFound" || cause.name === "NoSuchBucket") return describeLocalAwsFailureForWarn(err, operation);
22117
+ const inner = cause.cause;
22118
+ if (!(cause instanceof CdkdError) && inner instanceof Error && (inner.name === "Unknown" || inner.message === "UnknownError")) return describeLocalAwsFailureForWarn(new CdkdError(cause.message, "STATE_ERROR"), operation);
22119
+ return describeLocalAwsFailureForWarn(cause, operation);
22120
+ }
21946
22121
 
21947
22122
  //#endregion
21948
22123
  //#region src/local/s3-local-state-provider.ts
@@ -23611,6 +23786,10 @@ async function pullEcrImage(imageUri, options) {
23611
23786
  if (!identity.Account) throw new LocalInvokeBuildError$1("STS GetCallerIdentity returned no Account. Verify your AWS credentials.");
23612
23787
  callerAccount = identity.Account;
23613
23788
  CALLER_IDENTITY_CACHE.set(callerIdentityKey, callerAccount);
23789
+ } catch (err) {
23790
+ if (err instanceof LocalInvokeBuildError$1) throw err;
23791
+ const rendered = describeLocalAwsFailureForWarn(err, "STS GetCallerIdentity (ECR pull)");
23792
+ throw new LocalInvokeBuildError$1(`STS GetCallerIdentity failed while preparing the ECR pull: ${rendered}. Verify your AWS credentials.`, redactedAwsCause(err, "STS GetCallerIdentity failed"));
23614
23793
  } finally {
23615
23794
  sts.destroy();
23616
23795
  }
@@ -23681,8 +23860,8 @@ async function assumeRoleForEcr(roleArn, callerRegion, credentialConfig, logger)
23681
23860
  };
23682
23861
  } catch (err) {
23683
23862
  if (err instanceof LocalInvokeBuildError$1) throw err;
23684
- const reason = err instanceof Error ? err.message : String(err);
23685
- throw new LocalInvokeBuildError$1(`Failed to assume role ${displayIdent(roleArn, { maxCodePoints: 613 })} for ECR pull: ${displaySafe(reason)}. Verify the role exists and its trust policy permits the caller's identity to assume it.`, err instanceof Error ? err : void 0);
23863
+ const rendered = describeLocalAwsFailureForWarn(err, "STS AssumeRole (ECR pull)");
23864
+ throw new LocalInvokeBuildError$1(`Failed to assume role ${displayIdent(roleArn, { maxCodePoints: 613 })} for ECR pull: ${rendered}. Verify the role exists and its trust policy permits the caller's identity to assume it.`, redactedAwsCause(err, "STS AssumeRole failed"));
23686
23865
  } finally {
23687
23866
  sts.destroy();
23688
23867
  }
@@ -23690,7 +23869,14 @@ async function assumeRoleForEcr(roleArn, callerRegion, credentialConfig, logger)
23690
23869
  async function ecrLogin(client, target) {
23691
23870
  const { accountId, region, registryHost } = target;
23692
23871
  getLogger().child("ecr-puller").debug(`ECR login (account=${accountId}, region=${region}, host=${registryHost})`);
23693
- const authData = (await client.send(new GetAuthorizationTokenCommand({}))).authorizationData?.[0];
23872
+ let response;
23873
+ try {
23874
+ response = await client.send(new GetAuthorizationTokenCommand({}));
23875
+ } catch (err) {
23876
+ const rendered = describeLocalAwsFailureForWarn(err, "ECR GetAuthorizationToken");
23877
+ throw new LocalInvokeBuildError$1(`ECR GetAuthorizationToken failed (account=${displayIdent(accountId)}, region=${displayIdent(region)}): ${rendered}. Verify the credentials can call ecr:GetAuthorizationToken.`, redactedAwsCause(err, "ECR GetAuthorizationToken failed"));
23878
+ }
23879
+ const authData = response.authorizationData?.[0];
23694
23880
  if (!authData?.authorizationToken) throw new LocalInvokeBuildError$1("Failed to get ECR authorization token");
23695
23881
  const [username, password] = Buffer.from(authData.authorizationToken, "base64").toString().split(":");
23696
23882
  if (!username || password === void 0) throw new LocalInvokeBuildError$1("ECR authorization token has unexpected shape (missing username/password)");
@@ -25515,19 +25701,21 @@ async function resolveProfileCredentials(profile) {
25515
25701
  }),
25516
25702
  profile
25517
25703
  });
25704
+ const shownProfile = displayIdent(profile);
25705
+ const ssoHint = isPasteableIdent(profile) ? "run `aws sso login --profile " + profile + "`" : "run `aws sso login` for that profile -- cdkd is not writing the command out, because it cannot vouch that the name as rendered is the one your shell would act on";
25518
25706
  try {
25519
25707
  const credsProvider = sts.config.credentials;
25520
25708
  const creds = typeof credsProvider === "function" ? await credsProvider() : credsProvider;
25521
- if (!creds || !creds.accessKeyId || !creds.secretAccessKey) {
25522
- const shownProfile = displayIdent(profile);
25523
- const ssoHint = isPasteableIdent(profile) ? "run `aws sso login --profile " + profile + "`" : "run `aws sso login` for that profile -- cdkd is not writing the command out, because it cannot vouch that the name as rendered is the one your shell would act on";
25524
- throw new Error(`--profile ${shownProfile}: credential provider chain resolved without usable credentials. For SSO profiles, ${ssoHint}. For regular profiles, check \`~/.aws/credentials\` / \`~/.aws/config\`.`);
25525
- }
25709
+ if (!creds || !creds.accessKeyId || !creds.secretAccessKey) throw new CdkdError(`--profile ${shownProfile}: credential provider chain resolved without usable credentials. For SSO profiles, ${ssoHint}. For regular profiles, check \`~/.aws/credentials\` / \`~/.aws/config\`.`, "LOCAL_PROFILE_CREDENTIALS_UNUSABLE");
25526
25710
  return {
25527
25711
  accessKeyId: creds.accessKeyId,
25528
25712
  secretAccessKey: creds.secretAccessKey,
25529
25713
  ...creds.sessionToken && { sessionToken: creds.sessionToken }
25530
25714
  };
25715
+ } catch (err) {
25716
+ if (err instanceof CdkdError) throw err;
25717
+ const rendered = describeLocalAwsFailureForWarn(err, "--profile credential resolution");
25718
+ throw new CdkdError(`--profile ${shownProfile}: could not resolve the profile's credentials: ${rendered}. For SSO profiles, ${ssoHint}.`, "LOCAL_PROFILE_CREDENTIALS_FAILED", redactedAwsCause(err, "credential resolution failed"));
25531
25719
  } finally {
25532
25720
  sts.destroy();
25533
25721
  }
@@ -25549,12 +25737,16 @@ async function assumeLambdaExecutionRole$1(roleArn, region) {
25549
25737
  RoleSessionName: `cdkd-local-start-api-${Date.now()}`,
25550
25738
  DurationSeconds: 3600
25551
25739
  }))).Credentials;
25552
- if (!creds?.AccessKeyId || !creds.SecretAccessKey || !creds.SessionToken) throw new Error(`AssumeRole(${displayIdent(roleArn, { maxCodePoints: 613 })}) returned no usable credentials.`);
25740
+ if (!creds?.AccessKeyId || !creds.SecretAccessKey || !creds.SessionToken) throw new CdkdError(`AssumeRole(${displayIdent(roleArn, { maxCodePoints: 613 })}) returned no usable credentials.`, "LOCAL_START_API_ASSUMEROLE_NO_CREDS");
25553
25741
  return {
25554
25742
  accessKeyId: creds.AccessKeyId,
25555
25743
  secretAccessKey: creds.SecretAccessKey,
25556
25744
  sessionToken: creds.SessionToken
25557
25745
  };
25746
+ } catch (err) {
25747
+ if (err instanceof CdkdError) throw err;
25748
+ const rendered = describeLocalAwsFailureForWarn(err, "STS AssumeRole");
25749
+ throw new CdkdError(`--assume-role: STS AssumeRole(${displayIdent(roleArn, { maxCodePoints: 613 })}) failed: ${rendered}.`, "LOCAL_START_API_ASSUMEROLE_FAILED", redactedAwsCause(err, "STS AssumeRole failed"));
25558
25750
  } finally {
25559
25751
  sts.destroy();
25560
25752
  }
@@ -25979,7 +26171,7 @@ async function resolveSecretsManager(entry, shape, client) {
25979
26171
  try {
25980
26172
  secretString = (await client.send(new GetSecretValueCommand({ SecretId: shape.baseArn }))).SecretString;
25981
26173
  } catch (err) {
25982
- throw new EcsSecretsResolutionError(`Failed to resolve Secrets Manager secret for container ${displayIdent(entry.containerName)} / env ${displayIdent(entry.name)} (${displayIdent(shape.baseArn, { maxCodePoints: SECRET_REF_MAX_CODE_POINTS })}): ${displaySafe(err instanceof Error ? err.message : String(err))}`);
26174
+ throw new EcsSecretsResolutionError(`Failed to resolve Secrets Manager secret for container ${displayIdent(entry.containerName)} / env ${displayIdent(entry.name)} (${displayIdent(shape.baseArn, { maxCodePoints: SECRET_REF_MAX_CODE_POINTS })}): ${describeLocalAwsFailureForWarn(err, "SecretsManager GetSecretValue")}.`);
25983
26175
  }
25984
26176
  if (secretString === void 0) throw new EcsSecretsResolutionError(`Secrets Manager returned no SecretString for container ${displayIdent(entry.containerName)} / env ${displayIdent(entry.name)} (${displayIdent(shape.baseArn, { maxCodePoints: SECRET_REF_MAX_CODE_POINTS })}). Binary secrets are not supported.`);
25985
26177
  if (shape.jsonKey === void 0) return secretString;
@@ -26005,7 +26197,7 @@ async function resolveSsm(entry, shape, client) {
26005
26197
  return value;
26006
26198
  } catch (err) {
26007
26199
  if (err instanceof EcsSecretsResolutionError) throw err;
26008
- throw new EcsSecretsResolutionError(`Failed to resolve SSM parameter for container ${displayIdent(entry.containerName)} / env ${displayIdent(entry.name)} (${displayIdent(shape.name, { maxCodePoints: SECRET_REF_MAX_CODE_POINTS })}): ${displaySafe(err instanceof Error ? err.message : String(err))}`);
26200
+ throw new EcsSecretsResolutionError(`Failed to resolve SSM parameter for container ${displayIdent(entry.containerName)} / env ${displayIdent(entry.name)} (${displayIdent(shape.name, { maxCodePoints: SECRET_REF_MAX_CODE_POINTS })}): ${describeLocalAwsFailureForWarn(err, "SSM GetParameter")}.`);
26009
26201
  }
26010
26202
  }
26011
26203
 
@@ -26881,8 +27073,12 @@ async function resolvePlaceholderAccount(arn, source) {
26881
27073
  });
26882
27074
  try {
26883
27075
  const account = (await sts.send(new GetCallerIdentityCommand({}))).Account;
26884
- if (!account) throw new Error(`--assume-task-role: GetCallerIdentity returned no Account; cannot resolve placeholder ARN ${plainIdentOr(arn, VALUE_NOT_SHOWN, { maxCodePoints: 613 })}. Pass the ARN explicitly: --assume-task-role '<arn>'`);
27076
+ if (!account) throw new CdkdError(`--assume-task-role: GetCallerIdentity returned no Account; cannot resolve placeholder ARN ${plainIdentOr(arn, VALUE_NOT_SHOWN, { maxCodePoints: 613 })}. Pass the ARN explicitly: --assume-task-role '<arn>'`, "LOCAL_RUN_TASK_PLACEHOLDER_NO_ACCOUNT");
26885
27077
  return arn.split(TASK_ROLE_ACCOUNT_PLACEHOLDER).join(account);
27078
+ } catch (err) {
27079
+ if (err instanceof CdkdError) throw err;
27080
+ const rendered = describeLocalAwsFailureForWarn(err, "STS GetCallerIdentity");
27081
+ throw new CdkdError(`--assume-task-role: STS GetCallerIdentity failed while resolving the task role's account: ${rendered}.`, "LOCAL_RUN_TASK_GET_CALLER_IDENTITY_FAILED", redactedAwsCause(err, "STS GetCallerIdentity failed"));
26886
27082
  } finally {
26887
27083
  sts.destroy();
26888
27084
  }
@@ -26900,12 +27096,16 @@ async function assumeTaskRole(roleArn, region) {
26900
27096
  RoleSessionName: `cdkd-local-run-task-${Date.now()}`,
26901
27097
  DurationSeconds: 3600
26902
27098
  }))).Credentials;
26903
- if (!creds?.AccessKeyId || !creds.SecretAccessKey || !creds.SessionToken) throw new Error(`AssumeRole(${displayIdent(roleArn, { maxCodePoints: 613 })}) returned no usable credentials.`);
27099
+ if (!creds?.AccessKeyId || !creds.SecretAccessKey || !creds.SessionToken) throw new CdkdError(`AssumeRole(${displayIdent(roleArn, { maxCodePoints: 613 })}) returned no usable credentials.`, "LOCAL_RUN_TASK_ASSUMEROLE_NO_CREDS");
26904
27100
  return {
26905
27101
  accessKeyId: creds.AccessKeyId,
26906
27102
  secretAccessKey: creds.SecretAccessKey,
26907
27103
  sessionToken: creds.SessionToken
26908
27104
  };
27105
+ } catch (err) {
27106
+ if (err instanceof CdkdError) throw err;
27107
+ const rendered = describeLocalAwsFailureForWarn(err, "STS AssumeRole");
27108
+ throw new CdkdError(`--assume-task-role: STS AssumeRole(${displayIdent(roleArn, { maxCodePoints: 613 })}) failed: ${rendered}.`, "LOCAL_RUN_TASK_ASSUMEROLE_FAILED", redactedAwsCause(err, "STS AssumeRole failed"));
26909
27109
  } finally {
26910
27110
  sts.destroy();
26911
27111
  }
@@ -29143,4 +29343,4 @@ function collectVerbFlags(program) {
29143
29343
 
29144
29344
  //#endregion
29145
29345
  export { canonicalizeIpProtocolValue as a, buildProgram, resolveSecretDerivedPrincipals as i, runDestroyForStack as n, resolvedResourceTimeoutMs as o, isResolvableSecretPrincipalList as r, canonicalizeIpv4Cidr as t };
29146
- //# sourceMappingURL=program-BgDt3OZh.js.map
29346
+ //# sourceMappingURL=program-BgsCaZFy.js.map