@cdkd/cli 0.358.7 → 0.359.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 (58) hide show
  1. package/dist/{ambient-client-defaults-DvXDYfs8.js → ambient-client-defaults-BNqC0q-Z.js} +3 -3
  2. package/dist/{ambient-client-defaults-DvXDYfs8.js.map → ambient-client-defaults-BNqC0q-Z.js.map} +1 -1
  3. package/dist/{asg-provider-BReZap7O.js → asg-provider-BDCUGWZV.js} +6 -6
  4. package/dist/{asg-provider-BReZap7O.js.map → asg-provider-BDCUGWZV.js.map} +1 -1
  5. package/dist/cli.js +3 -3
  6. package/dist/{custom-resource-runtime-CpziCILQ.js → custom-resource-runtime-DMkX_oQo.js} +6 -6
  7. package/dist/{custom-resource-runtime-CpziCILQ.js.map → custom-resource-runtime-DMkX_oQo.js.map} +1 -1
  8. package/dist/{db-associated-roles-DTMCw2Ka.js → db-associated-roles-Bx5ML-MI.js} +2 -2
  9. package/dist/{db-associated-roles-DTMCw2Ka.js.map → db-associated-roles-Bx5ML-MI.js.map} +1 -1
  10. package/dist/{delete-started-DNc0CPAc.js → delete-started-V5NHQ1O-.js} +4 -4
  11. package/dist/{delete-started-DNc0CPAc.js.map → delete-started-V5NHQ1O-.js.map} +1 -1
  12. package/dist/{deploy-engine-Db00WvIx.js → deploy-engine-BjSv27_M.js} +2025 -859
  13. package/dist/deploy-engine-BjSv27_M.js.map +1 -0
  14. package/dist/{ec2-termination-protection-Gf-1-VVU.js → ec2-termination-protection-hc3MeuqF.js} +11 -7
  15. package/dist/ec2-termination-protection-hc3MeuqF.js.map +1 -0
  16. package/dist/{ecr-uri-zC_A2VLB.js → ecr-uri-D1ijxg7D.js} +2 -2
  17. package/dist/{ecr-uri-zC_A2VLB.js.map → ecr-uri-D1ijxg7D.js.map} +1 -1
  18. package/dist/{expected-bucket-owner-Am4J3ano.js → expected-bucket-owner-CQimj8gv.js} +2 -2
  19. package/dist/{expected-bucket-owner-Am4J3ano.js.map → expected-bucket-owner-CQimj8gv.js.map} +1 -1
  20. package/dist/{iam-role-provider-BisBYgT3.js → iam-role-provider-b46RdZD5.js} +27 -13
  21. package/dist/iam-role-provider-b46RdZD5.js.map +1 -0
  22. package/dist/{image-plan-CNMyGwzi.js → image-plan-DtFbiJj5.js} +8 -8
  23. package/dist/{image-plan-CNMyGwzi.js.map → image-plan-DtFbiJj5.js.map} +1 -1
  24. package/dist/index.d.ts +3 -0
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +5 -5
  27. package/dist/{logger-BZmINj0f.js → logger-CqKPJ_tV.js} +2 -2
  28. package/dist/{logger-BZmINj0f.js.map → logger-CqKPJ_tV.js.map} +1 -1
  29. package/dist/{neptune-provider-DM4GhUTb.js → neptune-provider-DiyWADaS.js} +7 -7
  30. package/dist/{neptune-provider-DM4GhUTb.js.map → neptune-provider-DiyWADaS.js.map} +1 -1
  31. package/dist/{program-CCtcOCaP.js → program-Cdwgr3Yv.js} +626 -40
  32. package/dist/program-Cdwgr3Yv.js.map +1 -0
  33. package/dist/{provider-classes-CgZzBNg8.js → provider-classes-DhmwW7hI.js} +465 -391
  34. package/dist/provider-classes-DhmwW7hI.js.map +1 -0
  35. package/dist/{rds-provider-Cef0DBFH.js → rds-provider-DpOZv_UG.js} +10 -10
  36. package/dist/{rds-provider-Cef0DBFH.js.map → rds-provider-DpOZv_UG.js.map} +1 -1
  37. package/dist/{read-replica-DCjUkLOl.js → read-replica-Ct0oakPU.js} +3 -3
  38. package/dist/{read-replica-DCjUkLOl.js.map → read-replica-Ct0oakPU.js.map} +1 -1
  39. package/dist/{replacement-rules-iQkausbv.js → replacement-rules-CMnMy7rf.js} +3 -3
  40. package/dist/{replacement-rules-iQkausbv.js.map → replacement-rules-CMnMy7rf.js.map} +1 -1
  41. package/dist/{resource-deadline-6tnCx6Yj.js → resource-deadline-DlZTHrBj.js} +123 -122
  42. package/dist/resource-deadline-DlZTHrBj.js.map +1 -0
  43. package/dist/{restore-source-guard-Dj_CS7r6.js → restore-source-guard-DIs6rqZm.js} +4 -4
  44. package/dist/{restore-source-guard-Dj_CS7r6.js.map → restore-source-guard-DIs6rqZm.js.map} +1 -1
  45. package/dist/{run-cli-Db8hPv4V.js → run-cli-BLZnjA32.js} +2 -2
  46. package/dist/{run-cli-Db8hPv4V.js.map → run-cli-BLZnjA32.js.map} +1 -1
  47. package/dist/{settle-own-write-members-CXG2uUvJ.js → settle-own-write-members-C1uPhq2z.js} +49 -304
  48. package/dist/settle-own-write-members-C1uPhq2z.js.map +1 -0
  49. package/dist/{version-DSeV-Tyv.js → version-DyE_oClc.js} +2 -2
  50. package/dist/{version-DSeV-Tyv.js.map → version-DyE_oClc.js.map} +1 -1
  51. package/package.json +1 -1
  52. package/dist/deploy-engine-Db00WvIx.js.map +0 -1
  53. package/dist/ec2-termination-protection-Gf-1-VVU.js.map +0 -1
  54. package/dist/iam-role-provider-BisBYgT3.js.map +0 -1
  55. package/dist/program-CCtcOCaP.js.map +0 -1
  56. package/dist/provider-classes-CgZzBNg8.js.map +0 -1
  57. package/dist/resource-deadline-6tnCx6Yj.js.map +0 -1
  58. package/dist/settle-own-write-members-CXG2uUvJ.js.map +0 -1
@@ -1,21 +1,21 @@
1
- import { a as IamCreateClientCache, i as isEntityAlreadyExists, n as collectInlinePolicyNamesManagedBySiblings, r as iamEntityLeftByThisCreate, t as IAMRoleProvider } from "./iam-role-provider-BisBYgT3.js";
2
- import { A as configStringRefusal, B as generateResourceName, D as coerceCfnInteger, E as coerceCfnBoolean, F as requireConfigString, J as getCurrentStackName, M as replayWarn, N as requireConfigArray, O as configBooleanRefusal, P as requireConfigObject, U as recordedGeneratedNameKept, V as generateResourceNameWithFallback, Y as isBeforeStateRead, c as VERBOSE_POINTER, d as describeAwsStatusReason, f as isAwsAuthoredFailure, g as verbosePointerTail, h as verbosePointerSentence, j as readConfigString, k as configIntegerRefusal, n as getLogger, p as safeStringify, q as getCurrentStackInstanceId, u as describeAwsFailure, w as generatedNameFor } from "./logger-BZmINj0f.js";
1
+ import { a as IamCreateClientCache, i as isEntityAlreadyExists, n as collectInlinePolicyNamesManagedBySiblings, r as iamEntityLeftByThisCreate, t as IAMRoleProvider } from "./iam-role-provider-b46RdZD5.js";
2
+ import { A as configStringRefusal, B as generateResourceName, D as coerceCfnInteger, E as coerceCfnBoolean, F as requireConfigString, J as getCurrentStackName, M as replayWarn, N as requireConfigArray, O as configBooleanRefusal, P as requireConfigObject, U as recordedGeneratedNameKept, V as generateResourceNameWithFallback, Y as isBeforeStateRead, c as VERBOSE_POINTER, d as describeAwsStatusReason, f as isAwsAuthoredFailure, g as verbosePointerTail, h as verbosePointerSentence, j as readConfigString, k as configIntegerRefusal, n as getLogger, p as safeStringify, q as getCurrentStackInstanceId, u as describeAwsFailure, w as generatedNameFor } from "./logger-CqKPJ_tV.js";
3
3
  import { d as withApiGatewayPacing, l as s3ClientDefaults, r as getAwsClients } from "./aws-clients-DOkPjjAW.js";
