@go-to-k/cdkd 0.296.13 → 0.296.15
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.
- package/dist/{asg-provider-DeeIdM5B.js → asg-provider-BbWC_1l5.js} +4 -4
- package/dist/{asg-provider-DeeIdM5B.js.map → asg-provider-BbWC_1l5.js.map} +1 -1
- package/dist/{logger-DAaB7GFO.js → aws-failure-text-BaWeCWRz.js} +45 -2
- package/dist/aws-failure-text-BaWeCWRz.js.map +1 -0
- package/dist/cli.js +2 -2
- package/dist/{deploy-engine-FDsHckZR.js → deploy-engine-CjLZZzyn.js} +553 -481
- package/dist/deploy-engine-CjLZZzyn.js.map +1 -0
- package/dist/{iam-policy-targets-elNafvpb.js → iam-policy-targets-BoZuWtxK.js} +43 -49
- package/dist/iam-policy-targets-BoZuWtxK.js.map +1 -0
- package/dist/{iam-role-provider-BuWI_oJp.js → iam-role-provider-DAqNwSNR.js} +4 -4
- package/dist/{iam-role-provider-BuWI_oJp.js.map → iam-role-provider-DAqNwSNR.js.map} +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/{neptune-provider-Bdc1YYxL.js → neptune-provider-DlSon_pZ.js} +4 -4
- package/dist/{neptune-provider-Bdc1YYxL.js.map → neptune-provider-DlSon_pZ.js.map} +1 -1
- package/dist/{program-1S4fU3m4.js → program-CqKPsOUR.js} +175 -119
- package/dist/program-CqKPsOUR.js.map +1 -0
- package/dist/{provider-classes-hW6X0dKh.js → provider-classes-Drnm0GAz.js} +193 -74
- package/dist/provider-classes-Drnm0GAz.js.map +1 -0
- package/dist/{rds-provider-Q1U7N7ee.js → rds-provider-e6XtJAGl.js} +4 -4
- package/dist/{rds-provider-Q1U7N7ee.js.map → rds-provider-e6XtJAGl.js.map} +1 -1
- package/dist/{version-B9EuX7Oh.js → version-Bdg2mYAM.js} +2 -2
- package/dist/{version-B9EuX7Oh.js.map → version-Bdg2mYAM.js.map} +1 -1
- package/package.json +1 -1
- package/dist/deploy-engine-FDsHckZR.js.map +0 -1
- package/dist/iam-policy-targets-elNafvpb.js.map +0 -1
- package/dist/logger-DAaB7GFO.js.map +0 -1
- package/dist/program-1S4fU3m4.js.map +0 -1
- package/dist/provider-classes-hW6X0dKh.js.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { r as getAwsClients } from "./aws-clients-CnmtbrxD.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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
|
|
6
|
-
import { n as collectInlinePolicyNamesManagedBySiblings, r as IamCreateClientCache, t as IAMRoleProvider } from "./iam-role-provider-
|
|
7
|
-
import { a as canonicalizeIpProtocolValue, i as resolveSecretDerivedPrincipals, n as runDestroyForStack, o as resolvedResourceTimeoutMs, r as isResolvableSecretPrincipalList, t as canonicalizeIpv4Cidr } from "./program-
|
|
8
|
-
import { RDSProvider } from "./rds-provider-
|
|
9
|
-
import { NeptuneProvider } from "./neptune-provider-
|
|
10
|
-
import { ASGProvider } from "./asg-provider-
|
|
5
|
+
import { $r as parseWebACLArn, Aa as isWarmThroughputDecrease, Ac as renderAssemblyPathEscape, Ba as requireConfigArray, Bn as DBPROXY_TAGS_WHAT, Ct as INDEX_SETTLE_POLL_INTERVAL_MS, Dt as S3_AUTO_DELETE_OBJECTS_TAG, Et as ECR_AUTO_DELETE_IMAGES_TAG, Fa as configBooleanRefusal, Fn as earliestDefined, Fr as s3BucketArn, Gn as tagMapAsList, Gt as redactedDeleteAddressFields, Ha as requireConfigString, Hn as planTagDiff, Ia as configIntegerRefusal, Ir as s3BucketDomainName, Ja as lambdaFunctionNameForMask, Jn as stringifyIfAssigned, Ka as withRetry, Kn as tagPlanWarning, Kt as redactedDeleteAddressSkip, La as configStringRefusal, Li as refuseMalformedNestedChildOutputs, Ln as reserveStackCreateToken, Lr as s3BucketDualStackDomainName, Ma as toFiniteNumber, Na as coerceCfnBoolean, Oa as WARM_THROUGHPUT_MEMBERS, Oc as describeFileReadFailure, Ot as hasCdkAutoDeleteTag, Pa as coerceCfnInteger, Pr as isSettledInstanceState, Ra as readConfigString, Rr as s3BucketRegionalDomainName, St as DELETE_INDEX_WAIT_PROCEED_NOTE, T as markRefusedBeforeApplying, Tt as waitForIndexesSettled, Un as readTagList, Ur as getAccountInfo, Ut as REDACTED_DELETE_ADDRESS_SKIP_REASON, Va as requireConfigObject, Vn as DBPROXY_TAG_OPTIONS, Vt as getCurrentProducerRegions, W as getNestedRevertRun, Wn as refuseMalformedDesiredTags, Wt as isRedactedRecordedValue, X as getCurrentNestedStackContext, Ya as sameLambdaFunctionAddress, Z as withNestedStackContext, _a as findSilentDropProperties, _c as canonicalizeRegion, _r as reEnableInstanceApiTermination, _t as beginDeleteWait, a as findNestedTemplateTreeDefect, ar as unchangedBehindSecretReference, bo as markSameGenerationBag, bt as resolveDynamoDbDeleteBudgetClock, c as renderNestedTemplateTreeDefect, ci as accountArgs, cr as deleteSkipReason, dr as markWaitAbandoned, gr as reDisableInstanceApiTermination, gt as DYNAMODB_DELETE_MIN_RESOURCE_TIMEOUT_MS, ha as withheldAccountClause, hr as observeThenDisableInstanceApiTermination, ht as DynamoDBGlobalTableProvider, io as passedNoEchoParametersOf, ir as slowCcOperationTimeoutMs, ja as toCfnInteger, jc as resolveAssemblyPath, jo as carriesSecretMask, ka as coerceWarmThroughput$1, kc as displayAssemblyPath, ko as recoverMaskedOutput, kt as isTruthyCfnBoolean, lo as hasMaskableValues, lr as withIndeterminateGuard, ls as stringifyValue, lt as getStackRecords, mc as decodeListingKey, mr as isTerminationProtectionPropagationError, ms as rewriteTemplateAssetReferences, ni as passedParameterClassesOf, o as isAbsoluteAssetPath, pr as ec2InstanceProtectionSite, q as revertNestedChildFromJournal, qa as canonicalLambdaFunctionName, qn as definedAttributes, ra as refuseMalformedResourcesForDestroy, s as listNestedTemplateRows, st as awaitInFlightSibling, t as DeployEngine, tr as getCurrentResourceSecrets, ur as isWaitAbandonedError, vc as derivePartitionAndUrlSuffix, vt as compensateRemovedDeletionProtection, w as getPriorAttempts, wo as dynamicReferenceTokens, wt as deleteTableWithIndexBusyRetry, xo as redactSecretsForState, xt as resolveDynamoDbDeleteBudgetMs, ya as withoutSilentDropProperties, yt as deleteBudgetKey, za as replayWarn, zn as acquireIdempotencyToken, zr as s3BucketWebsiteUrl } from "./deploy-engine-CjLZZzyn.js";
|
|
6
|
+
import { n as collectInlinePolicyNamesManagedBySiblings, r as IamCreateClientCache, t as IAMRoleProvider } from "./iam-role-provider-DAqNwSNR.js";
|
|
7
|
+
import { a as canonicalizeIpProtocolValue, i as resolveSecretDerivedPrincipals, n as runDestroyForStack, o as resolvedResourceTimeoutMs, r as isResolvableSecretPrincipalList, t as canonicalizeIpv4Cidr } from "./program-CqKPsOUR.js";
|
|
8
|
+
import { RDSProvider } from "./rds-provider-e6XtJAGl.js";
|
|
9
|
+
import { NeptuneProvider } from "./neptune-provider-DlSon_pZ.js";
|
|
10
|
+
import { ASGProvider } from "./asg-provider-BbWC_1l5.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(
|
|
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(
|
|
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(
|
|
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
|
|
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,
|
|
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
|
|
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,
|
|
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,
|
|
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
|
|
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,
|
|
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,
|
|
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
|
|
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,
|
|
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
|
|
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,
|
|
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,
|
|
@@ -25643,6 +25678,9 @@ function instanceAttributes(instance) {
|
|
|
25643
25678
|
Arn: instance?.DBInstanceArn
|
|
25644
25679
|
});
|
|
25645
25680
|
}
|
|
25681
|
+
function isDbIdentifier(id) {
|
|
25682
|
+
return id.length <= 63 && /^[A-Za-z](?:-?[A-Za-z0-9])*$/.test(id);
|
|
25683
|
+
}
|
|
25646
25684
|
var DocDBProvider = class {
|
|
25647
25685
|
docdbClient;
|
|
25648
25686
|
createClient;
|
|
@@ -25723,6 +25761,7 @@ var DocDBProvider = class {
|
|
|
25723
25761
|
lowercase: true
|
|
25724
25762
|
});
|
|
25725
25763
|
let clusterCreated = false;
|
|
25764
|
+
let createdResourceId;
|
|
25726
25765
|
try {
|
|
25727
25766
|
const response = await this.getCreateClient().send(new CreateDBClusterCommand$1({
|
|
25728
25767
|
DBClusterIdentifier: dbClusterIdentifier,
|
|
@@ -25743,6 +25782,7 @@ var DocDBProvider = class {
|
|
|
25743
25782
|
...tags.length > 0 && { Tags: tags }
|
|
25744
25783
|
}));
|
|
25745
25784
|
clusterCreated = true;
|
|
25785
|
+
createdResourceId = response.DBCluster?.DbClusterResourceId;
|
|
25746
25786
|
if (!response.DBCluster) throw new Error("CreateDBCluster did not return DBCluster");
|
|
25747
25787
|
this.logger.debug(`Successfully created DocDB DBCluster ${logicalId}: ${dbClusterIdentifier}`);
|
|
25748
25788
|
if (process.env["CDKD_NO_WAIT"] !== "true") await this.waitForClusterAvailable(dbClusterIdentifier);
|
|
@@ -25752,7 +25792,7 @@ var DocDBProvider = class {
|
|
|
25752
25792
|
};
|
|
25753
25793
|
} catch (error) {
|
|
25754
25794
|
const thrown = error instanceof ProvisioningError ? error : new ProvisioningError(`Failed to create DocDB DBCluster ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, dbClusterIdentifier, error instanceof Error ? error : void 0);
|
|
25755
|
-
if (clusterCreated) markCreatedBeforeFailure(thrown, logicalId, resourceType, dbClusterIdentifier);
|
|
25795
|
+
if (clusterCreated) markCreatedBeforeFailure(thrown, logicalId, resourceType, dbClusterIdentifier, createdResourceId);
|
|
25756
25796
|
throw thrown;
|
|
25757
25797
|
}
|
|
25758
25798
|
}
|
|
@@ -25854,7 +25894,8 @@ var DocDBProvider = class {
|
|
|
25854
25894
|
if (isDocDBNotFoundError(error, "DBClusterNotFoundFault")) {
|
|
25855
25895
|
const clientRegion = await this.getClient().config.region();
|
|
25856
25896
|
assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
|
|
25857
|
-
this.logger.
|
|
25897
|
+
if (context?.failedCreateOrphan === true) this.logger.info(safeMsg` DocDB DB cluster ${physicalId} (${logicalId}), which a failed deploy created, is already gone; nothing to delete`);
|
|
25898
|
+
else this.logger.debug(`DocDB DBCluster ${logicalId} does not exist, skipping deletion`);
|
|
25858
25899
|
return;
|
|
25859
25900
|
}
|
|
25860
25901
|
const cause = error instanceof Error ? error : void 0;
|
|
@@ -25869,6 +25910,7 @@ var DocDBProvider = class {
|
|
|
25869
25910
|
lowercase: true
|
|
25870
25911
|
});
|
|
25871
25912
|
let instanceCreated = false;
|
|
25913
|
+
let createdResourceId;
|
|
25872
25914
|
try {
|
|
25873
25915
|
const response = await this.getCreateClient().send(new CreateDBInstanceCommand$1({
|
|
25874
25916
|
DBInstanceIdentifier: dbInstanceIdentifier,
|
|
@@ -25881,6 +25923,7 @@ var DocDBProvider = class {
|
|
|
25881
25923
|
...tags.length > 0 && { Tags: tags }
|
|
25882
25924
|
}));
|
|
25883
25925
|
instanceCreated = true;
|
|
25926
|
+
createdResourceId = response.DBInstance?.DbiResourceId;
|
|
25884
25927
|
if (!response.DBInstance) throw new Error("CreateDBInstance did not return DBInstance");
|
|
25885
25928
|
this.logger.debug(`Successfully created DocDB DBInstance ${logicalId}: ${dbInstanceIdentifier}`);
|
|
25886
25929
|
if (process.env["CDKD_NO_WAIT"] !== "true") await this.waitForInstanceAvailable(dbInstanceIdentifier);
|
|
@@ -25890,7 +25933,7 @@ var DocDBProvider = class {
|
|
|
25890
25933
|
};
|
|
25891
25934
|
} catch (error) {
|
|
25892
25935
|
const thrown = error instanceof ProvisioningError ? error : new ProvisioningError(`Failed to create DocDB DBInstance ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, dbInstanceIdentifier, error instanceof Error ? error : void 0);
|
|
25893
|
-
if (instanceCreated) markCreatedBeforeFailure(thrown, logicalId, resourceType, dbInstanceIdentifier);
|
|
25936
|
+
if (instanceCreated) markCreatedBeforeFailure(thrown, logicalId, resourceType, dbInstanceIdentifier, createdResourceId);
|
|
25894
25937
|
throw thrown;
|
|
25895
25938
|
}
|
|
25896
25939
|
}
|
|
@@ -25928,7 +25971,8 @@ var DocDBProvider = class {
|
|
|
25928
25971
|
if (isDocDBNotFoundError(error, "DBInstanceNotFoundFault")) {
|
|
25929
25972
|
const clientRegion = await this.getClient().config.region();
|
|
25930
25973
|
assertRegionMatch(clientRegion, context?.expectedRegion, resourceType, logicalId, physicalId);
|
|
25931
|
-
this.logger.
|
|
25974
|
+
if (context?.failedCreateOrphan === true) this.logger.info(safeMsg` DocDB DB instance ${physicalId} (${logicalId}), which a failed deploy created, is already gone; nothing to delete`);
|
|
25975
|
+
else this.logger.debug(`DocDB DBInstance ${physicalId} does not exist, skipping deletion`);
|
|
25932
25976
|
return;
|
|
25933
25977
|
}
|
|
25934
25978
|
const cause = error instanceof Error ? error : void 0;
|
|
@@ -25941,6 +25985,55 @@ var DocDBProvider = class {
|
|
|
25941
25985
|
async describeDBInstance(dbInstanceIdentifier) {
|
|
25942
25986
|
return (await this.getClient().send(new DescribeDBInstancesCommand$1({ DBInstanceIdentifier: dbInstanceIdentifier }))).DBInstances?.[0];
|
|
25943
25987
|
}
|
|
25988
|
+
async isSameResource(journaledPhysicalId, record, resourceType, context) {
|
|
25989
|
+
if (resourceType !== "AWS::DocDB::DBCluster" && resourceType !== "AWS::DocDB::DBInstance") return "unknown";
|
|
25990
|
+
if (!isDbIdentifier(journaledPhysicalId) || !isDbIdentifier(record.physicalId)) return "unknown";
|
|
25991
|
+
if (journaledPhysicalId.toLowerCase() === record.physicalId.toLowerCase()) return "same";
|
|
25992
|
+
if (await this.getClient().config.region() !== context.expectedRegion) return "unknown";
|
|
25993
|
+
const recordResourceId = await this.readDbResourceIdIfExists(resourceType, record.physicalId);
|
|
25994
|
+
if (recordResourceId === void 0) return "unknown";
|
|
25995
|
+
const journaledResourceId = await this.readDbResourceIdIfExists(resourceType, journaledPhysicalId);
|
|
25996
|
+
if (journaledResourceId === void 0) return "different";
|
|
25997
|
+
return journaledResourceId === recordResourceId ? "same" : "different";
|
|
25998
|
+
}
|
|
25999
|
+
async resourceIdentity(physicalId, resourceType, context) {
|
|
26000
|
+
if (resourceType !== "AWS::DocDB::DBCluster" && resourceType !== "AWS::DocDB::DBInstance") return;
|
|
26001
|
+
if (!isDbIdentifier(physicalId)) return void 0;
|
|
26002
|
+
if (await this.getClient().config.region() !== context.expectedRegion) return void 0;
|
|
26003
|
+
const live = await this.readDbResourceIdIfExists(resourceType, physicalId);
|
|
26004
|
+
return live === void 0 ? RESOURCE_NOT_FOUND : live;
|
|
26005
|
+
}
|
|
26006
|
+
async readDbResourceIdIfExists(resourceType, identifier) {
|
|
26007
|
+
const isCluster = resourceType === "AWS::DocDB::DBCluster";
|
|
26008
|
+
let found;
|
|
26009
|
+
try {
|
|
26010
|
+
if (isCluster) {
|
|
26011
|
+
const cluster = await this.describeDBCluster(identifier);
|
|
26012
|
+
found = cluster && {
|
|
26013
|
+
identifier: cluster.DBClusterIdentifier,
|
|
26014
|
+
engine: cluster.Engine,
|
|
26015
|
+
resourceId: cluster.DbClusterResourceId
|
|
26016
|
+
};
|
|
26017
|
+
} else {
|
|
26018
|
+
const instance = await this.describeDBInstance(identifier);
|
|
26019
|
+
found = instance && {
|
|
26020
|
+
identifier: instance.DBInstanceIdentifier,
|
|
26021
|
+
engine: instance.Engine,
|
|
26022
|
+
resourceId: instance.DbiResourceId
|
|
26023
|
+
};
|
|
26024
|
+
}
|
|
26025
|
+
} catch (error) {
|
|
26026
|
+
const notFound = isCluster ? "DBClusterNotFoundFault" : "DBInstanceNotFoundFault";
|
|
26027
|
+
if (error?.name === notFound) return void 0;
|
|
26028
|
+
throw error;
|
|
26029
|
+
}
|
|
26030
|
+
if (found === void 0) return void 0;
|
|
26031
|
+
const api = isCluster ? "DescribeDBClusters" : "DescribeDBInstances";
|
|
26032
|
+
if (found.identifier?.toLowerCase() !== identifier.toLowerCase()) throw new Error(`${api} answered for another identifier`);
|
|
26033
|
+
if (found.engine !== "docdb") throw new Error(`${api} answered with a resource of another engine`);
|
|
26034
|
+
if (typeof found.resourceId !== "string" || found.resourceId === "") throw new Error(`${api} returned no resource id`);
|
|
26035
|
+
return found.resourceId;
|
|
26036
|
+
}
|
|
25944
26037
|
async waitForClusterAvailable(dbClusterIdentifier, maxWaitMs = 18e5) {
|
|
25945
26038
|
const startTime = Date.now();
|
|
25946
26039
|
let delay = 5e3;
|
|
@@ -28068,17 +28161,20 @@ var CognitoUserPoolProvider = class {
|
|
|
28068
28161
|
if (properties["UserPoolTier"]) createParams.UserPoolTier = properties["UserPoolTier"];
|
|
28069
28162
|
const orphanWindow = createUserPoolLatch.take(logicalId);
|
|
28070
28163
|
if (orphanWindow !== void 0) await this.reportPossibleOrphanPools(logicalId, poolName, orphanWindow, createMaskedLogSinks(this.logger, context?.maskSecrets));
|
|
28071
|
-
let
|
|
28164
|
+
let created;
|
|
28072
28165
|
const attemptStartMs = Date.now();
|
|
28073
28166
|
try {
|
|
28074
|
-
|
|
28167
|
+
created = await this.getCreateClient().send(new CreateUserPoolCommand(createParams));
|
|
28075
28168
|
} catch (error) {
|
|
28076
28169
|
createUserPoolLatch.noteFailure(logicalId, error, attemptStartMs, orphanWindow);
|
|
28077
28170
|
throw error;
|
|
28078
28171
|
}
|
|
28172
|
+
const userPool = created.UserPool;
|
|
28079
28173
|
if (!userPool?.Id) throw new Error("CreateUserPool did not return UserPool.Id");
|
|
28080
28174
|
const userPoolId = userPool.Id;
|
|
28081
28175
|
createdUserPoolId = userPoolId;
|
|
28176
|
+
const replayWindow = replayedSendWindow(created, attemptStartMs);
|
|
28177
|
+
if (replayWindow !== void 0) await this.reportPossibleOrphanPools(logicalId, poolName, replayWindow, createMaskedLogSinks(this.logger, context?.maskSecrets), userPoolId);
|
|
28082
28178
|
const userPoolArn = userPool.Arn;
|
|
28083
28179
|
const region = await this.getClient().config.region();
|
|
28084
28180
|
const { urlSuffix } = derivePartitionAndUrlSuffix(region);
|
|
@@ -28125,10 +28221,12 @@ var CognitoUserPoolProvider = class {
|
|
|
28125
28221
|
}
|
|
28126
28222
|
return region ? aws` --region ${region}` : aws``;
|
|
28127
28223
|
}
|
|
28128
|
-
async reportPossibleOrphanPools(logicalId, poolName, window, log) {
|
|
28224
|
+
async reportPossibleOrphanPools(logicalId, poolName, window, log, returnedId) {
|
|
28129
28225
|
const { value: v } = log;
|
|
28130
28226
|
const since = new Date(window.floorMs).toISOString();
|
|
28131
28227
|
const until = new Date(window.ceilingMs).toISOString();
|
|
28228
|
+
const lead = ambiguousAttemptLead("CreateUserPool", logicalId, window);
|
|
28229
|
+
const replayed = window.replayedInSend === true;
|
|
28132
28230
|
const candidates = [];
|
|
28133
28231
|
let truncated = false;
|
|
28134
28232
|
try {
|
|
@@ -28139,7 +28237,7 @@ var CognitoUserPoolProvider = class {
|
|
|
28139
28237
|
MaxResults: 60,
|
|
28140
28238
|
...nextToken && { NextToken: nextToken }
|
|
28141
28239
|
}));
|
|
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);
|
|
28240
|
+
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
28241
|
nextToken = page.NextToken;
|
|
28144
28242
|
pages++;
|
|
28145
28243
|
} while (nextToken && pages < MAX_USER_POOL_LIST_PAGES);
|
|
@@ -28147,12 +28245,12 @@ var CognitoUserPoolProvider = class {
|
|
|
28147
28245
|
} catch (error) {
|
|
28148
28246
|
const failure = describeAwsFailure(error);
|
|
28149
28247
|
log.debug(`ListUserPools failed with: ${v(failure.detail)}`);
|
|
28150
|
-
log.warn(
|
|
28248
|
+
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
28249
|
return;
|
|
28152
28250
|
}
|
|
28153
28251
|
const incomplete = truncated ? ` The search was incomplete: the pool list was cut at ${MAX_USER_POOL_LIST_PAGES} pages.` : "";
|
|
28154
28252
|
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}`;
|
|
28253
|
+
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
28254
|
if (truncated) log.warn(line);
|
|
28157
28255
|
else log.debug(line);
|
|
28158
28256
|
return;
|
|
@@ -28162,7 +28260,7 @@ var CognitoUserPoolProvider = class {
|
|
|
28162
28260
|
const region = await this.regionArg(aws);
|
|
28163
28261
|
const inspect = shown.map((id) => aws`aws cognito-idp describe-user-pool --user-pool-id ${id}${region}`.render()).join(" ; ");
|
|
28164
28262
|
const deletion = shown.map((id) => aws`aws cognito-idp delete-user-pool --user-pool-id ${id}${region}`.render()).join(" ; ");
|
|
28165
|
-
log.warn(
|
|
28263
|
+
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
28264
|
}
|
|
28167
28265
|
async applyMfaConfig(physicalId, properties, declaredMfaConfiguration, options = {}) {
|
|
28168
28266
|
const request = buildMfaConfigRequest(physicalId, properties, this.logger, declaredMfaConfiguration, options.maskSecrets ?? ((text) => text));
|
|
@@ -30887,6 +30985,8 @@ var AppSyncProvider = class {
|
|
|
30887
30985
|
}
|
|
30888
30986
|
createdApiId = response.graphqlApi?.apiId;
|
|
30889
30987
|
const apiId = response.graphqlApi.apiId;
|
|
30988
|
+
const replayWindow = replayedSendWindow(response, attemptStartMs);
|
|
30989
|
+
if (replayWindow !== void 0) await this.reportPossibleOrphanApis(logicalId, input, replayWindow, maskerOrIdentity(context?.maskSecrets), apiId);
|
|
30890
30990
|
const arn = response.graphqlApi.arn;
|
|
30891
30991
|
const graphQLUrl = response.graphqlApi.uris?.["GRAPHQL"];
|
|
30892
30992
|
const envRecord = await this.applyEnvironmentVariables(apiId, resourceType, logicalId, properties, void 0, context?.replayingState === true, maskerOrIdentity(context?.maskSecrets));
|
|
@@ -30928,8 +31028,10 @@ var AppSyncProvider = class {
|
|
|
30928
31028
|
}
|
|
30929
31029
|
return region ? aws` --region ${region}` : aws``;
|
|
30930
31030
|
}
|
|
30931
|
-
async reportPossibleOrphanApis(logicalId, input, window, mask) {
|
|
31031
|
+
async reportPossibleOrphanApis(logicalId, input, window, mask, returnedId) {
|
|
30932
31032
|
const since = new Date(window.floorMs).toISOString();
|
|
31033
|
+
const lead = ambiguousAttemptLead("CreateGraphqlApi", logicalId, window);
|
|
31034
|
+
const replayed = window.replayedInSend === true;
|
|
30933
31035
|
const name = mask(String(input.name));
|
|
30934
31036
|
const wantedType = input.apiType ?? "GRAPHQL";
|
|
30935
31037
|
const candidates = [];
|
|
@@ -30942,7 +31044,7 @@ var AppSyncProvider = class {
|
|
|
30942
31044
|
maxResults: 25,
|
|
30943
31045
|
...nextToken && { nextToken }
|
|
30944
31046
|
}));
|
|
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);
|
|
31047
|
+
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
31048
|
nextToken = page.nextToken;
|
|
30947
31049
|
pages++;
|
|
30948
31050
|
} while (nextToken && pages < MAX_GRAPHQL_API_LIST_PAGES);
|
|
@@ -30950,12 +31052,12 @@ var AppSyncProvider = class {
|
|
|
30950
31052
|
} catch (error) {
|
|
30951
31053
|
const failure = describeAwsFailure(error);
|
|
30952
31054
|
this.logger.debug(mask(`ListGraphqlApis failed with: ${failure.detail}`));
|
|
30953
|
-
this.logger.warn(mask(
|
|
31055
|
+
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
31056
|
return;
|
|
30955
31057
|
}
|
|
30956
31058
|
const incomplete = truncated ? ` The search was incomplete: the API list was cut at ${MAX_GRAPHQL_API_LIST_PAGES} pages.` : "";
|
|
30957
31059
|
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}`);
|
|
31060
|
+
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
31061
|
if (truncated) this.logger.warn(line);
|
|
30960
31062
|
else this.logger.debug(line);
|
|
30961
31063
|
return;
|
|
@@ -30963,7 +31065,7 @@ var AppSyncProvider = class {
|
|
|
30963
31065
|
const shown = candidates.slice(0, MAX_REPORTED_ORPHAN_APIS);
|
|
30964
31066
|
const aws = pasteableAwsCommand(mask);
|
|
30965
31067
|
const region = await this.regionArg(aws);
|
|
30966
|
-
this.logger.warn(mask(
|
|
31068
|
+
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
31069
|
}
|
|
30968
31070
|
async deleteGraphQLApi(logicalId, physicalId, resourceType, context) {
|
|
30969
31071
|
this.logger.debug(`Deleting GraphQL API ${logicalId}: ${physicalId}`);
|
|
@@ -31164,6 +31266,8 @@ var AppSyncProvider = class {
|
|
|
31164
31266
|
}
|
|
31165
31267
|
apiKeyId = response.apiKey.id;
|
|
31166
31268
|
apiKeysCreatedByThisProcess.add(injectiveKey(apiId, apiKeyId));
|
|
31269
|
+
const replayWindow = replayedSendWindow(response, attemptStartMs);
|
|
31270
|
+
if (replayWindow !== void 0) await this.reportPossibleOrphanApiKeys(logicalId, input, replayWindow, createMaskedLogSinks(this.logger, context?.maskSecrets));
|
|
31167
31271
|
this.logger.debug(`Successfully created ApiKey ${logicalId}: ${apiKeyId}`);
|
|
31168
31272
|
} catch (error) {
|
|
31169
31273
|
const cause = error instanceof Error ? error : void 0;
|
|
@@ -33836,6 +33940,9 @@ var KMSProvider = class {
|
|
|
33836
33940
|
inputDigest,
|
|
33837
33941
|
heldAtMs: Date.now()
|
|
33838
33942
|
});
|
|
33943
|
+
createdKeyId = keyId;
|
|
33944
|
+
const replayWindow = replayedSendWindow(result, attemptStartMs);
|
|
33945
|
+
if (replayWindow !== void 0) await this.reportPossibleOrphanKeys(logicalId, input, replayWindow);
|
|
33839
33946
|
}
|
|
33840
33947
|
createdKeyId = keyId;
|
|
33841
33948
|
if (enableKeyRotation) {
|
|
@@ -33917,6 +34024,7 @@ var KMSProvider = class {
|
|
|
33917
34024
|
async reportPossibleOrphanKeys(logicalId, input, window) {
|
|
33918
34025
|
const since = new Date(window.floorMs).toISOString();
|
|
33919
34026
|
const until = new Date(window.ceilingMs).toISOString();
|
|
34027
|
+
const lead = ambiguousAttemptLead("CreateKey", logicalId, window);
|
|
33920
34028
|
const pendingIds = new Set([...pendingKeys.values()].map((entry) => entry.keyId));
|
|
33921
34029
|
const ids = [];
|
|
33922
34030
|
let listTruncated = false;
|
|
@@ -33936,7 +34044,7 @@ var KMSProvider = class {
|
|
|
33936
34044
|
} catch (error) {
|
|
33937
34045
|
const failure = describeAwsFailure(error);
|
|
33938
34046
|
this.logger.debug(safeMsg`ListKeys failed with: ${failure.detail}`);
|
|
33939
|
-
this.logger.warn(safeMsg
|
|
34047
|
+
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
34048
|
return;
|
|
33941
34049
|
}
|
|
33942
34050
|
const describable = ids.slice(-200).reverse();
|
|
@@ -33968,7 +34076,7 @@ var KMSProvider = class {
|
|
|
33968
34076
|
];
|
|
33969
34077
|
const incomplete = gaps.length > 0 ? ` The search was incomplete: ${gaps.join(", ")}.` : "";
|
|
33970
34078
|
if (candidates.length === 0) {
|
|
33971
|
-
const line = safeMsg
|
|
34079
|
+
const line = safeMsg`${lead}; no listed customer managed key matching it was created between ${since} and ${until}.${incomplete}`;
|
|
33972
34080
|
if (incomplete) this.logger.warn(line);
|
|
33973
34081
|
else this.logger.debug(line);
|
|
33974
34082
|
return;
|
|
@@ -33978,7 +34086,7 @@ var KMSProvider = class {
|
|
|
33978
34086
|
const shown = candidates.slice(0, MAX_REPORTED_ORPHANS);
|
|
33979
34087
|
const inspect = shown.map((keyId) => aws`aws kms describe-key --key-id ${keyId}${region}`.render()).join(" ; ");
|
|
33980
34088
|
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
|
|
34089
|
+
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
34090
|
}
|
|
33983
34091
|
async updateKey(logicalId, physicalId, resourceType, properties, previousProperties) {
|
|
33984
34092
|
this.logger.debug(`Updating KMS Key ${logicalId}: ${physicalId}`);
|
|
@@ -38417,14 +38525,13 @@ var EMRClusterProvider = class {
|
|
|
38417
38525
|
})),
|
|
38418
38526
|
Instances: this.toJobFlowInstancesConfig(properties["Instances"])
|
|
38419
38527
|
};
|
|
38420
|
-
const
|
|
38421
|
-
if (orphanWindow !== void 0) {
|
|
38528
|
+
const reportOrphans = async (lookupWindow) => {
|
|
38422
38529
|
const log = createMaskedLogSinks(this.logger, context?.maskSecrets);
|
|
38423
38530
|
const aws = pasteableAwsCommand(log.mask);
|
|
38424
38531
|
const regionArg = await orphanCommandRegionArg(this.getClient(), aws);
|
|
38425
38532
|
const name = input.Name;
|
|
38426
38533
|
const protectedCluster = input.Instances?.TerminationProtected === true;
|
|
38427
|
-
await reportPossibleOrphans(logicalId,
|
|
38534
|
+
await reportPossibleOrphans(logicalId, lookupWindow, log, {
|
|
38428
38535
|
action: "RunJobFlow",
|
|
38429
38536
|
service: "EMR",
|
|
38430
38537
|
listAction: "ListClusters",
|
|
@@ -38432,8 +38539,8 @@ var EMRClusterProvider = class {
|
|
|
38432
38539
|
noun: "cluster(s)",
|
|
38433
38540
|
list: () => collectOrphanIds(async (marker) => {
|
|
38434
38541
|
const page = await this.getClient().send(new ListClustersCommand({
|
|
38435
|
-
CreatedAfter: new Date(
|
|
38436
|
-
CreatedBefore: new Date(
|
|
38542
|
+
CreatedAfter: new Date(lookupWindow.floorMs),
|
|
38543
|
+
CreatedBefore: new Date(lookupWindow.ceilingMs),
|
|
38437
38544
|
ClusterStates: LIVE_CLUSTER_STATES,
|
|
38438
38545
|
...marker && { Marker: marker }
|
|
38439
38546
|
}));
|
|
@@ -38441,12 +38548,14 @@ var EMRClusterProvider = class {
|
|
|
38441
38548
|
items: page.Clusters ?? [],
|
|
38442
38549
|
next: page.Marker
|
|
38443
38550
|
};
|
|
38444
|
-
}, (c) => c.Id && c.Name === name && isInsideWindow(c.Status?.Timeline?.CreationDateTime,
|
|
38551
|
+
}, (c) => c.Id && c.Name === name && isInsideWindow(c.Status?.Timeline?.CreationDateTime, lookupWindow) && !clustersCreatedByThisProcess.has(c.Id) ? c.Id : void 0),
|
|
38445
38552
|
inspect: (id) => aws`aws emr describe-cluster --cluster-id ${id}${regionArg}`.render(),
|
|
38446
38553
|
remove: (id) => aws`aws emr terminate-clusters --cluster-ids ${id}${regionArg}`.render(),
|
|
38447
38554
|
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
38555
|
});
|
|
38449
|
-
}
|
|
38556
|
+
};
|
|
38557
|
+
const orphanWindow = runJobFlowLatch.take(logicalId);
|
|
38558
|
+
if (orphanWindow !== void 0) await reportOrphans(orphanWindow);
|
|
38450
38559
|
const attemptStartMs = Date.now();
|
|
38451
38560
|
let response;
|
|
38452
38561
|
try {
|
|
@@ -38457,6 +38566,8 @@ var EMRClusterProvider = class {
|
|
|
38457
38566
|
}
|
|
38458
38567
|
clusterId = response.JobFlowId;
|
|
38459
38568
|
if (clusterId) clustersCreatedByThisProcess.add(clusterId);
|
|
38569
|
+
const replayWindow = replayedSendWindow(response, attemptStartMs);
|
|
38570
|
+
if (replayWindow !== void 0) await reportOrphans(replayWindow);
|
|
38460
38571
|
if (!clusterId) throw new ProvisioningError(`EMR RunJobFlow for ${logicalId} returned no JobFlowId`, resourceType, logicalId);
|
|
38461
38572
|
const cluster = await this.waitForClusterReady(clusterId, logicalId, resourceType);
|
|
38462
38573
|
this.logger.debug(`Successfully created EMR Cluster ${logicalId}: ${clusterId}`);
|
|
@@ -39098,13 +39209,12 @@ var EMRInstanceGroupConfigProvider = class {
|
|
|
39098
39209
|
let createdGroupId;
|
|
39099
39210
|
try {
|
|
39100
39211
|
const group = this.toInstanceGroupConfig(properties);
|
|
39101
|
-
const
|
|
39102
|
-
if (orphanWindow !== void 0 && group.InstanceRole === "TASK") {
|
|
39212
|
+
const reportOrphans = async (lookupWindow) => {
|
|
39103
39213
|
const log = createMaskedLogSinks(this.logger, context?.maskSecrets);
|
|
39104
39214
|
const aws = pasteableAwsCommand(log.mask);
|
|
39105
39215
|
const regionArg = await orphanCommandRegionArg(this.getClient(), aws);
|
|
39106
39216
|
const name = group.Name;
|
|
39107
|
-
await reportPossibleOrphans(logicalId,
|
|
39217
|
+
await reportPossibleOrphans(logicalId, lookupWindow, log, {
|
|
39108
39218
|
action: "AddInstanceGroups",
|
|
39109
39219
|
service: "EMR",
|
|
39110
39220
|
listAction: "ListInstanceGroups",
|
|
@@ -39119,12 +39229,14 @@ var EMRInstanceGroupConfigProvider = class {
|
|
|
39119
39229
|
items: page.InstanceGroups ?? [],
|
|
39120
39230
|
next: page.Marker
|
|
39121
39231
|
};
|
|
39122
|
-
}, (item) => item.Id && item.InstanceGroupType === "TASK" && (name === void 0 || item.Name === name) && isInsideWindow(item.Status?.Timeline?.CreationDateTime,
|
|
39232
|
+
}, (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
39233
|
inspect: () => aws`aws emr list-instance-groups --cluster-id ${jobFlowId}${regionArg}`.render(),
|
|
39124
39234
|
remove: (id) => aws`aws emr modify-instance-groups --cluster-id ${jobFlowId} --instance-groups InstanceGroupId=${id},InstanceCount=0${regionArg}`.render(),
|
|
39125
39235
|
removeVerb: "scale it to zero, which releases its instances (EMR has no call that removes an instance group; it ends with its cluster)"
|
|
39126
39236
|
});
|
|
39127
|
-
}
|
|
39237
|
+
};
|
|
39238
|
+
const orphanWindow = addInstanceGroupsLatch.take(logicalId);
|
|
39239
|
+
if (orphanWindow !== void 0 && group.InstanceRole === "TASK") await reportOrphans(orphanWindow);
|
|
39128
39240
|
const attemptStartMs = Date.now();
|
|
39129
39241
|
let response;
|
|
39130
39242
|
try {
|
|
@@ -39139,6 +39251,8 @@ var EMRInstanceGroupConfigProvider = class {
|
|
|
39139
39251
|
const groupId = response.InstanceGroupIds?.[0];
|
|
39140
39252
|
if (groupId) groupsCreatedByThisProcess.add(groupId);
|
|
39141
39253
|
createdGroupId = groupId;
|
|
39254
|
+
const replayWindow = replayedSendWindow(response, attemptStartMs);
|
|
39255
|
+
if (replayWindow !== void 0 && group.InstanceRole === "TASK") await reportOrphans(replayWindow);
|
|
39142
39256
|
if (!groupId) throw new ProvisioningError(`EMR AddInstanceGroups for ${logicalId} returned no instance group id`, resourceType, logicalId);
|
|
39143
39257
|
await this.waitForGroupReady(jobFlowId, groupId, logicalId, resourceType, toNumber$1(properties["InstanceCount"]) ?? 0);
|
|
39144
39258
|
this.logger.debug(`Successfully added EMR instance group ${logicalId}: ${groupId}`);
|
|
@@ -39394,13 +39508,12 @@ var EMRInstanceFleetConfigProvider = class {
|
|
|
39394
39508
|
let createdFleetId;
|
|
39395
39509
|
try {
|
|
39396
39510
|
const fleet = this.toInstanceFleetConfig(properties);
|
|
39397
|
-
const
|
|
39398
|
-
if (orphanWindow !== void 0 && fleet.InstanceFleetType === "TASK") {
|
|
39511
|
+
const reportOrphans = async (lookupWindow) => {
|
|
39399
39512
|
const log = createMaskedLogSinks(this.logger, context?.maskSecrets);
|
|
39400
39513
|
const aws = pasteableAwsCommand(log.mask);
|
|
39401
39514
|
const regionArg = await orphanCommandRegionArg(this.getClient(), aws);
|
|
39402
39515
|
const name = fleet.Name;
|
|
39403
|
-
await reportPossibleOrphans(logicalId,
|
|
39516
|
+
await reportPossibleOrphans(logicalId, lookupWindow, log, {
|
|
39404
39517
|
action: "AddInstanceFleet",
|
|
39405
39518
|
service: "EMR",
|
|
39406
39519
|
listAction: "ListInstanceFleets",
|
|
@@ -39415,12 +39528,14 @@ var EMRInstanceFleetConfigProvider = class {
|
|
|
39415
39528
|
items: page.InstanceFleets ?? [],
|
|
39416
39529
|
next: page.Marker
|
|
39417
39530
|
};
|
|
39418
|
-
}, (item) => item.Id && item.InstanceFleetType === "TASK" && (name === void 0 || item.Name === name) && isInsideWindow(item.Status?.Timeline?.CreationDateTime,
|
|
39531
|
+
}, (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
39532
|
inspect: () => aws`aws emr list-instance-fleets --cluster-id ${clusterId}${regionArg}`.render(),
|
|
39420
39533
|
remove: (id) => aws`aws emr modify-instance-fleet --cluster-id ${clusterId} --instance-fleet InstanceFleetId=${id},TargetOnDemandCapacity=0,TargetSpotCapacity=0${regionArg}`.render(),
|
|
39421
39534
|
removeVerb: "scale it to zero, which releases its instances (EMR has no call that removes an instance fleet; it ends with its cluster)"
|
|
39422
39535
|
});
|
|
39423
|
-
}
|
|
39536
|
+
};
|
|
39537
|
+
const orphanWindow = addInstanceFleetLatch.take(logicalId);
|
|
39538
|
+
if (orphanWindow !== void 0 && fleet.InstanceFleetType === "TASK") await reportOrphans(orphanWindow);
|
|
39424
39539
|
const attemptStartMs = Date.now();
|
|
39425
39540
|
let response;
|
|
39426
39541
|
try {
|
|
@@ -39435,6 +39550,8 @@ var EMRInstanceFleetConfigProvider = class {
|
|
|
39435
39550
|
const fleetId = response.InstanceFleetId;
|
|
39436
39551
|
if (fleetId) fleetsCreatedByThisProcess.add(fleetId);
|
|
39437
39552
|
createdFleetId = fleetId;
|
|
39553
|
+
const replayWindow = replayedSendWindow(response, attemptStartMs);
|
|
39554
|
+
if (replayWindow !== void 0 && fleet.InstanceFleetType === "TASK") await reportOrphans(replayWindow);
|
|
39438
39555
|
if (!fleetId) throw new ProvisioningError(`EMR AddInstanceFleet for ${logicalId} returned no instance fleet id`, resourceType, logicalId);
|
|
39439
39556
|
await this.waitForFleetReady(clusterId, fleetId, logicalId, resourceType, this.targetCapacities(properties), {
|
|
39440
39557
|
onDemand: 0,
|
|
@@ -41943,6 +42060,8 @@ var DLMLifecyclePolicyProvider = class {
|
|
|
41943
42060
|
}
|
|
41944
42061
|
if (!response.PolicyId) throw new Error("CreateLifecyclePolicy did not return a PolicyId");
|
|
41945
42062
|
policiesCreatedByThisProcess.add(response.PolicyId);
|
|
42063
|
+
const replayWindow = replayedSendWindow(response, attemptStartMs);
|
|
42064
|
+
if (replayWindow !== void 0) await this.reportPossibleOrphanPolicies(logicalId, input, replayWindow, log);
|
|
41946
42065
|
let arn = "";
|
|
41947
42066
|
try {
|
|
41948
42067
|
arn = await this.fetchPolicyArn(response.PolicyId);
|
|
@@ -44223,4 +44342,4 @@ var ACMCertificateProvider = class {
|
|
|
44223
44342
|
|
|
44224
44343
|
//#endregion
|
|
44225
44344
|
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-
|
|
44345
|
+
//# sourceMappingURL=provider-classes-Drnm0GAz.js.map
|