@go-to-k/cdkd 0.296.12 → 0.296.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/{asg-provider-DoaukzYL.js → asg-provider-eXsnCQh2.js} +4 -4
  2. package/dist/{asg-provider-DoaukzYL.js.map → asg-provider-eXsnCQh2.js.map} +1 -1
  3. package/dist/{logger-DAaB7GFO.js → aws-failure-text-BaWeCWRz.js} +45 -2
  4. package/dist/aws-failure-text-BaWeCWRz.js.map +1 -0
  5. package/dist/cli.js +2 -2
  6. package/dist/{deploy-engine-CrYi7ta5.js → deploy-engine-Z_zHC0jz.js} +546 -483
  7. package/dist/deploy-engine-Z_zHC0jz.js.map +1 -0
  8. package/dist/{iam-policy-targets-elNafvpb.js → iam-policy-targets-BoZuWtxK.js} +43 -49
  9. package/dist/iam-policy-targets-BoZuWtxK.js.map +1 -0
  10. package/dist/{iam-role-provider-ClAgHnkh.js → iam-role-provider-BTYPRrDe.js} +4 -4
  11. package/dist/{iam-role-provider-ClAgHnkh.js.map → iam-role-provider-BTYPRrDe.js.map} +1 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +4 -4
  14. package/dist/{neptune-provider-ppi8nIX-.js → neptune-provider-ZYVwKq6K.js} +4 -4
  15. package/dist/{neptune-provider-ppi8nIX-.js.map → neptune-provider-ZYVwKq6K.js.map} +1 -1
  16. package/dist/{program-epAinsMQ.js → program-CKV6Kn8Q.js} +150 -112
  17. package/dist/program-CKV6Kn8Q.js.map +1 -0
  18. package/dist/{provider-classes-D76dAHvV.js → provider-classes-Dz2gVtOZ.js} +131 -70
  19. package/dist/provider-classes-Dz2gVtOZ.js.map +1 -0
  20. package/dist/{rds-provider-V_uJHUSX.js → rds-provider-6YeZRRfW.js} +4 -4
  21. package/dist/{rds-provider-V_uJHUSX.js.map → rds-provider-6YeZRRfW.js.map} +1 -1
  22. package/dist/{version-B8WzrPJT.js → version-1NhJbqzi.js} +2 -2
  23. package/dist/{version-B8WzrPJT.js.map → version-1NhJbqzi.js.map} +1 -1
  24. package/package.json +1 -1
  25. package/dist/deploy-engine-CrYi7ta5.js.map +0 -1
  26. package/dist/iam-policy-targets-elNafvpb.js.map +0 -1
  27. package/dist/logger-DAaB7GFO.js.map +0 -1
  28. package/dist/program-epAinsMQ.js.map +0 -1
  29. package/dist/provider-classes-D76dAHvV.js.map +0 -1
@@ -1,13 +1,13 @@
1
1
  import { r as getAwsClients } from "./aws-clients-CnmtbrxD.js";
2
- import { A as displayIdent, F as plainIdentOr, I as safeMsg, M as displayStackName, N as isPasteableIdent, T as SECRET_REF_MAX_CODE_POINTS, _ as generateResourceNameWithFallback, g as generateResourceName, j as displaySafe, n as getLogger } from "./logger-DAaB7GFO.js";
3
- import { A as refusalTypeShown, An as pasteableCommand, B as protectionFlipKey, Bt as injectiveKey, C as assertRegionMatch, D as isQuotableImportValue, Dn as commandHole, E as isPlainImportValue, Fn as shellQuote, Gn as markNameCollision, Gt as withPasteableAwsProfile, I as deleteWithProtectionCompensation, In as withheldTargetClause, J as isAwsCliLiteral, Jt as clientDefaultsFor, K as UNNAMEABLE_ID_CLAUSE, Kn as markReplayMayCollide, Kt as ambientClientDefaults, L as isTerminalDeleteFailure, M as resolveExplicitPhysicalId, Mn as plainOrDescribed, O as normalizeAwsTagsToCfn, On as hasClauseBreak, Ot as markAuxiliaryFailure, P as ProtectionFlipRegistry, Qn as isTransientServerError, Qt as CdkdError, R as logGroupProtectionSite, S as RESOURCE_NOT_FOUND, St as clearCreatedBeforeFailure, T as isPlainImportJson, V as rdsFamilyProtectionSite, Vt as injectiveKeyPrefix, W as userPoolProtectionSite, X as protectedReplacementAdvice, Xt as AccountIdUnavailableError, Y as pasteableAwsCommand, Yn as isAmbiguousOutcomeError, Yt as credentialFingerprint, Z as renderDisableCommand, Zn as isRetryableTransientError, _ as RecentIdSet, _t as maskDeep, a as onlySecretDerived, ar as isThrottlingError, at as canonicalizeRoute53QueryName, b as setBounded, c as recordedPrincipalsRepair, cr as wrapMaskedAwsError, ct as compositeIdSkipResult, er as describeAwsFailure, fn as ProvisioningError, ft as segmentAfterAnchor, g as AmbiguousCreateLatch, gt as isSecretDerivedValue, h as AMBIGUOUS_LATCH_TTL_MS, ht as createMaskedRetryLogger, i as holdsSecretDerivedEntry, ir as isMarkedNonRetryable, j as remedyLogicalId, k as quotedRemedyLogicalId, kn as isInertUnquoted, kt as markCreatedBeforeFailure, lt as logicalIdShown, mn as ResourceUpdateNotSupportedError, mt as createMaskedLogSinks, nr as safeStringify, nt as startInterruptWatch, o as readPrincipalLists, or as markNonRetryable, ot as compositeIdFormatMessage, p as withRemovalDefaults, pt as stateOrphanRecordRemedy, q as WITHHELD_AWS_COMMAND, qt as ambientCredentialConfig, r as SECRET_DERIVED_READ_LIVE, rr as THROTTLING_ERROR_NAMES, rt as ElapsedBudgetRegistry, sr as markRedactedCause, st as compositeIdSeparatorRefusal, tr as isAwsAuthoredFailure, tt as isInterruptedWaitError, u as clearOnUpdateRemoval, ut as packCompositeId, v as createAttemptKey, vt as maskerOrIdentity, w as VALUE_NOT_SHOWN, x as withoutServerErrorRetries, y as isInsideWindow, yt as withDerivedNameMasks, z as observeThenDisableProtection } from "./iam-policy-targets-elNafvpb.js";
2
+ import { F as displayStackName, I as isPasteableIdent, N as displayIdent, O as SECRET_REF_MAX_CODE_POINTS, P as displaySafe, R as plainIdentOr, a as getLogger, b as generateResourceNameWithFallback, n as isAwsAuthoredFailure, r as safeStringify, t as describeAwsFailure, y as generateResourceName, z as safeMsg } from "./aws-failure-text-BaWeCWRz.js";
3
+ import { $ as protectedReplacementAdvice, $t as AccountIdUnavailableError, A as isQuotableImportValue, An as commandHole, B as isTerminalDeleteFailure, C as setBounded, D as VALUE_NOT_SHOWN, E as assertRegionMatch, F as resolveExplicitPhysicalId, Fn as plainOrDescribed, H as observeThenDisableProtection, Jn as markNameCollision, Jt as withPasteableAwsProfile, L as ProtectionFlipRegistry, M as quotedRemedyLogicalId, Mn as isInertUnquoted, Mt as markCreatedBeforeFailure, N as refusalTypeShown, Nn as pasteableCommand, O as isPlainImportJson, P as remedyLogicalId, Q as pasteableAwsCommand, Qn as isAmbiguousOutcomeError, Qt as credentialFingerprint, Rn as shellQuote, S as replayedSendWindow, St as withDerivedNameMasks, T as RESOURCE_NOT_FOUND, Tt as clearCreatedBeforeFailure, U as protectionFlipKey, Ut as injectiveKey, V as logGroupProtectionSite, W as rdsFamilyProtectionSite, Wt as injectiveKeyPrefix, X as WITHHELD_AWS_COMMAND, Xt as ambientCredentialConfig, Y as UNNAMEABLE_ID_CLAUSE, Yn as markReplayMayCollide, Yt as ambientClientDefaults, Z as isAwsCliLiteral, Zt as clientDefaultsFor, _ as RecentIdSet, _n as ResourceUpdateNotSupportedError, _t as createMaskedLogSinks, a as onlySecretDerived, ar as isThrottlingError, at as startInterruptWatch, b as isInsideWindow, bt as maskDeep, c as recordedPrincipalsRepair, cr as wrapMaskedAwsError, ct as canonicalizeRoute53QueryName, dt as compositeIdSkipResult, er as isRetryableTransientError, et as renderDisableCommand, ft as logicalIdShown, g as AmbiguousCreateLatch, gt as stateOrphanRecordRemedy, h as AMBIGUOUS_LATCH_TTL_MS, hn as ProvisioningError, ht as segmentAfterAnchor, i as holdsSecretDerivedEntry, ir as isMarkedNonRetryable, it as isInterruptedWaitError, j as normalizeAwsTagsToCfn, jn as hasClauseBreak, jt as markAuxiliaryFailure, k as isPlainImportValue, lt as compositeIdFormatMessage, o as readPrincipalLists, or as markNonRetryable, ot as ElapsedBudgetRegistry, p as withRemovalDefaults, pt as packCompositeId, q as userPoolProtectionSite, r as SECRET_DERIVED_READ_LIVE, rr as THROTTLING_ERROR_NAMES, sr as markRedactedCause, tn as CdkdError, tr as isTransientServerError, u as clearOnUpdateRemoval, ut as compositeIdSeparatorRefusal, v as ambiguousAttemptLead, vt as createMaskedRetryLogger, w as withoutServerErrorRetries, x as replayFollowedAmbiguousAttempt, xt as maskerOrIdentity, y as createAttemptKey, yt as isSecretDerivedValue, z as deleteWithProtectionCompensation, zn as withheldTargetClause } from "./iam-policy-targets-BoZuWtxK.js";
4
4
  import { s as ambientRegion } from "./aws-client-defaults-D0q0z4dG.js";