4
- import { D as markReplayMayCollide, E as markNameCollision, F as isAmbiguousOutcomeError, G as markRedactedCause, I as isExplicitDenyError, K as wrapMaskedAwsError, M as explicitDenyPolicyKind, O as relayedNameCollision, Q as AccountIdUnavailableError, R as isRetryableTransientError, U as isThrottlingError, V as THROTTLING_ERROR_NAMES, W as markNonRetryable, _ as ResourceUpdateNotSupportedError, at as ProvisioningError, et as CdkdError, i as credentialFingerprint, n as ambientCredentialConfig, r as clientDefaultsFor, t as ambientClientDefaults, x as hasReplayMayCollide, z as isTransientServerError } from "./ambient-client-defaults-DvXDYfs8.js";
5
- import { $ as deleteWithProtectionCompensation, $t as markAuxiliaryFailure, A as ambiguousAttemptLead, At as canonicalizeRoute53QueryName, B as isPlainImportValue, Bt as createMaskedRetryLogger, Ct as protectedReplacementAdvice, D as AmbiguousCreateLatch, E as AMBIGUOUS_LATCH_TTL_MS, F as setBounded, Ft as packCompositeId, G as remedyLogicalId, H as normalizeAwsTagsToCfn, Ht as maskDeep, I as withoutServerErrorRetries, J as RESOURCE_NOT_FOUND, K as resolveExplicitPhysicalId, L as VALUE_NOT_SHOWN, Lt as segmentAfterAnchor, M as isInsideWindow, Mt as compositeIdSeparatorRefusal, N as replayFollowedAmbiguousAttempt, Nt as compositeIdSkipResult, O as CREATION_DATE_SKEW_MARGIN_MS, Ot as isInterruptedWaitError, P as replayedSendWindow, Pt as logicalIdShown, R as importRemedyCommand, Rt as stateOrphanRecordRemedy, S as readPrincipalLists, St as pasteableAwsCommand, U as quotedRemedyLogicalId, Ut as maskerOrIdentity, V as isQuotableImportValue, Vt as isSecretDerivedValue, W as refusalTypeShown, Wt as withDerivedNameMasks, Y as assertRegionMatch, Z as markNotGone, Zt as isAuxiliaryFailure, _n as injectiveKey, a as clearOnUpdateRemoval, at as PROTECTION_FLIP_RETRY_WAIT_MS, b as holdsSecretDerivedEntry, bt as WITHHELD_AWS_COMMAND, c as removedTemplateKeys, ct as isProceedDbStatus, dt as ProtectionFlipRegistry, en as markCreatedBeforeFailure, et as logGroupProtectionSite, ft as isTerminalDeleteFailure, g as retractCreatedResource, gn as withPasteableAwsProfile, gt as ElapsedBudgetRegistry, ht as ElapsedBudget, it as userPoolProtectionSite, j as createAttemptKey, jt as compositeIdFormatMessage, k as RecentIdSet, kt as startInterruptWatch, l as withRemovalDefaults, lt as isTerminalDbWaitStatus, m as reportCreatedResource, n as enclosingDeadlineRemainingMs, nt as rdsFamilyProtectionSite, ot as deleteAfterProtectionFlipWithFinalSnapshot, pt as protectionFlipKey, q as DriftReadRefusedError, qt as clearCreatedBeforeFailure, t as enclosingDeadlineExpired, tn as markSupersedesEarlierCreate, tt as observeThenDisableProtection, vn as injectiveKeyPrefix, w as recordedPrincipalsRepair, wt as renderDisableCommand, x as onlySecretDerived, xt as isAwsCliLiteral, y as SECRET_DERIVED_READ_LIVE, yt as UNNAMEABLE_ID_CLAUSE, z as isPlainImportJson, zt as createMaskedLogSinks } from "./resource-deadline-6tnCx6Yj.js";
6
- import { A as displayStackName, N as plainIdentOr, O as displayIdent, P as safeMsg, S as SECRET_REF_MAX_CODE_POINTS, T as asIsMessage, _ as shellQuote, c as deployReplaceCommand, d as pasteableCommand, j as isPasteableIdent, k as displaySafe, l as hasClauseBreak, m as proseQuoted, o as cdkdRemedy, p as plainOrDescribed, s as commandHole, u as isInertUnquoted, v as withheldTargetClause } from "./version-DSeV-Tyv.js";
7
- import { gt as slowCcOperationTimeoutMs, n as isRefusedByName, r as markDeleteStarted } from "./delete-started-DNc0CPAc.js";
8
- import { A as eventBridgeEnabledOf, B as shownLifecycleRuleId, C as lifecycleUsesFilterForm, D as effectiveIntelligentTieringItem, E as effectiveAnalyticsItem, F as declaresNestedObjectLock, I as describeValue$1, L as isPlainObject$4, M as coerceCfnNumber, N as configItemId, O as effectiveInventoryItem, P as declaresBucketObjectLock, R as manualBucketDeletionClause, S as lifecycleRuleScope, T as EVENTBRIDGE_CONFIG_PATH, _ as LIFECYCLE_RULE_PATH, a as resolveSecretDerivedPrincipals, b as canonicalizeItemList, c as mergeDeclaredSgRules, d as lifecycleSettleTarget, f as recordLifecycleWrite, g as LIFECYCLE_FILTER_PATH, h as LIFECYCLE_DEFAULT_STATUS, i as isResolvableSecretPrincipalList, j as caughtErrorName, k as effectiveNotificationConfiguration, l as LIFECYCLE_BASELINE_REREAD_DELAYS_MS, m as takeLifecycleWrite, n as runDestroyForStack, o as markCopiesAgreed, p as settleLifecycleRead, r as holdsUnprovenSecretPrincipalToken, s as declaredSgRulesRead, t as canonicalizeIpv4Cidr, u as clearLifecycleWritesOf, v as LIFECYCLE_TAG_FILTERS_PATH, w as parseCfnTimestamp, x as effectiveLifecycleConfiguration, y as canonicalizeBlock, z as mergeLegacySingular } from "./program-CCtcOCaP.js";
9
- import { $ as sendTtlWaitingOutRateLimit, $c as findSdkUnwiredProperties, $n as sgProtocolKey, Al as renderNestedTemplateTreeDefect, At as S3_AUTO_DELETE_OBJECTS_TAG, B as declaredStreamTagsMember, Ci as replacedDeleteFailureVerdict, Cs as isWarmThroughputDecrease, Ct as INDEX_SETTLE_POLL_INTERVAL_MS, Cu as describeFileReadFailure, Dl as findNestedTemplateTreeDefect, Dt as relayedIndexBusyDelete, Du as resolveAssemblyPath, Et as maskedLogger, Eu as renderAssemblyPathEscape, Fo as s3BucketWebsiteUrl, Fr as REDACTED_DELETE_ADDRESS_SKIP_REASON, G as streamDeclaresTags, Gc as withheldAccountClause, Go as parseWebACLArn, Gt as chunks, I as DynamoDBGlobalTableProvider, Ir as isRedactedRecordedValue, J as streamTagsMatchDeclared, Jt as withApiLimit, K as streamMemberRefusals, Ka as waitForGoneAfterDelete, Kt as isAccessDeniedError, L as STREAM_POLICY_KEY, Ll as decodeListingKey, Lr as redactedDeleteAddressFields, Mo as s3BucketDomainName, Mt as isTruthyCfnBoolean, No as s3BucketDualStackDomainName, Ol as isAbsoluteAssetPath, Ot as waitForIndexesSettled, Pa as getCurrentResourceSecrets, Po as s3BucketRegionalDomainName, Ps as passedParameterClassesOf, Q as readTtlSpec, Qa as withIndeterminateGuard, Qn as cfnIngressPortValue, R as STREAM_TAGS_KEY, Rr as redactedDeleteAddressSkip, Ss as coerceWarmThroughput$1, St as DELETE_INDEX_WAIT_PROCEED_NOTE, Tl as stringifyValue, Ts as toFiniteNumber, Tt as deleteTableWithIndexBusyRetry, U as reverseMapStreamPolicy, V as planStreamMemberOps, W as streamDeclaresPolicy, Wa as waitForLambdaFunctionActive, Wc as accountArgs, X as isTtlRateLimited, Xn as siblingOwnedSgRuleIdentities, Y as isTtlAlreadyDisabled, Yl as rewriteTemplateAssetReferences, Yo as outputReferenceProvenanceOf, Yr as getCurrentProducerRegions, Z as planTimeToLive, Za as deleteSkipReason, Zn as withoutSiblingOwnedSgRules, _a as collectManagedPolicyArnsAttachedBySiblings, _r as earliestDefined, _t as beginDeleteWait, at as CONTRIBUTOR_INSIGHTS_KEY, ba as withoutSiblingAttachedArns, bt as resolveDynamoDbDeleteBudgetClock, cn as getCurrentNestedStackContext, co as APPSYNC_APIKEY_ARN_RESOURCE_PATH, cr as calculateResourceDrift, ct as planContributorInsightsOp, dt as reverseMapIndexContributorInsights, er as canonicalizeIpProtocolValue, et as planVectorIndexUpdates, fr as verbatimEchoDriftKeys, ft as reverseMapTableContributorInsights, ga as collectGroupsAddedBySiblings, gt as DYNAMODB_DELETE_POLL_COST_MS, ht as DYNAMODB_DELETE_MIN_RESOURCE_TIMEOUT_MS, in as revertNestedChildFromJournal, it as vectorIndexesShapeDetail, jo as s3BucketArn, jt as hasCdkAutoDeleteTag, kc as refuseMalformedNestedChildOutputs, kl as listNestedTemplateRows, kt as ECR_AUTO_DELETE_IMAGES_TAG, ln as withNestedStackContext, lo as maskedSecretSegment, lt as planIndexContributorInsightsOps, mt as DYNAMODB_DELETE_DEADLINE_MARGIN_MS, nl as withoutSdkUnwiredProperties, nt as vectorIndexesForCreate, ot as contributorInsightsRefusals, pt as stripIndexContributorInsights, q as streamPolicyMatchesDeclared, qt as lookupEachName, rt as vectorIndexesSettled, so as isSettledInstanceState, st as indexDeclaresContributorInsights, t as DeployEngine, ta as secretNamedAttributeNamesOf, tn as getNestedRevertRun, to as markWaitAbandoned, ts as getAccountInfo, tt as readbackVectorIndexes, ut as readContributorInsightsSpec, va as collectPrincipalsAttachingPolicy, vt as compensateRemovedDeletionProtection, ws as toCfnInteger, wt as TABLE_INDEX_NOUN, wu as displayAssemblyPath, xa as withoutSiblingOwned, xi as getStackRecords, xr as acquireIdempotencyToken, xs as WARM_THROUGHPUT_MEMBERS, xt as resolveDynamoDbDeleteBudgetMs, ya as isStoredExpression, yi as awaitInFlightSibling, yr as reserveStackCreateToken, yt as deleteBudgetKey, z as declaredStreamPolicyMember, zc as refuseMalformedResourcesForDestroy } from "./deploy-engine-Db00WvIx.js";
10
- import { C as policyContentKey, S as attemptedPolicyDocument, T as planSubscriptionAttributes, _ as memberReadFailure, a as principalOwnWriteMembers, b as settleDeclaredMember, c as stringListMember, d as OWN_WRITE_REREAD_DELAYS_MS, f as SNS_DEFAULT_POLICY_ID, g as lambdaPermissionMatchesDeclared, h as efsPolicyMatchesDeclared, l as KMS_DEFAULT_KEY_POLICY_ID, m as declaredPolicyDocument, n as declaredStringList, o as settleOwnWriteMembers, p as declaredMemberDocument, v as policyDocumentMatchesDeclared, x as warnUnsettledMember, y as reReadUntilSettled } from "./settle-own-write-members-CXG2uUvJ.js";
11
- import { _ as isUsableAttemptedName, c as planTagDiff, d as tagMapAsList, f as tagPlanWarning, g as stringifyIfAssigned, h as definedAttributes, i as refuseRestoreFromItself, l as readTagList, m as modifyDbInstanceWhenAvailable, o as DBPROXY_TAGS_WHAT, p as isModifyNotAvailableRefusal, s as DBPROXY_TAG_OPTIONS, u as refuseMalformedDesiredTags } from "./restore-source-guard-Dj_CS7r6.js";
12
- import { A as withRetry, U as timePhase, _ as unchangedBehindSecretReference, a as reDisableInstanceApiTermination, d as markRefusedBeforeApplying, g as onlySecretReferencesDiffer, i as observeThenDisableInstanceApiTermination, l as getPriorAttempts, n as ec2InstanceProtectionSite, o as reEnableInstanceApiTermination, r as isTerminationProtectionPropagationError, s as resolvedResourceTimeoutMs } from "./ec2-termination-protection-Gf-1-VVU.js";
4
+ import { D as markReplayMayCollide, E as markNameCollision, F as isAmbiguousOutcomeError, G as markRedactedCause, I as isExplicitDenyError, K as wrapMaskedAwsError, M as explicitDenyPolicyKind, O as relayedNameCollision, Q as AccountIdUnavailableError, R as isRetryableTransientError, U as isThrottlingError, W as markNonRetryable, _ as ResourceUpdateNotSupportedError, at as ProvisioningError, et as CdkdError, i as credentialFingerprint, n as ambientCredentialConfig, r as clientDefaultsFor, t as ambientClientDefaults, x as hasReplayMayCollide, z as isTransientServerError } from "./ambient-client-defaults-BNqC0q-Z.js";
5
+ import { $ as isProceedDbStatus, $t as markAuxiliaryFailure, A as isPlainImportJson, At as canonicalizeRoute53QueryName, B as assertRegionMatch, Bt as createMaskedRetryLogger, C as isInsideWindow, Ct as SECRET_DERIVED_READ_LIVE, D as withoutServerErrorRetries, E as setBounded, Et as readPrincipalLists, F as refusalTypeShown, Ft as packCompositeId, G as logGroupProtectionSite, H as markNotGone, Ht as maskDeep, I as remedyLogicalId, K as observeThenDisableProtection, L as resolveExplicitPhysicalId, Lt as segmentAfterAnchor, M as isQuotableImportValue, Mt as compositeIdSeparatorRefusal, N as normalizeAwsTagsToCfn, Nt as compositeIdSkipResult, O as VALUE_NOT_SHOWN, Ot as recordedPrincipalsRepair, P as quotedRemedyLogicalId, Pt as logicalIdShown, R as DriftReadRefusedError, Rt as stateOrphanRecordRemedy, S as createAttemptKey, T as replayedSendWindow, Tt as onlySecretDerived, Ut as maskerOrIdentity, Vt as isSecretDerivedValue, W as deleteWithProtectionCompensation, Wt as withDerivedNameMasks, X as PROTECTION_FLIP_RETRY_WAIT_MS, Y as userPoolProtectionSite, Z as deleteAfterProtectionFlipWithFinalSnapshot, Zt as isAuxiliaryFailure, _ as AMBIGUOUS_LATCH_TTL_MS, _n as withPasteableAwsProfile, a as clearOnUpdateRemoval, b as RecentIdSet, bt as startInterruptWatch, c as removedTemplateKeys, dt as WITHHELD_AWS_COMMAND, en as markCreatedBeforeFailure, et as isTerminalDbWaitStatus, ft as isAwsCliLiteral, g as retractCreatedResource, ht as renderDisableCommand, it as protectionFlipKey, j as isPlainImportValue, jt as compositeIdFormatMessage, k as importRemedyCommand, l as withRemovalDefaults, m as reportCreatedResource, mt as protectedReplacementAdvice, n as enclosingDeadlineRemainingMs, nt as ProtectionFlipRegistry, ot as ElapsedBudget, pt as pasteableAwsCommand, q as rdsFamilyProtectionSite, qt as clearCreatedBeforeFailure, rt as isTerminalDeleteFailure, st as ElapsedBudgetRegistry, t as enclosingDeadlineExpired, tn as markSupersedesEarlierCreate, ut as UNNAMEABLE_ID_CLAUSE, v as AmbiguousCreateLatch, vn as injectiveKey, w as replayFollowedAmbiguousAttempt, wt as holdsSecretDerivedEntry, x as ambiguousAttemptLead, y as CREATION_DATE_SKEW_MARGIN_MS, yn as injectiveKeyPrefix, yt as isInterruptedWaitError, z as RESOURCE_NOT_FOUND, zt as createMaskedLogSinks } from "./resource-deadline-DlZTHrBj.js";
6
+ import { A as displayStackName, L as truncateCodePoints, N as plainIdentOr, O as displayIdent, P as safeMsg, S as SECRET_REF_MAX_CODE_POINTS, T as asIsMessage, _ as shellQuote, c as deployReplaceCommand, d as pasteableCommand, j as isPasteableIdent, k as displaySafe, l as hasClauseBreak, m as proseQuoted, o as cdkdRemedy, p as plainOrDescribed, s as commandHole, u as isInertUnquoted, v as withheldTargetClause } from "./version-DyE_oClc.js";
7
+ import { gt as slowCcOperationTimeoutMs, n as isRefusedByName, r as markDeleteStarted } from "./delete-started-V5NHQ1O-.js";
8
+ import { $ as effectiveInventoryItem, A as tagListsMatch, B as LIFECYCLE_DEFAULT_STATUS, C as reconcileSgRules, D as singleSecurityGroupRuleId, E as sgRuleKey, F as clearLifecycleWritesOf, G as canonicalizeItemList, H as LIFECYCLE_RULE_PATH, I as lifecycleSettleTarget, J as lifecycleUsesFilterForm, K as effectiveLifecycleConfiguration, L as recordLifecycleWrite, M as declaredSgRulesRead, N as mergeDeclaredSgRules, O as stackIngressRuleHolder, P as LIFECYCLE_BASELINE_REREAD_DELAYS_MS, Q as effectiveIntelligentTieringItem, R as settleLifecycleRead, S as narrowIngressIpProtocol, T as securityGroupRuleMatchesCfnIngress, U as LIFECYCLE_TAG_FILTERS_PATH, V as LIFECYCLE_FILTER_PATH, W as canonicalizeBlock, X as EVENTBRIDGE_CONFIG_PATH, Y as parseCfnTimestamp, Z as effectiveAnalyticsItem, _ as flattenIpPermissions, a as resolveSecretDerivedPrincipals, at as declaresBucketObjectLock, b as isDefaultEgressRule, c as readSgIngressById, ct as isPlainObject$4, d as SG_RULE_PAGE_SIZE, dt as shownLifecycleRuleId, et as effectiveNotificationConfiguration, f as authorizeDefinitelyNotApplied, g as descriptionKey, h as comparableIngressIdentity, i as isResolvableSecretPrincipalList, it as configItemId, j as markCopiesAgreed, k as survivingRecordOfRuleId, l as siblingIdOwnedSgRules, lt as manualBucketDeletionClause, m as canonicalizeSgRuleProtocol, n as runDestroyForStack, nt as caughtErrorName, o as refuseRevertRevokingSiblingRules, ot as declaresNestedObjectLock, p as canonicalizeSgInlineRuleProtocols, q as lifecycleRuleScope, r as holdsUnprovenSecretPrincipalToken, rt as coerceCfnNumber, s as sgRuleDiffKey, st as describeValue$1, t as canonicalizeIpv4Cidr, tt as eventBridgeEnabledOf, u as SG_READBACK_RETRY_DELAY_MS, ut as mergeLegacySingular, v as ingressRuleIdentity, w as securityGroupReadbackDelays, x as isResendableSocketFailure, y as isConnectTimeout, z as takeLifecycleWrite } from "./program-Cdwgr3Yv.js";
9
+ import { $ as recordTagWrite, $r as redactedDeleteAddressSkip, Al as accountArgs, At as DELETE_INDEX_WAIT_PROCEED_NOTE, B as declaredStreamTagsMember, Ba as SNS_DEFAULT_POLICY_ID, Bt as isTruthyCfnBoolean, Cr as calculateResourceDrift, Ct as DYNAMODB_DELETE_MIN_RESOURCE_TIMEOUT_MS, Cu as decodeListingKey, Do as RecordedIdentityError, Dr as verbatimEchoDriftKeys, Dt as deleteBudgetKey, Eo as waitForGoneAfterDelete, Et as compensateRemovedDeletionProtection, Fa as withoutSiblingAttachedArns, Fo as deleteSkipReason, Fs as outputReferenceProvenanceOf, Ft as relayedIndexBusyDelete, Fu as rewriteTemplateAssetReferences, G as streamDeclaresTags, Ga as memberReadFailure, Go as isSettledInstanceState, Ha as declaredPolicyDocument, Hl as withoutSdkUnwiredProperties, I as DynamoDBGlobalTableProvider, Ia as withoutSiblingOwned, Ii as getStackRecords, Io as withIndeterminateGuard, Ir as acquireIdempotencyToken, It as waitForIndexesSettled, J as streamTagsMatchDeclared, Ja as settleDeclaredMember, Jo as maskedSecretSegment, K as streamMemberRefusals, Ka as policyDocumentMatchesDeclared, Ki as replacedDeleteFailureVerdict, Ko as APPSYNC_APIKEY_ARN_RESOURCE_PATH, L as STREAM_POLICY_KEY, La as KMS_DEFAULT_KEY_POLICY_ID, Lt as ECR_AUTO_DELETE_IMAGES_TAG, Ma as collectManagedPolicyArnsAttachedBySiblings, Mr as earliestDefined, Mt as TABLE_INDEX_NOUN, Na as collectPrincipalsAttachingPolicy, Nt as deleteTableWithIndexBusyRetry, Oo as RecordedIdentityMismatchError, Ot as resolveDynamoDbDeleteBudgetClock, Pa as isStoredExpression, Pi as awaitInFlightSibling, Pr as reserveStackCreateToken, Pt as maskedLogger, Q as isDynamoDBTableArnIn, Qr as redactedDeleteAddressFields, Qt as licensedNameHolder, R as STREAM_TAGS_KEY, Rt as S3_AUTO_DELETE_OBJECTS_TAG, St as DYNAMODB_DELETE_DEADLINE_MARGIN_MS, Tl as refuseMalformedResourcesForDestroy, Tt as beginDeleteWait, U as reverseMapStreamPolicy, Ua as efsPolicyMatchesDeclared, V as planStreamMemberOps, Va as declaredMemberDocument, Vs as getAccountInfo, W as streamDeclaresPolicy, Wa as lambdaPermissionMatchesDeclared, X as clearTagWrites, Xa as attemptedPolicyDocument, Xr as REDACTED_DELETE_ADDRESS_SKIP_REASON, Y as TAGS_BASELINE_REREAD_DELAYS_MS, Ya as warnUnsettledMember, Za as policyContentKey, Zr as isRedactedRecordedValue, _n as getCurrentNestedStackContext, _s as s3BucketArn, _t as planIndexContributorInsightsOps, ao as classifyHandleUrl, at as planTimeToLive, bc as passedParameterClassesOf, bs as s3BucketRegionalDomainName, bt as reverseMapTableContributorInsights, cc as coerceWarmThroughput$1, cr as siblingOwnedSgRuleIdentities, ct as planVectorIndexUpdates, dc as toFiniteNumber, dr as SG_RULE_ID_PATTERN, dt as vectorIndexesSettled, du as stringifyValue, en as chunks, et as settleWrittenTags, fd as renderAssemblyPathEscape, fr as cfnIngressPortValue, ft as vectorIndexesShapeDetail, ga as secretNamedAttributeNamesOf, gt as planContributorInsightsOp, gu as renderNestedTemplateTreeDefect, hl as refuseMalformedNestedChildOutputs, ht as indexDeclaresContributorInsights, hu as listNestedTemplateRows, io as WaitConditionSignalStore, it as isTtlRateLimited, ja as collectGroupsAddedBySiblings, jl as withheldAccountClause, js as parseWebACLArn, jt as INDEX_SETTLE_POLL_INTERVAL_MS, ko as assertRecordedIdentity, kt as resolveDynamoDbDeleteBudgetMs, lc as isWarmThroughputDecrease, ld as describeFileReadFailure, lt as readbackVectorIndexes, mo as getCurrentResourceSecrets, mr as sgProtocolKey, mt as contributorInsightsRefusals, mu as isAbsoluteAssetPath, nn as lookupEachName, nt as takeTagWrite, oo as evaluateSignals, ot as readTtlSpec, pd as resolveAssemblyPath, pn as revertNestedChildFromJournal, pr as recordedSgRuleId, pt as CONTRIBUTOR_INSIGHTS_KEY, pu as findNestedTemplateTreeDefect, q as streamPolicyMatchesDeclared, qa as reReadUntilSettled, rn as withApiLimit, ro as LEGACY_HANDLE_ID_PREFIX, rt as isTtlAlreadyDisabled, sc as WARM_THROUGHPUT_MEMBERS, st as sendTtlWaitingOutRateLimit, t as DeployEngine, tn as isAccessDeniedError, uc as toCfnInteger, ud as displayAssemblyPath, ui as getCurrentProducerRegions, un as getNestedRevertRun, ur as withoutSiblingOwnedSgRules, ut as vectorIndexesForCreate, vn as withNestedStackContext, vs as s3BucketDomainName, vt as readContributorInsightsSpec, wo as waitForLambdaFunctionActive, wt as DYNAMODB_DELETE_POLL_COST_MS, xs as s3BucketWebsiteUrl, xt as stripIndexContributorInsights, ys as s3BucketDualStackDomainName, yt as reverseMapIndexContributorInsights, z as declaredStreamPolicyMember, za as OWN_WRITE_REREAD_DELAYS_MS, zl as findSdkUnwiredProperties, zo as markWaitAbandoned, zt as hasCdkAutoDeleteTag } from "./deploy-engine-BjSv27_M.js";
10
+ import { _ as isUsableAttemptedName, c as planTagDiff, d as tagMapAsList, f as tagPlanWarning, g as stringifyIfAssigned, h as definedAttributes, i as refuseRestoreFromItself, l as readTagList, m as modifyDbInstanceWhenAvailable, o as DBPROXY_TAGS_WHAT, p as isModifyNotAvailableRefusal, s as DBPROXY_TAG_OPTIONS, u as refuseMalformedDesiredTags } from "./restore-source-guard-DIs6rqZm.js";
11
+ import { W as timePhase, _ as onlySecretReferencesDiffer, a as reDisableInstanceApiTermination, c as resolvedResourceTimeoutMs, f as markRefusedBeforeApplying, i as observeThenDisableInstanceApiTermination, j as withRetry, n as ec2InstanceProtectionSite, o as reEnableInstanceApiTermination, r as isTerminationProtectionPropagationError, s as resolvedPerTypeResourceTimeoutMs, u as getPriorAttempts, v as unchangedBehindSecretReference } from "./ec2-termination-protection-hc3MeuqF.js";
12
+ import { a as principalOwnWriteMembers, c as stringListMember, d as planSubscriptionAttributes, n as declaredStringList, o as settleOwnWriteMembers, u as normalizeRecordName } from "./settle-own-write-members-C1uPhq2z.js";
13
13
  import { n as canonicalizeRegion, r as derivePartitionAndUrlSuffix } from "./aws-partition-DA0r2sr-.js";
