@go-to-k/cdkd 0.300.2 → 0.301.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{asg-provider-DJdNNqDe.js → asg-provider-CK2nZE6B.js} +2 -2
- package/dist/{asg-provider-DJdNNqDe.js.map → asg-provider-CK2nZE6B.js.map} +1 -1
- package/dist/aws-failure-text-BEQfs6za.js.map +1 -1
- package/dist/cli.js +2 -2
- package/dist/{deploy-engine-DOBzE5TD.js → deploy-engine-DEvS2r2M.js} +1238 -765
- package/dist/deploy-engine-DEvS2r2M.js.map +1 -0
- package/dist/{iam-role-provider-C8gNXG1G.js → iam-role-provider-s7oQ_V1d.js} +3 -9
- package/dist/iam-role-provider-s7oQ_V1d.js.map +1 -0
- package/dist/index.d.ts +25 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/{neptune-provider-UDy6HC5O.js → neptune-provider-BWESr5fm.js} +2 -2
- package/dist/{neptune-provider-UDy6HC5O.js.map → neptune-provider-BWESr5fm.js.map} +1 -1
- package/dist/{program-BDm58Wc8.js → program-C_kDHyxY.js} +107 -82
- package/dist/program-C_kDHyxY.js.map +1 -0
- package/dist/{provider-classes-DzoIZFZK.js → provider-classes-C1xbZd9k.js} +141 -94
- package/dist/provider-classes-C1xbZd9k.js.map +1 -0
- package/dist/{rds-provider-C-lGTdAb.js → rds-provider-BfwQbYRR.js} +2 -2
- package/dist/{rds-provider-C-lGTdAb.js.map → rds-provider-BfwQbYRR.js.map} +1 -1
- package/dist/{version-CZbKGFSS.js → version-BdWNHoO2.js} +2 -2
- package/dist/{version-CZbKGFSS.js.map → version-BdWNHoO2.js.map} +1 -1
- package/package.json +2 -2
- package/dist/deploy-engine-DOBzE5TD.js.map +0 -1
- package/dist/iam-role-provider-C8gNXG1G.js.map +0 -1
- package/dist/program-BDm58Wc8.js.map +0 -1
- package/dist/provider-classes-DzoIZFZK.js.map +0 -1
|
@@ -2,12 +2,12 @@ import { r as getAwsClients } from "./aws-clients-B_CEQGE1.js";
|
|
|
2
2
|
import { B as safeMsg, F as displaySafe, I as displayStackName, L as isPasteableIdent, O as SECRET_REF_MAX_CODE_POINTS, P as displayIdent, a as getLogger, b as generateResourceNameWithFallback, n as isAwsAuthoredFailure, r as safeStringify, t as describeAwsFailure, y as generateResourceName, z as plainIdentOr } from "./aws-failure-text-BEQfs6za.js";
|
|
3
3
|
import { $ as protectedReplacementAdvice, $n as explicitDenyPolicyKind, $t as ambientCredentialConfig, A as isQuotableImportValue, B as isTerminalDeleteFailure, C as setBounded, D as VALUE_NOT_SHOWN, E as assertRegionMatch, F as resolveExplicitPhysicalId, Fn as isInertUnquoted, H as observeThenDisableProtection, Hn as withheldTargetClause, In as pasteableCommand, Kt as injectiveKey, L as ProtectionFlipRegistry, M as quotedRemedyLogicalId, Mt as markCreatedBeforeFailure, N as refusalTypeShown, Nn as commandHole, Nt as markSupersedesEarlierCreate, O as isPlainImportJson, P as remedyLogicalId, Pn as hasClauseBreak, Q as pasteableAwsCommand, Qn as markReplayMayCollide, Qt as ambientClientDefaults, Rn as plainOrDescribed, S as replayedSendWindow, St as withDerivedNameMasks, T as RESOURCE_NOT_FOUND, Tt as clearCreatedBeforeFailure, U as protectionFlipKey, V as logGroupProtectionSite, Vn as shellQuote, W as rdsFamilyProtectionSite, X as WITHHELD_AWS_COMMAND, Y as UNNAMEABLE_ID_CLAUSE, Z as isAwsCliLiteral, Zn as markNameCollision, Zt as withPasteableAwsProfile, _ as RecentIdSet, _t as createMaskedLogSinks, a as onlySecretDerived, ar as isRetryableTransientError, at as startInterruptWatch, b as isInsideWindow, bn as ResourceUpdateNotSupportedError, bt as maskDeep, c as recordedPrincipalsRepair, cr as THROTTLING_ERROR_NAMES, ct as canonicalizeRoute53QueryName, dr as markNonRetryable, dt as compositeIdSkipResult, en as clientDefaultsFor, et as renderDisableCommand, fr as markRedactedCause, ft as logicalIdShown, g as AmbiguousCreateLatch, gt as stateOrphanRecordRemedy, h as AMBIGUOUS_LATCH_TTL_MS, ht as segmentAfterAnchor, i as holdsSecretDerivedEntry, in as CdkdError, it as isInterruptedWaitError, j as normalizeAwsTagsToCfn, jt as markAuxiliaryFailure, k as isPlainImportValue, lr as isMarkedNonRetryable, lt as compositeIdFormatMessage, nn as AccountIdUnavailableError, nr as isAmbiguousOutcomeError, o as readPrincipalLists, or as isTransientServerError, ot as ElapsedBudgetRegistry, p as withRemovalDefaults, pr as wrapMaskedAwsError, pt as packCompositeId, q as userPoolProtectionSite, qt as injectiveKeyPrefix, r as SECRET_DERIVED_READ_LIVE, rr as isExplicitDenyError, tn as credentialFingerprint, u as clearOnUpdateRemoval, ur as isThrottlingError, ut as compositeIdSeparatorRefusal, v as ambiguousAttemptLead, vn as ProvisioningError, vt as createMaskedRetryLogger, w as withoutServerErrorRetries, x as replayFollowedAmbiguousAttempt, xt as maskerOrIdentity, y as createAttemptKey, yt as isSecretDerivedValue, z as deleteWithProtectionCompensation } from "./iam-policy-targets-DFk7zr0Q.js";
|
|
4
4
|
import { s as ambientRegion } from "./aws-client-defaults-DBXBcg0J.js";
|
|
5
|
-
import { $ as S3_AUTO_DELETE_OBJECTS_TAG,
|
|
6
|
-
import { n as collectInlinePolicyNamesManagedBySiblings, r as IamCreateClientCache, t as IAMRoleProvider } from "./iam-role-provider-
|
|
7
|
-
import { a as resolveSecretDerivedPrincipals, i as isResolvableSecretPrincipalList, n as runDestroyForStack, o as canonicalizeIpProtocolValue, r as holdsUnprovenSecretPrincipalToken, s as resolvedResourceTimeoutMs, 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 { $ as S3_AUTO_DELETE_OBJECTS_TAG, Bl as renderAssemblyPathEscape, Br as deleteSkipReason, C as withApiLimit, Co as configIntegerRefusal, Dl as canonicalizeRegion, Do as requireConfigArray, Ds as recoverMaskedOutput, Eo as replayWarn, Fo as lambdaFunctionNameForMask, Fr as unchangedBehindSecretReference, G as deleteBudgetKey, Gr as ec2InstanceProtectionSite, Gt as awaitInFlightSibling, H as DYNAMODB_DELETE_MIN_RESOURCE_TIMEOUT_MS, Hi as passedParameterClassesOf, Hr as isWaitAbandonedError, Ht as withNestedStackContext, Io as sameLambdaFunctionAddress, J as DELETE_INDEX_WAIT_PROCEED_NOTE, Jo as passedNoEchoParametersOf, Jr as reDisableInstanceApiTermination, K as resolveDynamoDbDeleteBudgetClock, Kr as isTerminationProtectionPropagationError, Lt as revertNestedChildFromJournal, Ms as carriesSecretMask, No as withRetry, Ol as derivePartitionAndUrlSuffix, Oo as requireConfigObject, Or as getCurrentResourceSecrets, Os as physicalNameCopiesOf, Po as canonicalLambdaFunctionName, Pr as slowCcOperationTimeoutMs, Pt as getNestedRevertRun, Q as ECR_AUTO_DELETE_IMAGES_TAG, Rl as describeFileReadFailure, S as lookupEachName, Sc as rewriteTemplateAssetReferences, So as configBooleanRefusal, To as readConfigString, U as beginDeleteWait, Ur as markWaitAbandoned, V as DynamoDBGlobalTableProvider, Vl as resolveAssemblyPath, Vr as withIndeterminateGuard, Vt as getCurrentNestedStackContext, W as compensateRemovedDeletionProtection, Wa as refuseMalformedResourcesForDestroy, X as deleteTableWithIndexBusyRetry, Xt as replacedDeleteFailureVerdict, Y as INDEX_SETTLE_POLL_INTERVAL_MS, Yi as accountArgs, Yr as reEnableInstanceApiTermination, Z as waitForIndexesSettled, _c as stringifyValue, _i as s3BucketArn, _o as isWarmThroughputDecrease, _r as tagPlanWarning, b as chunks, bi as s3BucketRegionalDomainName, bo as coerceCfnBoolean, c as isAbsoluteAssetPath, cr as acquireIdempotencyToken, dn as REDACTED_DELETE_ADDRESS_SKIP_REASON, dr as DBPROXY_TAGS_WHAT, et as hasCdkAutoDeleteTag, fi as isSettledInstanceState, fn as isRedactedRecordedValue, fr as DBPROXY_TAG_OPTIONS, go as coerceWarmThroughput$1, gr as tagMapAsList, gs as redactSecretsForState, ho as WARM_THROUGHPUT_MEMBERS, hr as refuseMalformedDesiredTags, hs as snapshotPassProvenance, io as findSilentDropProperties, ir as earliestDefined, ki as getAccountInfo, ko as requireConfigString, ks as recordAttributeIdCopy, l as listNestedTemplateRows, ln as getCurrentProducerRegions, lr as isRefusedByName, mi as outputReferenceProvenanceOf, mn as redactedDeleteAddressSkip, mr as readTagList, ms as recordReferenceProvenanceEntry, no as withheldAccountClause, nt as getPriorAttempts, oo as withoutSilentDropProperties, or as reserveStackCreateToken, pn as redactedDeleteAddressFields, pr as planTagDiff, ps as markSameGenerationBag, q as resolveDynamoDbDeleteBudgetMs, qr as observeThenDisableInstanceApiTermination, qt as getStackRecords, rt as markRefusedBeforeApplying, s as findNestedTemplateTreeDefect, t as DeployEngine, ts as hasMaskableValues, tt as isTruthyCfnBoolean, u as renderNestedTemplateTreeDefect, ur as markDeleteStarted, vi as s3BucketDomainName, vo as toCfnInteger, vr as definedAttributes, wa as refuseMalformedNestedChildOutputs, wl as decodeListingKey, wo as configStringRefusal, x as isAccessDeniedError, xi as s3BucketWebsiteUrl, xo as coerceCfnInteger, xs as dynamicReferenceTokens, yi as s3BucketDualStackDomainName, yo as toFiniteNumber, yr as stringifyIfAssigned, ys as withoutPhysicalNameCopies, zi as parseWebACLArn, zl as displayAssemblyPath } from "./deploy-engine-DEvS2r2M.js";
|
|
6
|
+
import { n as collectInlinePolicyNamesManagedBySiblings, r as IamCreateClientCache, t as IAMRoleProvider } from "./iam-role-provider-s7oQ_V1d.js";
|
|
7
|
+
import { a as resolveSecretDerivedPrincipals, i as isResolvableSecretPrincipalList, n as runDestroyForStack, o as canonicalizeIpProtocolValue, r as holdsUnprovenSecretPrincipalToken, s as resolvedResourceTimeoutMs, t as canonicalizeIpv4Cidr } from "./program-C_kDHyxY.js";
|
|
8
|
+
import { RDSProvider } from "./rds-provider-BfwQbYRR.js";
|
|
9
|
+
import { NeptuneProvider } from "./neptune-provider-BWESr5fm.js";
|
|
10
|
+
import { ASGProvider } from "./asg-provider-CK2nZE6B.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, ListBucketsCommand, 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";
|
|
@@ -4827,7 +4827,7 @@ var S3BucketProvider = class S3BucketProvider {
|
|
|
4827
4827
|
out = canonicalizeBlock(out, "LifecycleConfiguration", effectiveLifecycleConfiguration);
|
|
4828
4828
|
return out;
|
|
4829
4829
|
}
|
|
4830
|
-
async readCurrentState(physicalId,
|
|
4830
|
+
async readCurrentState(physicalId, logicalId, _resourceType, _properties, context) {
|
|
4831
4831
|
const headAttempts = context?.afterOwnWrite === true ? OWN_WRITE_HEAD_ATTEMPTS : 1;
|
|
4832
4832
|
for (let attempt = 1;; attempt++) try {
|
|
4833
4833
|
await this.s3Client.send(new HeadBucketCommand({ Bucket: physicalId }));
|
|
@@ -4839,6 +4839,7 @@ var S3BucketProvider = class S3BucketProvider {
|
|
|
4839
4839
|
await new Promise((r) => setTimeout(r, OWN_WRITE_HEAD_DELAY_MS));
|
|
4840
4840
|
continue;
|
|
4841
4841
|
}
|
|
4842
|
+
if (headAttempts > 1) this.logger.debug(safeMsg`HeadBucket still answered 404 after ${String(headAttempts)} attempts right after cdkd's own write; ` + safeMsg`no observed baseline is captured for ${displaySafe(logicalId)}`);
|
|
4842
4843
|
return RESOURCE_NOT_FOUND;
|
|
4843
4844
|
}
|
|
4844
4845
|
throw err;
|
|
@@ -14699,7 +14700,6 @@ var SSMParameterProvider = class SSMParameterProvider {
|
|
|
14699
14700
|
}
|
|
14700
14701
|
async create(logicalId, resourceType, properties, context) {
|
|
14701
14702
|
const mask = maskerOrIdentity(context?.maskSecrets);
|
|
14702
|
-
const warn = (message) => this.logger.warn(mask(message));
|
|
14703
14703
|
const ssmTags = SSMParameterProvider.desiredSsmTags(properties["Tags"], resourceType, logicalId);
|
|
14704
14704
|
const debug = (message) => this.logger.debug(mask(message));
|
|
14705
14705
|
debug(`Creating SSM parameter ${displaySafe(logicalId)}`);
|
|
@@ -14710,7 +14710,6 @@ var SSMParameterProvider = class SSMParameterProvider {
|
|
|
14710
14710
|
const type = properties["Type"] || "String";
|
|
14711
14711
|
const value = properties["Value"];
|
|
14712
14712
|
if (!value) throw new ProvisioningError(`Value is required for SSM parameter ${displaySafe(logicalId)}`, resourceType, logicalId);
|
|
14713
|
-
let leftBehind = false;
|
|
14714
14713
|
try {
|
|
14715
14714
|
const putParams = {
|
|
14716
14715
|
Name: name,
|
|
@@ -14724,30 +14723,8 @@ var SSMParameterProvider = class SSMParameterProvider {
|
|
|
14724
14723
|
const policies = ssmPoliciesParameter(properties["Policies"]);
|
|
14725
14724
|
if (policies !== void 0) putParams.Policies = policies;
|
|
14726
14725
|
if (properties["DataType"]) putParams.DataType = properties["DataType"];
|
|
14726
|
+
if (ssmTags.length > 0) putParams.Tags = ssmTags;
|
|
14727
14727
|
await (await this.getCreateClient()).send(new PutParameterCommand(putParams));
|
|
14728
|
-
leftBehind = true;
|
|
14729
|
-
try {
|
|
14730
|
-
if (ssmTags.length > 0) await this.ssmClient.send(new AddTagsToResourceCommand({
|
|
14731
|
-
ResourceType: "Parameter",
|
|
14732
|
-
ResourceId: name,
|
|
14733
|
-
Tags: ssmTags
|
|
14734
|
-
}));
|
|
14735
|
-
} catch (innerError) {
|
|
14736
|
-
try {
|
|
14737
|
-
await this.ssmClient.send(new DeleteParameterCommand({ Name: name }));
|
|
14738
|
-
leftBehind = false;
|
|
14739
|
-
debug(`Cleaned up partially-created SSM parameter ${displaySafe(logicalId)} (${displaySafe(mask(name))}) after wiring failure`);
|
|
14740
|
-
} catch (cleanupError) {
|
|
14741
|
-
const deleteCommand = renderDisableCommand({
|
|
14742
|
-
before: "aws ssm delete-parameter --name",
|
|
14743
|
-
identifier: name,
|
|
14744
|
-
maskSecrets: mask
|
|
14745
|
-
});
|
|
14746
|
-
const manualStep = deleteCommand ? `Outside a rollback's re-create, the failed deploy's rollback journal records it for \`cdkd rollback --revert-failed\`; otherwise delete it yourself before the next deploy: ${deleteCommand}` : "Outside a rollback's re-create, the failed deploy's rollback journal records it for `cdkd rollback --revert-failed`; otherwise delete it yourself before the next deploy, via the console: the parameter name cannot be reproduced safely on a command line: a command naming the sanitized form would delete a DIFFERENT parameter, and one naming a name that is not inert unquoted could run part of it as shell.";
|
|
14747
|
-
warn(`Failed to clean up partially-created SSM parameter ${displaySafe(logicalId)} (${displaySafe(mask(name))}): ${describeAwsFailure(cleanupError).detail}. ${manualStep}`);
|
|
14748
|
-
}
|
|
14749
|
-
throw markAuxiliaryFailure(innerError, logicalId);
|
|
14750
|
-
}
|
|
14751
14728
|
debug(`Successfully created SSM parameter ${displaySafe(logicalId)}: ${displaySafe(mask(name))}`);
|
|
14752
14729
|
const arn = await this.buildParameterArn(name, mask);
|
|
14753
14730
|
return {
|
|
@@ -14760,9 +14737,7 @@ var SSMParameterProvider = class SSMParameterProvider {
|
|
|
14760
14737
|
};
|
|
14761
14738
|
} catch (error) {
|
|
14762
14739
|
const cause = error instanceof Error ? error : void 0;
|
|
14763
|
-
|
|
14764
|
-
if (leftBehind) markCreatedBeforeFailure(thrown, logicalId, resourceType, name);
|
|
14765
|
-
throw thrown;
|
|
14740
|
+
throw this.wrapMaskedError(mask, error, (text) => new ProvisioningError(`Failed to create SSM parameter ${displaySafe(logicalId)}: ${text}`, resourceType, logicalId, void 0, cause));
|
|
14766
14741
|
}
|
|
14767
14742
|
}
|
|
14768
14743
|
async update(logicalId, physicalId, resourceType, properties, previousProperties, context) {
|
|
@@ -15747,7 +15722,15 @@ const createSubnetLatch = new AmbiguousCreateLatch("ec2:CreateSubnet");
|
|
|
15747
15722
|
const createInternetGatewayLatch = new AmbiguousCreateLatch("ec2:CreateInternetGateway");
|
|
15748
15723
|
const allocateAddressLatch = new AmbiguousCreateLatch("ec2:AllocateAddress");
|
|
15749
15724
|
const ec2IdsCreatedByThisProcess = new RecentIdSet();
|
|
15750
|
-
const
|
|
15725
|
+
const mayBeLostCreate = (tags, sent) => tags === void 0 || tags.length === 0 || sent.length > 0 && tagListsMatch(tags, sent);
|
|
15726
|
+
const lostCreateNoun = (what, sent, adjective) => sent.length === 0 ? `${adjective !== void 0 ? `${adjective}, ` : ""}untagged ${what}` : `${adjective !== void 0 ? `${adjective} ` : ""}${what} with no tags or exactly the template's tags`;
|
|
15727
|
+
function isCreateTagsDenial(error) {
|
|
15728
|
+
return isNamedError(error, CREATE_TAGS_DENIAL_NAMES) && describeAwsFailure(error).detail.includes("ec2:CreateTags");
|
|
15729
|
+
}
|
|
15730
|
+
const CREATE_TAGS_DENIAL_NAMES = /* @__PURE__ */ new Set(["UnauthorizedOperation"]);
|
|
15731
|
+
const IDEMPOTENT_MISMATCH_NAMES = /* @__PURE__ */ new Set(["IdempotentParameterMismatch"]);
|
|
15732
|
+
const OWN_WRITE_READ_ATTEMPTS = 5;
|
|
15733
|
+
const OWN_WRITE_READ_DELAY_MS = 500;
|
|
15751
15734
|
const ORPHAN_LIST_PAGE_SIZE$2 = 1e3;
|
|
15752
15735
|
var EC2Provider = class {
|
|
15753
15736
|
ec2Client;
|
|
@@ -15902,14 +15885,14 @@ var EC2Provider = class {
|
|
|
15902
15885
|
inspect: (id) => lookup.inspect(aws, id, regionArg)
|
|
15903
15886
|
});
|
|
15904
15887
|
}
|
|
15905
|
-
async reportPossibleOrphanVpcs(logicalId, cidrBlock, window, context) {
|
|
15888
|
+
async reportPossibleOrphanVpcs(logicalId, cidrBlock, sent, window, context) {
|
|
15906
15889
|
const log = createMaskedLogSinks(this.logger, context?.maskSecrets);
|
|
15907
15890
|
const wanted = canonicalizeIpv4Cidr(cidrBlock) ?? cidrBlock;
|
|
15908
15891
|
await this.reportPossibleEc2Orphans(logicalId, window, log, {
|
|
15909
15892
|
action: "CreateVpc",
|
|
15910
15893
|
listAction: "DescribeVpcs",
|
|
15911
15894
|
subject: `a VPC with CIDR ${log.value(cidrBlock)}`,
|
|
15912
|
-
noun: "
|
|
15895
|
+
noun: lostCreateNoun("VPC(s)", sent),
|
|
15913
15896
|
list: () => collectOrphanIds(async (token) => {
|
|
15914
15897
|
const page = await this.ec2Client.send(new DescribeVpcsCommand({
|
|
15915
15898
|
MaxResults: ORPHAN_LIST_PAGE_SIZE$2,
|
|
@@ -15919,18 +15902,18 @@ var EC2Provider = class {
|
|
|
15919
15902
|
items: page.Vpcs ?? [],
|
|
15920
15903
|
next: page.NextToken
|
|
15921
15904
|
};
|
|
15922
|
-
}, (vpc) => vpc.VpcId !== void 0 && vpc.IsDefault !== true &&
|
|
15905
|
+
}, (vpc) => vpc.VpcId !== void 0 && vpc.IsDefault !== true && mayBeLostCreate(vpc.Tags, sent) && vpc.CidrBlock !== void 0 && (canonicalizeIpv4Cidr(vpc.CidrBlock) ?? vpc.CidrBlock) === wanted && !ec2IdsCreatedByThisProcess.has(vpc.VpcId) ? vpc.VpcId : void 0),
|
|
15923
15906
|
inspect: (aws, id, regionArg) => aws`aws ec2 describe-vpcs --vpc-ids ${id}${regionArg}`.render()
|
|
15924
15907
|
});
|
|
15925
15908
|
}
|
|
15926
|
-
async reportPossibleOrphanSubnets(logicalId, vpcId, cidrBlock, window, context) {
|
|
15909
|
+
async reportPossibleOrphanSubnets(logicalId, vpcId, cidrBlock, sent, window, context) {
|
|
15927
15910
|
const log = createMaskedLogSinks(this.logger, context?.maskSecrets);
|
|
15928
15911
|
const wanted = canonicalizeIpv4Cidr(cidrBlock) ?? cidrBlock;
|
|
15929
15912
|
await this.reportPossibleEc2Orphans(logicalId, window, log, {
|
|
15930
15913
|
action: "CreateSubnet",
|
|
15931
15914
|
listAction: "DescribeSubnets",
|
|
15932
15915
|
subject: `a subnet with CIDR ${log.value(cidrBlock)} in VPC ${log.value(vpcId)}`,
|
|
15933
|
-
noun: "
|
|
15916
|
+
noun: lostCreateNoun("subnet(s)", sent),
|
|
15934
15917
|
afterward: "Creating it again, which fails with InvalidSubnet.Conflict while that subnet exists.",
|
|
15935
15918
|
list: () => collectOrphanIds(async (token) => {
|
|
15936
15919
|
const page = await this.ec2Client.send(new DescribeSubnetsCommand({
|
|
@@ -15945,17 +15928,17 @@ var EC2Provider = class {
|
|
|
15945
15928
|
items: page.Subnets ?? [],
|
|
15946
15929
|
next: page.NextToken
|
|
15947
15930
|
};
|
|
15948
|
-
}, (subnet) => subnet.SubnetId !== void 0 &&
|
|
15931
|
+
}, (subnet) => subnet.SubnetId !== void 0 && mayBeLostCreate(subnet.Tags, sent) && subnet.CidrBlock !== void 0 && (canonicalizeIpv4Cidr(subnet.CidrBlock) ?? subnet.CidrBlock) === wanted && !ec2IdsCreatedByThisProcess.has(subnet.SubnetId) ? subnet.SubnetId : void 0),
|
|
15949
15932
|
inspect: (aws, id, regionArg) => aws`aws ec2 describe-subnets --subnet-ids ${id}${regionArg}`.render()
|
|
15950
15933
|
});
|
|
15951
15934
|
}
|
|
15952
|
-
async reportPossibleOrphanInternetGateways(logicalId, window, context) {
|
|
15935
|
+
async reportPossibleOrphanInternetGateways(logicalId, sent, window, context) {
|
|
15953
15936
|
const log = createMaskedLogSinks(this.logger, context?.maskSecrets);
|
|
15954
15937
|
await this.reportPossibleEc2Orphans(logicalId, window, log, {
|
|
15955
15938
|
action: "CreateInternetGateway",
|
|
15956
15939
|
listAction: "DescribeInternetGateways",
|
|
15957
15940
|
subject: "an internet gateway",
|
|
15958
|
-
noun: "
|
|
15941
|
+
noun: lostCreateNoun("internet gateway(s)", sent, "detached"),
|
|
15959
15942
|
list: () => collectOrphanIds(async (token) => {
|
|
15960
15943
|
const page = await this.ec2Client.send(new DescribeInternetGatewaysCommand({
|
|
15961
15944
|
MaxResults: ORPHAN_LIST_PAGE_SIZE$2,
|
|
@@ -15965,23 +15948,23 @@ var EC2Provider = class {
|
|
|
15965
15948
|
items: page.InternetGateways ?? [],
|
|
15966
15949
|
next: page.NextToken
|
|
15967
15950
|
};
|
|
15968
|
-
}, (igw) => igw.InternetGatewayId !== void 0 && (igw.Attachments ?? []).length === 0 &&
|
|
15951
|
+
}, (igw) => igw.InternetGatewayId !== void 0 && (igw.Attachments ?? []).length === 0 && mayBeLostCreate(igw.Tags, sent) && !ec2IdsCreatedByThisProcess.has(igw.InternetGatewayId) ? igw.InternetGatewayId : void 0),
|
|
15969
15952
|
inspect: (aws, id, regionArg) => aws`aws ec2 describe-internet-gateways --internet-gateway-ids ${id}${regionArg}`.render()
|
|
15970
15953
|
});
|
|
15971
15954
|
}
|
|
15972
|
-
async reportPossibleOrphanAddresses(logicalId, input, window, context) {
|
|
15955
|
+
async reportPossibleOrphanAddresses(logicalId, input, sent, window, context) {
|
|
15973
15956
|
const log = createMaskedLogSinks(this.logger, context?.maskSecrets);
|
|
15974
15957
|
await this.reportPossibleEc2Orphans(logicalId, window, log, {
|
|
15975
15958
|
action: "AllocateAddress",
|
|
15976
15959
|
listAction: "DescribeAddresses",
|
|
15977
15960
|
subject: `an Elastic IP address (domain ${log.value(input.Domain ?? "vpc")})`,
|
|
15978
|
-
noun: "
|
|
15961
|
+
noun: lostCreateNoun("Elastic IP address(es)", sent, "unassociated"),
|
|
15979
15962
|
list: async () => {
|
|
15980
15963
|
const response = await this.ec2Client.send(new DescribeAddressesCommand({}));
|
|
15981
15964
|
const ids = [];
|
|
15982
15965
|
for (const address of response.Addresses ?? []) {
|
|
15983
15966
|
const id = address.AllocationId;
|
|
15984
|
-
if (id === void 0 || (address.Domain ?? "vpc") !== (input.Domain ?? "vpc") || address.AssociationId !== void 0 || !
|
|
15967
|
+
if (id === void 0 || (address.Domain ?? "vpc") !== (input.Domain ?? "vpc") || address.AssociationId !== void 0 || !mayBeLostCreate(address.Tags, sent) || input.NetworkBorderGroup !== void 0 && address.NetworkBorderGroup !== input.NetworkBorderGroup || input.PublicIpv4Pool !== void 0 && address.PublicIpv4Pool !== input.PublicIpv4Pool || ec2IdsCreatedByThisProcess.has(id)) continue;
|
|
15985
15968
|
ids.push(id);
|
|
15986
15969
|
}
|
|
15987
15970
|
return {
|
|
@@ -16197,14 +16180,16 @@ var EC2Provider = class {
|
|
|
16197
16180
|
try {
|
|
16198
16181
|
const createClient = await this.getCreateClient();
|
|
16199
16182
|
const orphanWindow = createVpcLatch.take(logicalId);
|
|
16200
|
-
if (orphanWindow !== void 0) await this.reportPossibleOrphanVpcs(logicalId, cidrBlock, orphanWindow, context);
|
|
16183
|
+
if (orphanWindow !== void 0) await this.reportPossibleOrphanVpcs(logicalId, cidrBlock, desiredTags, orphanWindow, context);
|
|
16201
16184
|
const attemptStartMs = Date.now();
|
|
16202
16185
|
let response;
|
|
16186
|
+
let tagsApplied;
|
|
16203
16187
|
try {
|
|
16204
|
-
response = await createClient.send(new CreateVpcCommand({
|
|
16188
|
+
({response, tagsApplied} = await this.sendTaggedCreate(logicalId, "vpc", desiredTags, (TagSpecifications) => createClient.send(new CreateVpcCommand({
|
|
16205
16189
|
CidrBlock: cidrBlock,
|
|
16206
|
-
InstanceTenancy: properties["InstanceTenancy"] ?? void 0
|
|
16207
|
-
|
|
16190
|
+
InstanceTenancy: properties["InstanceTenancy"] ?? void 0,
|
|
16191
|
+
...TagSpecifications && { TagSpecifications }
|
|
16192
|
+
}))));
|
|
16208
16193
|
} catch (error) {
|
|
16209
16194
|
createVpcLatch.noteFailure(logicalId, error, attemptStartMs, orphanWindow);
|
|
16210
16195
|
throw error;
|
|
@@ -16212,7 +16197,7 @@ var EC2Provider = class {
|
|
|
16212
16197
|
const vpcId = response.Vpc.VpcId;
|
|
16213
16198
|
ec2IdsCreatedByThisProcess.add(vpcId);
|
|
16214
16199
|
const vpcReplayWindow = replayedSendWindow(response, attemptStartMs);
|
|
16215
|
-
if (vpcReplayWindow !== void 0) await this.reportPossibleOrphanVpcs(logicalId, cidrBlock, vpcReplayWindow, context);
|
|
16200
|
+
if (vpcReplayWindow !== void 0) await this.reportPossibleOrphanVpcs(logicalId, cidrBlock, desiredTags, vpcReplayWindow, context);
|
|
16216
16201
|
let defaultSgId;
|
|
16217
16202
|
try {
|
|
16218
16203
|
if (properties["EnableDnsHostnames"] === true || properties["EnableDnsHostnames"] === "true") await this.ec2Client.send(new ModifyVpcAttributeCommand({
|
|
@@ -16223,7 +16208,7 @@ var EC2Provider = class {
|
|
|
16223
16208
|
VpcId: vpcId,
|
|
16224
16209
|
EnableDnsSupport: { Value: false }
|
|
16225
16210
|
}));
|
|
16226
|
-
await this.applyTags(vpcId, desiredTags, logicalId);
|
|
16211
|
+
if (!tagsApplied) await this.applyTags(vpcId, desiredTags, logicalId);
|
|
16227
16212
|
await this.ec2Client.send(new DescribeVpcsCommand({ VpcIds: [vpcId] }));
|
|
16228
16213
|
try {
|
|
16229
16214
|
defaultSgId = (await this.ec2Client.send(new DescribeSecurityGroupsCommand({ Filters: [{
|
|
@@ -16367,15 +16352,17 @@ var EC2Provider = class {
|
|
|
16367
16352
|
try {
|
|
16368
16353
|
const createClient = await this.getCreateClient();
|
|
16369
16354
|
const orphanWindow = createSubnetLatch.take(logicalId);
|
|
16370
|
-
if (orphanWindow !== void 0) await this.reportPossibleOrphanSubnets(logicalId, vpcId, cidrBlock, orphanWindow, context);
|
|
16355
|
+
if (orphanWindow !== void 0) await this.reportPossibleOrphanSubnets(logicalId, vpcId, cidrBlock, desiredTags, orphanWindow, context);
|
|
16371
16356
|
const attemptStartMs = Date.now();
|
|
16372
16357
|
let response;
|
|
16358
|
+
let tagsApplied;
|
|
16373
16359
|
try {
|
|
16374
|
-
response = await createClient.send(new CreateSubnetCommand({
|
|
16360
|
+
({response, tagsApplied} = await this.sendTaggedCreate(logicalId, "subnet", desiredTags, (TagSpecifications) => createClient.send(new CreateSubnetCommand({
|
|
16375
16361
|
VpcId: vpcId,
|
|
16376
16362
|
CidrBlock: cidrBlock,
|
|
16377
|
-
AvailabilityZone: properties["AvailabilityZone"] ?? void 0
|
|
16378
|
-
|
|
16363
|
+
AvailabilityZone: properties["AvailabilityZone"] ?? void 0,
|
|
16364
|
+
...TagSpecifications && { TagSpecifications }
|
|
16365
|
+
}))));
|
|
16379
16366
|
} catch (error) {
|
|
16380
16367
|
createSubnetLatch.noteFailure(logicalId, error, attemptStartMs, orphanWindow);
|
|
16381
16368
|
throw error;
|
|
@@ -16383,10 +16370,10 @@ var EC2Provider = class {
|
|
|
16383
16370
|
const subnetId = response.Subnet.SubnetId;
|
|
16384
16371
|
ec2IdsCreatedByThisProcess.add(subnetId);
|
|
16385
16372
|
const subnetReplayWindow = replayedSendWindow(response, attemptStartMs);
|
|
16386
|
-
if (subnetReplayWindow !== void 0) await this.reportPossibleOrphanSubnets(logicalId, vpcId, cidrBlock, subnetReplayWindow, context);
|
|
16373
|
+
if (subnetReplayWindow !== void 0) await this.reportPossibleOrphanSubnets(logicalId, vpcId, cidrBlock, desiredTags, subnetReplayWindow, context);
|
|
16387
16374
|
const availabilityZone = response.Subnet.AvailabilityZone;
|
|
16388
16375
|
try {
|
|
16389
|
-
await this.applyTags(subnetId, desiredTags, logicalId);
|
|
16376
|
+
if (!tagsApplied) await this.applyTags(subnetId, desiredTags, logicalId);
|
|
16390
16377
|
const mapPublicIp = properties["MapPublicIpOnLaunch"];
|
|
16391
16378
|
if (mapPublicIp === true || mapPublicIp === "true") {
|
|
16392
16379
|
await this.ec2Client.send(new ModifySubnetAttributeCommand({
|
|
@@ -16537,11 +16524,12 @@ var EC2Provider = class {
|
|
|
16537
16524
|
try {
|
|
16538
16525
|
const createClient = await this.getCreateClient();
|
|
16539
16526
|
const orphanWindow = createInternetGatewayLatch.take(logicalId);
|
|
16540
|
-
if (orphanWindow !== void 0) await this.reportPossibleOrphanInternetGateways(logicalId, orphanWindow, context);
|
|
16527
|
+
if (orphanWindow !== void 0) await this.reportPossibleOrphanInternetGateways(logicalId, desiredTags, orphanWindow, context);
|
|
16541
16528
|
const attemptStartMs = Date.now();
|
|
16542
16529
|
let response;
|
|
16530
|
+
let tagsApplied;
|
|
16543
16531
|
try {
|
|
16544
|
-
response = await createClient.send(new CreateInternetGatewayCommand({}));
|
|
16532
|
+
({response, tagsApplied} = await this.sendTaggedCreate(logicalId, "internet-gateway", desiredTags, (TagSpecifications) => createClient.send(new CreateInternetGatewayCommand(TagSpecifications ? { TagSpecifications } : {}))));
|
|
16545
16533
|
} catch (error) {
|
|
16546
16534
|
createInternetGatewayLatch.noteFailure(logicalId, error, attemptStartMs, orphanWindow);
|
|
16547
16535
|
throw error;
|
|
@@ -16549,8 +16537,8 @@ var EC2Provider = class {
|
|
|
16549
16537
|
const igwId = response.InternetGateway.InternetGatewayId;
|
|
16550
16538
|
ec2IdsCreatedByThisProcess.add(igwId);
|
|
16551
16539
|
const igwReplayWindow = replayedSendWindow(response, attemptStartMs);
|
|
16552
|
-
if (igwReplayWindow !== void 0) await this.reportPossibleOrphanInternetGateways(logicalId, igwReplayWindow, context);
|
|
16553
|
-
await this.applyTags(igwId, desiredTags, logicalId);
|
|
16540
|
+
if (igwReplayWindow !== void 0) await this.reportPossibleOrphanInternetGateways(logicalId, desiredTags, igwReplayWindow, context);
|
|
16541
|
+
if (!tagsApplied) await this.applyTags(igwId, desiredTags, logicalId);
|
|
16554
16542
|
this.logger.debug(`Successfully created InternetGateway ${logicalId}: ${igwId}`);
|
|
16555
16543
|
return {
|
|
16556
16544
|
physicalId: igwId,
|
|
@@ -16616,11 +16604,15 @@ var EC2Provider = class {
|
|
|
16616
16604
|
};
|
|
16617
16605
|
const createClient = await this.getCreateClient();
|
|
16618
16606
|
const orphanWindow = allocateAddressLatch.take(logicalId);
|
|
16619
|
-
if (orphanWindow !== void 0) await this.reportPossibleOrphanAddresses(logicalId, input, orphanWindow, context);
|
|
16607
|
+
if (orphanWindow !== void 0) await this.reportPossibleOrphanAddresses(logicalId, input, desiredTags, orphanWindow, context);
|
|
16620
16608
|
const attemptStartMs = Date.now();
|
|
16621
16609
|
let response;
|
|
16610
|
+
let tagsApplied;
|
|
16622
16611
|
try {
|
|
16623
|
-
response = await createClient.send(new AllocateAddressCommand(
|
|
16612
|
+
({response, tagsApplied} = await this.sendTaggedCreate(logicalId, "elastic-ip", desiredTags, (TagSpecifications) => createClient.send(new AllocateAddressCommand(TagSpecifications ? {
|
|
16613
|
+
...input,
|
|
16614
|
+
TagSpecifications
|
|
16615
|
+
} : input))));
|
|
16624
16616
|
} catch (error) {
|
|
16625
16617
|
allocateAddressLatch.noteFailure(logicalId, error, attemptStartMs, orphanWindow);
|
|
16626
16618
|
throw error;
|
|
@@ -16636,8 +16628,8 @@ var EC2Provider = class {
|
|
|
16636
16628
|
}
|
|
16637
16629
|
ec2IdsCreatedByThisProcess.add(allocationId);
|
|
16638
16630
|
const eipReplayWindow = replayedSendWindow(response, attemptStartMs);
|
|
16639
|
-
if (eipReplayWindow !== void 0) await this.reportPossibleOrphanAddresses(logicalId, input, eipReplayWindow, context);
|
|
16640
|
-
await this.applyTags(allocationId, desiredTags, logicalId);
|
|
16631
|
+
if (eipReplayWindow !== void 0) await this.reportPossibleOrphanAddresses(logicalId, input, desiredTags, eipReplayWindow, context);
|
|
16632
|
+
if (!tagsApplied) await this.applyTags(allocationId, desiredTags, logicalId);
|
|
16641
16633
|
const instanceId = properties["InstanceId"];
|
|
16642
16634
|
if (instanceId) {
|
|
16643
16635
|
if (process.env["CDKD_NO_WAIT"] === "true") this.logger.warn(`EIP ${logicalId} (${allocationId}) was NOT associated with ${displayIdent(instanceId)}: --no-wait skips the instance running-state wait, and AssociateAddress rejects an instance that is not yet running. Verify and associate once the instance is running: ${pasteableAwsCommand(context?.maskSecrets)`aws ec2 describe-instances --instance-ids ${instanceId} --query 'Reservations[].Instances[].State.Name' && aws ec2 associate-address --allocation-id ${allocationId} --instance-id ${instanceId}`.render()}`);
|
|
@@ -16825,7 +16817,8 @@ var EC2Provider = class {
|
|
|
16825
16817
|
});
|
|
16826
16818
|
let createdId;
|
|
16827
16819
|
try {
|
|
16828
|
-
const
|
|
16820
|
+
const { response, tagsApplied } = await this.sendTaggedCreate(logicalId, "natgateway", desiredTags, (TagSpecifications) => this.ec2Client.send(new CreateNatGatewayCommand({
|
|
16821
|
+
...TagSpecifications && { TagSpecifications },
|
|
16829
16822
|
ClientToken: natGatewayToken.value,
|
|
16830
16823
|
SubnetId: subnetId,
|
|
16831
16824
|
AllocationId: properties["AllocationId"],
|
|
@@ -16834,9 +16827,10 @@ var EC2Provider = class {
|
|
|
16834
16827
|
SecondaryAllocationIds: properties["SecondaryAllocationIds"],
|
|
16835
16828
|
SecondaryPrivateIpAddresses: properties["SecondaryPrivateIpAddresses"],
|
|
16836
16829
|
SecondaryPrivateIpAddressCount: properties["SecondaryPrivateIpAddressCount"]
|
|
16837
|
-
})))
|
|
16830
|
+
})));
|
|
16831
|
+
const natGatewayId = response.NatGateway.NatGatewayId;
|
|
16838
16832
|
createdId = natGatewayId;
|
|
16839
|
-
await this.applyTags(natGatewayId, desiredTags, logicalId);
|
|
16833
|
+
if (!tagsApplied) await this.applyTags(natGatewayId, desiredTags, logicalId);
|
|
16840
16834
|
if (process.env["CDKD_NO_WAIT"] !== "true") {
|
|
16841
16835
|
this.logger.debug(`Waiting for NatGateway ${natGatewayId} to reach available state...`);
|
|
16842
16836
|
await waitUntilNatGatewayAvailable({
|
|
@@ -16901,11 +16895,13 @@ var EC2Provider = class {
|
|
|
16901
16895
|
logicalId
|
|
16902
16896
|
});
|
|
16903
16897
|
try {
|
|
16904
|
-
const
|
|
16898
|
+
const { response, tagsApplied } = await this.sendTaggedCreate(logicalId, "route-table", desiredTags, (TagSpecifications) => this.ec2Client.send(new CreateRouteTableCommand({
|
|
16905
16899
|
VpcId: vpcId,
|
|
16906
|
-
ClientToken: routeTableToken.value
|
|
16907
|
-
|
|
16908
|
-
|
|
16900
|
+
ClientToken: routeTableToken.value,
|
|
16901
|
+
...TagSpecifications && { TagSpecifications }
|
|
16902
|
+
})));
|
|
16903
|
+
const routeTableId = response.RouteTable.RouteTableId;
|
|
16904
|
+
if (!tagsApplied) await this.applyTags(routeTableId, desiredTags, logicalId);
|
|
16909
16905
|
this.logger.debug(`Successfully created RouteTable ${logicalId}: ${routeTableId}`);
|
|
16910
16906
|
routeTableToken.release();
|
|
16911
16907
|
return {
|
|
@@ -17086,11 +17082,14 @@ var EC2Provider = class {
|
|
|
17086
17082
|
if (!groupDescription) throw new ProvisioningError(`GroupDescription is required for SecurityGroup ${logicalId}`, resourceType, logicalId);
|
|
17087
17083
|
let leftBehindId;
|
|
17088
17084
|
try {
|
|
17089
|
-
const
|
|
17085
|
+
const createClient = await this.getCreateClient();
|
|
17086
|
+
const { response, tagsApplied } = await this.sendTaggedCreate(logicalId, "security-group", desiredTags, (TagSpecifications) => createClient.send(new CreateSecurityGroupCommand({
|
|
17090
17087
|
GroupName: properties["GroupName"] ?? logicalId,
|
|
17091
17088
|
Description: groupDescription,
|
|
17092
|
-
VpcId: properties["VpcId"] ?? void 0
|
|
17093
|
-
|
|
17089
|
+
VpcId: properties["VpcId"] ?? void 0,
|
|
17090
|
+
...TagSpecifications && { TagSpecifications }
|
|
17091
|
+
})));
|
|
17092
|
+
const groupId = response.GroupId;
|
|
17094
17093
|
try {
|
|
17095
17094
|
const ingressRules = properties["SecurityGroupIngress"];
|
|
17096
17095
|
const egressRules = properties["SecurityGroupEgress"];
|
|
@@ -17099,7 +17098,7 @@ var EC2Provider = class {
|
|
|
17099
17098
|
firstRejection ??= { error };
|
|
17100
17099
|
});
|
|
17101
17100
|
await Promise.all([
|
|
17102
|
-
recordRejection(this.applyTags(groupId, desiredTags, logicalId)),
|
|
17101
|
+
recordRejection(this.applyTags(groupId, tagsApplied ? [] : desiredTags, logicalId)),
|
|
17103
17102
|
recordRejection(this.authorizeInlineIngress(groupId, ingressRules)),
|
|
17104
17103
|
recordRejection(this.applyInlineEgress(groupId, egressRules))
|
|
17105
17104
|
]);
|
|
@@ -17621,7 +17620,8 @@ var EC2Provider = class {
|
|
|
17621
17620
|
scope: "RunInstances",
|
|
17622
17621
|
logicalId
|
|
17623
17622
|
});
|
|
17624
|
-
const
|
|
17623
|
+
const { response, tagsApplied } = await this.sendTaggedCreate(logicalId, "instance", desiredTags, (TagSpecifications) => this.ec2Client.send(new RunInstancesCommand({
|
|
17624
|
+
...TagSpecifications && { TagSpecifications },
|
|
17625
17625
|
ClientToken: runInstancesToken.value,
|
|
17626
17626
|
ImageId: imageId,
|
|
17627
17627
|
InstanceType: instanceType,
|
|
@@ -17644,11 +17644,12 @@ var EC2Provider = class {
|
|
|
17644
17644
|
MetadataOptions: this.buildMetadataOptions(properties),
|
|
17645
17645
|
CreditSpecification: this.buildCreditSpecification(properties),
|
|
17646
17646
|
Placement: this.buildPlacement(properties)
|
|
17647
|
-
})))
|
|
17647
|
+
})));
|
|
17648
|
+
const instance = response.Instances?.[0];
|
|
17648
17649
|
if (!instance?.InstanceId) throw new Error("No instance ID returned from RunInstances");
|
|
17649
17650
|
const instanceId = instance.InstanceId;
|
|
17650
17651
|
try {
|
|
17651
|
-
await this.applyTags(instanceId, desiredTags, logicalId);
|
|
17652
|
+
if (!tagsApplied) await this.applyTags(instanceId, desiredTags, logicalId);
|
|
17652
17653
|
if (process.env["CDKD_NO_WAIT"] !== "true") {
|
|
17653
17654
|
this.logger.debug(`Waiting for instance ${instanceId} to be running...`);
|
|
17654
17655
|
await waitUntilInstanceRunning({
|
|
@@ -18079,11 +18080,13 @@ var EC2Provider = class {
|
|
|
18079
18080
|
logicalId
|
|
18080
18081
|
});
|
|
18081
18082
|
try {
|
|
18082
|
-
const
|
|
18083
|
+
const { response, tagsApplied } = await this.sendTaggedCreate(logicalId, "network-acl", desiredTags, (TagSpecifications) => this.ec2Client.send(new CreateNetworkAclCommand({
|
|
18083
18084
|
VpcId: vpcId,
|
|
18084
|
-
ClientToken: networkAclToken.value
|
|
18085
|
-
|
|
18086
|
-
|
|
18085
|
+
ClientToken: networkAclToken.value,
|
|
18086
|
+
...TagSpecifications && { TagSpecifications }
|
|
18087
|
+
})));
|
|
18088
|
+
const networkAclId = response.NetworkAcl.NetworkAclId;
|
|
18089
|
+
if (!tagsApplied) await this.applyTags(networkAclId, desiredTags, logicalId);
|
|
18087
18090
|
this.logger.debug(`Successfully created NetworkAcl ${logicalId}: ${networkAclId}`);
|
|
18088
18091
|
networkAclToken.release();
|
|
18089
18092
|
return {
|
|
@@ -18233,6 +18236,45 @@ var EC2Provider = class {
|
|
|
18233
18236
|
throw new ProvisioningError(`Failed to create SubnetNetworkAclAssociation ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, void 0, cause);
|
|
18234
18237
|
}
|
|
18235
18238
|
}
|
|
18239
|
+
async sendTaggedCreate(logicalId, tagResourceType, tags, send) {
|
|
18240
|
+
if (tags.length === 0) return {
|
|
18241
|
+
response: await send(void 0),
|
|
18242
|
+
tagsApplied: false
|
|
18243
|
+
};
|
|
18244
|
+
const tagSpecifications = [{
|
|
18245
|
+
ResourceType: tagResourceType,
|
|
18246
|
+
Tags: tags.map((t) => ({
|
|
18247
|
+
Key: t.Key,
|
|
18248
|
+
Value: t.Value
|
|
18249
|
+
}))
|
|
18250
|
+
}];
|
|
18251
|
+
try {
|
|
18252
|
+
return {
|
|
18253
|
+
response: await send(tagSpecifications),
|
|
18254
|
+
tagsApplied: true
|
|
18255
|
+
};
|
|
18256
|
+
} catch (taggedError) {
|
|
18257
|
+
const tagsDenied = isCreateTagsDenial(taggedError);
|
|
18258
|
+
if (!tagsDenied && !isNamedError(taggedError, IDEMPOTENT_MISMATCH_NAMES)) throw taggedError;
|
|
18259
|
+
this.logger.debug(safeMsg`Create of ${logicalId} with tags was ${tagsDenied ? "denied ec2:CreateTags" : "refused for a client token an untagged create already used"}; ` + `retrying without tags and applying them with CreateTags`);
|
|
18260
|
+
try {
|
|
18261
|
+
return {
|
|
18262
|
+
response: await send(void 0),
|
|
18263
|
+
tagsApplied: false
|
|
18264
|
+
};
|
|
18265
|
+
} catch (untaggedError) {
|
|
18266
|
+
if (!tagsDenied || !(taggedError instanceof Error) || !isNamedError(untaggedError, CREATE_TAGS_DENIAL_NAMES)) throw untaggedError;
|
|
18267
|
+
this.logger.debug(safeMsg`Create of ${logicalId} without tags was denied too; reporting the ec2:CreateTags denial`);
|
|
18268
|
+
const untaggedDetail = describeAwsFailure(untaggedError).detail;
|
|
18269
|
+
this.logger.debug(safeMsg`Create of ${logicalId} without tags was refused: ${untaggedDetail}`);
|
|
18270
|
+
const explicit = isExplicitDenyError(untaggedDetail);
|
|
18271
|
+
const kind = explicit ? explicitDenyPolicyKind(untaggedDetail) : void 0;
|
|
18272
|
+
taggedError.message = `${taggedError.message} The create without tags was refused too (UnauthorizedOperation)${explicit ? `; explicit deny${kind !== void 0 ? ` (${kind})` : ""}` : ""}.`;
|
|
18273
|
+
if (explicit) markNonRetryable(taggedError);
|
|
18274
|
+
throw taggedError;
|
|
18275
|
+
}
|
|
18276
|
+
}
|
|
18277
|
+
}
|
|
18236
18278
|
async applyTags(resourceId, tags, logicalId) {
|
|
18237
18279
|
if (tags.length > 0) try {
|
|
18238
18280
|
await this.ec2Client.send(new CreateTagsCommand({
|
|
@@ -18325,6 +18367,14 @@ var EC2Provider = class {
|
|
|
18325
18367
|
return null;
|
|
18326
18368
|
}
|
|
18327
18369
|
async readCurrentState(physicalId, logicalId, resourceType, properties, context) {
|
|
18370
|
+
const attempts = context?.afterOwnWrite === true ? OWN_WRITE_READ_ATTEMPTS : 1;
|
|
18371
|
+
for (let attempt = 1;; attempt++) {
|
|
18372
|
+
const read = await this.readCurrentStateOnce(physicalId, logicalId, resourceType, properties, context);
|
|
18373
|
+
if (read !== RESOURCE_NOT_FOUND || attempt >= attempts) return read;
|
|
18374
|
+
await new Promise((r) => setTimeout(r, OWN_WRITE_READ_DELAY_MS));
|
|
18375
|
+
}
|
|
18376
|
+
}
|
|
18377
|
+
async readCurrentStateOnce(physicalId, logicalId, resourceType, properties, context) {
|
|
18328
18378
|
try {
|
|
18329
18379
|
switch (resourceType) {
|
|
18330
18380
|
case "AWS::EC2::VPC": return await this.readVpcCurrentState(physicalId);
|
|
@@ -37161,21 +37211,18 @@ var KinesisStreamProvider = class {
|
|
|
37161
37211
|
const streamMode = readConfigString(streamModeDetails, "StreamMode", "PROVISIONED", "AWS::Kinesis::Stream StreamModeDetails");
|
|
37162
37212
|
const shardCount = streamMode === "PROVISIONED" ? Number(properties["ShardCount"] ?? 1) : void 0;
|
|
37163
37213
|
const maxRecordSizeInKiB = maxRecordRead.kind === "usable" ? maxRecordRead.size : void 0;
|
|
37214
|
+
const tags = {};
|
|
37215
|
+
for (const tag of desiredTags) tags[tag.Key] = tag.Value;
|
|
37164
37216
|
await this.getCreateClient().send(new CreateStreamCommand({
|
|
37165
37217
|
StreamName: streamName,
|
|
37166
37218
|
...shardCount !== void 0 && { ShardCount: shardCount },
|
|
37167
37219
|
StreamModeDetails: { StreamMode: streamMode },
|
|
37168
|
-
...maxRecordSizeInKiB !== void 0 && { MaxRecordSizeInKiB: maxRecordSizeInKiB }
|
|
37220
|
+
...maxRecordSizeInKiB !== void 0 && { MaxRecordSizeInKiB: maxRecordSizeInKiB },
|
|
37221
|
+
...Object.keys(tags).length > 0 && { Tags: tags }
|
|
37169
37222
|
}));
|
|
37170
37223
|
streamCreated = true;
|
|
37171
37224
|
this.logger.debug(`CreateStream initiated for ${streamName}, waiting for ACTIVE status`);
|
|
37172
37225
|
const streamInfo = await this.waitForStreamActive(streamName);
|
|
37173
|
-
const tags = {};
|
|
37174
|
-
for (const tag of desiredTags) tags[tag.Key] = tag.Value;
|
|
37175
|
-
if (Object.keys(tags).length > 0) await this.getClient().send(new AddTagsToStreamCommand({
|
|
37176
|
-
StreamName: streamName,
|
|
37177
|
-
Tags: tags
|
|
37178
|
-
}));
|
|
37179
37226
|
const retentionPeriodHours = retentionRead.kind === "usable" ? retentionRead.hours : void 0;
|
|
37180
37227
|
if (retentionPeriodHours !== void 0 && retentionPeriodHours !== 24) {
|
|
37181
37228
|
this.logger.debug(`Setting retention period to ${retentionPeriodHours} hours for ${streamName}`);
|
|
@@ -46664,4 +46711,4 @@ var ACMCertificateProvider = class {
|
|
|
46664
46711
|
|
|
46665
46712
|
//#endregion
|
|
46666
46713
|
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, LambdaNetworkConnectorProvider, LambdaPermissionProvider, LambdaUrlProvider, LambdaWebFunctionEndpointProvider, LambdaWebFunctionRevisionProvider, 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 };
|
|
46667
|
-
//# sourceMappingURL=provider-classes-
|
|
46714
|
+
//# sourceMappingURL=provider-classes-C1xbZd9k.js.map
|