5
- import { $r as passedParameterClassesOf, Aa as coerceCfnBoolean, Bn as planTagDiff, Br as getAccountInfo, Ct as INDEX_SETTLE_POLL_INTERVAL_MS, Da as isWarmThroughputDecrease, Dc as renderAssemblyPathEscape, Dt as S3_AUTO_DELETE_OBJECTS_TAG, Ea as coerceWarmThroughput$1, Ec as displayAssemblyPath, Eo as recoverMaskedOutput, Et as ECR_AUTO_DELETE_IMAGES_TAG, Fa as readConfigString, Fn as reserveStackCreateToken, Fr as s3BucketRegionalDomainName, Ga as lambdaFunctionNameForMask, Gn as definedAttributes, Gt as redactedDeleteAddressFields, Hn as refuseMalformedDesiredTags, Ia as replayWarn, Ir as s3BucketWebsiteUrl, Ka as sameLambdaFunctionAddress, Kn as stringifyIfAssigned, Kt as redactedDeleteAddressSkip, La as requireConfigArray, Ln as acquireIdempotencyToken, Ma as configBooleanRefusal, Mr as s3BucketArn, Na as configIntegerRefusal, Nn as earliestDefined, Nr as s3BucketDomainName, Oa as toCfnInteger, Oc as resolveAssemblyPath, Oo as carriesSecretMask, Ot as hasCdkAutoDeleteTag, Pa as configStringRefusal, Pi as refuseMalformedNestedChildOutputs, Pr as s3BucketDualStackDomainName, Qn as getCurrentResourceSecrets, Ra as requireConfigObject, Rn as DBPROXY_TAGS_WHAT, St as DELETE_INDEX_WAIT_PROCEED_NOTE, T as markRefusedBeforeApplying, Ta as WARM_THROUGHPUT_MEMBERS, Tc as describeFileReadFailure, Tt as waitForIndexesSettled, Ua as withRetry, Un as tagMapAsList, Ut as REDACTED_DELETE_ADDRESS_SKIP_REASON, Vn as readTagList, Vt as getCurrentProducerRegions, Wa as canonicalLambdaFunctionName, Wn as tagPlanWarning, Wt as isRedactedRecordedValue, Xr as parseWebACLArn, Z as getNestedRevertRun, _o as markSameGenerationBag, _t as beginDeleteWait, a as findNestedTemplateTreeDefect, ai as accountArgs, ar as deleteSkipReason, bt as resolveDynamoDbDeleteBudgetClock, c as renderNestedTemplateTreeDefect, cr as markWaitAbandoned, dc as decodeListingKey, dr as isTerminationProtectionPropagationError, ds as rewriteTemplateAssetReferences, ea as refuseMalformedResourcesForDestroy, et as revertNestedChildFromJournal, fa as withheldAccountClause, fr as observeThenDisableInstanceApiTermination, ga as withoutSilentDropProperties, gt as DYNAMODB_DELETE_MIN_RESOURCE_TIMEOUT_MS, hc as derivePartitionAndUrlSuffix, ht as DynamoDBGlobalTableProvider, it as withNestedStackContext, ja as coerceCfnInteger, jr as isSettledInstanceState, ka as toFiniteNumber, kt as isTruthyCfnBoolean, lt as getStackRecords, ma as findSilentDropProperties, mc as canonicalizeRegion, mr as reEnableInstanceApiTermination, nr as unchangedBehindSecretReference, o as isAbsoluteAssetPath, oo as hasMaskableValues, or as withIndeterminateGuard, os as stringifyValue, pr as reDisableInstanceApiTermination, rt as getCurrentNestedStackContext, s as listNestedTemplateRows, sr as isWaitAbandonedError, st as awaitInFlightSibling, t as DeployEngine, to as passedNoEchoParametersOf, tr as slowCcOperationTimeoutMs, ur as ec2InstanceProtectionSite, vo as redactSecretsForState, vt as compensateRemovedDeletionProtection, w as getPriorAttempts, wt as deleteTableWithIndexBusyRetry, xo as dynamicReferenceTokens, xt as resolveDynamoDbDeleteBudgetMs, yt as deleteBudgetKey, za as requireConfigString, zn as DBPROXY_TAG_OPTIONS } from "./deploy-engine-CrYi7ta5.js";
6
- import { n as collectInlinePolicyNamesManagedBySiblings, r as IamCreateClientCache, t as IAMRoleProvider } from "./iam-role-provider-ClAgHnkh.js";
7
- import { a as canonicalizeIpProtocolValue, i as resolveSecretDerivedPrincipals, n as runDestroyForStack, o as resolvedResourceTimeoutMs, r as isResolvableSecretPrincipalList, t as canonicalizeIpv4Cidr } from "./program-epAinsMQ.js";
8
- import { RDSProvider } from "./rds-provider-V_uJHUSX.js";
9
- import { NeptuneProvider } from "./neptune-provider-ppi8nIX-.js";
10
- import { ASGProvider } from "./asg-provider-DoaukzYL.js";
5
+ import { $n as getCurrentResourceSecrets, Aa as toFiniteNumber, Ba as requireConfigString, Bn as planTagDiff, Ct as INDEX_SETTLE_POLL_INTERVAL_MS, Da as coerceWarmThroughput$1, Dc as displayAssemblyPath, Do as recoverMaskedOutput, Dt as S3_AUTO_DELETE_OBJECTS_TAG, Ea as WARM_THROUGHPUT_MEMBERS, Ec as describeFileReadFailure, Et as ECR_AUTO_DELETE_IMAGES_TAG, Fa as configStringRefusal, Fi as refuseMalformedNestedChildOutputs, Fn as reserveStackCreateToken, Fr as s3BucketDualStackDomainName, Ga as canonicalLambdaFunctionName, Gn as definedAttributes, Gt as redactedDeleteAddressFields, Hn as refuseMalformedDesiredTags, Ia as readConfigString, Ir as s3BucketRegionalDomainName, Ka as lambdaFunctionNameForMask, Kn as stringifyIfAssigned, Kt as redactedDeleteAddressSkip, La as replayWarn, Ln as acquireIdempotencyToken, Lr as s3BucketWebsiteUrl, Ma as coerceCfnInteger, Mr as isSettledInstanceState, Na as configBooleanRefusal, Nn as earliestDefined, Nr as s3BucketArn, Oa as isWarmThroughputDecrease, Oc as renderAssemblyPathEscape, Ot as hasCdkAutoDeleteTag, Pa as configIntegerRefusal, Pr as s3BucketDomainName, Ra as requireConfigArray, Rn as DBPROXY_TAGS_WHAT, So as dynamicReferenceTokens, St as DELETE_INDEX_WAIT_PROCEED_NOTE, T as markRefusedBeforeApplying, Tt as waitForIndexesSettled, Un as tagMapAsList, Ut as REDACTED_DELETE_ADDRESS_SKIP_REASON, Vn as readTagList, Vr as getAccountInfo, Vt as getCurrentProducerRegions, W as getNestedRevertRun, Wa as withRetry, Wn as tagPlanWarning, Wt as isRedactedRecordedValue, X as getCurrentNestedStackContext, Z as withNestedStackContext, Zr as parseWebACLArn, _a as withoutSilentDropProperties, _t as beginDeleteWait, a as findNestedTemplateTreeDefect, bt as resolveDynamoDbDeleteBudgetClock, c as renderNestedTemplateTreeDefect, cr as isWaitAbandonedError, dr as ec2InstanceProtectionSite, ei as passedParameterClassesOf, fc as decodeListingKey, fr as isTerminationProtectionPropagationError, fs as rewriteTemplateAssetReferences, gc as derivePartitionAndUrlSuffix, gt as DYNAMODB_DELETE_MIN_RESOURCE_TIMEOUT_MS, ha as findSilentDropProperties, hc as canonicalizeRegion, hr as reEnableInstanceApiTermination, ht as DynamoDBGlobalTableProvider, ja as coerceCfnBoolean, ka as toCfnInteger, kc as resolveAssemblyPath, ko as carriesSecretMask, kt as isTruthyCfnBoolean, lr as markWaitAbandoned, lt as getStackRecords, mr as reDisableInstanceApiTermination, no as passedNoEchoParametersOf, nr as slowCcOperationTimeoutMs, o as isAbsoluteAssetPath, oi as accountArgs, or as deleteSkipReason, pa as withheldAccountClause, pr as observeThenDisableInstanceApiTermination, q as revertNestedChildFromJournal, qa as sameLambdaFunctionAddress, rr as unchangedBehindSecretReference, s as listNestedTemplateRows, so as hasMaskableValues, sr as withIndeterminateGuard, ss as stringifyValue, st as awaitInFlightSibling, t as DeployEngine, ta as refuseMalformedResourcesForDestroy, vo as markSameGenerationBag, vt as compensateRemovedDeletionProtection, w as getPriorAttempts, wt as deleteTableWithIndexBusyRetry, xt as resolveDynamoDbDeleteBudgetMs, yo as redactSecretsForState, yt as deleteBudgetKey, za as requireConfigObject, zn as DBPROXY_TAG_OPTIONS } from "./deploy-engine-Z_zHC0jz.js";
6
+ import { n as collectInlinePolicyNamesManagedBySiblings, r as IamCreateClientCache, t as IAMRoleProvider } from "./iam-role-provider-BTYPRrDe.js";
7
+ import { a as canonicalizeIpProtocolValue, i as resolveSecretDerivedPrincipals, n as runDestroyForStack, o as resolvedResourceTimeoutMs, r as isResolvableSecretPrincipalList, t as canonicalizeIpv4Cidr } from "./program-CKV6Kn8Q.js";
8
+ import { RDSProvider } from "./rds-provider-6YeZRRfW.js";
9
+ import { NeptuneProvider } from "./neptune-provider-ZYVwKq6K.js";
10
+ import { ASGProvider } from "./asg-provider-eXsnCQh2.js";
11
11
  import { createHash, randomUUID } from "node:crypto";