14
14
  import { f as ambientRegion, r as awsEndpointOverrideActive } from "./aws-client-defaults-DAebi99J.js";
15
- import { $ as snapshotPassProvenance, At as withoutPhysicalNameCopies, C as passedNoEchoParametersOf, I as markSameGenerationBag, Nt as dynamicReferenceTokens, W as redactForState, Z as recordReferenceProvenanceEntry, a as emrClusterInstancesReplaced, cn as recordAttributeIdCopy, i as ecsServiceLaunchTypeSetOrChanged, it as hasMaskableValues, l as sameLambdaFunctionAddress, mn as carriesSecretMask, n as blockDeviceMappingsDifferOnlyInDeleteOnTermination, o as canonicalLambdaFunctionName, on as recoverMaskedOutput, s as lambdaFunctionNameForMask, sn as physicalNameCopiesOf } from "./replacement-rules-iQkausbv.js";
16
- import { RDSProvider } from "./rds-provider-Cef0DBFH.js";
17
- import { NeptuneProvider } from "./neptune-provider-DM4GhUTb.js";
18
- import { ASGProvider } from "./asg-provider-BReZap7O.js";
15
+ import { $ as snapshotPassProvenance, At as withoutPhysicalNameCopies, C as passedNoEchoParametersOf, I as markSameGenerationBag, Nt as dynamicReferenceTokens, W as redactForState, Z as recordReferenceProvenanceEntry, a as emrClusterInstancesReplaced, cn as recordAttributeIdCopy, i as ecsServiceLaunchTypeSetOrChanged, it as hasMaskableValues, l as sameLambdaFunctionAddress, mn as carriesSecretMask, n as blockDeviceMappingsDifferOnlyInDeleteOnTermination, o as canonicalLambdaFunctionName, on as recoverMaskedOutput, s as lambdaFunctionNameForMask, sn as physicalNameCopiesOf } from "./replacement-rules-CMnMy7rf.js";
16
+ import { RDSProvider } from "./rds-provider-DpOZv_UG.js";
17
+ import { NeptuneProvider } from "./neptune-provider-DiyWADaS.js";
18
+ import { ASGProvider } from "./asg-provider-BDCUGWZV.js";
19
19
  import { createHash, randomUUID } from "node:crypto";
20
20
  import { CreateBucketCommand, CreateBucketMetadataConfigurationCommand, DeleteBucketAnalyticsConfigurationCommand, DeleteBucketCommand, DeleteBucketCorsCommand, DeleteBucketEncryptionCommand, DeleteBucketIntelligentTieringConfigurationCommand, DeleteBucketInventoryConfigurationCommand, DeleteBucketLifecycleCommand, DeleteBucketMetadataConfigurationCommand, DeleteBucketMetricsConfigurationCommand, DeleteBucketOwnershipControlsCommand, DeleteBucketPolicyCommand, DeleteBucketReplicationCommand, DeleteBucketTaggingCommand, DeleteBucketWebsiteCommand, DeleteObjectsCommand, GetBucketAbacCommand, GetBucketAccelerateConfigurationCommand, GetBucketCorsCommand, GetBucketEncryptionCommand, GetBucketLifecycleConfigurationCommand, GetBucketLocationCommand, GetBucketLoggingCommand, GetBucketMetadataConfigurationCommand, GetBucketNotificationConfigurationCommand, GetBucketOwnershipControlsCommand, GetBucketPolicyCommand, GetBucketReplicationCommand, GetBucketTaggingCommand, GetBucketVersioningCommand, GetBucketWebsiteCommand, GetObjectCommand, GetObjectLockConfigurationCommand, GetPublicAccessBlockCommand, HeadBucketCommand, ListBucketAnalyticsConfigurationsCommand, ListBucketIntelligentTieringConfigurationsCommand, ListBucketInventoryConfigurationsCommand, ListBucketMetricsConfigurationsCommand, ListBucketsCommand, ListObjectVersionsCommand, ListObjectsV2Command, NoSuchBucket, PutBucketAbacCommand, PutBucketAccelerateConfigurationCommand, PutBucketAnalyticsConfigurationCommand, PutBucketCorsCommand, PutBucketEncryptionCommand, PutBucketIntelligentTieringConfigurationCommand, PutBucketInventoryConfigurationCommand, PutBucketLifecycleConfigurationCommand, PutBucketLoggingCommand, PutBucketMetricsConfigurationCommand, PutBucketNotificationConfigurationCommand, PutBucketOwnershipControlsCommand, PutBucketPolicyCommand, PutBucketReplicationCommand, PutBucketTaggingCommand, PutBucketVersioningCommand, PutBucketWebsiteCommand, PutObjectLockConfigurationCommand, PutPublicAccessBlockCommand, S3Client, UpdateBucketMetadataAnnotationTableConfigurationCommand, UpdateBucketMetadataInventoryTableConfigurationCommand, UpdateBucketMetadataJournalTableConfigurationCommand } from "@aws-sdk/client-s3";
21
21
  import { AddRoleToInstanceProfileCommand, AddUserToGroupCommand, AttachGroupPolicyCommand, AttachRolePolicyCommand, AttachUserPolicyCommand, CreateAccessKeyCommand, CreateGroupCommand, CreateInstanceProfileCommand, CreateLoginProfileCommand, CreatePolicyCommand, CreatePolicyVersionCommand, CreateUserCommand, DeleteAccessKeyCommand, DeleteGroupCommand, DeleteGroupPolicyCommand, DeleteInstanceProfileCommand, DeleteLoginProfileCommand, DeletePolicyCommand, DeletePolicyVersionCommand, DeleteRolePolicyCommand, DeleteUserCommand, DeleteUserPermissionsBoundaryCommand, DeleteUserPolicyCommand, DetachGroupPolicyCommand, DetachRolePolicyCommand, DetachUserPolicyCommand, GetAccessKeyLastUsedCommand, GetGroupCommand, GetGroupPolicyCommand, GetInstanceProfileCommand, GetPolicyCommand, GetPolicyVersionCommand, GetRolePolicyCommand, GetUserCommand, GetUserPolicyCommand, IAMClient, ListAccessKeysCommand, ListAttachedGroupPoliciesCommand, ListAttachedUserPoliciesCommand, ListEntitiesForPolicyCommand, ListGroupPoliciesCommand, ListGroupsForUserCommand, ListPoliciesCommand, ListPolicyTagsCommand, ListPolicyVersionsCommand, ListUserPoliciesCommand, NoSuchEntityException, PutGroupPolicyCommand, PutRolePolicyCommand, PutUserPermissionsBoundaryCommand, PutUserPolicyCommand, RemoveRoleFromInstanceProfileCommand, RemoveUserFromGroupCommand, TagPolicyCommand, TagUserCommand, UntagPolicyCommand, UntagUserCommand, UpdateAccessKeyCommand, UpdateGroupCommand, UpdateLoginProfileCommand, UpdateUserCommand } from "@aws-sdk/client-iam";
@@ -930,14 +930,18 @@ async function update$41(logicalId, physicalId, resourceType, properties, previo
930
930
  const createResult = await this.create(logicalId, resourceType, properties, { maskSecrets: log.mask });
931
931
  let orphanReason;
932
932
  try {
933
- const deleteResult = await this.delete(logicalId, physicalId, resourceType, previousProperties, { maskSecrets: log.mask });
933
+ const deleteResult = await this.delete(logicalId, physicalId, resourceType, previousProperties, {
934
+ maskSecrets: log.mask,
935
+ ...context?.recordedAttributes && { recordedAttributes: context.recordedAttributes }
936
+ });
934
937
  if (deleteResult?.outcome === "skipped") {
935
938
  orphanReason = log.mask(`old managed policy ${v(physicalId)} was not deleted: ${deleteResult.reason}`);
936
939
  log.warn(`Skipped deleting old managed policy ${v(physicalId)} during replacement: ${deleteResult.reason}. The old policy may be orphaned and require manual cleanup.`);
937
940
  }
938
941
  } catch (error) {
939
- orphanReason = log.mask(`old managed policy ${v(physicalId)} could not be deleted: ${safeStringify(error)}`);
940
- log.warn(`Failed to delete old managed policy ${v(physicalId)} during replacement: ${v(safeStringify(error))}. The old policy may be orphaned and require manual cleanup.`);
942
+ orphanReason = log.mask(error instanceof RecordedIdentityMismatchError ? `old managed policy ${v(physicalId)} was not deleted: the managed policy now holding that name is not the one cdkd created (its ${error.attribute} differs from the recorded one), so cdkd left it alone` : `old managed policy ${v(physicalId)} could not be deleted: ${safeStringify(error)}`);
943
+ if (error instanceof RecordedIdentityMismatchError) log.warn(`${orphanReason}.`);
944
+ else log.warn(`Failed to delete old managed policy ${v(physicalId)} during replacement: ${v(safeStringify(error))}. The old policy may be orphaned and require manual cleanup.`);
941
945
  }
942
946
  const base = {
943
947
  physicalId: createResult.physicalId,
@@ -1053,8 +1057,10 @@ async function deleteImpl$39(logicalId, physicalId, resourceType, _properties, c
1053
1057
  this.logger.debug(mask(`Deleting IAM managed policy ${logicalId}: ${physicalId}`));
1054
1058
  const progress = { stripped: false };
1055
1059
  try {
1060
+ const readPolicyId = async () => policyIdentityToken((await this.iamClient.send(new GetPolicyCommand({ PolicyArn: physicalId }))).Policy?.PolicyId);
1061
+ let liveId;
1056
1062
  try {
1057
- await this.iamClient.send(new GetPolicyCommand({ PolicyArn: physicalId }));
1063
+ liveId = await readPolicyId();
1058
1064
  } catch (error) {
1059
1065
  if (error instanceof NoSuchEntityException) {
1060
1066
  await this.goneOnDelete(logicalId, physicalId, resourceType, context, mask);
@@ -1062,11 +1068,21 @@ async function deleteImpl$39(logicalId, physicalId, resourceType, _properties, c
1062
1068
  }
1063
1069
  throw error;
1064
1070
  }
1071
+ await assertRecordedIdentity({
1072
+ label: "IAM managed policy",
1073
+ resourceType,
1074
+ logicalId,
1075
+ physicalId,
1076
+ liveId,
1077
+ reread: readPolicyId,
1078
+ context
1079
+ });
1065
1080
  await this.detachAllPrincipals(physicalId, progress);
1066
1081
  await this.deleteAllNonDefaultVersions(physicalId);
1067
1082
  await this.iamClient.send(new DeletePolicyCommand({ PolicyArn: physicalId }));
1068
1083
  this.logger.debug(`Successfully deleted IAM managed policy ${logicalId}`);
1069
1084
  } catch (error) {
1085
+ if (error instanceof RecordedIdentityError) throw error;
1070
1086
  if (error instanceof NoSuchEntityException) {
1071
1087
  await this.goneOnDelete(logicalId, physicalId, resourceType, context, mask);
1072
1088
  return;
@@ -1659,7 +1675,10 @@ var IAMInstanceProfileProvider = class {
1659
1675
  log.debug(`Successfully created IAM instance profile ${logicalId}: ${v(instanceProfileName)}`);
1660
1676
  return {
1661
1677
  physicalId: instanceProfileName,
1662
- attributes: { Arn: profile?.Arn }
1678
+ attributes: {
1679
+ Arn: profile?.Arn,
1680
+ ...definedAttributes({ InstanceProfileId: createdProfileIdentity })
1681
+ }
1663
1682
  };
1664
1683
  } catch (error) {
1665
1684
  const cause = error instanceof Error ? error : void 0;
@@ -1710,10 +1729,14 @@ var IAMInstanceProfileProvider = class {
1710
1729
  log.debug(`Added role ${v(roleName)} to instance profile ${v(physicalId)}`);
1711
1730
  }
1712
1731
  log.debug(`Successfully updated IAM instance profile ${logicalId}`);
1732
+ const getResponse = await this.iamClient.send(new GetInstanceProfileCommand({ InstanceProfileName: physicalId }));
1713
1733
  return {
1714
1734
  physicalId,
1715
1735
  wasReplaced: false,
1716
- attributes: { Arn: (await this.iamClient.send(new GetInstanceProfileCommand({ InstanceProfileName: physicalId }))).InstanceProfile?.Arn }
1736
+ attributes: {
1737
+ Arn: getResponse.InstanceProfile?.Arn,
1738
+ ...definedAttributes({ InstanceProfileId: instanceProfileIdentityToken(getResponse.InstanceProfile?.InstanceProfileId) })
1739
+ }
1717
1740
  };
1718
1741
  } catch (error) {
1719
1742
  const cause = error instanceof Error ? error : void 0;
@@ -1736,7 +1759,20 @@ var IAMInstanceProfileProvider = class {
1736
1759
  try {
1737
1760
  let roles = [];
1738
1761
  try {
1739
- roles = (await this.iamClient.send(new GetInstanceProfileCommand({ InstanceProfileName: physicalId }))).InstanceProfile?.Roles?.map((r) => r.RoleName).filter((name) => !!name) || [];
1762
+ const readProfile = async () => {
1763
+ const response = await this.iamClient.send(new GetInstanceProfileCommand({ InstanceProfileName: physicalId }));
1764
+ roles = response.InstanceProfile?.Roles?.map((r) => r.RoleName).filter((name) => !!name) || [];
1765
+ return response.InstanceProfile?.InstanceProfileName?.toLowerCase() === physicalId.toLowerCase() ? response.InstanceProfile.InstanceProfileId : void 0;
1766
+ };
1767
+ await assertRecordedIdentity({
1768
+ label: "IAM instance profile",
1769
+ resourceType,
1770
+ logicalId,
1771
+ physicalId,
1772
+ liveId: await readProfile(),
1773
+ reread: readProfile,
1774
+ context
1775
+ });
1740
1776
  } catch (error) {
1741
1777
  if (error instanceof NoSuchEntityException) {
1742
1778
  const clientRegion = await this.iamClient.config.region();
@@ -1765,6 +1801,7 @@ var IAMInstanceProfileProvider = class {
1765
1801
  this.logGoneOnDelete(logicalId, physicalId, context, log);
1766
1802
  return;
1767
1803
  }
1804
+ if (error instanceof RecordedIdentityError) throw error;
1768
1805
  const cause = error instanceof Error ? error : void 0;
1769
1806
  const { mask } = log;
1770
1807
  const failure = this.wrapMaskedError(mask, error, (text) => new ProvisioningError(mask(`Failed to delete IAM instance profile ${logicalId}: ${text}`), resourceType, logicalId, physicalId, cause));
@@ -1836,7 +1873,10 @@ var IAMInstanceProfileProvider = class {
1836
1873
  const resp = await this.iamClient.send(new GetInstanceProfileCommand({ InstanceProfileName: explicit }));
1837
1874
  return {
1838
1875
  physicalId: explicit,
1839
- attributes: definedAttributes({ Arn: resp.InstanceProfile?.Arn })
1876
+ attributes: definedAttributes({
1877
+ Arn: resp.InstanceProfile?.Arn,
1878
+ InstanceProfileId: instanceProfileIdentityToken(resp.InstanceProfile?.InstanceProfileId)
1879
+ })
1840
1880
  };
1841
1881
  } catch (err) {
1842
1882
  if (err instanceof NoSuchEntityException) return null;
@@ -2393,7 +2433,10 @@ async function createUser(logicalId, resourceType, properties, log) {
2393
2433
  log.debug(`Successfully created IAM user ${logicalId}: ${v(userName)}`);
2394
2434
  return {
2395
2435
  physicalId: userName,
2396
- attributes: { Arn: user?.Arn }
2436
+ attributes: {
2437
+ Arn: user?.Arn,
2438
+ ...definedAttributes({ UserId: createdUserIdentity })
2439
+ }
2397
2440
  };
2398
2441
  } catch (error) {
2399
2442
  const cause = error instanceof Error ? error : void 0;
@@ -2476,10 +2519,14 @@ async function updateUser(logicalId, physicalId, resourceType, properties, previ
2476
2519
  await this.updateUserManagedPolicies(physicalId, properties["ManagedPolicyArns"], previousProperties["ManagedPolicyArns"], log);
2477
2520
  await this.updateUserGroups(physicalId, groups.next.Groups, groups.prev.Groups, log);
2478
2521
  await this.updateUserInlinePolicies(physicalId, properties["Policies"], previousProperties["Policies"], log, claimed);
2522
+ const getUserResponse = await this.iamClient.send(new GetUserCommand({ UserName: physicalId }));
2479
2523
  return {
2480
2524
  physicalId,
2481
2525
  wasReplaced: false,
2482
- attributes: { Arn: (await this.iamClient.send(new GetUserCommand({ UserName: physicalId }))).User?.Arn }
2526
+ attributes: {
2527
+ Arn: getUserResponse.User?.Arn,
2528
+ ...definedAttributes({ UserId: userOrGroupIdentityToken(getUserResponse.User?.UserId) })
2529
+ }
2483
2530
  };
2484
2531
  } catch (error) {
2485
2532
  const cause = error instanceof Error ? error : void 0;
@@ -2592,7 +2639,20 @@ async function deleteUser(logicalId, physicalId, resourceType, context) {
2592
2639
  let hadBoundary = false;
2593
2640
  try {
2594
2641
  try {
2595
- hadBoundary = (await this.iamClient.send(new GetUserCommand({ UserName: physicalId }))).User?.PermissionsBoundary !== void 0;
2642
+ const readUser = async () => {
2643
+ const user = (await this.iamClient.send(new GetUserCommand({ UserName: physicalId }))).User;
2644
+ hadBoundary = user?.PermissionsBoundary !== void 0;
2645
+ return user?.UserName?.toLowerCase() === physicalId.toLowerCase() ? user.UserId : void 0;
2646
+ };
2647
+ await assertRecordedIdentity({
2648
+ label: "IAM user",
2649
+ resourceType,
2650
+ logicalId,
2651
+ physicalId,
2652
+ liveId: await readUser(),
2653
+ reread: readUser,
2654
+ context
2655
+ });
2596
2656
  } catch (error) {
2597
2657
  if (error instanceof NoSuchEntityException) {
2598
2658
  const clientRegion = await this.iamClient.config.region();
@@ -2623,6 +2683,7 @@ async function deleteUser(logicalId, physicalId, resourceType, context) {
2623
2683
  await this.iamClient.send(new DeleteUserCommand({ UserName: physicalId }));
2624
2684
  log.debug(`Successfully deleted IAM user ${logicalId}`);
2625
2685
  } catch (error) {
2686
+ if (error instanceof RecordedIdentityError) throw error;
2626
2687
  const cause = error instanceof Error ? error : void 0;
2627
2688
  const failure = this.wrapMaskedError(log.mask, error, (text) => new ProvisioningError(log.mask(`Failed to delete IAM user ${logicalId}: ${text}`), resourceType, logicalId, physicalId, cause));
2628
2689
  throw progress.stripped ? markDeleteStarted(failure) : failure;
@@ -2789,7 +2850,10 @@ async function createGroup(logicalId, resourceType, properties, log) {
2789
2850
  log.debug(`Successfully created IAM group ${logicalId}: ${v(groupName)}`);
2790
2851
  return {
2791
2852
  physicalId: groupName,
2792
- attributes: { Arn: group?.Arn }
2853
+ attributes: {
2854
+ Arn: group?.Arn,
2855
+ ...definedAttributes({ GroupId: createdGroupIdentity })
2856
+ }
2793
2857
  };
2794
2858
  } catch (error) {
2795
2859
  const cause = error instanceof Error ? error : void 0;
@@ -2817,7 +2881,10 @@ async function updateGroup(logicalId, physicalId, resourceType, properties, prev
2817
2881
  return {
2818
2882
  physicalId,
2819
2883
  wasReplaced: false,
2820
- attributes: { Arn: getGroupResponse.Group?.Arn }
2884
+ attributes: {
2885
+ Arn: getGroupResponse.Group?.Arn,
2886
+ ...definedAttributes({ GroupId: userOrGroupIdentityToken(getGroupResponse.Group?.GroupId) })
2887
+ }
2821
2888
  };
2822
2889
  } catch (error) {
2823
2890
  const cause = error instanceof Error ? error : void 0;
@@ -2830,9 +2897,24 @@ async function deleteGroup(logicalId, physicalId, resourceType, context) {
2830
2897
  log.debug(`Deleting IAM group ${logicalId}: ${v(physicalId)}`);
2831
2898
  const progress = { stripped: false };
2832
2899
  try {
2900
+ let members = [];
2901
+ const readGroup = async () => {
2902
+ const response = await this.iamClient.send(new GetGroupCommand({ GroupName: physicalId }));
2903
+ members = response.Users ?? [];
2904
+ return response.Group?.GroupName?.toLowerCase() === physicalId.toLowerCase() ? response.Group.GroupId : void 0;
2905
+ };
2906
+ await assertRecordedIdentity({
2907
+ label: "IAM group",
2908
+ resourceType,
2909
+ logicalId,
2910
+ physicalId,
2911
+ liveId: await readGroup(),
2912
+ reread: readGroup,
2913
+ context
2914
+ });
2833
2915
  await this.detachAllGroupPolicies(physicalId, log, progress);
2834
2916
  await this.deleteAllGroupInlinePolicies(physicalId, log, progress);
2835
- await this.removeAllUsersFromGroup(physicalId, log, progress);
2917
+ await this.removeAllUsersFromGroup(physicalId, log, progress, members);
2836
2918
  await this.iamClient.send(new DeleteGroupCommand({ GroupName: physicalId }));
2837
2919
  log.debug(`Successfully deleted IAM group ${logicalId}`);
2838
2920
  } catch (error) {
@@ -2843,6 +2925,7 @@ async function deleteGroup(logicalId, physicalId, resourceType, context) {
2843
2925
  else log.debug(`Group ${v(physicalId)} does not exist, skipping deletion`);
2844
2926
  return;
2845
2927
  }
2928
+ if (error instanceof RecordedIdentityError) throw error;
2846
2929
  const cause = error instanceof Error ? error : void 0;
2847
2930
  const failure = this.wrapMaskedError(log.mask, error, (text) => new ProvisioningError(log.mask(`Failed to delete IAM group ${logicalId}: ${text}`), resourceType, logicalId, physicalId, cause));
2848
2931
  throw progress.stripped ? markDeleteStarted(failure) : failure;
@@ -2867,10 +2950,9 @@ async function detachAllGroupPolicies(groupName, log, progress) {
2867
2950
  throw error;
2868
2951
  }
2869
2952
  }
2870
- async function removeAllUsersFromGroup(groupName, log, progress) {
2953
+ async function removeAllUsersFromGroup(groupName, log, progress, users) {
2871
2954
  const { value: v } = log;
2872
2955
  try {
2873
- const users = (await this.iamClient.send(new GetGroupCommand({ GroupName: groupName }))).Users || [];
2874
2956
  for (const user of users) if (user.UserName) try {
2875
2957
  await this.iamClient.send(new RemoveUserFromGroupCommand({
2876
2958
  GroupName: groupName,
@@ -3347,7 +3429,10 @@ async function importUser(input) {
3347
3429
  const resp = await this.iamClient.send(new GetUserCommand({ UserName: explicit }));
3348
3430
  return {
3349
3431
  physicalId: explicit,
3350
- attributes: definedAttributes({ Arn: resp.User?.Arn })
3432
+ attributes: definedAttributes({
3433
+ Arn: resp.User?.Arn,
3434
+ UserId: userOrGroupIdentityToken(resp.User?.UserId)
3435
+ })
3351
3436
  };
3352
3437
  } catch (err) {
3353
3438
  if (err instanceof NoSuchEntityException) return null;
@@ -3361,7 +3446,10 @@ async function importGroup(input) {
3361
3446
  const resp = await this.iamClient.send(new GetGroupCommand({ GroupName: explicit }));
3362
3447
  return {
3363
3448
  physicalId: explicit,
3364
- attributes: definedAttributes({ Arn: resp.Group?.Arn })
3449
+ attributes: definedAttributes({
3450
+ Arn: resp.Group?.Arn,
3451
+ GroupId: userOrGroupIdentityToken(resp.Group?.GroupId)
3452
+ })
3365
3453
  };
3366
3454
  } catch (err) {
3367
3455
  if (err instanceof NoSuchEntityException) return null;
@@ -3469,8 +3557,8 @@ var IAMUserGroupProvider = class {
3469
3557
  detachAllGroupPolicies(groupName, log, progress) {
3470
3558
  return detachAllGroupPolicies.call(this, groupName, log, progress);
3471
3559
  }
3472
- removeAllUsersFromGroup(groupName, log, progress) {
3473
- return removeAllUsersFromGroup.call(this, groupName, log, progress);
3560
+ removeAllUsersFromGroup(groupName, log, progress, users) {
3561
+ return removeAllUsersFromGroup.call(this, groupName, log, progress, users);
3474
3562
  }
3475
3563
  updateGroupManagedPolicies(groupName, newPolicies, oldPolicies, log) {
3476
3564
  return updateGroupManagedPolicies.call(this, groupName, newPolicies, oldPolicies, log);
@@ -12328,7 +12416,7 @@ function recordedFunctionNameSpelling(recorded, liveFunctionArn) {
12328
12416
  return liveFunctionArn;
12329
12417
  }
12330
12418
  function projectOntoRecorded(recorded, live) {
12331
- if (!isPlainRecord$4(recorded) || !isPlainRecord$4(live)) return live;
12419
+ if (!isPlainRecord$3(recorded) || !isPlainRecord$3(live)) return live;
12332
12420
  const out = {};
12333
12421
  for (const key of Object.keys(recorded)) {
12334
12422
  if (!Object.prototype.hasOwnProperty.call(live, key)) continue;
@@ -12336,7 +12424,7 @@ function projectOntoRecorded(recorded, live) {
12336
12424
  }
12337
12425
  return out;
12338
12426
  }
12339
- function isPlainRecord$4(value) {
12427
+ function isPlainRecord$3(value) {
12340
12428
  return typeof value === "object" && value !== null && !Array.isArray(value);
12341
12429
  }
12342
12430
  const LAMBDA_WEB_MAX_POLL_ATTEMPTS = 1200;
@@ -12544,15 +12632,15 @@ var LambdaWebFunctionRevisionProvider = class {
12544
12632
  const functionName = properties["FunctionName"];
12545
12633
  if (typeof functionName !== "string" || functionName === "") fail("FunctionName must be a non-empty string");
12546
12634
  const build = properties["BuildConfig"];
12547
- if (!isPlainRecord$4(build)) fail("BuildConfig must be an object");
12635
+ if (!isPlainRecord$3(build)) fail("BuildConfig must be an object");
12548
12636
  const code = build["CodeConfig"];
12549
- const s3 = isPlainRecord$4(code) ? code["S3Object"] : void 0;
12550
- if (!isPlainRecord$4(s3) || typeof s3["Bucket"] !== "string" || typeof s3["Key"] !== "string") fail("BuildConfig.CodeConfig.S3Object.Bucket and .Key are required strings");
12637
+ const s3 = isPlainRecord$3(code) ? code["S3Object"] : void 0;
12638
+ if (!isPlainRecord$3(s3) || typeof s3["Bucket"] !== "string" || typeof s3["Key"] !== "string") fail("BuildConfig.CodeConfig.S3Object.Bucket and .Key are required strings");
12551
12639
  const runtimeConfig = build["RuntimeConfig"];
12552
- const runtime = isPlainRecord$4(runtimeConfig) ? runtimeConfig["Runtime"] : void 0;
12640
+ const runtime = isPlainRecord$3(runtimeConfig) ? runtimeConfig["Runtime"] : void 0;
12553
12641
  if (typeof runtime !== "string") fail("BuildConfig.RuntimeConfig.Runtime is a required string");
12554
12642
  const service = properties["ServiceConfig"];
12555
- if (!isPlainRecord$4(service) || typeof service["ExecutionRoleArn"] !== "string") fail("ServiceConfig.ExecutionRoleArn is a required string");
12643
+ if (!isPlainRecord$3(service) || typeof service["ExecutionRoleArn"] !== "string") fail("ServiceConfig.ExecutionRoleArn is a required string");
12556
12644
  const s3Object = s3;
12557
12645
  const input = {
12558
12646
  functionName,
@@ -12591,15 +12679,15 @@ var LambdaWebFunctionRevisionProvider = class {
12591
12679
  if (typeof service["EgressNetworkConnectorArn"] === "string") out.egressNetworkConnectorArn = service["EgressNetworkConnectorArn"];
12592
12680
  const env = service["EnvironmentVariables"];
12593
12681
  if (env !== void 0) {
12594
- if (isPlainRecord$4(env) && Object.values(env).every((v) => typeof v === "string")) out.environmentVariables = { ...env };
12682
+ if (isPlainRecord$3(env) && Object.values(env).every((v) => typeof v === "string")) out.environmentVariables = { ...env };
12595
12683
  else if (context?.replayingState) this.logger.warn(safeMsg`ServiceConfig.EnvironmentVariables must be an object of string values; omitting it while replaying a state record`);
12596
12684
  else fail("ServiceConfig.EnvironmentVariables must be an object of string values");
12597
12685
  }
12598
12686
  const telemetry = service["TelemetryConfig"];
12599
- if (isPlainRecord$4(telemetry)) {
12687
+ if (isPlainRecord$3(telemetry)) {
12600
12688
  const telemetryConfig = {};
12601
12689
  const logging = telemetry["LoggingConfig"];
12602
- if (isPlainRecord$4(logging)) {
12690
+ if (isPlainRecord$3(logging)) {
12603
12691
  const loggingConfig = {};
12604
12692
  if (typeof logging["LogGroup"] === "string") loggingConfig.logGroup = logging["LogGroup"];
12605
12693
  if (typeof logging["ApplicationLogLevel"] === "string") loggingConfig.applicationLogLevel = logging["ApplicationLogLevel"];
@@ -12931,7 +13019,7 @@ var LambdaWebFunctionEndpointProvider = class {
12931
13019
  }
12932
13020
  return fail(message);
12933
13021
  };
12934
- if (!isPlainRecord$4(value)) return bad(`${blockKey} must be an object`);
13022
+ if (!isPlainRecord$3(value)) return bad(`${blockKey} must be an object`);
12935
13023
  if (value[memberKey] === void 0) return { present: false };
12936
13024
  const n = coerceCfnInteger(value[memberKey]);
12937
13025
  if (n === void 0) return bad(`${blockKey}.${memberKey} must be an integer`);
@@ -13000,7 +13088,7 @@ function readRevisionWeights(value, fail) {
13000
13088
  if (value === void 0) return void 0;
13001
13089
  if (!Array.isArray(value)) return fail("RevisionWeights must be a list");
13002
13090
  return value.map((entry, i) => {
13003
- if (!isPlainRecord$4(entry) || typeof entry["RevisionId"] !== "string") return fail(`RevisionWeights[${i}].RevisionId must be a string`);
13091
+ if (!isPlainRecord$3(entry) || typeof entry["RevisionId"] !== "string") return fail(`RevisionWeights[${i}].RevisionId must be a string`);
13004
13092
  const weight = coerceCfnInteger(entry["Weight"]);
13005
13093
  if (weight === void 0) return fail(`RevisionWeights[${i}].Weight must be an integer`);
13006
13094
  return {
@@ -13263,8 +13351,8 @@ var LambdaNetworkConnectorProvider = class {
13263
13351
  throw new ProvisioningError(`${message} for Lambda network connector ${logicalIdShown(logicalId)}`, resourceType, logicalId, physicalId);
13264
13352
  };
13265
13353
  const config = properties["Configuration"];
13266
- const vpc = isPlainRecord$4(config) ? config["VpcEgressConfiguration"] : void 0;
13267
- if (!isPlainRecord$4(vpc)) return fail("Configuration.VpcEgressConfiguration must be an object");
13354
+ const vpc = isPlainRecord$3(config) ? config["VpcEgressConfiguration"] : void 0;
13355
+ if (!isPlainRecord$3(vpc)) return fail("Configuration.VpcEgressConfiguration must be an object");
13268
13356
  const strings = (key) => {
13269
13357
  const value = vpc[key];
13270
13358
  if (value === void 0) return void 0;
@@ -13286,7 +13374,7 @@ var LambdaNetworkConnectorProvider = class {
13286
13374
  readElasticIp(properties, logicalId, resourceType, physicalId, context) {
13287
13375
  const eip = declaredElasticIp(properties);
13288
13376
  if (eip === void 0) return void 0;
13289
- if (isPlainRecord$4(eip) && typeof eip["Type"] === "string" && ELASTIC_IP_TYPES.has(eip["Type"])) return { Type: eip["Type"] };
13377
+ if (isPlainRecord$3(eip) && typeof eip["Type"] === "string" && ELASTIC_IP_TYPES.has(eip["Type"])) return { Type: eip["Type"] };
13290
13378
  const message = `Configuration.VpcEgressConfiguration.${ELASTIC_IP_KEY} must be an object whose Type is ${[...ELASTIC_IP_TYPES].join(" or ")} for Lambda network connector ${logicalIdShown(logicalId)}`;
13291
13379
  if (context?.replayingState === true || context !== void 0 && "desiredFromAwsReadback" in context && context.desiredFromAwsReadback === true) {
13292
13380
  this.logger.warn(safeMsg`${message}; omitting it while applying a state-borne bag`);
@@ -13371,11 +13459,11 @@ const ELASTIC_IP_KEY = "ElasticIpConfiguration";
13371
13459
  const ELASTIC_IP_TYPES = /* @__PURE__ */ new Set(["None", "ServiceManaged"]);
13372
13460
  function declaredElasticIp(properties) {
13373
13461
  const config = properties["Configuration"];
13374
- const vpc = isPlainRecord$4(config) ? config["VpcEgressConfiguration"] : void 0;
13375
- return isPlainRecord$4(vpc) ? vpc[ELASTIC_IP_KEY] : void 0;
13462
+ const vpc = isPlainRecord$3(config) ? config["VpcEgressConfiguration"] : void 0;
13463
+ return isPlainRecord$3(vpc) ? vpc[ELASTIC_IP_KEY] : void 0;
13376
13464
  }
13377
13465
  function isNoneElasticIp(value) {
13378
- return isPlainRecord$4(value) && value["Type"] === "None";
13466
+ return isPlainRecord$3(value) && value["Type"] === "None";
13379
13467
  }
13380
13468
  function withoutElasticIp(properties) {
13381
13469
  const config = properties["Configuration"];
@@ -13393,7 +13481,7 @@ function elasticIpForUpdate(fromDesired, properties, previousProperties) {
13393
13481
  if (fromDesired !== void 0 || declaredElasticIp(properties) !== void 0) return fromDesired;
13394
13482
  const previous = declaredElasticIp(previousProperties);
13395
13483
  if (previous === void 0) return void 0;
13396
- if (isPlainRecord$4(previous) && previous["Type"] === "None") return void 0;
13484
+ if (isPlainRecord$3(previous) && previous["Type"] === "None") return void 0;
13397
13485
  return { Type: "None" };
13398
13486
  }
13399
13487
  var TerminalConnectorStateError = class extends Error {};
@@ -14777,7 +14865,7 @@ async function waitForKinesisDestinationSettled(tableName, streamArn, expectedPr
14777
14865
  function isTransientStreamReadFailure(err) {
14778
14866
  return isThrottlingError(err) || isTransientServerError(err) || isAmbiguousOutcomeError(err) || err instanceof ResourceNotFoundException$1;
14779
14867
  }
14780
- async function readCurrentState$34(physicalId, _logicalId, _resourceType, properties, context) {
14868
+ async function readCurrentState$34(physicalId, logicalId, _resourceType, properties, context) {
14781
14869
  try {
14782
14870
  const table = (await this.dynamoDBClient.send(new DescribeTableCommand({ TableName: physicalId }))).Table;
14783
14871
  if (!table) return void 0;
@@ -14830,8 +14918,10 @@ async function readCurrentState$34(physicalId, _logicalId, _resourceType, proper
14830
14918
  if (table.DeletionProtectionEnabled !== void 0) result["DeletionProtectionEnabled"] = table.DeletionProtectionEnabled;
14831
14919
  if (table.TableClassSummary?.TableClass) result["TableClass"] = table.TableClassSummary.TableClass;
14832
14920
  const tableArn = table.TableArn;
14921
+ const tagsWritten = context?.afterOwnWrite === true && tableArn !== void 0 ? takeTagWrite("AWS::DynamoDB::Table", tableArn) : void 0;
14922
+ const tagsSettle = properties !== void 0 && bagInformative ? tagsWritten : void 0;
14833
14923
  const [tags, pitr, ttl, resourcePolicy, kinesis, contributorInsights] = await Promise.all([
14834
- tableArn ? this.readTableTags(tableArn) : Promise.resolve(void 0),
14924
+ tableArn ? tagsSettle === void 0 ? this.readTableTags(tableArn) : this.readTableTagsBaseline(tableArn, tagsSettle, logicalId) : Promise.resolve(void 0),
14835
14925
  this.readPointInTimeRecovery(physicalId),
14836
14926
  this.readTimeToLive(physicalId),
14837
14927
  tableArn ? this.readTableResourcePolicy(physicalId, tableArn, false, properties !== void 0 && bagInformative ? {
@@ -15145,6 +15235,7 @@ async function applyTagDiff$17(tableArn, resourceType, logicalId, oldTagsRaw, ne
15145
15235
  ResourceArn: tableArn,
15146
15236
  TagKeys: tagsToRemove
15147
15237
  }));
15238
+ recordTagWrite("AWS::DynamoDB::Table", tableArn, [], tagsToRemove);
15148
15239
  this.logger.debug(`Removed ${tagsToRemove.length} tag(s) from DynamoDB table ${tableArn}`);
15149
15240
  }
15150
15241
  if (tagsToAdd.length > 0) {
@@ -15152,6 +15243,7 @@ async function applyTagDiff$17(tableArn, resourceType, logicalId, oldTagsRaw, ne
15152
15243
  ResourceArn: tableArn,
15153
15244
  Tags: tagsToAdd
15154
15245
  }));
15246
+ recordTagWrite("AWS::DynamoDB::Table", tableArn, tagsToAdd.map((t) => [t.Key, t.Value]), []);
15155
15247
  let recordedKeys;
15156
15248
  try {
15157
15249
  recordedKeys = /* @__PURE__ */ new Set([...planTagDiff(void 0, oldTagsRaw).set.keys()]);
@@ -15522,6 +15614,8 @@ async function applyIndexUpdates(logicalId, physicalId, resourceType, properties
15522
15614
 
15523
15615
  // src/provisioning/providers/dynamodb-table/update.ts
15524
15616
  async function update$35(logicalId, physicalId, resourceType, properties, previousProperties, context) {
15617
+ const region = await this.dynamoDBClient.config.region().catch(() => void 0);
15618
+ clearTagWrites("AWS::DynamoDB::Table", (arn) => region === void 0 ? isDynamoDBTableArnIn(arn, physicalId, /* @__PURE__ */ new Set([arn.split(":")[3] ?? ""])) : isDynamoDBTableArnIn(arn, physicalId, /* @__PURE__ */ new Set([region])));
15525
15619
  const markUnsettled = (key) => context?.markUnsettled?.(key);
15526
15620
  const maskSecrets = context?.maskSecrets ?? ((text) => text);
15527
15621
  const warn = (message) => this.logger.warn(maskSecrets(message));
@@ -15947,6 +16041,11 @@ var DynamoDBTableProvider = class {
15947
16041
  readTableTags(...args) {
15948
16042
  return readTableTags.call(this, ...args);
15949
16043
  }
16044
+ tagsBaselineRereadDelaysMs = TAGS_BASELINE_REREAD_DELAYS_MS;
16045
+ readTableTagsBaseline(tableArn, written, logicalId) {
16046
+ const read = () => this.readTableTags(tableArn);
16047
+ return settleWrittenTags(read, read, written, this.tagsBaselineRereadDelaysMs, () => warnUnsettledMember(this.logger, logicalId, "AWS::DynamoDB::Table", "Tags"), (answer) => answer === RESOURCE_NOT_FOUND);
16048
+ }
15950
16049
  readPointInTimeRecovery(...args) {
15951
16050
  return readPointInTimeRecovery.call(this, ...args);
15952
16051
  }
@@ -16049,6 +16148,41 @@ function assertUsableRetention(raw, coerced, logicalId, resourceType) {
16049
16148
  throw new ProvisioningError(`${logicalId} (${resourceType}): RetentionInDays must be a positive CloudFormation Integer (optional sign then decimal digits, as a number or a string — 30 or '30'); ${detail}`, resourceType, logicalId);
16050
16149
  }
16051
16150
 
16151
+ // src/provisioning/providers/logs-loggroup/own-replay.ts
16152
+ const createLogGroupLatch = new AmbiguousCreateLatch("CreateLogGroup");
16153
+ const createClients = /* @__PURE__ */ new WeakMap();
16154
+ function logGroupCreateClient(shared) {
16155
+ if (!(shared instanceof CloudWatchLogsClient)) return Promise.resolve(shared);
16156
+ let client = createClients.get(shared);
16157
+ if (client === void 0) {
16158
+ client = shared.config.region().then((region) => withoutServerErrorRetries(new CloudWatchLogsClient({
16159
+ ...ambientClientDefaults(),
16160
+ region
16161
+ })), (error) => {
16162
+ createClients.delete(shared);
16163
+ throw error;
16164
+ });
16165
+ createClients.set(shared, client);
16166
+ }
16167
+ return client;
16168
+ }
16169
+ async function ownReplayedGroup(logGroupName, createError, carried, attemptStartMs, shownName) {
16170
+ const replayedInSend = hasReplayMayCollide(createError);
16171
+ if (carried === void 0 && !replayedInSend) return false;
16172
+ const window = {
16173
+ floorMs: Math.min(carried?.floorMs ?? Number.POSITIVE_INFINITY, replayedInSend ? attemptStartMs - CREATION_DATE_SKEW_MARGIN_MS : Number.POSITIVE_INFINITY),
16174
+ ceilingMs: replayedInSend || carried === void 0 ? Date.now() + CREATION_DATE_SKEW_MARGIN_MS : carried.ceilingMs
16175
+ };
16176
+ let createdAt;
16177
+ try {
16178
+ createdAt = await this.holderCreatedAt("AWS::Logs::LogGroup", logGroupName);
16179
+ } catch (readError) {
16180
+ this.logger.debug(safeMsg`Could not read when log group ${shownName} was created (${describeAwsFailure(readError).summary}); refusing it`);
16181
+ return false;
16182
+ }
16183
+ return isInsideWindow(createdAt === void 0 ? void 0 : new Date(createdAt), window);
16184
+ }
16185
+
16052
16186
  // src/provisioning/providers/logs-loggroup/create.ts
16053
16187
  async function create$33(logicalId, resourceType, properties, context) {
16054
16188
  this.logger.debug(`Creating log group ${logicalId}`);
@@ -16062,14 +16196,26 @@ async function create$33(logicalId, resourceType, properties, context) {
16062
16196
  if (properties["DeletionProtectionEnabled"] !== void 0) createParams.deletionProtectionEnabled = properties["DeletionProtectionEnabled"];
16063
16197
  if (desiredTags.length > 0) createParams.tags = Object.fromEntries(desiredTags.map((t) => [t.Key, t.Value]));
16064
16198
  let createdNewLogGroup = false;
16199
+ const carried = createLogGroupLatch.take(logicalId);
16200
+ const attemptStartMs = Date.now();
16065
16201
  try {
16066
- await this.logsClient.send(new CreateLogGroupCommand(createParams));
16202
+ await (await logGroupCreateClient(this.logsClient)).send(new CreateLogGroupCommand(createParams));
16067
16203
  createdNewLogGroup = true;
16068
16204
  leftBehind = true;
16069
16205
  reportCreatedResource(logicalId, resourceType, logGroupName);
16070
16206
  } catch (createError) {
16071
- if (createError instanceof ResourceAlreadyExistsException) this.logger.debug(`Log group ${logGroupName} already exists, using existing`);
16072
- else throw createError;
16207
+ if (!(createError instanceof ResourceAlreadyExistsException)) {
16208
+ createLogGroupLatch.noteFailure(logicalId, createError, attemptStartMs, carried);
16209
+ throw createError;
16210
+ }
16211
+ const shownName = maskerOrIdentity(context?.maskSecrets)(logGroupName);
16212
+ if (licensedNameHolder() === logGroupName) this.logger.debug(safeMsg`Log group ${shownName} already exists and is this stack's own: taking it back`);
16213
+ else if (await ownReplayedGroup.call(this, logGroupName, createError, carried, attemptStartMs, shownName)) {
16214
+ createdNewLogGroup = true;
16215
+ leftBehind = true;
16216
+ reportCreatedResource(logicalId, resourceType, logGroupName);
16217
+ this.logger.debug(safeMsg`Log group ${shownName} was created by an earlier attempt of this create whose answer was lost: using it`);
16218
+ } else throw createError;
16073
16219
  }
16074
16220
  try {
16075
16221
  const rawRetention = properties["RetentionInDays"];
@@ -16560,7 +16706,7 @@ var LogsLogGroupProvider = class {
16560
16706
  function isLogsNotFound(error) {
16561
16707
  return error instanceof Error && error.name === "ResourceNotFoundException";
16562
16708
  }
16563
- function isPlainRecord$3(value) {
16709
+ function isPlainRecord$2(value) {
16564
16710
  return typeof value === "object" && value !== null && !Array.isArray(value);
16565
16711
  }
16566
16712
  function isStateBorne(context) {
@@ -16611,7 +16757,7 @@ var PropertyReader = class {
16611
16757
  optionalStringMap(key) {
16612
16758
  const value = this.properties[key];
16613
16759
  if (value === void 0) return void 0;
16614
- if (isPlainRecord$3(value) && Object.values(value).every((v) => typeof v === "string")) return { ...value };
16760
+ if (isPlainRecord$2(value) && Object.values(value).every((v) => typeof v === "string")) return { ...value };
16615
16761
  return this.refuse(`${key} must be a map of string values`);
16616
16762
  }
16617
16763
  optionalBoolean(key) {
@@ -16772,7 +16918,7 @@ var LogsDeliverySourceProvider = class {
16772
16918
  const liveConfig = source.deliverySourceConfiguration;
16773
16919
  if (liveConfig !== void 0 && Object.keys(liveConfig).length > 0) {
16774
16920
  const declared = properties?.["DeliverySourceConfiguration"];
16775
- result["DeliverySourceConfiguration"] = isPlainRecord$3(declared) ? Object.fromEntries(Object.entries(liveConfig).filter(([k]) => k in declared)) : { ...liveConfig };
16921
+ result["DeliverySourceConfiguration"] = isPlainRecord$2(declared) ? Object.fromEntries(Object.entries(liveConfig).filter(([k]) => k in declared)) : { ...liveConfig };
16776
16922
  }
16777
16923
  if (source.arn) try {
16778
16924
  result["Tags"] = await readTags$1(this.client, source.arn);
@@ -16950,10 +17096,10 @@ var LogsDeliveryDestinationProvider = class {
16950
17096
  if (destination.outputFormat !== void 0) result["OutputFormat"] = destination.outputFormat;
16951
17097
  let policy = await this.readDestinationPolicy(physicalId);
16952
17098
  const declared = properties?.["DeliveryDestinationPolicy"];
16953
- const declaredDocument = context?.afterOwnWrite === true && isPlainRecord$3(declared) ? declared["DeliveryDestinationPolicy"] : void 0;
16954
- if (isPlainRecord$3(declaredDocument)) policy = await settleDeclaredMember(policy, () => this.readDestinationPolicy(physicalId), (document) => policyDocumentMatchesDeclared(document, declaredDocument), declaredDocument, this.ownWriteRereadDelaysMs, () => warnUnsettledMember(this.logger, logicalId, "AWS::Logs::DeliveryDestination", "DeliveryDestinationPolicy"));
17099
+ const declaredDocument = context?.afterOwnWrite === true && isPlainRecord$2(declared) ? declared["DeliveryDestinationPolicy"] : void 0;
17100
+ if (isPlainRecord$2(declaredDocument)) policy = await settleDeclaredMember(policy, () => this.readDestinationPolicy(physicalId), (document) => policyDocumentMatchesDeclared(document, declaredDocument), declaredDocument, this.ownWriteRereadDelaysMs, () => warnUnsettledMember(this.logger, logicalId, "AWS::Logs::DeliveryDestination", "DeliveryDestinationPolicy"));
16955
17101
  if (typeof policy === "object") result["DeliveryDestinationPolicy"] = {
16956
- ...isPlainRecord$3(declared) && declared["DeliveryDestinationName"] !== void 0 && { DeliveryDestinationName: physicalId },
17102
+ ...isPlainRecord$2(declared) && declared["DeliveryDestinationName"] !== void 0 && { DeliveryDestinationName: physicalId },
16957
17103
  DeliveryDestinationPolicy: policy.value
16958
17104
  };
16959
17105
  try {
@@ -16985,7 +17131,7 @@ var LogsDeliveryDestinationProvider = class {
16985
17131
  if (block === void 0) return void 0;
16986
17132
  let problem;
16987
17133
  const document = policyDocument$1(block);
16988
- if (!isPlainRecord$3(block)) problem = "DeliveryDestinationPolicy must be an object";
17134
+ if (!isPlainRecord$2(block)) problem = "DeliveryDestinationPolicy must be an object";
16989
17135
  else if (block["DeliveryDestinationName"] !== void 0 && block["DeliveryDestinationName"] !== name) problem = "DeliveryDestinationPolicy.DeliveryDestinationName must equal the destination Name";
16990
17136
  else if (document === void 0) problem = "DeliveryDestinationPolicy.DeliveryDestinationPolicy must be a policy document object";
16991
17137
  if (problem === void 0) return document;
@@ -17008,9 +17154,9 @@ var LogsDeliveryDestinationProvider = class {
17008
17154
  }
17009
17155
  };
17010
17156
  function policyDocument$1(block) {
17011
- if (!isPlainRecord$3(block)) return void 0;
17157
+ if (!isPlainRecord$2(block)) return void 0;
17012
17158
  const document = block["DeliveryDestinationPolicy"];
17013
- if (isPlainRecord$3(document)) return JSON.stringify(document);
17159
+ if (isPlainRecord$2(document)) return JSON.stringify(document);
17014
17160
  }
17015
17161
  function parsePolicy(policy) {
17016
17162
  try {
@@ -17881,6 +18027,7 @@ async function create$32(logicalId, resourceType, properties, context) {
17881
18027
 
17882
18028
  // src/provisioning/providers/secretsmanager-secret/update.ts
17883
18029
  async function update$33(logicalId, physicalId, resourceType, properties, previousProperties, context) {
18030
+ clearTagWrites("AWS::SecretsManager::Secret", (id) => id === physicalId);
17884
18031
  const log = this.operationSinks(context?.maskSecrets, [
17885
18032
  [properties["Name"], properties["Name"]],
17886
18033
  [properties["Name"], physicalId],
@@ -17912,17 +18059,23 @@ async function update$33(logicalId, physicalId, resourceType, properties, previo
17912
18059
  const tagPlan = planTagDiff(previousProperties["Tags"], properties["Tags"]);
17913
18060
  const tagWarning = tagPlanWarning(tagPlan, resourceType, logicalId);
17914
18061
  if (tagWarning !== void 0) log.warn(tagWarning);
17915
- if (tagPlan.remove.length > 0) await this.smClient.send(new UntagResourceCommand$5({
17916
- SecretId: physicalId,
17917
- TagKeys: tagPlan.remove
17918
- }));
17919
- if (tagPlan.set.size > 0) await this.smClient.send(new TagResourceCommand$5({
17920
- SecretId: physicalId,
17921
- Tags: [...tagPlan.set].map(([Key, Value]) => ({
17922
- Key,
17923
- Value
17924
- }))
17925
- }));
18062
+ if (tagPlan.remove.length > 0) {
18063
+ await this.smClient.send(new UntagResourceCommand$5({
18064
+ SecretId: physicalId,
18065
+ TagKeys: tagPlan.remove
18066
+ }));
18067
+ recordTagWrite("AWS::SecretsManager::Secret", physicalId, [], tagPlan.remove);
18068
+ }
18069
+ if (tagPlan.set.size > 0) {
18070
+ await this.smClient.send(new TagResourceCommand$5({
18071
+ SecretId: physicalId,
18072
+ Tags: [...tagPlan.set].map(([Key, Value]) => ({
18073
+ Key,
18074
+ Value
18075
+ }))
18076
+ }));
18077
+ recordTagWrite("AWS::SecretsManager::Secret", physicalId, [...tagPlan.set], []);
18078
+ }
17926
18079
  if (tagPlan.remove.length > 0 || tagPlan.set.size > 0) log.debug(`Updated tags for secret ${v(physicalId)}`);
17927
18080
  const newReplicas = properties["ReplicaRegions"];
17928
18081
  const oldReplicas = previousProperties["ReplicaRegions"];
@@ -18096,7 +18249,9 @@ function generateSecretString(config, options) {
18096
18249
  }
18097
18250
 
18098
18251
  // src/provisioning/providers/secretsmanager-secret/read-state.ts
18099
- async function readCurrentState$32(physicalId, _logicalId, _resourceType) {
18252
+ async function readCurrentState$32(physicalId, logicalId, _resourceType, properties, context) {
18253
+ const tagsWritten = context?.afterOwnWrite === true ? takeTagWrite("AWS::SecretsManager::Secret", physicalId) : void 0;
18254
+ const tagsSettle = properties !== void 0 && Object.keys(properties).length > 0 ? tagsWritten : void 0;
18100
18255
  try {
18101
18256
  const resp = await this.smClient.send(new DescribeSecretCommand({ SecretId: physicalId }));
18102
18257
  const result = {};
@@ -18109,7 +18264,8 @@ async function readCurrentState$32(physicalId, _logicalId, _resourceType) {
18109
18264
  if (r.KmsKeyId) out["KmsKeyId"] = r.KmsKeyId;
18110
18265
  return out;
18111
18266
  });
18112
- result["Tags"] = normalizeAwsTagsToCfn(resp.Tags);
18267
+ const tags = normalizeAwsTagsToCfn(resp.Tags);
18268
+ result["Tags"] = tagsSettle === void 0 ? tags : await this.settleSecretTags(physicalId, logicalId, tags, tagsSettle);
18113
18269
  if (resp.Type !== void 0) result["Type"] = resp.Type;
18114
18270
  return result;
18115
18271
  } catch (err) {
@@ -18117,6 +18273,9 @@ async function readCurrentState$32(physicalId, _logicalId, _resourceType) {
18117
18273
  throw err;
18118
18274
  }
18119
18275
  }
18276
+ async function settleSecretTags(physicalId, logicalId, first, written) {
18277
+ return settleWrittenTags(() => Promise.resolve(first), async () => normalizeAwsTagsToCfn((await this.smClient.send(new DescribeSecretCommand({ SecretId: physicalId }))).Tags), written, this.tagsBaselineRereadDelaysMs, () => warnUnsettledMember(this.logger, logicalId, "AWS::SecretsManager::Secret", "Tags"));
18278
+ }
18120
18279
  async function importImpl$32(input) {
18121
18280
  if (input.knownPhysicalId) try {
18122
18281
  const resp = await this.smClient.send(new DescribeSecretCommand({ SecretId: input.knownPhysicalId }));
@@ -18218,8 +18377,12 @@ var SecretsManagerSecretProvider = class {
18218
18377
  generateSecretString(config, options) {
18219
18378
  return generateSecretString.call(this, config, options);
18220
18379
  }
18221
- readCurrentState(physicalId, logicalId, resourceType) {
18222
- return readCurrentState$32.call(this, physicalId, logicalId, resourceType);
18380
+ readCurrentState(physicalId, logicalId, resourceType, properties, context) {
18381
+ return readCurrentState$32.call(this, physicalId, logicalId, resourceType, properties, context);
18382
+ }
18383
+ tagsBaselineRereadDelaysMs = TAGS_BASELINE_REREAD_DELAYS_MS;
18384
+ settleSecretTags(...args) {
18385
+ return settleSecretTags.call(this, ...args);
18223
18386
  }
18224
18387
  getDriftUnknownPaths() {
18225
18388
  return ["SecretString", "GenerateSecretString"];
@@ -19602,272 +19765,6 @@ var EventBridgeArchiveProvider = class {
19602
19765
  }
19603
19766
  };
19604
19767
 
19605
- // src/provisioning/providers/ec2/sg-support.ts
19606
- const SG_INGRESS_IP_PROTOCOL_DEFAULT = "-1";
19607
- const SG_INGRESS_IP_PROTOCOL_PATH = "AWS::EC2::SecurityGroupIngress IpProtocol";
19608
- const SG_READBACK_RETRY_DELAY_MS = 1e3;
19609
- const securityGroupReadbackDelays = {};
19610
- const SG_RULE_PAGE_SIZE = 1e3;
19611
- const SG_RULE_ID_PATTERN = /^sgr-[0-9a-f]+$/;
19612
- function narrowIngressIpProtocol(properties, onUnusable) {
19613
- const declared = properties["IpProtocol"];
19614
- const ipProtocol = requireConfigString(declared, SG_INGRESS_IP_PROTOCOL_DEFAULT, SG_INGRESS_IP_PROTOCOL_PATH, {
19615
- coerceNumber: true,
19616
- ...onUnusable && { onUnusable }
19617
- });
19618
- if (declared === void 0 || declared === ipProtocol) return {
19619
- ipProtocol,
19620
- narrowed: properties
19621
- };
19622
- return {
19623
- ipProtocol,
19624
- narrowed: {
19625
- ...properties,
19626
- IpProtocol: ipProtocol
19627
- }
19628
- };
19629
- }
19630
- function canonicalizeSgRuleProtocol(rule) {
19631
- if (!("IpProtocol" in rule)) return rule;
19632
- const next = canonicalizeIpProtocolValue(rule["IpProtocol"]);
19633
- if (next === rule["IpProtocol"]) return rule;
19634
- return {
19635
- ...rule,
19636
- IpProtocol: next
19637
- };
19638
- }
19639
- function canonicalizeSgInlineRuleProtocols(properties) {
19640
- let out = properties;
19641
- for (const key of ["SecurityGroupIngress", "SecurityGroupEgress"]) {
19642
- const list = out[key];
19643
- if (!Array.isArray(list)) continue;
19644
- let changed = false;
19645
- const mapped = list.map((el) => {
19646
- if (el === null || typeof el !== "object" || Array.isArray(el)) return el;
19647
- const next = canonicalizeSgRuleProtocol(el);
19648
- if (next !== el) changed = true;
19649
- return next;
19650
- });
19651
- if (changed) out = {
19652
- ...out,
19653
- [key]: mapped
19654
- };
19655
- }
19656
- return out;
19657
- }
19658
- function flattenIpPermissions(perms, direction) {
19659
- const out = [];
19660
- for (const p of perms) {
19661
- const base = {};
19662
- if (p.IpProtocol !== void 0) base["IpProtocol"] = p.IpProtocol;
19663
- if (p.FromPort !== void 0) base["FromPort"] = p.FromPort;
19664
- if (p.ToPort !== void 0) base["ToPort"] = p.ToPort;
19665
- for (const ip of p.IpRanges ?? []) {
19666
- const rule = { ...base };
19667
- if (ip.CidrIp !== void 0) rule["CidrIp"] = ip.CidrIp;
19668
- if (ip.Description !== void 0) rule["Description"] = ip.Description;
19669
- out.push(rule);
19670
- }
19671
- for (const ipv6 of p.Ipv6Ranges ?? []) {
19672
- const rule = { ...base };
19673
- if (ipv6.CidrIpv6 !== void 0) rule["CidrIpv6"] = ipv6.CidrIpv6;
19674
- if (ipv6.Description !== void 0) rule["Description"] = ipv6.Description;
19675
- out.push(rule);
19676
- }
19677
- for (const grp of p.UserIdGroupPairs ?? []) {
19678
- const rule = { ...base };
19679
- if (direction === "ingress") {
19680
- if (grp.GroupId !== void 0) rule["SourceSecurityGroupId"] = grp.GroupId;
19681
- if (grp.UserId !== void 0) rule["SourceSecurityGroupOwnerId"] = grp.UserId;
19682
- } else if (grp.GroupId !== void 0) rule["DestinationSecurityGroupId"] = grp.GroupId;
19683
- if (grp.Description !== void 0) rule["Description"] = grp.Description;
19684
- out.push(rule);
19685
- }
19686
- for (const pl of p.PrefixListIds ?? []) {
19687
- const rule = { ...base };
19688
- if (direction === "ingress") {
19689
- if (pl.PrefixListId !== void 0) rule["SourcePrefixListId"] = pl.PrefixListId;
19690
- } else if (pl.PrefixListId !== void 0) rule["DestinationPrefixListId"] = pl.PrefixListId;
19691
- if (pl.Description !== void 0) rule["Description"] = pl.Description;
19692
- out.push(rule);
19693
- }
19694
- if ((p.IpRanges?.length ?? 0) === 0 && (p.Ipv6Ranges?.length ?? 0) === 0 && (p.UserIdGroupPairs?.length ?? 0) === 0 && (p.PrefixListIds?.length ?? 0) === 0) out.push({ ...base });
19695
- }
19696
- return out;
19697
- }
19698
- function ingressRuleIdentity(groupId, properties) {
19699
- const source = (key) => properties[key] ?? null;
19700
- return JSON.stringify({
19701
- g: groupId ?? null,
19702
- p: sgProtocolKey(properties["IpProtocol"]),
19703
- f: cfnIngressPortValue(properties["FromPort"]),
19704
- t: cfnIngressPortValue(properties["ToPort"]),
19705
- c4: source("CidrIp"),
19706
- c6: source("CidrIpv6"),
19707
- sg: source("SourceSecurityGroupId"),
19708
- sgName: source("SourceSecurityGroupName"),
19709
- sgOwner: source("SourceSecurityGroupOwnerId"),
19710
- pl: source("SourcePrefixListId")
19711
- });
19712
- }
19713
- const INGRESS_IDENTITY_KEYS = [
19714
- "IpProtocol",
19715
- "FromPort",
19716
- "ToPort",
19717
- "CidrIp",
19718
- "CidrIpv6",
19719
- "SourceSecurityGroupId",
19720
- "SourceSecurityGroupName",
19721
- "SourceSecurityGroupOwnerId",
19722
- "SourcePrefixListId"
19723
- ];
19724
- function comparableIngressIdentity(group, rule) {
19725
- if (!isPlainRecord$2(rule) || typeof group !== "string" || group === "" || isRedactedRecordedValue(group) || !INGRESS_IDENTITY_KEYS.every((key) => !isRedactedRecordedValue(rule[key])) || !Number.isFinite(cfnIngressPortValue(rule["FromPort"])) || !Number.isFinite(cfnIngressPortValue(rule["ToPort"]))) return;
19726
- return ingressRuleIdentity(group, rule);
19727
- }
19728
- function recordedSgRuleId(attributes) {
19729
- const recorded = attributes?.["Id"];
19730
- return typeof recorded === "string" && SG_RULE_ID_PATTERN.test(recorded) ? recorded : void 0;
19731
- }
19732
- function survivingRecordOfRuleId(records, selfLogicalId, ruleId) {
19733
- for (const [lid, record] of records ?? []) {
19734
- if (lid === selfLogicalId || record.resourceType !== "AWS::EC2::SecurityGroupIngress") continue;
19735
- if (recordedSgRuleId(record.attributes) === ruleId) return lid;
19736
- }
19737
- }
19738
- function stackIngressRuleHolder(records, selfLogicalId, groupId, rule, idCheck) {
19739
- if (records === void 0) return void 0;
19740
- const wanted = comparableIngressIdentity(groupId, rule);
19741
- if (wanted === void 0) return void 0;
19742
- for (const [lid, record] of records) {
19743
- if (lid === selfLogicalId) continue;
19744
- const props = record.properties;
19745
- if (record.resourceType === "AWS::EC2::SecurityGroupIngress") {
19746
- if (!isPlainRecord$2(props) || comparableIngressIdentity(props["GroupId"], props) !== wanted) continue;
19747
- const ruleId = recordedSgRuleId(record.attributes);
19748
- if (ruleId !== void 0 && idCheck !== void 0) {
19749
- if ("live" in idCheck && ruleId !== idCheck.live) continue;
19750
- if ("own" in idCheck && idCheck.own !== void 0 && ruleId !== idCheck.own) continue;
19751
- }
19752
- return lid;
19753
- }
19754
- if (record.resourceType === "AWS::EC2::SecurityGroup" && record.physicalId === groupId) {
19755
- const inline = isPlainRecord$2(props) ? props["SecurityGroupIngress"] : void 0;
19756
- if (Array.isArray(inline) && inline.some((entry) => comparableIngressIdentity(groupId, entry) === wanted)) return lid;
19757
- }
19758
- }
19759
- }
19760
- function tagListsMatch(live, declared) {
19761
- const pairs = (list) => list.every((entry) => isPlainRecord$2(entry) && typeof entry["Key"] === "string") ? list.map((entry) => {
19762
- const tag = entry;
19763
- return JSON.stringify([tag["Key"], tag["Value"] ?? ""]);
19764
- }).sort() : void 0;
19765
- const a = pairs(live);
19766
- const b = pairs(declared);
19767
- return a !== void 0 && b !== void 0 && JSON.stringify(a) === JSON.stringify(b);
19768
- }
19769
- function isPlainRecord$2(value) {
19770
- return typeof value === "object" && value !== null && !Array.isArray(value);
19771
- }
19772
- function descriptionKey(value) {
19773
- return typeof value === "string" ? value : "";
19774
- }
19775
- const NEVER_CONNECTED_SOCKET_CODES = /* @__PURE__ */ new Set([
19776
- "ECONNREFUSED",
19777
- "ENOTFOUND",
19778
- "EHOSTUNREACH",
19779
- "ENETUNREACH",
19780
- "EAI_AGAIN"
19781
- ]);
19782
- const RESENDABLE_SOCKET_CODES = /* @__PURE__ */ new Set([
19783
- "ECONNRESET",
19784
- "EPIPE",
19785
- "ETIMEDOUT",
19786
- "EADDRNOTAVAIL"
19787
- ]);
19788
- function errorCode(error) {
19789
- return error?.code;
19790
- }
19791
- function isConnectTimeout(error) {
19792
- const e = error;
19793
- return e?.name === "TimeoutError" && e.code === void 0 && typeof e.message === "string" && e.message.includes("did not establish a connection");
19794
- }
19795
- function neverReachedAws(error) {
19796
- if (isConnectTimeout(error)) return true;
19797
- const code = errorCode(error);
19798
- if (typeof code === "string" && NEVER_CONNECTED_SOCKET_CODES.has(code)) return true;
19799
- return error?.name === "CredentialsProviderError";
19800
- }
19801
- function isResendableSocketFailure(error) {
19802
- if (isConnectTimeout(error)) return false;
19803
- const code = errorCode(error);
19804
- if (typeof code === "string" && RESENDABLE_SOCKET_CODES.has(code)) return true;
19805
- return error?.name === "TimeoutError";
19806
- }
19807
- function authorizeDefinitelyNotApplied(error) {
19808
- if (neverReachedAws(error)) return true;
19809
- const e = error;
19810
- if (typeof e?.name === "string" && THROTTLING_ERROR_NAMES.has(e.name)) return true;
19811
- if (e?.$retryable?.throttling === true) return true;
19812
- const status = e?.$metadata?.httpStatusCode;
19813
- return typeof status === "number" && status >= 400 && status < 500;
19814
- }
19815
- function singleSecurityGroupRuleId(rules) {
19816
- const ids = (rules ?? []).map((rule) => rule.SecurityGroupRuleId).filter((id) => typeof id === "string" && id.trim() !== "");
19817
- return ids.length === 1 ? ids[0] : void 0;
19818
- }
19819
- function securityGroupRuleMatchesCfnIngress(rule, properties) {
19820
- if (sgProtocolKey(rule.IpProtocol) !== sgProtocolKey(properties["IpProtocol"])) return false;
19821
- if ((rule.FromPort ?? -1) !== cfnIngressPortValue(properties["FromPort"])) return false;
19822
- if ((rule.ToPort ?? -1) !== cfnIngressPortValue(properties["ToPort"])) return false;
19823
- const sources = [
19824
- [properties["CidrIp"], rule.CidrIpv4],
19825
- [properties["CidrIpv6"], rule.CidrIpv6],
19826
- [properties["SourceSecurityGroupId"], rule.ReferencedGroupInfo?.GroupId],
19827
- [properties["SourcePrefixListId"], rule.PrefixListId]
19828
- ];
19829
- for (const [declared, actual] of sources) if (declared !== void 0 && declared !== null && declared !== actual) return false;
19830
- return true;
19831
- }
19832
- function sgRuleKey(rule, direction) {
19833
- const peerKey = direction === "egress" ? rule["DestinationSecurityGroupId"] : rule["SourceSecurityGroupId"];
19834
- const prefixKey = direction === "egress" ? rule["DestinationPrefixListId"] : rule["SourcePrefixListId"];
19835
- const peerOwner = direction === "ingress" ? rule["SourceSecurityGroupOwnerId"] : void 0;
19836
- return JSON.stringify({
19837
- p: sgProtocolKey(rule["IpProtocol"]),
19838
- f: rule["FromPort"] ?? null,
19839
- t: rule["ToPort"] ?? null,
19840
- c4: rule["CidrIp"] ?? null,
19841
- c6: rule["CidrIpv6"] ?? null,
19842
- peer: peerKey ?? null,
19843
- peerOwner: peerOwner ?? null,
19844
- pl: prefixKey ?? null,
19845
- d: rule["Description"] ?? null
19846
- });
19847
- }
19848
- function reconcileSgRules(awsRules, stateRules, direction) {
19849
- if (!stateRules || stateRules.length === 0) return awsRules;
19850
- const remaining = [...awsRules];
19851
- const reordered = [];
19852
- for (const sr of stateRules) {
19853
- const key = sgRuleKey(sr, direction);
19854
- const idx = remaining.findIndex((ar) => sgRuleKey(ar, direction) === key);
19855
- if (idx >= 0) reordered.push(remaining.splice(idx, 1)[0]);
19856
- }
19857
- return [...reordered, ...remaining];
19858
- }
19859
- function isDefaultEgressRule(rule) {
19860
- if (rule["IpProtocol"] !== "-1") return false;
19861
- if (rule["CidrIp"] !== "0.0.0.0/0") return false;
19862
- if (rule["CidrIpv6"] !== void 0) return false;
19863
- if (rule["DestinationSecurityGroupId"] !== void 0) return false;
19864
- if (rule["DestinationPrefixListId"] !== void 0) return false;
19865
- if (rule["Description"] !== void 0) return false;
19866
- if (rule["FromPort"] !== void 0 && rule["FromPort"] !== -1) return false;
19867
- if (rule["ToPort"] !== void 0 && rule["ToPort"] !== -1) return false;
19868
- return true;
19869
- }
19870
-
19871
19768
  // src/provisioning/providers/ec2/common.ts
19872
19769
  function isEc2NotFoundCode(error) {
19873
19770
  const name = error?.name;
@@ -22487,6 +22384,7 @@ async function applyInlineEgress(groupId, egressRules) {
22487
22384
  async function updateSecurityGroup(logicalId, physicalId, resourceType, properties, previousProperties, context) {
22488
22385
  this.logger.debug(`Updating SecurityGroup ${logicalId}: ${physicalId}`);
22489
22386
  refuseMalformedDesiredTags(properties["Tags"], resourceType, logicalId, physicalId);
22387
+ if (context?.desiredFromAwsReadback === true && (context.siblingSgRuleIds?.size ?? 0) > 0) await refuseRevertRevokingSiblingRules((group) => this.listGroupRules(group), logicalId, physicalId, resourceType, properties, previousProperties, context.siblingSgRuleIds);
22490
22388
  try {
22491
22389
  await this.applyTagDiff(physicalId, resourceType, logicalId, previousProperties["Tags"], properties["Tags"], maskerOrIdentity(context?.maskSecrets));
22492
22390
  await this.applySecurityGroupRuleDiff(physicalId, previousProperties["SecurityGroupIngress"] ?? [], properties["SecurityGroupIngress"] ?? [], "ingress", logicalId);
@@ -22624,23 +22522,7 @@ function buildIpPermission(properties, direction = "ingress", inline = false) {
22624
22522
  return permission;
22625
22523
  }
22626
22524
  async function applySecurityGroupRuleDiff(groupId, previousRules, nextRules, direction, logicalId) {
22627
- const ruleKey = (rule) => {
22628
- const peerKey = direction === "egress" ? rule["DestinationSecurityGroupId"] : rule["SourceSecurityGroupId"];
22629
- const prefixKey = direction === "egress" ? rule["DestinationPrefixListId"] : rule["SourcePrefixListId"];
22630
- const peerOwner = direction === "ingress" ? rule["SourceSecurityGroupOwnerId"] : void 0;
22631
- const peerName = direction === "ingress" ? rule["SourceSecurityGroupName"] : void 0;
22632
- return JSON.stringify({
22633
- p: sgProtocolKey(rule["IpProtocol"]),
22634
- f: rule["FromPort"] ?? null,
22635
- t: rule["ToPort"] ?? null,
22636
- c4: rule["CidrIp"] ?? null,
22637
- c6: rule["CidrIpv6"] ?? null,
22638
- peer: peerKey ?? null,
22639
- peerName: peerKey ? null : peerName ?? null,
22640
- peerOwner: peerOwner ?? null,
22641
- pl: prefixKey ?? null
22642
- });
22643
- };
22525
+ const ruleKey = (rule) => sgRuleDiffKey(rule, direction);
22644
22526
  const prevByKey = /* @__PURE__ */ new Map();
22645
22527
  for (const rule of previousRules) prevByKey.set(ruleKey(rule), rule);
22646
22528
  const nextByKey = /* @__PURE__ */ new Map();
@@ -22855,12 +22737,15 @@ async function settledInFlightIngressHolder(logicalId, resourceType, groupId, de
22855
22737
  }
22856
22738
  }
22857
22739
  async function listGroupRules(groupId) {
22740
+ return listSecurityGroupRules(this.ec2Client, groupId);
22741
+ }
22742
+ async function listSecurityGroupRules(client, groupId) {
22858
22743
  const rules = [];
22859
22744
  let nextToken;
22860
22745
  let pages = 0;
22861
22746
  do {
22862
22747
  if (pages >= 20) return void 0;
22863
- const resp = await this.ec2Client.send(new DescribeSecurityGroupRulesCommand({
22748
+ const resp = await client.send(new DescribeSecurityGroupRulesCommand({
22864
22749
  Filters: [{
22865
22750
  Name: "group-id",
22866
22751
  Values: [groupId]
@@ -25556,13 +25441,14 @@ async function readRouteTableCurrentState(physicalId) {
25556
25441
  async function readSecurityGroupCurrentState(physicalId, properties, context) {
25557
25442
  const sg = (await this.ec2Client.send(new DescribeSecurityGroupsCommand({ GroupIds: [physicalId] }))).SecurityGroups?.[0];
25558
25443
  if (!sg) return RESOURCE_NOT_FOUND;
25444
+ const idOwned = await siblingIdOwnedSgRules(this, physicalId, properties, context);
25559
25445
  const result = {};
25560
25446
  if (sg.GroupName !== void 0) result["GroupName"] = sg.GroupName;
25561
25447
  if (sg.Description !== void 0) result["GroupDescription"] = sg.Description;
25562
25448
  if (sg.VpcId !== void 0) result["VpcId"] = sg.VpcId;
25563
25449
  const tags = normalizeAwsTagsToCfn(sg.Tags);
25564
25450
  if (tags.length > 0) result["Tags"] = tags;
25565
- Object.assign(result, sgRuleLists(sg, physicalId, properties, context));
25451
+ Object.assign(result, sgRuleLists(sg, physicalId, properties, context, idOwned));
25566
25452
  if (context?.afterOwnWrite === true && properties !== void 0) {
25567
25453
  const members = [];
25568
25454
  for (const [key, direction] of [["SecurityGroupIngress", "ingress"], ["SecurityGroupEgress", "egress"]]) {
@@ -25575,7 +25461,7 @@ async function readSecurityGroupCurrentState(physicalId, properties, context) {
25575
25461
  whenUnsettled: (newest) => reconcileSgRules(mergeDeclaredSgRules(newest, declared, direction), declared, direction),
25576
25462
  read: async () => {
25577
25463
  const group = (await this.ec2Client.send(new DescribeSecurityGroupsCommand({ GroupIds: [physicalId] }))).SecurityGroups?.[0];
25578
- return group ? { value: sgRuleLists(group, physicalId, properties, context)[key] } : "failed";
25464
+ return group ? { value: sgRuleLists(group, physicalId, properties, context, idOwned)[key] } : "failed";
25579
25465
  }
25580
25466
  });
25581
25467
  }
@@ -25583,11 +25469,17 @@ async function readSecurityGroupCurrentState(physicalId, properties, context) {
25583
25469
  }
25584
25470
  return result;
25585
25471
  }
25586
- function sgRuleLists(sg, physicalId, properties, context) {
25472
+ function sgRuleLists(sg, physicalId, properties, context, idOwned) {
25473
+ const owned = (direction) => {
25474
+ if (idOwned === void 0) return siblingOwnedSgRuleIdentities(physicalId, direction, properties, context);
25475
+ const out = siblingOwnedSgRuleIdentities(physicalId, direction, properties, context, (lid) => idOwned.decided.has(lid));
25476
+ for (const identity of idOwned.owned[direction]) out.add(identity);
25477
+ return out;
25478
+ };
25587
25479
  const stateIngress = Array.isArray(properties?.["SecurityGroupIngress"]) ? properties["SecurityGroupIngress"] : void 0;
25588
- const ingressRules = withoutSiblingOwnedSgRules(flattenIpPermissions(sg.IpPermissions ?? [], "ingress"), siblingOwnedSgRuleIdentities(physicalId, "ingress", properties, context), "ingress");
25480
+ const ingressRules = withoutSiblingOwnedSgRules(flattenIpPermissions(sg.IpPermissions ?? [], "ingress"), owned("ingress"), "ingress");
25589
25481
  const stateEgress = Array.isArray(properties?.["SecurityGroupEgress"]) ? properties["SecurityGroupEgress"] : void 0;
25590
- let egressRules = withoutSiblingOwnedSgRules(flattenIpPermissions(sg.IpPermissionsEgress ?? [], "egress"), siblingOwnedSgRuleIdentities(physicalId, "egress", properties, context), "egress");
25482
+ let egressRules = withoutSiblingOwnedSgRules(flattenIpPermissions(sg.IpPermissionsEgress ?? [], "egress"), owned("egress"), "egress");
25591
25483
  if (stateEgress === void 0) egressRules = egressRules.filter((r) => !isDefaultEgressRule(r));
25592
25484
  return {
25593
25485
  SecurityGroupIngress: reconcileSgRules(ingressRules, stateIngress, "ingress"),
@@ -25684,6 +25576,14 @@ async function readSecurityGroupIngressCurrentState(physicalId, properties, cont
25684
25576
  const protocol = parts[1];
25685
25577
  const fromPort = parts[2] === "-1" ? void 0 : parseInt(parts[2], 10);
25686
25578
  const toPort = parts[3] === "-1" ? void 0 : parseInt(parts[3], 10);
25579
+ if (properties && Object.keys(properties).length > 0) {
25580
+ const byId = await readSgIngressById(this, groupId, properties, context);
25581
+ if (byId === "gone") return RESOURCE_NOT_FOUND;
25582
+ if (byId !== "fallback") return {
25583
+ GroupId: groupId,
25584
+ ...byId
25585
+ };
25586
+ }
25687
25587
  const sg = (await this.ec2Client.send(new DescribeSecurityGroupsCommand({ GroupIds: [groupId] }))).SecurityGroups?.[0];
25688
25588
  if (!sg) return RESOURCE_NOT_FOUND;
25689
25589
  const wantedProtocol = sgProtocolKey(protocol);
@@ -39794,7 +39694,7 @@ var DocDBSubnetGroupProvider = class {
39794
39694
  };
39795
39695
 
39796
39696
  // src/provisioning/providers/appconfig-environment-provider.ts
39797
- const TYPE$1 = "AWS::AppConfig::Environment";
39697
+ const TYPE$2 = "AWS::AppConfig::Environment";
39798
39698
  const DELETION_PROTECTION_CHECKS = /* @__PURE__ */ new Set([
39799
39699
  "ACCOUNT_DEFAULT",
39800
39700
  "APPLY",
@@ -39820,7 +39720,7 @@ var AppConfigEnvironmentProvider = class {
39820
39720
  return this.appConfigClient;
39821
39721
  }
39822
39722
  assertType(resourceType, logicalId, physicalId) {
39823
- if (resourceType !== TYPE$1) throw new ProvisioningError(`Unsupported resource type: ${resourceType}`, resourceType, logicalId, physicalId);
39723
+ if (resourceType !== TYPE$2) throw new ProvisioningError(`Unsupported resource type: ${resourceType}`, resourceType, logicalId, physicalId);
39824
39724
  }
39825
39725
  splitId(physicalId, resourceType, logicalId) {
39826
39726
  const idx = physicalId.indexOf("|");
@@ -39946,7 +39846,7 @@ var AppConfigEnvironmentProvider = class {
39946
39846
  }
39947
39847
  }
39948
39848
  async import(input) {
39949
- if (input.resourceType !== TYPE$1 || !input.knownPhysicalId) return null;
39849
+ if (input.resourceType !== TYPE$2 || !input.knownPhysicalId) return null;
39950
39850
  const { applicationId, environmentId } = this.splitId(input.knownPhysicalId, input.resourceType, input.logicalId);
39951
39851
  try {
39952
39852
  await this.getClient().send(new GetEnvironmentCommand({
@@ -40081,11 +39981,6 @@ function recordSetCompositeId(hostedZoneId, name, type) {
40081
39981
  type
40082
39982
  ].map(String).join("|");
40083
39983
  }
40084
- const UNDECODABLE_OCTAL_ESCAPES = /* @__PURE__ */ new Set(["056", "134"]);
40085
- function normalizeRecordName(name) {
40086
- const lowered = name.replace(/\\([0-7]{3})/g, (match, oct) => UNDECODABLE_OCTAL_ESCAPES.has(oct) ? match : String.fromCharCode(parseInt(oct, 8))).toLowerCase();
40087
- return lowered.endsWith(".") ? lowered : `${lowered}.`;
40088
- }
40089
39984
  function isIntrinsicOnly(value) {
40090
39985
  if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
40091
39986
  const keys = Object.keys(value);
@@ -60886,9 +60781,9 @@ async function importImpl$4(input) {
60886
60781
  }
60887
60782
 
60888
60783
  // src/provisioning/providers/codebuild/drift.ts
60889
- const TYPE = "AWS::CodeBuild::Project";
60784
+ const TYPE$1 = "AWS::CodeBuild::Project";
60890
60785
  function canonicalizeDriftPair(resourceType, baseline, aws) {
60891
- if (resourceType !== TYPE) return {
60786
+ if (resourceType !== TYPE$1) return {
60892
60787
  baseline,
60893
60788
  aws
60894
60789
  };
@@ -65270,14 +65165,25 @@ var NestedStackProvider = class {
65270
65165
  };
65271
65166
 
65272
65167
  // src/provisioning/providers/wait-condition-handle-provider.ts
65168
+ const SHORT_URL_LIFETIME_MS = 432e5;
65273
65169
  var WaitConditionHandleProvider = class {
65274
65170
  logger = getLogger().child("WaitConditionHandleProvider");
65275
65171
  handledProperties = /* @__PURE__ */ new Map([["AWS::CloudFormation::WaitConditionHandle", /* @__PURE__ */ new Set([])]]);
65276
- async create(logicalId, _resourceType, _properties) {
65277
- const physicalId = `cdkd-wait-condition-handle-${logicalId}-${randomUUID()}`;
65278
- this.logger.debug(`Created no-op WaitConditionHandle placeholder ${logicalId} (${physicalId})`);
65172
+ signals;
65173
+ constructor(signals = new WaitConditionSignalStore()) {
65174
+ this.signals = signals;
65175
+ }
65176
+ async create(logicalId, resourceType, _properties) {
65177
+ let issued;
65178
+ try {
65179
+ issued = await this.signals.issueSignalUrl(logicalId);
65180
+ } catch (error) {
65181
+ throw markNonRetryable(new ProvisioningError(`Failed to issue the signal URL for WaitConditionHandle ${logicalId}: ${error instanceof Error ? error.message : safeStringify(error)}`, resourceType, logicalId, void 0, error instanceof Error ? error : void 0));
65182
+ }
65183
+ this.logger.debug(safeMsg`Issued WaitConditionHandle ${logicalId} signal URL for ${issued.key}`);
65184
+ if (issued.expiresAt.getTime() - Date.now() < SHORT_URL_LIFETIME_MS) this.logger.warn(safeMsg`WaitConditionHandle ${logicalId}: its signal URL is signed with temporary credentials and stops accepting signals at ${issued.expiresAt.toISOString()}. Deploy with longer-lived credentials if anything signals it later than that.`);
65279
65185
  return {
65280
- physicalId,
65186
+ physicalId: issued.url,
65281
65187
  attributes: {}
65282
65188
  };
65283
65189
  }
@@ -65289,8 +65195,20 @@ var WaitConditionHandleProvider = class {
65289
65195
  attributes: {}
65290
65196
  };
65291
65197
  }
65292
- async delete(logicalId, _physicalId, _resourceType) {
65293
- this.logger.debug(`No-op delete for WaitConditionHandle ${logicalId}`);
65198
+ async delete(logicalId, physicalId, _resourceType) {
65199
+ let bucket;
65200
+ try {
65201
+ bucket = this.signals.requireBucket();
65202
+ } catch {
65203
+ this.logger.debug(`No state bucket configured; nothing to remove for WaitConditionHandle ${logicalId}`);
65204
+ return;
65205
+ }
65206
+ const verdict = classifyHandleUrl(physicalId, bucket);
65207
+ if (verdict.kind !== "ours") {
65208
+ this.logger.debug(`No cdkd signal object behind WaitConditionHandle ${logicalId}`);
65209
+ return;
65210
+ }
65211
+ await this.signals.deleteSignals(verdict.key);
65294
65212
  }
65295
65213
  async getAttribute(physicalId, resourceType, attributeName, logicalId) {
65296
65214
  throw new ProvisioningError(`AWS::CloudFormation::WaitConditionHandle has no Fn::GetAtt attributes (requested: ${attributeName})`, resourceType, logicalId, physicalId);
@@ -65300,12 +65218,168 @@ var WaitConditionHandleProvider = class {
65300
65218
  }
65301
65219
  async import(input) {
65302
65220
  return {
65303
- physicalId: input.knownPhysicalId ?? `cdkd-wait-condition-handle-${input.logicalId}-${randomUUID()}`,
65221
+ physicalId: input.knownPhysicalId ?? `${"cdkd-wait-condition-handle-"}${input.logicalId}-${randomUUID()}`,
65304
65222
  attributes: {}
65305
65223
  };
65306
65224
  }
65307
65225
  };
65308
65226
 
65227
+ // src/provisioning/providers/wait-condition-provider.ts
65228
+ const TYPE = "AWS::CloudFormation::WaitCondition";
65229
+ const MAX_WAIT_CONDITION_TIMEOUT_SECONDS = 43200;
65230
+ const INITIAL_POLL_INTERVAL_MS = 2e3;
65231
+ const MAX_POLL_INTERVAL_MS = 1e4;
65232
+ const REASON_DISPLAY_CAP = 512;
65233
+ var WaitConditionProvider = class {
65234
+ logger = getLogger().child("WaitConditionProvider");
65235
+ handledProperties = /* @__PURE__ */ new Map([["AWS::CloudFormation::WaitCondition", /* @__PURE__ */ new Set([
65236
+ "Handle",
65237
+ "Count",
65238
+ "Timeout"
65239
+ ])]]);
65240
+ now = () => Date.now();
65241
+ sleep = (ms) => new Promise((r) => setTimeout(r, ms));
65242
+ signals;
65243
+ constructor(signals = new WaitConditionSignalStore()) {
65244
+ this.signals = signals;
65245
+ }
65246
+ getMinResourceTimeoutMs() {
65247
+ return 435e5;
65248
+ }
65249
+ async create(logicalId, _resourceType, properties) {
65250
+ const spec = this.readSpec(logicalId, properties);
65251
+ const data = await this.waitForSignals(logicalId, spec);
65252
+ return {
65253
+ physicalId: `cdkd-wait-condition-${logicalId}-${randomUUID()}`,
65254
+ attributes: { Data: JSON.stringify(data) }
65255
+ };
65256
+ }
65257
+ async update(logicalId, physicalId, _resourceType, properties, previousProperties, context) {
65258
+ if (context?.replayingState === true || context?.desiredFromAwsReadback === true) {
65259
+ this.logger.debug(safeMsg`WaitCondition ${logicalId}: restoring a recorded wait, not waiting`);
65260
+ return {
65261
+ physicalId,
65262
+ wasReplaced: false
65263
+ };
65264
+ }
65265
+ const differs = (a, b) => JSON.stringify(a) !== JSON.stringify(b);
65266
+ if (!(differs(properties["Handle"], previousProperties["Handle"]) || differs(properties["Count"], previousProperties["Count"]) || differs(properties["Timeout"], previousProperties["Timeout"]))) return {
65267
+ physicalId,
65268
+ wasReplaced: false
65269
+ };
65270
+ const spec = this.readSpec(logicalId, properties);
65271
+ const data = await this.waitForSignals(logicalId, spec);
65272
+ return {
65273
+ physicalId,
65274
+ wasReplaced: false,
65275
+ attributes: { Data: JSON.stringify(data) }
65276
+ };
65277
+ }
65278
+ async delete(logicalId, _physicalId, _resourceType) {
65279
+ this.logger.debug(safeMsg`No-op delete for WaitCondition ${logicalId}`);
65280
+ }
65281
+ async getAttribute(physicalId, resourceType, attributeName, logicalId) {
65282
+ throw new ProvisioningError(`AWS::CloudFormation::WaitCondition attribute ${attributeName} can only be read from the value recorded when the wait completed`, resourceType, logicalId, physicalId);
65283
+ }
65284
+ async readCurrentState() {
65285
+ return {};
65286
+ }
65287
+ async import(input) {
65288
+ if (input.knownPhysicalId === void 0) return null;
65289
+ return {
65290
+ physicalId: input.knownPhysicalId,
65291
+ attributes: {}
65292
+ };
65293
+ }
65294
+ refuse(logicalId, message) {
65295
+ throw markNonRetryable(new ProvisioningError(message, TYPE, logicalId));
65296
+ }
65297
+ readSpec(logicalId, properties) {
65298
+ const handle = properties["Handle"];
65299
+ if (handle === void 0 || handle === null) this.refuse(logicalId, `WaitCondition ${logicalId} has no Handle. cdkd supports only the handle form (a WaitConditionHandle whose URL is signalled); a CreationPolicy-signalled wait condition is not supported.`);
65300
+ if (typeof handle !== "string") this.refuse(logicalId, `WaitCondition ${logicalId}: Handle must resolve to a string.`);
65301
+ const timeoutSeconds = integerOf(properties["Timeout"]);
65302
+ if (timeoutSeconds === void 0 || timeoutSeconds < 1 || timeoutSeconds > 43200) this.refuse(logicalId, `WaitCondition ${logicalId}: Timeout must be a whole number of seconds from 1 to ${MAX_WAIT_CONDITION_TIMEOUT_SECONDS}.`);
65303
+ const rawCount = properties["Count"];
65304
+ const count = rawCount === void 0 || rawCount === null ? 1 : integerOf(rawCount);
65305
+ if (count === void 0 || count < 1) this.refuse(logicalId, `WaitCondition ${logicalId}: Count must be a whole number of at least 1.`);
65306
+ return {
65307
+ handle,
65308
+ count,
65309
+ timeoutSeconds
65310
+ };
65311
+ }
65312
+ async waitForSignals(logicalId, spec) {
65313
+ const verdict = classifyHandleUrl(spec.handle, this.signals.requireBucket());
65314
+ if (verdict.kind === "legacy") this.refuse(logicalId, `WaitCondition ${logicalId}: its Handle was created by a cdkd version that issued no signal URL. Give the WaitConditionHandle a new logical id (or remove it, deploy, and add it back) so cdkd issues one, then deploy again.`);
65315
+ if (verdict.kind === "foreign") this.refuse(logicalId, `WaitCondition ${logicalId}: its Handle is not a signal URL cdkd issued for this state bucket (for example a CloudFormation-issued handle), so cdkd cannot read its signals. Give the WaitConditionHandle a new logical id so cdkd issues one.`);
65316
+ const perTypeCapMs = resolvedPerTypeResourceTimeoutMs(TYPE);
65317
+ const waitMs = Math.min(spec.timeoutSeconds * 1e3, perTypeCapMs ?? Infinity);
65318
+ const deadline = this.now() + waitMs;
65319
+ const maxVersions = spec.count * 10 + 100;
65320
+ const seen = /* @__PURE__ */ new Map();
65321
+ const watch = startInterruptWatch(`WaitCondition ${logicalId}`);
65322
+ let interval = INITIAL_POLL_INTERVAL_MS;
65323
+ let received = 0;
65324
+ this.logger.info(safeMsg`Waiting for ${spec.count} signal(s) on WaitCondition ${logicalId} (timeout ${spec.timeoutSeconds}s)`);
65325
+ try {
65326
+ for (;;) {
65327
+ if (watch.isInterrupted()) throw watch.onInterrupted();
65328
+ let signals;
65329
+ try {
65330
+ signals = await this.signals.readSignals(verdict.key, seen, maxVersions);
65331
+ } catch (error) {
65332
+ const name = error instanceof Error ? error.name : "unknown error";
65333
+ if (!isTransientReadFailure(error)) throw markNonRetryable(new ProvisioningError(safeMsg`WaitCondition ${logicalId} could not read its signals from the cdkd state bucket (${name}).`, TYPE, logicalId, void 0, error instanceof Error ? error : void 0));
65334
+ this.logger.debug(safeMsg`WaitCondition ${logicalId} signal read failed: ${name}`);
65335
+ }
65336
+ if (signals !== void 0) {
65337
+ const result = evaluateSignals(signals, spec.count);
65338
+ if (result.state === "succeeded") return result.data;
65339
+ if (result.state === "failed") {
65340
+ const reason = bounded(result.signal.reason, REASON_DISPLAY_CAP);
65341
+ const from = bounded(result.signal.uniqueId, 128);
65342
+ this.refuse(logicalId, `WaitCondition ${logicalId} received a FAILURE signal` + (from !== "" ? ` from ${from}` : "") + (reason !== "" ? `: ${reason}` : ""));
65343
+ }
65344
+ received = result.successes;
65345
+ }
65346
+ const remaining = deadline - this.now();
65347
+ if (remaining <= 0) this.refuse(logicalId, `WaitCondition ${logicalId} timed out after ${Math.round(waitMs / 1e3)}s with ${received} of ${spec.count} SUCCESS signal(s) received.`);
65348
+ await this.sleep(Math.min(interval, remaining));
65349
+ interval = Math.min(Math.ceil(interval * 1.5), MAX_POLL_INTERVAL_MS);
65350
+ }
65351
+ } finally {
65352
+ watch.dispose();
65353
+ }
65354
+ }
65355
+ };
65356
+ const TRANSIENT_READ_ERROR_NAMES = /* @__PURE__ */ new Set([
65357
+ "NoSuchKey",
65358
+ "NoSuchVersion",
65359
+ "RequestTimeout",
65360
+ "TimeoutError",
65361
+ "NetworkingError",
65362
+ "ECONNRESET",
65363
+ "ECONNREFUSED",
65364
+ "ETIMEDOUT",
65365
+ "EPIPE",
65366
+ "EAI_AGAIN",
65367
+ "ENOTFOUND"
65368
+ ]);
65369
+ function isTransientReadFailure(error) {
65370
+ if (isThrottlingError(error) || isTransientServerError(error)) return true;
65371
+ const e = error;
65372
+ return typeof e?.name === "string" && TRANSIENT_READ_ERROR_NAMES.has(e.name) || typeof e?.code === "string" && TRANSIENT_READ_ERROR_NAMES.has(e.code);
65373
+ }
65374
+ function bounded(value, cap) {
65375
+ const { text, truncated } = truncateCodePoints(displaySafe(value), cap);
65376
+ return truncated ? `${text}...` : text;
65377
+ }
65378
+ function integerOf(value) {
65379
+ const n = typeof value === "number" ? value : typeof value === "string" && /^\s*\d+\s*$/.test(value) ? Number(value) : NaN;
65380
+ return Number.isSafeInteger(n) && n >= 0 ? n : void 0;
65381
+ }
65382
+
65309
65383
  // src/provisioning/providers/acm-certificate/shared.ts
65310
65384
  function certificateInUseByName(error) {
65311
65385
  let current = error;
@@ -65753,5 +65827,5 @@ var ACMCertificateProvider = class {
65753
65827
  }
65754
65828
  };
65755
65829
 
65756
- export { ACMCertificateProvider, ASGProvider, AgentCoreBrowserProvider, AgentCoreCodeInterpreterProvider, AgentCoreEvaluatorProvider, AgentCoreRuntimeProvider, ApiGatewayProvider, ApiGatewayV2Provider, AppConfigEnvironmentProvider, AppSyncProvider, BudgetsBudgetProvider, CloudFrontDistributionProvider, CloudFrontOACProvider, CloudFrontOAIProvider, CloudTrailProvider, CloudWatchAlarmProvider, CloudWatchAnomalyDetectorProvider, CodeBuildProvider, CodeCommitRepositoryProvider, CognitoUserPoolProvider, DLMLifecyclePolicyProvider, DocDBProvider, DocDBSubnetGroupProvider, DynamoDBGlobalTableProvider, DynamoDBTableProvider, EC2Provider, ECRProvider, ECSProvider, EFSProvider, ELBv2Provider, EMRClusterProvider, EMRInstanceFleetConfigProvider, EMRInstanceGroupConfigProvider, ElastiCacheProvider, EventBridgeArchiveProvider, EventBridgeBusProvider, EventBridgeRuleProvider, FSxFileSystemProvider, FirehoseProvider, GlueConnectionProvider, GlueCrawlerProvider, GlueJobProvider, GlueProvider, GlueSecurityConfigurationProvider, GlueTriggerProvider, GlueWorkflowProvider, IAMAccessKeyProvider, IAMInstanceProfileProvider, IAMManagedPolicyProvider, IAMPolicyProvider, IAMRoleProvider, IAMUserGroupProvider, KMSProvider, KinesisStreamConsumerProvider, KinesisStreamProvider, LambdaEventInvokeConfigProvider, LambdaEventSourceMappingProvider, LambdaFunctionProvider, LambdaLayerVersionProvider, LambdaMicrovmImageProvider, LambdaNetworkConnectorProvider, LambdaPermissionProvider, LambdaUrlProvider, LambdaWebFunctionEndpointProvider, LambdaWebFunctionRevisionProvider, LogsDeliveryDestinationProvider, LogsDeliveryProvider, LogsDeliverySourceProvider, LogsLogGroupProvider, NeptuneProvider, NestedStackProvider, PipesPipeProvider, RDSDBProxyEndpointProvider, RDSDBProxyProvider, RDSDBProxyTargetGroupProvider, RDSProvider, Route53Provider, S3BucketPolicyProvider, S3BucketProvider, S3DirectoryBucketProvider, S3TablesProvider, S3VectorsProvider, SNSSubscriptionProvider, SNSTopicPolicyProvider, SNSTopicProvider, SQSQueuePolicyProvider, SQSQueueProvider, SSMParameterProvider, SchedulerScheduleProvider, SecretsManagerSecretProvider, ServiceDiscoveryProvider, StepFunctionsProvider, WAFv2WebACLProvider, WaitConditionHandleProvider };
65757
- //# sourceMappingURL=provider-classes-CgZzBNg8.js.map
65830
+ export { ACMCertificateProvider, ASGProvider, AgentCoreBrowserProvider, AgentCoreCodeInterpreterProvider, AgentCoreEvaluatorProvider, AgentCoreRuntimeProvider, ApiGatewayProvider, ApiGatewayV2Provider, AppConfigEnvironmentProvider, AppSyncProvider, BudgetsBudgetProvider, CloudFrontDistributionProvider, CloudFrontOACProvider, CloudFrontOAIProvider, CloudTrailProvider, CloudWatchAlarmProvider, CloudWatchAnomalyDetectorProvider, CodeBuildProvider, CodeCommitRepositoryProvider, CognitoUserPoolProvider, DLMLifecyclePolicyProvider, DocDBProvider, DocDBSubnetGroupProvider, DynamoDBGlobalTableProvider, DynamoDBTableProvider, EC2Provider, ECRProvider, ECSProvider, EFSProvider, ELBv2Provider, EMRClusterProvider, EMRInstanceFleetConfigProvider, EMRInstanceGroupConfigProvider, ElastiCacheProvider, EventBridgeArchiveProvider, EventBridgeBusProvider, EventBridgeRuleProvider, FSxFileSystemProvider, FirehoseProvider, GlueConnectionProvider, GlueCrawlerProvider, GlueJobProvider, GlueProvider, GlueSecurityConfigurationProvider, GlueTriggerProvider, GlueWorkflowProvider, IAMAccessKeyProvider, IAMInstanceProfileProvider, IAMManagedPolicyProvider, IAMPolicyProvider, IAMRoleProvider, IAMUserGroupProvider, KMSProvider, KinesisStreamConsumerProvider, KinesisStreamProvider, LambdaEventInvokeConfigProvider, LambdaEventSourceMappingProvider, LambdaFunctionProvider, LambdaLayerVersionProvider, LambdaMicrovmImageProvider, LambdaNetworkConnectorProvider, LambdaPermissionProvider, LambdaUrlProvider, LambdaWebFunctionEndpointProvider, LambdaWebFunctionRevisionProvider, LogsDeliveryDestinationProvider, LogsDeliveryProvider, LogsDeliverySourceProvider, LogsLogGroupProvider, NeptuneProvider, NestedStackProvider, PipesPipeProvider, RDSDBProxyEndpointProvider, RDSDBProxyProvider, RDSDBProxyTargetGroupProvider, RDSProvider, Route53Provider, S3BucketPolicyProvider, S3BucketProvider, S3DirectoryBucketProvider, S3TablesProvider, S3VectorsProvider, SNSSubscriptionProvider, SNSTopicPolicyProvider, SNSTopicProvider, SQSQueuePolicyProvider, SQSQueueProvider, SSMParameterProvider, SchedulerScheduleProvider, SecretsManagerSecretProvider, ServiceDiscoveryProvider, StepFunctionsProvider, WAFv2WebACLProvider, WaitConditionHandleProvider, WaitConditionProvider };
65831
+ //# sourceMappingURL=provider-classes-DhmwW7hI.js.map