12
12
  import { CreateBucketCommand, DeleteBucketAnalyticsConfigurationCommand, DeleteBucketCommand, DeleteBucketCorsCommand, DeleteBucketEncryptionCommand, DeleteBucketIntelligentTieringConfigurationCommand, DeleteBucketInventoryConfigurationCommand, DeleteBucketLifecycleCommand, DeleteBucketMetricsConfigurationCommand, DeleteBucketOwnershipControlsCommand, DeleteBucketPolicyCommand, DeleteBucketReplicationCommand, DeleteBucketTaggingCommand, DeleteBucketWebsiteCommand, DeleteObjectsCommand, GetBucketAccelerateConfigurationCommand, GetBucketCorsCommand, GetBucketEncryptionCommand, GetBucketLifecycleConfigurationCommand, GetBucketLocationCommand, GetBucketLoggingCommand, GetBucketNotificationConfigurationCommand, GetBucketOwnershipControlsCommand, GetBucketPolicyCommand, GetBucketReplicationCommand, GetBucketTaggingCommand, GetBucketVersioningCommand, GetBucketWebsiteCommand, GetObjectCommand, GetObjectLockConfigurationCommand, GetPublicAccessBlockCommand, HeadBucketCommand, ListBucketAnalyticsConfigurationsCommand, ListBucketIntelligentTieringConfigurationsCommand, ListBucketInventoryConfigurationsCommand, ListBucketMetricsConfigurationsCommand, ListObjectVersionsCommand, ListObjectsV2Command, NoSuchBucket, PutBucketAccelerateConfigurationCommand, PutBucketAnalyticsConfigurationCommand, PutBucketCorsCommand, PutBucketEncryptionCommand, PutBucketIntelligentTieringConfigurationCommand, PutBucketInventoryConfigurationCommand, PutBucketLifecycleConfigurationCommand, PutBucketLoggingCommand, PutBucketMetricsConfigurationCommand, PutBucketNotificationConfigurationCommand, PutBucketOwnershipControlsCommand, PutBucketPolicyCommand, PutBucketReplicationCommand, PutBucketTaggingCommand, PutBucketVersioningCommand, PutBucketWebsiteCommand, PutObjectLockConfigurationCommand, PutPublicAccessBlockCommand, S3Client } from "@aws-sdk/client-s3";
13
13
  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, UpdateLoginProfileCommand } from "@aws-sdk/client-iam";
@@ -1389,6 +1389,11 @@ var IAMAccessKeyProvider = class {
1389
1389
  }
1390
1390
  log.debug(`Successfully created IAM access key ${logicalId}: ${v(accessKeyId)}`);
1391
1391
  this.accessKeyIdsCreatedByThisProcess.add(accessKeyId);
1392
+ if (replayFollowedAmbiguousAttempt(response)) try {
1393
+ await this.deleteOrphanFromFailedAttempt(userName, logicalId, baseline, attemptStartMs, log, "replayed");
1394
+ } catch (reconcileError) {
1395
+ log.warn(`Could not check user ${v(userName)} for an access key left by the replayed CreateAccessKey for ${logicalId}: ${v(describeAwsFailure(reconcileError).detail)}. List the user's keys and delete any that no deploy records: ${aws`aws iam list-access-keys --user-name ${userName}`.render()}`);
1396
+ }
1392
1397
  return {
1393
1398
  physicalId: accessKeyId,
1394
1399
  attributes: {
@@ -1419,7 +1424,7 @@ var IAMAccessKeyProvider = class {
1419
1424
  release();
1420
1425
  }
1421
1426
  }
1422
- async deleteOrphanFromFailedAttempt(userName, logicalId, baseline, attemptStartMs, log) {
1427
+ async deleteOrphanFromFailedAttempt(userName, logicalId, baseline, attemptStartMs, log, cause = "failed") {
1423
1428
  const { value: v } = log;
1424
1429
  const aws = pasteableAwsCommand(log.mask);
1425
1430
  const deleted = /* @__PURE__ */ new Set();
@@ -1433,7 +1438,7 @@ var IAMAccessKeyProvider = class {
1433
1438
  log.warn(`IAM access key ${v(accessKeyId)} appeared on user ${v(userName)} while creating ${logicalId}, but cdkd cannot attribute it to this attempt (created ${key.createDateMs === void 0 ? "at an unknown time" : new Date(key.createDateMs).toISOString()}, attempt started ${new Date(attemptStartMs).toISOString()}). Leaving it in place. If it is an orphan of a failed cdkd deploy, delete it with: ${aws`aws iam delete-access-key --user-name ${userName} --access-key-id ${accessKeyId}`.render()}`);
1434
1439
  continue;
1435
1440
  }
1436
- log.warn(`IAM access key ${v(accessKeyId)} was minted on user ${v(userName)} by this failed attempt at ${logicalId} and its secret was lost with the response, so it is unusable and unrecorded; deleting it before the retry`);
1441
+ log.warn(cause === "replayed" ? `IAM access key ${v(accessKeyId)} was minted on user ${v(userName)} by the CreateAccessKey attempt for ${logicalId} that the AWS SDK then sent again, and its secret was lost with that attempt's response, so it is unusable and unrecorded; deleting it (the key the replay returned is recorded)` : `IAM access key ${v(accessKeyId)} was minted on user ${v(userName)} by this failed attempt at ${logicalId} and its secret was lost with the response, so it is unusable and unrecorded; deleting it before the retry`);
1437
1442
  try {
1438
1443
  await this.iamClient.send(new DeleteAccessKeyCommand({
1439
1444
  UserName: userName,
@@ -8387,7 +8392,8 @@ async function reportPossibleOrphans(logicalId, window, log, lookup) {
8387
8392
  const until = new Date(window.ceilingMs).toISOString();
8388
8393
  const remove = lookup.remove;
8389
8394
  const service = lookup.service ?? "API Gateway";
8390
- const afterward = lookup.afterward ?? "Creating a new one now.";
8395
+ const afterward = window.replayedInSend === true ? "cdkd recorded the one the create returned." : lookup.afterward ?? "Creating a new one now.";
8396
+ const lead = ambiguousAttemptLead(lookup.action, logicalId, window);
8391
8397
  const when = remove !== void 0 ? `between ${since} and ${until}` : `at ${since}`;
8392
8398
  let found;
8393
8399
  try {
@@ -8395,12 +8401,12 @@ async function reportPossibleOrphans(logicalId, window, log, lookup) {
8395
8401
  } catch (error) {
8396
8402
  const failure = describeAwsFailure(error);
8397
8403
  log.debug(`${lookup.listAction} failed with: ${log.value(failure.detail)}`);
8398
- log.warn(`An earlier ${lookup.action} attempt for ${logicalId} failed without a definite answer (${when}), so ${service} may have created ${lookup.subject} that no cdkd state records, and cdkd could not look for it (${lookup.listAction}: ${failure.summary}). Creating it again; check for a duplicate.`);
8404
+ log.warn(`${lead} (${when}), so ${service} may have created ${lookup.subject} that no cdkd state records, and cdkd could not look for it (${lookup.listAction}: ${failure.summary}). ${window.replayedInSend === true ? "Check" : "Creating it again; check"} for a duplicate.`);
8399
8405
  return;
8400
8406
  }
8401
8407
  const incomplete = found.truncated ? ` The search was incomplete: the list was cut at ${20} pages.` : "";
8402
8408
  if (found.ids.length === 0) {
8403
- const line = `No listed ${lookup.noun} matching ${lookup.subject} is unrecorded by this deploy, so the listing shows no orphan of the earlier ambiguous ${lookup.action} attempt for ${logicalId} (${when}).${incomplete}`;
8409
+ const line = `No listed ${lookup.noun} matching ${lookup.subject} is unrecorded by this deploy, so the listing shows no orphan of the ${window.replayedInSend === true ? "replayed" : "earlier ambiguous"} ${lookup.action} attempt for ${logicalId} (${when}).${incomplete}`;
8404
8410
  if (found.truncated) log.warn(line);
8405
8411
  else log.debug(line);
8406
8412
  return;
@@ -8410,10 +8416,10 @@ async function reportPossibleOrphans(logicalId, window, log, lookup) {
8410
8416
  const inspect = [...new Set(shown.map((id) => lookup.inspect(id)))].join(" ; ");
8411
8417
  if (remove !== void 0) {
8412
8418
  const deletion = [...new Set(shown.map((id) => remove(id)))].join(" ; ");
8413
- log.warn(`An earlier ${lookup.action} attempt for ${logicalId} failed without a definite answer, and ${service} may have created ${lookup.subject} then that no cdkd state records. ${found.ids.length} ${lookup.noun} were created ${when} that this deploy did not record: ${shown.join(", ")}${more}. cdkd does not adopt or delete them: nothing listed proves which deploy created one. ${afterward} First inspect each candidate: ${inspect}. Only after confirming one is this deploy's orphan and not another deploy's, ${lookup.removeVerb ?? "delete it"}: ${deletion}.${incomplete}`);
8419
+ log.warn(`${lead}, and ${service} may have created ${lookup.subject} then that no cdkd state records. ${found.ids.length} ${lookup.noun} were created ${when} that this deploy did not record: ${shown.join(", ")}${more}. cdkd does not adopt or delete them: nothing listed proves which deploy created one. ${afterward} First inspect each candidate: ${inspect}. Only after confirming one is this deploy's orphan and not another deploy's, ${lookup.removeVerb ?? "delete it"}: ${deletion}.${incomplete}`);
8414
8420
  return;
8415
8421
  }
8416
- log.warn(`An earlier ${lookup.action} attempt for ${logicalId} failed without a definite answer (${when}), and ${service} may have created ${lookup.subject} then that no cdkd state records. ${found.ids.length} ${lookup.noun} match that this deploy did not record: ${shown.join(", ")}${more}. ${service} reports no creation time for them, so any of them may instead be this stack's own recorded one, another stack's, or older than this deploy; cdkd does not adopt or delete them. ${afterward} Inspect each before deleting anything: ${inspect}.${incomplete}`);
8422
+ log.warn(`${lead} (${when}), and ${service} may have created ${lookup.subject} then that no cdkd state records. ${found.ids.length} ${lookup.noun} match that this deploy did not record: ${shown.join(", ")}${more}. ${service} reports no creation time for them, so any of them may instead be this stack's own recorded one, another stack's, or older than this deploy; cdkd does not adopt or delete them. ${afterward} Inspect each before deleting anything: ${inspect}.${incomplete}`);
8417
8423
  }
8418
8424
 
8419
8425
  //#endregion
@@ -8621,6 +8627,8 @@ var LambdaEventSourceMappingProvider = class {
8621
8627
  const uuid = response.UUID;
8622
8628
  if (!uuid) throw new Error("CreateEventSourceMapping did not return UUID");
8623
8629
  mappingsCreatedByThisProcess.add(uuid);
8630
+ const replayWindow = replayedSendWindow(response, attemptStartMs);
8631
+ if (replayWindow !== void 0) await this.reportPossibleMappingOrphans(logicalId, replayWindow, log, functionName, params.EventSourceArn);
8624
8632
  log.debug(`Successfully created event source mapping ${logicalId}: ${uuid}`);
8625
8633
  return {
8626
8634
  physicalId: uuid,
@@ -8955,6 +8963,8 @@ var LambdaLayerVersionProvider = class {
8955
8963
  }
8956
8964
  const layerVersionArn = response.LayerVersionArn;
8957
8965
  if (layerVersionArn) versionsPublishedByThisProcess.add(layerVersionArn);
8966
+ const replayWindow = replayedSendWindow(response, attemptStartMs);
8967
+ if (replayWindow !== void 0) await this.reportPossibleLayerOrphans(logicalId, replayWindow, log, layerName);
8958
8968
  log.debug(`Successfully created Lambda layer version ${logicalId}: ${layerVersionArn}`);
8959
8969
  return {
8960
8970
  physicalId: layerVersionArn,
@@ -14318,6 +14328,8 @@ var EC2Provider = class {
14318
14328
  }
14319
14329
  const vpcId = response.Vpc.VpcId;
14320
14330
  ec2IdsCreatedByThisProcess.add(vpcId);
14331
+ const vpcReplayWindow = replayedSendWindow(response, attemptStartMs);
14332
+ if (vpcReplayWindow !== void 0) await this.reportPossibleOrphanVpcs(logicalId, cidrBlock, vpcReplayWindow, context);
14321
14333
  let defaultSgId;
14322
14334
  try {
14323
14335
  if (properties["EnableDnsHostnames"] === true || properties["EnableDnsHostnames"] === "true") await this.ec2Client.send(new ModifyVpcAttributeCommand({
@@ -14484,6 +14496,8 @@ var EC2Provider = class {
14484
14496
  }
14485
14497
  const subnetId = response.Subnet.SubnetId;
14486
14498
  ec2IdsCreatedByThisProcess.add(subnetId);
14499
+ const subnetReplayWindow = replayedSendWindow(response, attemptStartMs);
14500
+ if (subnetReplayWindow !== void 0) await this.reportPossibleOrphanSubnets(logicalId, vpcId, cidrBlock, subnetReplayWindow, context);
14487
14501
  const availabilityZone = response.Subnet.AvailabilityZone;
14488
14502
  try {
14489
14503
  await this.applyTags(subnetId, desiredTags, logicalId);
@@ -14648,6 +14662,8 @@ var EC2Provider = class {
14648
14662
  }
14649
14663
  const igwId = response.InternetGateway.InternetGatewayId;
14650
14664
  ec2IdsCreatedByThisProcess.add(igwId);
14665
+ const igwReplayWindow = replayedSendWindow(response, attemptStartMs);
14666
+ if (igwReplayWindow !== void 0) await this.reportPossibleOrphanInternetGateways(logicalId, igwReplayWindow, context);
14651
14667
  await this.applyTags(igwId, desiredTags, logicalId);
14652
14668
  this.logger.debug(`Successfully created InternetGateway ${logicalId}: ${igwId}`);
14653
14669
  return {
@@ -14731,6 +14747,8 @@ var EC2Provider = class {
14731
14747
  createdId = allocationId;
14732
14748
  }
14733
14749
  ec2IdsCreatedByThisProcess.add(allocationId);
14750
+ const eipReplayWindow = replayedSendWindow(response, attemptStartMs);
14751
+ if (eipReplayWindow !== void 0) await this.reportPossibleOrphanAddresses(logicalId, input, eipReplayWindow, context);
14734
14752
  await this.applyTags(allocationId, desiredTags, logicalId);
14735
14753
  const instanceId = properties["InstanceId"];
14736
14754
  if (instanceId) {
@@ -17479,11 +17497,10 @@ var ApiGatewayProvider = class ApiGatewayProvider {
17479
17497
  if (!restApiId || !name || !type) throw new ProvisioningError(`RestApiId, Name, and Type are required for API Gateway Authorizer ${logicalId}`, resourceType, logicalId);
17480
17498
  try {
17481
17499
  const providerArns = properties["ProviderARNs"];
17482
- const orphanWindow = createAuthorizerLatch$1.take(logicalId);
17483
- if (orphanWindow !== void 0) {
17500
+ const reportOrphans = async (lookupWindow) => {
17484
17501
  const aws = pasteableAwsCommand(log.mask);
17485
17502
  const regionArg = await this.orphanCommandRegionArg(aws);
17486
- await reportPossibleOrphans(logicalId, orphanWindow, log, {
17503
+ await reportPossibleOrphans(logicalId, lookupWindow, log, {
17487
17504
  action: "CreateAuthorizer",
17488
17505
  listAction: "GetAuthorizers",
17489
17506
  subject: `an authorizer named ${log.value(name)} (type ${log.value(type)}) in REST API ${log.value(restApiId)}`,
@@ -17501,7 +17518,9 @@ var ApiGatewayProvider = class ApiGatewayProvider {
17501
17518
  }, (a) => a.id && a.name === name && a.type === type && !authorizersCreatedByThisProcess$1.has(injectiveKey(restApiId, a.id)) ? a.id : void 0),
17502
17519
  inspect: (id) => aws`aws apigateway get-authorizer --rest-api-id ${restApiId} --authorizer-id ${id}${regionArg}`.render()
17503
17520
  });
17504
- }
17521
+ };
17522
+ const orphanWindow = createAuthorizerLatch$1.take(logicalId);
17523
+ if (orphanWindow !== void 0) await reportOrphans(orphanWindow);
17505
17524
  const createClient = await this.getCreateClient();
17506
17525
  const attemptStartMs = Date.now();
17507
17526
  let response;
@@ -17524,6 +17543,8 @@ var ApiGatewayProvider = class ApiGatewayProvider {
17524
17543
  }
17525
17544
  const authorizerId = response.id;
17526
17545
  authorizersCreatedByThisProcess$1.add(injectiveKey(restApiId, authorizerId));
17546
+ const replayWindow = replayedSendWindow(response, attemptStartMs);
17547
+ if (replayWindow !== void 0) await reportOrphans(replayWindow);
17527
17548
  log.debug(`Successfully created API Gateway Authorizer ${logicalId}: ${authorizerId}`);
17528
17549
  return {
17529
17550
  physicalId: authorizerId,
@@ -17718,11 +17739,10 @@ var ApiGatewayProvider = class ApiGatewayProvider {
17718
17739
  if (!restApiId) throw new ProvisioningError(`RestApiId is required for API Gateway Deployment ${logicalId}`, resourceType, logicalId);
17719
17740
  try {
17720
17741
  const description = properties["Description"];
17721
- const orphanWindow = createDeploymentLatch.take(logicalId);
17722
- if (orphanWindow !== void 0) {
17742
+ const reportOrphans = async (lookupWindow) => {
17723
17743
  const aws = pasteableAwsCommand(log.mask);
17724
17744
  const regionArg = await this.orphanCommandRegionArg(aws);
17725
- await reportPossibleOrphans(logicalId, orphanWindow, log, {
17745
+ await reportPossibleOrphans(logicalId, lookupWindow, log, {
17726
17746
  action: "CreateDeployment",
17727
17747
  listAction: "GetDeployments",
17728
17748
  subject: `a deployment of REST API ${log.value(restApiId)}${description !== void 0 ? ` described ${log.value(description)}` : ""}`,
@@ -17737,11 +17757,13 @@ var ApiGatewayProvider = class ApiGatewayProvider {
17737
17757
  items: page.items ?? [],
17738
17758
  next: page.position
17739
17759
  };
17740
- }, (d) => d.id && (d.description ?? "") === (description ?? "") && isInsideWindow(d.createdDate, orphanWindow) && !deploymentsCreatedByThisProcess.has(injectiveKey(restApiId, d.id)) ? d.id : void 0),
17760
+ }, (d) => d.id && (d.description ?? "") === (description ?? "") && isInsideWindow(d.createdDate, lookupWindow) && !deploymentsCreatedByThisProcess.has(injectiveKey(restApiId, d.id)) ? d.id : void 0),
17741
17761
  inspect: (id) => aws`aws apigateway get-deployment --rest-api-id ${restApiId} --deployment-id ${id}${regionArg}`.render(),
17742
17762
  remove: (id) => aws`aws apigateway delete-deployment --rest-api-id ${restApiId} --deployment-id ${id}${regionArg}`.render()
17743
17763
  });
17744
- }
17764
+ };
17765
+ const orphanWindow = createDeploymentLatch.take(logicalId);
17766
+ if (orphanWindow !== void 0) await reportOrphans(orphanWindow);
17745
17767
  const createClient = await this.getCreateClient();
17746
17768
  const attemptStartMs = Date.now();
17747
17769
  let response;
@@ -17756,6 +17778,8 @@ var ApiGatewayProvider = class ApiGatewayProvider {
17756
17778
  }
17757
17779
  const deploymentId = response.id;
17758
17780
  deploymentsCreatedByThisProcess.add(injectiveKey(restApiId, deploymentId));
17781
+ const replayWindow = replayedSendWindow(response, attemptStartMs);
17782
+ if (replayWindow !== void 0) await reportOrphans(replayWindow);
17759
17783
  log.debug(`Successfully created API Gateway Deployment ${logicalId}: ${deploymentId}`);
17760
17784
  return {
17761
17785
  physicalId: deploymentId,
@@ -18773,11 +18797,10 @@ var ApiGatewayV2Provider = class {
18773
18797
  const protocolType = properties["ProtocolType"];
18774
18798
  if (!name || !protocolType) throw new ProvisioningError(`Name and ProtocolType are required for API Gateway V2 Api ${logicalId}`, resourceType, logicalId);
18775
18799
  try {
18776
- const orphanWindow = createApiLatch.take(logicalId);
18777
- if (orphanWindow !== void 0) {
18800
+ const reportOrphans = async (lookupWindow) => {
18778
18801
  const aws = pasteableAwsCommand(log.mask);
18779
18802
  const regionArg = await this.orphanCommandRegionArg(aws);
18780
- await reportPossibleOrphans(logicalId, orphanWindow, log, {
18803
+ await reportPossibleOrphans(logicalId, lookupWindow, log, {
18781
18804
  action: "CreateApi",
18782
18805
  listAction: "GetApis",
18783
18806
  subject: `an API named ${log.value(name)} (protocol ${log.value(protocolType)})`,
@@ -18791,11 +18814,13 @@ var ApiGatewayV2Provider = class {
18791
18814
  items: page.Items ?? [],
18792
18815
  next: page.NextToken
18793
18816
  };
18794
- }, (a) => a.ApiId && a.Name === name && a.ProtocolType === protocolType && isInsideWindow(a.CreatedDate, orphanWindow) && !apisCreatedByThisProcess.has(a.ApiId) ? a.ApiId : void 0),
18817
+ }, (a) => a.ApiId && a.Name === name && a.ProtocolType === protocolType && isInsideWindow(a.CreatedDate, lookupWindow) && !apisCreatedByThisProcess.has(a.ApiId) ? a.ApiId : void 0),
18795
18818
  inspect: (id) => aws`aws apigatewayv2 get-api --api-id ${id}${regionArg}`.render(),
18796
18819
  remove: (id) => aws`aws apigatewayv2 delete-api --api-id ${id}${regionArg}`.render()
18797
18820
  });
18798
- }
18821
+ };
18822
+ const orphanWindow = createApiLatch.take(logicalId);
18823
+ if (orphanWindow !== void 0) await reportOrphans(orphanWindow);
18799
18824
  const attemptStartMs = Date.now();
18800
18825
  let response;
18801
18826
  try {
@@ -18817,6 +18842,8 @@ var ApiGatewayV2Provider = class {
18817
18842
  }
18818
18843
  const apiId = response.ApiId;
18819
18844
  apisCreatedByThisProcess.add(apiId);
18845
+ const replayWindow = replayedSendWindow(response, attemptStartMs);
18846
+ if (replayWindow !== void 0) await reportOrphans(replayWindow);
18820
18847
  const apiEndpoint = response.ApiEndpoint;
18821
18848
  log.debug(`Successfully created API Gateway V2 Api ${logicalId}: ${apiId}`);
18822
18849
  const executeApiArn = await this.buildExecuteApiArn(apiId, log);
@@ -18931,11 +18958,10 @@ var ApiGatewayV2Provider = class {
18931
18958
  this.warnTlsConfigIgnoredIfPublic(logicalId, properties, log);
18932
18959
  try {
18933
18960
  const integrationUri = properties["IntegrationUri"];
18934
- const orphanWindow = createIntegrationLatch.take(logicalId);
18935
- if (orphanWindow !== void 0) {
18961
+ const reportOrphans = async (lookupWindow) => {
18936
18962
  const aws = pasteableAwsCommand(log.mask);
18937
18963
  const regionArg = await this.orphanCommandRegionArg(aws);
18938
- await reportPossibleOrphans(logicalId, orphanWindow, log, {
18964
+ await reportPossibleOrphans(logicalId, lookupWindow, log, {
18939
18965
  action: "CreateIntegration",
18940
18966
  listAction: "GetIntegrations",
18941
18967
  subject: `an integration of type ${log.value(integrationType)}${integrationUri !== void 0 ? ` to ${log.value(integrationUri)}` : ""} in API ${log.value(apiId)}`,
@@ -18953,7 +18979,9 @@ var ApiGatewayV2Provider = class {
18953
18979
  }, (i) => i.IntegrationId && i.IntegrationType === integrationType && (i.IntegrationUri ?? "") === (integrationUri ?? "") && !integrationsCreatedByThisProcess.has(injectiveKey(apiId, i.IntegrationId)) ? i.IntegrationId : void 0),
18954
18980
  inspect: (id) => aws`aws apigatewayv2 get-integration --api-id ${apiId} --integration-id ${id}${regionArg}`.render()
18955
18981
  });
18956
- }
18982
+ };
18983
+ const orphanWindow = createIntegrationLatch.take(logicalId);
18984
+ if (orphanWindow !== void 0) await reportOrphans(orphanWindow);
18957
18985
  const attemptStartMs = Date.now();
18958
18986
  let response;
18959
18987
  try {
@@ -18983,6 +19011,8 @@ var ApiGatewayV2Provider = class {
18983
19011
  }
18984
19012
  const integrationId = response.IntegrationId;
18985
19013
  integrationsCreatedByThisProcess.add(injectiveKey(apiId, integrationId));
19014
+ const replayWindow = replayedSendWindow(response, attemptStartMs);
19015
+ if (replayWindow !== void 0) await reportOrphans(replayWindow);
18986
19016
  log.debug(`Successfully created API Gateway V2 Integration ${logicalId}: ${integrationId}`);
18987
19017
  return {
18988
19018
  physicalId: integrationId,
@@ -19078,11 +19108,10 @@ var ApiGatewayV2Provider = class {
19078
19108
  const name = properties["Name"] || logicalId;
19079
19109
  if (!apiId || !authorizerType) throw new ProvisioningError(`ApiId and AuthorizerType are required for API Gateway V2 Authorizer ${logicalId}`, resourceType, logicalId);
19080
19110
  try {
19081
- const orphanWindow = createAuthorizerLatch.take(logicalId);
19082
- if (orphanWindow !== void 0) {
19111
+ const reportOrphans = async (lookupWindow) => {
19083
19112
  const aws = pasteableAwsCommand(log.mask);
19084
19113
  const regionArg = await this.orphanCommandRegionArg(aws);
19085
- await reportPossibleOrphans(logicalId, orphanWindow, log, {
19114
+ await reportPossibleOrphans(logicalId, lookupWindow, log, {
19086
19115
  action: "CreateAuthorizer",
19087
19116
  listAction: "GetAuthorizers",
19088
19117
  subject: `an authorizer named ${log.value(name)} (type ${log.value(authorizerType)}) in API ${log.value(apiId)}`,
@@ -19100,7 +19129,9 @@ var ApiGatewayV2Provider = class {
19100
19129
  }, (a) => a.AuthorizerId && a.Name === name && a.AuthorizerType === authorizerType && !authorizersCreatedByThisProcess.has(injectiveKey(apiId, a.AuthorizerId)) ? a.AuthorizerId : void 0),
19101
19130
  inspect: (id) => aws`aws apigatewayv2 get-authorizer --api-id ${apiId} --authorizer-id ${id}${regionArg}`.render()
19102
19131
  });
19103
- }
19132
+ };
19133
+ const orphanWindow = createAuthorizerLatch.take(logicalId);
19134
+ if (orphanWindow !== void 0) await reportOrphans(orphanWindow);
19104
19135
  const attemptStartMs = Date.now();
19105
19136
  let response;
19106
19137
  try {
@@ -19123,6 +19154,8 @@ var ApiGatewayV2Provider = class {
19123
19154
  }
19124
19155
  const authorizerId = response.AuthorizerId;
19125
19156
  authorizersCreatedByThisProcess.add(injectiveKey(apiId, authorizerId));
19157
+ const replayWindow = replayedSendWindow(response, attemptStartMs);
19158
+ if (replayWindow !== void 0) await reportOrphans(replayWindow);
19126
19159
  log.debug(`Successfully created API Gateway V2 Authorizer ${logicalId}: ${authorizerId}`);
19127
19160
  return {
19128
19161
  physicalId: authorizerId,
@@ -22107,6 +22140,8 @@ var ECSProvider = class {
22107
22140
  const taskDef = response.taskDefinition;
22108
22141
  if (!taskDef || !taskDef.taskDefinitionArn) throw new Error("RegisterTaskDefinition did not return task definition ARN");
22109
22142
  taskDefinitionsRegisteredByThisProcess.add(taskDef.taskDefinitionArn);
22143
+ const replayWindow = replayedSendWindow(response, attemptStartMs);
22144
+ if (replayWindow !== void 0) await this.reportPossibleOrphanTaskDefinitions(logicalId, family, replayWindow, log);
22110
22145
  log.debug(`Successfully created ECS task definition ${logicalId}: ${taskDef.taskDefinitionArn}`);
22111
22146
  return {
22112
22147
  physicalId: taskDef.taskDefinitionArn,
@@ -28068,17 +28103,20 @@ var CognitoUserPoolProvider = class {
28068
28103
  if (properties["UserPoolTier"]) createParams.UserPoolTier = properties["UserPoolTier"];
28069
28104
  const orphanWindow = createUserPoolLatch.take(logicalId);
28070
28105
  if (orphanWindow !== void 0) await this.reportPossibleOrphanPools(logicalId, poolName, orphanWindow, createMaskedLogSinks(this.logger, context?.maskSecrets));
28071
- let userPool;
28106
+ let created;
28072
28107
  const attemptStartMs = Date.now();
28073
28108
  try {
28074
- userPool = (await this.getCreateClient().send(new CreateUserPoolCommand(createParams))).UserPool;
28109
+ created = await this.getCreateClient().send(new CreateUserPoolCommand(createParams));
28075
28110
  } catch (error) {
28076
28111
  createUserPoolLatch.noteFailure(logicalId, error, attemptStartMs, orphanWindow);
28077
28112
  throw error;
28078
28113
  }
28114
+ const userPool = created.UserPool;
28079
28115
  if (!userPool?.Id) throw new Error("CreateUserPool did not return UserPool.Id");
28080
28116
  const userPoolId = userPool.Id;
28081
28117
  createdUserPoolId = userPoolId;
28118
+ const replayWindow = replayedSendWindow(created, attemptStartMs);
28119
+ if (replayWindow !== void 0) await this.reportPossibleOrphanPools(logicalId, poolName, replayWindow, createMaskedLogSinks(this.logger, context?.maskSecrets), userPoolId);
28082
28120
  const userPoolArn = userPool.Arn;
28083
28121
  const region = await this.getClient().config.region();
28084
28122
  const { urlSuffix } = derivePartitionAndUrlSuffix(region);
@@ -28125,10 +28163,12 @@ var CognitoUserPoolProvider = class {
28125
28163
  }
28126
28164
  return region ? aws` --region ${region}` : aws``;
28127
28165
  }
28128
- async reportPossibleOrphanPools(logicalId, poolName, window, log) {
28166
+ async reportPossibleOrphanPools(logicalId, poolName, window, log, returnedId) {
28129
28167
  const { value: v } = log;
28130
28168
  const since = new Date(window.floorMs).toISOString();
28131
28169
  const until = new Date(window.ceilingMs).toISOString();
28170
+ const lead = ambiguousAttemptLead("CreateUserPool", logicalId, window);
28171
+ const replayed = window.replayedInSend === true;
28132
28172
  const candidates = [];
28133
28173
  let truncated = false;
28134
28174
  try {
@@ -28139,7 +28179,7 @@ var CognitoUserPoolProvider = class {
28139
28179
  MaxResults: 60,
28140
28180
  ...nextToken && { NextToken: nextToken }
28141
28181
  }));
28142
- for (const pool of page.UserPools ?? []) if (pool.Id && pool.Name === poolName && isInsideWindow(pool.CreationDate, window) && !userPoolsCreatedByThisProcess.has(pool.Id)) candidates.push(pool.Id);
28182
+ for (const pool of page.UserPools ?? []) if (pool.Id && pool.Name === poolName && isInsideWindow(pool.CreationDate, window) && pool.Id !== returnedId && !userPoolsCreatedByThisProcess.has(pool.Id)) candidates.push(pool.Id);
28143
28183
  nextToken = page.NextToken;
28144
28184
  pages++;
28145
28185
  } while (nextToken && pages < MAX_USER_POOL_LIST_PAGES);
@@ -28147,12 +28187,12 @@ var CognitoUserPoolProvider = class {
28147
28187
  } catch (error) {
28148
28188
  const failure = describeAwsFailure(error);
28149
28189
  log.debug(`ListUserPools failed with: ${v(failure.detail)}`);
28150
- log.warn(`An earlier CreateUserPool attempt for ${logicalId} failed without a definite answer, so Cognito may have created a user pool named ${v(poolName)} that no cdkd state records, and cdkd could not look for it (ListUserPools: ${failure.summary}). Creating a new pool; check for a pool of that name created between ${since} and ${until}.`);
28190
+ log.warn(`${lead}, so Cognito may have created a user pool named ${v(poolName)} that no cdkd state records, and cdkd could not look for it (ListUserPools: ${failure.summary}). ${replayed ? "Check" : "Creating a new pool; check"} for a pool of that name created between ${since} and ${until}.`);
28151
28191
  return;
28152
28192
  }
28153
28193
  const incomplete = truncated ? ` The search was incomplete: the pool list was cut at ${MAX_USER_POOL_LIST_PAGES} pages.` : "";
28154
28194
  if (candidates.length === 0) {
28155
- const line = `No listed user pool named ${v(poolName)} was created between ${since} and ${until}, where the earlier ambiguous CreateUserPool attempt for ${logicalId} ran.${incomplete}`;
28195
+ const line = `No listed user pool named ${v(poolName)} was created between ${since} and ${until}, where the ${replayed ? "replayed" : "earlier ambiguous"} CreateUserPool attempt for ${logicalId} ran.${incomplete}`;
28156
28196
  if (truncated) log.warn(line);
28157
28197
  else log.debug(line);
28158
28198
  return;
@@ -28162,7 +28202,7 @@ var CognitoUserPoolProvider = class {
28162
28202
  const region = await this.regionArg(aws);
28163
28203
  const inspect = shown.map((id) => aws`aws cognito-idp describe-user-pool --user-pool-id ${id}${region}`.render()).join(" ; ");
28164
28204
  const deletion = shown.map((id) => aws`aws cognito-idp delete-user-pool --user-pool-id ${id}${region}`.render()).join(" ; ");
28165
- log.warn(`An earlier CreateUserPool attempt for ${logicalId} failed without a definite answer, and Cognito may have created a pool then that no cdkd state records. ${candidates.length} user pool(s) named ${v(poolName)} were created between ${since} and ${until}: ${shown.join(", ")}${candidates.length > shown.length ? ", ..." : ""}. cdkd does not adopt or delete them: a pool name does not prove which deploy created it. Creating a new pool now, so the new pool and the candidate(s) above will ALL be named ${v(poolName)} -- Cognito allows duplicate names. First inspect each candidate (its user count, creation date and tags): ${inspect}. Only after confirming a pool is this deploy's orphan and not another deploy's, delete it: ${deletion}.${incomplete}`);
28205
+ log.warn(`${lead}, and Cognito may have created a pool then that no cdkd state records. ${candidates.length} user pool(s) named ${v(poolName)} were created between ${since} and ${until}: ${shown.join(", ")}${candidates.length > shown.length ? ", ..." : ""}. cdkd does not adopt or delete them: a pool name does not prove which deploy created it. ${replayed ? `The pool the create returned and the candidate(s) above are ALL named ${v(poolName)}` : `Creating a new pool now, so the new pool and the candidate(s) above will ALL be named ${v(poolName)}`} -- Cognito allows duplicate names. First inspect each candidate (its user count, creation date and tags): ${inspect}. Only after confirming a pool is this deploy's orphan and not another deploy's, delete it: ${deletion}.${incomplete}`);
28166
28206
  }
28167
28207
  async applyMfaConfig(physicalId, properties, declaredMfaConfiguration, options = {}) {
28168
28208
  const request = buildMfaConfigRequest(physicalId, properties, this.logger, declaredMfaConfiguration, options.maskSecrets ?? ((text) => text));
@@ -30887,6 +30927,8 @@ var AppSyncProvider = class {
30887
30927
  }
30888
30928
  createdApiId = response.graphqlApi?.apiId;
30889
30929
  const apiId = response.graphqlApi.apiId;
30930
+ const replayWindow = replayedSendWindow(response, attemptStartMs);
30931
+ if (replayWindow !== void 0) await this.reportPossibleOrphanApis(logicalId, input, replayWindow, maskerOrIdentity(context?.maskSecrets), apiId);
30890
30932
  const arn = response.graphqlApi.arn;
30891
30933
  const graphQLUrl = response.graphqlApi.uris?.["GRAPHQL"];
30892
30934
  const envRecord = await this.applyEnvironmentVariables(apiId, resourceType, logicalId, properties, void 0, context?.replayingState === true, maskerOrIdentity(context?.maskSecrets));
@@ -30928,8 +30970,10 @@ var AppSyncProvider = class {
30928
30970
  }
30929
30971
  return region ? aws` --region ${region}` : aws``;
30930
30972
  }
30931
- async reportPossibleOrphanApis(logicalId, input, window, mask) {
30973
+ async reportPossibleOrphanApis(logicalId, input, window, mask, returnedId) {
30932
30974
  const since = new Date(window.floorMs).toISOString();
30975
+ const lead = ambiguousAttemptLead("CreateGraphqlApi", logicalId, window);
30976
+ const replayed = window.replayedInSend === true;
30933
30977
  const name = mask(String(input.name));
30934
30978
  const wantedType = input.apiType ?? "GRAPHQL";
30935
30979
  const candidates = [];
@@ -30942,7 +30986,7 @@ var AppSyncProvider = class {
30942
30986
  maxResults: 25,
30943
30987
  ...nextToken && { nextToken }
30944
30988
  }));
30945
- for (const api of page.graphqlApis ?? []) if (api.apiId && api.name === input.name && (api.apiType ?? "GRAPHQL") === wantedType && !graphqlApisCreatedByThisProcess.has(api.apiId)) candidates.push(api.apiId);
30989
+ for (const api of page.graphqlApis ?? []) if (api.apiId && api.name === input.name && (api.apiType ?? "GRAPHQL") === wantedType && api.apiId !== returnedId && !graphqlApisCreatedByThisProcess.has(api.apiId)) candidates.push(api.apiId);
30946
30990
  nextToken = page.nextToken;
30947
30991
  pages++;
30948
30992
  } while (nextToken && pages < MAX_GRAPHQL_API_LIST_PAGES);
@@ -30950,12 +30994,12 @@ var AppSyncProvider = class {
30950
30994
  } catch (error) {
30951
30995
  const failure = describeAwsFailure(error);
30952
30996
  this.logger.debug(mask(`ListGraphqlApis failed with: ${failure.detail}`));
30953
- this.logger.warn(mask(`An earlier CreateGraphqlApi attempt for ${logicalId} failed without a definite answer (at ${since}), so AppSync may have created an API named ${name} that no cdkd state records, and cdkd could not list APIs to look for it (${failure.summary}). Creating a new API; check for another API of that name.`));
30997
+ this.logger.warn(mask(`${lead} (at ${since}), so AppSync may have created an API named ${name} that no cdkd state records, and cdkd could not list APIs to look for it (${failure.summary}). ${replayed ? "Check" : "Creating a new API; check"} for another API of that name.`));
30954
30998
  return;
30955
30999
  }
30956
31000
  const incomplete = truncated ? ` The search was incomplete: the API list was cut at ${MAX_GRAPHQL_API_LIST_PAGES} pages.` : "";
30957
31001
  if (candidates.length === 0) {
30958
- const line = mask(`No listed GraphQL API named ${name} is unrecorded by this deploy, so the listing shows no orphan of the earlier ambiguous CreateGraphqlApi attempt for ${logicalId} (at ${since}).${incomplete}`);
31002
+ const line = mask(`No listed GraphQL API named ${name} is unrecorded by this deploy, so the listing shows no orphan of the ${replayed ? "replayed" : "earlier ambiguous"} CreateGraphqlApi attempt for ${logicalId} (at ${since}).${incomplete}`);
30959
31003
  if (truncated) this.logger.warn(line);
30960
31004
  else this.logger.debug(line);
30961
31005
  return;
@@ -30963,7 +31007,7 @@ var AppSyncProvider = class {
30963
31007
  const shown = candidates.slice(0, MAX_REPORTED_ORPHAN_APIS);
30964
31008
  const aws = pasteableAwsCommand(mask);
30965
31009
  const region = await this.regionArg(aws);
30966
- this.logger.warn(mask(`An earlier CreateGraphqlApi attempt for ${logicalId} failed without a definite answer (at ${since}), and AppSync may have created an API then that no cdkd state records. ${candidates.length} GraphQL API(s) named ${name} exist that this deploy did not record: ${shown.join(", ")}${candidates.length > shown.length ? ", ..." : ""}. AppSync reports no creation time, so any of them may instead be this stack's own recorded API, another stack's, or older than this deploy; cdkd does not adopt or delete them. Creating a new API. Inspect each before deleting anything: ${shown.map((apiId) => aws`aws appsync get-graphql-api --api-id ${apiId}${region}`.render()).join(" ; ")}${incomplete}`));
31010
+ this.logger.warn(mask(`${lead} (at ${since}), and AppSync may have created an API then that no cdkd state records. ${candidates.length} GraphQL API(s) named ${name} exist that this deploy did not record: ${shown.join(", ")}${candidates.length > shown.length ? ", ..." : ""}. AppSync reports no creation time, so any of them may instead be this stack's own recorded API, another stack's, or older than this deploy; cdkd does not adopt or delete them. ${replayed ? "cdkd recorded the API the create returned." : "Creating a new API."} Inspect each before deleting anything: ${shown.map((apiId) => aws`aws appsync get-graphql-api --api-id ${apiId}${region}`.render()).join(" ; ")}${incomplete}`));
30967
31011
  }
30968
31012
  async deleteGraphQLApi(logicalId, physicalId, resourceType, context) {
30969
31013
  this.logger.debug(`Deleting GraphQL API ${logicalId}: ${physicalId}`);
@@ -31164,6 +31208,8 @@ var AppSyncProvider = class {
31164
31208
  }
31165
31209
  apiKeyId = response.apiKey.id;
31166
31210
  apiKeysCreatedByThisProcess.add(injectiveKey(apiId, apiKeyId));
31211
+ const replayWindow = replayedSendWindow(response, attemptStartMs);
31212
+ if (replayWindow !== void 0) await this.reportPossibleOrphanApiKeys(logicalId, input, replayWindow, createMaskedLogSinks(this.logger, context?.maskSecrets));
31167
31213
  this.logger.debug(`Successfully created ApiKey ${logicalId}: ${apiKeyId}`);
31168
31214
  } catch (error) {
31169
31215
  const cause = error instanceof Error ? error : void 0;
@@ -33836,6 +33882,9 @@ var KMSProvider = class {
33836
33882
  inputDigest,
33837
33883
  heldAtMs: Date.now()
33838
33884
  });
33885
+ createdKeyId = keyId;
33886
+ const replayWindow = replayedSendWindow(result, attemptStartMs);
33887
+ if (replayWindow !== void 0) await this.reportPossibleOrphanKeys(logicalId, input, replayWindow);
33839
33888
  }
33840
33889
  createdKeyId = keyId;
33841
33890
  if (enableKeyRotation) {
@@ -33917,6 +33966,7 @@ var KMSProvider = class {
33917
33966
  async reportPossibleOrphanKeys(logicalId, input, window) {
33918
33967
  const since = new Date(window.floorMs).toISOString();
33919
33968
  const until = new Date(window.ceilingMs).toISOString();
33969
+ const lead = ambiguousAttemptLead("CreateKey", logicalId, window);
33920
33970
  const pendingIds = new Set([...pendingKeys.values()].map((entry) => entry.keyId));
33921
33971
  const ids = [];
33922
33972
  let listTruncated = false;
@@ -33936,7 +33986,7 @@ var KMSProvider = class {
33936
33986
  } catch (error) {
33937
33987
  const failure = describeAwsFailure(error);
33938
33988
  this.logger.debug(safeMsg`ListKeys failed with: ${failure.detail}`);
33939
- this.logger.warn(safeMsg`An earlier CreateKey attempt for ${logicalId} failed without a definite answer, so KMS may have created a key that no cdkd state records, and cdkd could not list keys to look for it (${failure.summary}). Check the account's customer managed keys created between ${since} and ${until}.`);
33989
+ this.logger.warn(safeMsg`${lead}, so KMS may have created a key that no cdkd state records, and cdkd could not list keys to look for it (${failure.summary}). Check the account's customer managed keys created between ${since} and ${until}.`);
33940
33990
  return;
33941
33991
  }
33942
33992
  const describable = ids.slice(-200).reverse();
@@ -33968,7 +34018,7 @@ var KMSProvider = class {
33968
34018
  ];
33969
34019
  const incomplete = gaps.length > 0 ? ` The search was incomplete: ${gaps.join(", ")}.` : "";
33970
34020
  if (candidates.length === 0) {
33971
- const line = safeMsg`An earlier CreateKey attempt for ${logicalId} failed without a definite answer; no listed customer managed key matching it was created between ${since} and ${until}.${incomplete}`;
34021
+ const line = safeMsg`${lead}; no listed customer managed key matching it was created between ${since} and ${until}.${incomplete}`;
33972
34022
  if (incomplete) this.logger.warn(line);
33973
34023
  else this.logger.debug(line);
33974
34024
  return;
@@ -33978,7 +34028,7 @@ var KMSProvider = class {
33978
34028
  const shown = candidates.slice(0, MAX_REPORTED_ORPHANS);
33979
34029
  const inspect = shown.map((keyId) => aws`aws kms describe-key --key-id ${keyId}${region}`.render()).join(" ; ");
33980
34030
  const deletion = shown.map((keyId) => aws`aws kms schedule-key-deletion --key-id ${keyId}${region} --pending-window-in-days 7`.render()).join(" ; ");
33981
- this.logger.warn(safeMsg`An earlier CreateKey attempt for ${logicalId} failed without a definite answer, and KMS may have created a key then that no cdkd state records. ${candidates.length} customer managed key(s) created between ${since} and ${until} match this key's settings: ${shown.join(", ")}${candidates.length > shown.length ? ", ..." : ""}. cdkd does not adopt or delete them, because a key has no name or token that ties it to ${logicalId} -- another key with the same settings is indistinguishable. Creating a new key now, so the orphan (if any) and the new key will both exist. First inspect each candidate: ${inspect}. Only after confirming a key is this deploy's orphan and no other deploy uses it, schedule its deletion: ${deletion}.${incomplete}`);
34031
+ this.logger.warn(safeMsg`${lead}, and KMS may have created a key then that no cdkd state records. ${candidates.length} customer managed key(s) created between ${since} and ${until} match this key's settings: ${shown.join(", ")}${candidates.length > shown.length ? ", ..." : ""}. cdkd does not adopt or delete them, because a key has no name or token that ties it to ${logicalId} -- another key with the same settings is indistinguishable. ${window.replayedInSend === true ? "cdkd recorded the key the create returned, so the orphan (if any) and that key both exist." : "Creating a new key now, so the orphan (if any) and the new key will both exist."} First inspect each candidate: ${inspect}. Only after confirming a key is this deploy's orphan and no other deploy uses it, schedule its deletion: ${deletion}.${incomplete}`);
33982
34032
  }
33983
34033
  async updateKey(logicalId, physicalId, resourceType, properties, previousProperties) {
33984
34034
  this.logger.debug(`Updating KMS Key ${logicalId}: ${physicalId}`);
@@ -38417,14 +38467,13 @@ var EMRClusterProvider = class {
38417
38467
  })),
38418
38468
  Instances: this.toJobFlowInstancesConfig(properties["Instances"])
38419
38469
  };
38420
- const orphanWindow = runJobFlowLatch.take(logicalId);
38421
- if (orphanWindow !== void 0) {
38470
+ const reportOrphans = async (lookupWindow) => {
38422
38471
  const log = createMaskedLogSinks(this.logger, context?.maskSecrets);
38423
38472
  const aws = pasteableAwsCommand(log.mask);
38424
38473
  const regionArg = await orphanCommandRegionArg(this.getClient(), aws);
38425
38474
  const name = input.Name;
38426
38475
  const protectedCluster = input.Instances?.TerminationProtected === true;
38427
- await reportPossibleOrphans(logicalId, orphanWindow, log, {
38476
+ await reportPossibleOrphans(logicalId, lookupWindow, log, {
38428
38477
  action: "RunJobFlow",
38429
38478
  service: "EMR",
38430
38479
  listAction: "ListClusters",
@@ -38432,8 +38481,8 @@ var EMRClusterProvider = class {
38432
38481
  noun: "cluster(s)",
38433
38482
  list: () => collectOrphanIds(async (marker) => {
38434
38483
  const page = await this.getClient().send(new ListClustersCommand({
38435
- CreatedAfter: new Date(orphanWindow.floorMs),
38436
- CreatedBefore: new Date(orphanWindow.ceilingMs),
38484
+ CreatedAfter: new Date(lookupWindow.floorMs),
38485
+ CreatedBefore: new Date(lookupWindow.ceilingMs),
38437
38486
  ClusterStates: LIVE_CLUSTER_STATES,
38438
38487
  ...marker && { Marker: marker }
38439
38488
  }));
@@ -38441,12 +38490,14 @@ var EMRClusterProvider = class {
38441
38490
  items: page.Clusters ?? [],
38442
38491
  next: page.Marker
38443
38492
  };
38444
- }, (c) => c.Id && c.Name === name && isInsideWindow(c.Status?.Timeline?.CreationDateTime, orphanWindow) && !clustersCreatedByThisProcess.has(c.Id) ? c.Id : void 0),
38493
+ }, (c) => c.Id && c.Name === name && isInsideWindow(c.Status?.Timeline?.CreationDateTime, lookupWindow) && !clustersCreatedByThisProcess.has(c.Id) ? c.Id : void 0),
38445
38494
  inspect: (id) => aws`aws emr describe-cluster --cluster-id ${id}${regionArg}`.render(),
38446
38495
  remove: (id) => aws`aws emr terminate-clusters --cluster-ids ${id}${regionArg}`.render(),
38447
38496
  removeVerb: protectedCluster ? `terminate it (this template turns termination protection on, so if describe-cluster shows it on for the candidate, first run ${aws`aws emr modify-cluster-attributes --cluster-id`.render()} ${commandHole("id")} ${aws`--no-termination-protected${regionArg}`.render()} with its id)` : "terminate it"
38448
38497
  });
38449
- }
38498
+ };
38499
+ const orphanWindow = runJobFlowLatch.take(logicalId);
38500
+ if (orphanWindow !== void 0) await reportOrphans(orphanWindow);
38450
38501
  const attemptStartMs = Date.now();
38451
38502
  let response;
38452
38503
  try {
@@ -38457,6 +38508,8 @@ var EMRClusterProvider = class {
38457
38508
  }
38458
38509
  clusterId = response.JobFlowId;
38459
38510
  if (clusterId) clustersCreatedByThisProcess.add(clusterId);
38511
+ const replayWindow = replayedSendWindow(response, attemptStartMs);
38512
+ if (replayWindow !== void 0) await reportOrphans(replayWindow);
38460
38513
  if (!clusterId) throw new ProvisioningError(`EMR RunJobFlow for ${logicalId} returned no JobFlowId`, resourceType, logicalId);
38461
38514
  const cluster = await this.waitForClusterReady(clusterId, logicalId, resourceType);
38462
38515
  this.logger.debug(`Successfully created EMR Cluster ${logicalId}: ${clusterId}`);
@@ -39098,13 +39151,12 @@ var EMRInstanceGroupConfigProvider = class {
39098
39151
  let createdGroupId;
39099
39152
  try {
39100
39153
  const group = this.toInstanceGroupConfig(properties);
39101
- const orphanWindow = addInstanceGroupsLatch.take(logicalId);
39102
- if (orphanWindow !== void 0 && group.InstanceRole === "TASK") {
39154
+ const reportOrphans = async (lookupWindow) => {
39103
39155
  const log = createMaskedLogSinks(this.logger, context?.maskSecrets);
39104
39156
  const aws = pasteableAwsCommand(log.mask);
39105
39157
  const regionArg = await orphanCommandRegionArg(this.getClient(), aws);
39106
39158
  const name = group.Name;
39107
- await reportPossibleOrphans(logicalId, orphanWindow, log, {
39159
+ await reportPossibleOrphans(logicalId, lookupWindow, log, {
39108
39160
  action: "AddInstanceGroups",
39109
39161
  service: "EMR",
39110
39162
  listAction: "ListInstanceGroups",
@@ -39119,12 +39171,14 @@ var EMRInstanceGroupConfigProvider = class {
39119
39171
  items: page.InstanceGroups ?? [],
39120
39172
  next: page.Marker
39121
39173
  };
39122
- }, (item) => item.Id && item.InstanceGroupType === "TASK" && (name === void 0 || item.Name === name) && isInsideWindow(item.Status?.Timeline?.CreationDateTime, orphanWindow) && !groupsCreatedByThisProcess.has(item.Id) ? item.Id : void 0),
39174
+ }, (item) => item.Id && item.InstanceGroupType === "TASK" && (name === void 0 || item.Name === name) && isInsideWindow(item.Status?.Timeline?.CreationDateTime, lookupWindow) && !groupsCreatedByThisProcess.has(item.Id) ? item.Id : void 0),
39123
39175
  inspect: () => aws`aws emr list-instance-groups --cluster-id ${jobFlowId}${regionArg}`.render(),
39124
39176
  remove: (id) => aws`aws emr modify-instance-groups --cluster-id ${jobFlowId} --instance-groups InstanceGroupId=${id},InstanceCount=0${regionArg}`.render(),
39125
39177
  removeVerb: "scale it to zero, which releases its instances (EMR has no call that removes an instance group; it ends with its cluster)"
39126
39178
  });
39127
- }
39179
+ };
39180
+ const orphanWindow = addInstanceGroupsLatch.take(logicalId);
39181
+ if (orphanWindow !== void 0 && group.InstanceRole === "TASK") await reportOrphans(orphanWindow);
39128
39182
  const attemptStartMs = Date.now();
39129
39183
  let response;
39130
39184
  try {
@@ -39139,6 +39193,8 @@ var EMRInstanceGroupConfigProvider = class {
39139
39193
  const groupId = response.InstanceGroupIds?.[0];
39140
39194
  if (groupId) groupsCreatedByThisProcess.add(groupId);
39141
39195
  createdGroupId = groupId;
39196
+ const replayWindow = replayedSendWindow(response, attemptStartMs);
39197
+ if (replayWindow !== void 0 && group.InstanceRole === "TASK") await reportOrphans(replayWindow);
39142
39198
  if (!groupId) throw new ProvisioningError(`EMR AddInstanceGroups for ${logicalId} returned no instance group id`, resourceType, logicalId);
39143
39199
  await this.waitForGroupReady(jobFlowId, groupId, logicalId, resourceType, toNumber$1(properties["InstanceCount"]) ?? 0);
39144
39200
  this.logger.debug(`Successfully added EMR instance group ${logicalId}: ${groupId}`);
@@ -39394,13 +39450,12 @@ var EMRInstanceFleetConfigProvider = class {
39394
39450
  let createdFleetId;
39395
39451
  try {
39396
39452
  const fleet = this.toInstanceFleetConfig(properties);
39397
- const orphanWindow = addInstanceFleetLatch.take(logicalId);
39398
- if (orphanWindow !== void 0 && fleet.InstanceFleetType === "TASK") {
39453
+ const reportOrphans = async (lookupWindow) => {
39399
39454
  const log = createMaskedLogSinks(this.logger, context?.maskSecrets);
39400
39455
  const aws = pasteableAwsCommand(log.mask);
39401
39456
  const regionArg = await orphanCommandRegionArg(this.getClient(), aws);
39402
39457
  const name = fleet.Name;
39403
- await reportPossibleOrphans(logicalId, orphanWindow, log, {
39458
+ await reportPossibleOrphans(logicalId, lookupWindow, log, {
39404
39459
  action: "AddInstanceFleet",
39405
39460
  service: "EMR",
39406
39461
  listAction: "ListInstanceFleets",
@@ -39415,12 +39470,14 @@ var EMRInstanceFleetConfigProvider = class {
39415
39470
  items: page.InstanceFleets ?? [],
39416
39471
  next: page.Marker
39417
39472
  };
39418
- }, (item) => item.Id && item.InstanceFleetType === "TASK" && (name === void 0 || item.Name === name) && isInsideWindow(item.Status?.Timeline?.CreationDateTime, orphanWindow) && !fleetsCreatedByThisProcess.has(item.Id) ? item.Id : void 0),
39473
+ }, (item) => item.Id && item.InstanceFleetType === "TASK" && (name === void 0 || item.Name === name) && isInsideWindow(item.Status?.Timeline?.CreationDateTime, lookupWindow) && !fleetsCreatedByThisProcess.has(item.Id) ? item.Id : void 0),
39419
39474
  inspect: () => aws`aws emr list-instance-fleets --cluster-id ${clusterId}${regionArg}`.render(),
39420
39475
  remove: (id) => aws`aws emr modify-instance-fleet --cluster-id ${clusterId} --instance-fleet InstanceFleetId=${id},TargetOnDemandCapacity=0,TargetSpotCapacity=0${regionArg}`.render(),
39421
39476
  removeVerb: "scale it to zero, which releases its instances (EMR has no call that removes an instance fleet; it ends with its cluster)"
39422
39477
  });
39423
- }
39478
+ };
39479
+ const orphanWindow = addInstanceFleetLatch.take(logicalId);
39480
+ if (orphanWindow !== void 0 && fleet.InstanceFleetType === "TASK") await reportOrphans(orphanWindow);
39424
39481
  const attemptStartMs = Date.now();
39425
39482
  let response;
39426
39483
  try {
@@ -39435,6 +39492,8 @@ var EMRInstanceFleetConfigProvider = class {
39435
39492
  const fleetId = response.InstanceFleetId;
39436
39493
  if (fleetId) fleetsCreatedByThisProcess.add(fleetId);
39437
39494
  createdFleetId = fleetId;
39495
+ const replayWindow = replayedSendWindow(response, attemptStartMs);
39496
+ if (replayWindow !== void 0 && fleet.InstanceFleetType === "TASK") await reportOrphans(replayWindow);
39438
39497
  if (!fleetId) throw new ProvisioningError(`EMR AddInstanceFleet for ${logicalId} returned no instance fleet id`, resourceType, logicalId);
39439
39498
  await this.waitForFleetReady(clusterId, fleetId, logicalId, resourceType, this.targetCapacities(properties), {
39440
39499
  onDemand: 0,
@@ -41943,6 +42002,8 @@ var DLMLifecyclePolicyProvider = class {
41943
42002
  }
41944
42003
  if (!response.PolicyId) throw new Error("CreateLifecyclePolicy did not return a PolicyId");
41945
42004
  policiesCreatedByThisProcess.add(response.PolicyId);
42005
+ const replayWindow = replayedSendWindow(response, attemptStartMs);
42006
+ if (replayWindow !== void 0) await this.reportPossibleOrphanPolicies(logicalId, input, replayWindow, log);
41946
42007
  let arn = "";
41947
42008
  try {
41948
42009
  arn = await this.fetchPolicyArn(response.PolicyId);
@@ -44223,4 +44284,4 @@ var ACMCertificateProvider = class {
44223
44284
 
44224
44285
  //#endregion
44225
44286
  export { ACMCertificateProvider, ASGProvider, AgentCoreBrowserProvider, AgentCoreCodeInterpreterProvider, AgentCoreEvaluatorProvider, AgentCoreRuntimeProvider, ApiGatewayProvider, ApiGatewayV2Provider, 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, 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, LambdaPermissionProvider, LambdaUrlProvider, 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 };
44226
- //# sourceMappingURL=provider-classes-D76dAHvV.js.map
44287
+ //# sourceMappingURL=provider-classes-Dz2gVtOZ.js.map