@go-to-k/cdkd 0.300.2 → 0.301.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/dist/{asg-provider-DJdNNqDe.js → asg-provider-BHhRkEYv.js} +2 -2
  2. package/dist/{asg-provider-DJdNNqDe.js.map → asg-provider-BHhRkEYv.js.map} +1 -1
  3. package/dist/aws-failure-text-BEQfs6za.js.map +1 -1
  4. package/dist/cli.js +2 -2
  5. package/dist/{deploy-engine-DOBzE5TD.js → deploy-engine-BYgrFxwH.js} +1304 -766
  6. package/dist/deploy-engine-BYgrFxwH.js.map +1 -0
  7. package/dist/{iam-role-provider-C8gNXG1G.js → iam-role-provider-B3i7FMiT.js} +3 -9
  8. package/dist/iam-role-provider-B3i7FMiT.js.map +1 -0
  9. package/dist/index.d.ts +25 -1
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +2 -2
  12. package/dist/{neptune-provider-UDy6HC5O.js → neptune-provider-iRg5Dagt.js} +2 -2
  13. package/dist/{neptune-provider-UDy6HC5O.js.map → neptune-provider-iRg5Dagt.js.map} +1 -1
  14. package/dist/{program-BDm58Wc8.js → program-Djx1RrEU.js} +107 -82
  15. package/dist/program-Djx1RrEU.js.map +1 -0
  16. package/dist/{provider-classes-DzoIZFZK.js → provider-classes-gt8C7wFO.js} +154 -95
  17. package/dist/provider-classes-gt8C7wFO.js.map +1 -0
  18. package/dist/{rds-provider-C-lGTdAb.js → rds-provider-N3EBsqc6.js} +2 -2
  19. package/dist/{rds-provider-C-lGTdAb.js.map → rds-provider-N3EBsqc6.js.map} +1 -1
  20. package/dist/{version-CZbKGFSS.js → version-Q15RJPDm.js} +2 -2
  21. package/dist/{version-CZbKGFSS.js.map → version-Q15RJPDm.js.map} +1 -1
  22. package/package.json +2 -2
  23. package/dist/deploy-engine-DOBzE5TD.js.map +0 -1
  24. package/dist/iam-role-provider-C8gNXG1G.js.map +0 -1
  25. package/dist/program-BDm58Wc8.js.map +0 -1
  26. 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, $a as withheldAccountClause, Ao as withRetry, At as withNestedStackContext, Br as markWaitAbandoned, Bt as awaitInFlightSibling, C as withApiLimit, Co as replayWarn, Ei as getAccountInfo, Eo as requireConfigString, Es as recordAttributeIdCopy, Fl as describeFileReadFailure, G as deleteBudgetKey, Go as passedNoEchoParametersOf, Gr as reDisableInstanceApiTermination, Gt as replacedDeleteFailureVerdict, H as DYNAMODB_DELETE_MIN_RESOURCE_TIMEOUT_MS, Hr as ec2InstanceProtectionSite, Ht as getStackRecords, Ii as parseWebACLArn, Il as displayAssemblyPath, J as DELETE_INDEX_WAIT_PROCEED_NOTE, K as resolveDynamoDbDeleteBudgetClock, Ki as accountArgs, Kr as reEnableInstanceApiTermination, Ll as renderAssemblyPathEscape, Lr as deleteSkipReason, Mo as lambdaFunctionNameForMask, Mr as unchangedBehindSecretReference, No as sameLambdaFunctionAddress, Q as ECR_AUTO_DELETE_IMAGES_TAG, Qo as hasMaskableValues, Rl as resolveAssemblyPath, Rr as withIndeterminateGuard, S as lookupEachName, So as readConfigString, St as getNestedRevertRun, Tl as derivePartitionAndUrlSuffix, To as requireConfigObject, Tr as getCurrentResourceSecrets, Ts as physicalNameCopiesOf, Tt as revertNestedChildFromJournal, U as beginDeleteWait, Ur as isTerminationProtectionPropagationError, V as DynamoDBGlobalTableProvider, Va as refuseMalformedResourcesForDestroy, W as compensateRemovedDeletionProtection, Wr as observeThenDisableInstanceApiTermination, X as deleteTableWithIndexBusyRetry, Y as INDEX_SETTLE_POLL_INTERVAL_MS, Z as waitForIndexesSettled, _i as s3BucketRegionalDomainName, _o as coerceCfnBoolean, an as getCurrentProducerRegions, ar as acquireIdempotencyToken, b as chunks, bo as configIntegerRefusal, c as isAbsoluteAssetPath, cn as isRedactedRecordedValue, cr as DBPROXY_TAGS_WHAT, di as outputReferenceProvenanceOf, dr as readTagList, ds as recordReferenceProvenanceEntry, et as hasCdkAutoDeleteTag, fo as WARM_THROUGHPUT_MEMBERS, fr as refuseMalformedDesiredTags, fs as snapshotPassProvenance, gi as s3BucketDualStackDomainName, go as toFiniteNumber, gr as stringifyIfAssigned, gs as withoutPhysicalNameCopies, hi as s3BucketDomainName, ho as toCfnInteger, hr as definedAttributes, jo as canonicalLambdaFunctionName, jr as slowCcOperationTimeoutMs, ks as carriesSecretMask, kt as getCurrentNestedStackContext, l as listNestedTemplateRows, li as isSettledInstanceState, ln as redactedDeleteAddressFields, lr as DBPROXY_TAG_OPTIONS, mc as stringifyValue, mi as s3BucketArn, mo as isWarmThroughputDecrease, mr as tagPlanWarning, nt as getPriorAttempts, or as isRefusedByName, po as coerceWarmThroughput$1, pr as tagMapAsList, ps as redactSecretsForState, q as resolveDynamoDbDeleteBudgetMs, ro as withoutSilentDropProperties, rr as reserveStackCreateToken, rt as markRefusedBeforeApplying, s as findNestedTemplateTreeDefect, sn as REDACTED_DELETE_ADDRESS_SKIP_REASON, sr as markDeleteStarted, t as DeployEngine, to as findSilentDropProperties, tr as earliestDefined, tt as isTruthyCfnBoolean, u as renderNestedTemplateTreeDefect, un as redactedDeleteAddressSkip, ur as planTagDiff, us as markSameGenerationBag, vi as s3BucketWebsiteUrl, vo as coerceCfnInteger, vs as dynamicReferenceTokens, wl as canonicalizeRegion, wo as requireConfigArray, ws as recoverMaskedOutput, x as isAccessDeniedError, xa as refuseMalformedNestedChildOutputs, xl as decodeListingKey, xo as configStringRefusal, yc as rewriteTemplateAssetReferences, yo as configBooleanRefusal, zi as passedParameterClassesOf, zr as isWaitAbandonedError } from "./deploy-engine-DOBzE5TD.js";
6
- import { n as collectInlinePolicyNamesManagedBySiblings, r as IamCreateClientCache, t as IAMRoleProvider } from "./iam-role-provider-C8gNXG1G.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-BDm58Wc8.js";
8
- import { RDSProvider } from "./rds-provider-C-lGTdAb.js";
9
- import { NeptuneProvider } from "./neptune-provider-UDy6HC5O.js";
10
- import { ASGProvider } from "./asg-provider-DJdNNqDe.js";
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-BYgrFxwH.js";
6
+ import { n as collectInlinePolicyNamesManagedBySiblings, r as IamCreateClientCache, t as IAMRoleProvider } from "./iam-role-provider-B3i7FMiT.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-Djx1RrEU.js";
8
+ import { RDSProvider } from "./rds-provider-N3EBsqc6.js";
9
+ import { NeptuneProvider } from "./neptune-provider-iRg5Dagt.js";
10
+ import { ASGProvider } from "./asg-provider-BHhRkEYv.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, _logicalId, _resourceType, _properties, context) {
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;
@@ -10948,7 +10949,7 @@ function sameWeights(a, b) {
10948
10949
  return left.every((k, i) => k === right[i]);
10949
10950
  }
10950
10951
  function buildAttributes$1(resp) {
10951
- return definedAttributes({
10952
+ const attributes = definedAttributes({
10952
10953
  EndpointArn: resp.endpointArn,
10953
10954
  FunctionArn: resp.functionArn,
10954
10955
  DomainName: resp.domainName,
@@ -10959,6 +10960,18 @@ function buildAttributes$1(resp) {
10959
10960
  CreatedAt: resp.createdAt?.toISOString(),
10960
10961
  UpdatedAt: resp.updatedAt?.toISOString()
10961
10962
  });
10963
+ for (const [region, entry] of Object.entries(resp.regionalEndpoints ?? {})) {
10964
+ const members = definedAttributes({
10965
+ DomainName: entry.domainName,
10966
+ AuthType: entry.authType,
10967
+ State: entry.state,
10968
+ StateReason: entry.stateReason,
10969
+ UpdateStatus: entry.updateStatus,
10970
+ UpdateStatusReason: entry.updateStatusReason
10971
+ });
10972
+ for (const [member, value] of Object.entries(members)) attributes[`RegionalEndpoints.${region}.${member}`] = value;
10973
+ }
10974
+ return attributes;
10962
10975
  }
10963
10976
 
10964
10977
  //#endregion
@@ -14699,7 +14712,6 @@ var SSMParameterProvider = class SSMParameterProvider {
14699
14712
  }
14700
14713
  async create(logicalId, resourceType, properties, context) {
14701
14714
  const mask = maskerOrIdentity(context?.maskSecrets);
14702
- const warn = (message) => this.logger.warn(mask(message));
14703
14715
  const ssmTags = SSMParameterProvider.desiredSsmTags(properties["Tags"], resourceType, logicalId);
14704
14716
  const debug = (message) => this.logger.debug(mask(message));
14705
14717
  debug(`Creating SSM parameter ${displaySafe(logicalId)}`);
@@ -14710,7 +14722,6 @@ var SSMParameterProvider = class SSMParameterProvider {
14710
14722
  const type = properties["Type"] || "String";
14711
14723
  const value = properties["Value"];
14712
14724
  if (!value) throw new ProvisioningError(`Value is required for SSM parameter ${displaySafe(logicalId)}`, resourceType, logicalId);
14713
- let leftBehind = false;
14714
14725
  try {
14715
14726
  const putParams = {
14716
14727
  Name: name,
@@ -14724,30 +14735,8 @@ var SSMParameterProvider = class SSMParameterProvider {
14724
14735
  const policies = ssmPoliciesParameter(properties["Policies"]);
14725
14736
  if (policies !== void 0) putParams.Policies = policies;
14726
14737
  if (properties["DataType"]) putParams.DataType = properties["DataType"];
14738
+ if (ssmTags.length > 0) putParams.Tags = ssmTags;
14727
14739
  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
14740
  debug(`Successfully created SSM parameter ${displaySafe(logicalId)}: ${displaySafe(mask(name))}`);
14752
14741
  const arn = await this.buildParameterArn(name, mask);
14753
14742
  return {
@@ -14760,9 +14749,7 @@ var SSMParameterProvider = class SSMParameterProvider {
14760
14749
  };
14761
14750
  } catch (error) {
14762
14751
  const cause = error instanceof Error ? error : void 0;
14763
- const thrown = this.wrapMaskedError(mask, error, (text) => new ProvisioningError(`Failed to create SSM parameter ${displaySafe(logicalId)}: ${text}`, resourceType, logicalId, void 0, cause));
14764
- if (leftBehind) markCreatedBeforeFailure(thrown, logicalId, resourceType, name);
14765
- throw thrown;
14752
+ throw this.wrapMaskedError(mask, error, (text) => new ProvisioningError(`Failed to create SSM parameter ${displaySafe(logicalId)}: ${text}`, resourceType, logicalId, void 0, cause));
14766
14753
  }
14767
14754
  }
14768
14755
  async update(logicalId, physicalId, resourceType, properties, previousProperties, context) {
@@ -15747,7 +15734,15 @@ const createSubnetLatch = new AmbiguousCreateLatch("ec2:CreateSubnet");
15747
15734
  const createInternetGatewayLatch = new AmbiguousCreateLatch("ec2:CreateInternetGateway");
15748
15735
  const allocateAddressLatch = new AmbiguousCreateLatch("ec2:AllocateAddress");
15749
15736
  const ec2IdsCreatedByThisProcess = new RecentIdSet();
15750
- const isUntagged = (tags) => tags === void 0 || tags.length === 0;
15737
+ const mayBeLostCreate = (tags, sent) => tags === void 0 || tags.length === 0 || sent.length > 0 && tagListsMatch(tags, sent);
15738
+ 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`;
15739
+ function isCreateTagsDenial(error) {
15740
+ return isNamedError(error, CREATE_TAGS_DENIAL_NAMES) && describeAwsFailure(error).detail.includes("ec2:CreateTags");
15741
+ }
15742
+ const CREATE_TAGS_DENIAL_NAMES = /* @__PURE__ */ new Set(["UnauthorizedOperation"]);
15743
+ const IDEMPOTENT_MISMATCH_NAMES = /* @__PURE__ */ new Set(["IdempotentParameterMismatch"]);
15744
+ const OWN_WRITE_READ_ATTEMPTS = 5;
15745
+ const OWN_WRITE_READ_DELAY_MS = 500;
15751
15746
  const ORPHAN_LIST_PAGE_SIZE$2 = 1e3;
15752
15747
  var EC2Provider = class {
15753
15748
  ec2Client;
@@ -15902,14 +15897,14 @@ var EC2Provider = class {
15902
15897
  inspect: (id) => lookup.inspect(aws, id, regionArg)
15903
15898
  });
15904
15899
  }
15905
- async reportPossibleOrphanVpcs(logicalId, cidrBlock, window, context) {
15900
+ async reportPossibleOrphanVpcs(logicalId, cidrBlock, sent, window, context) {
15906
15901
  const log = createMaskedLogSinks(this.logger, context?.maskSecrets);
15907
15902
  const wanted = canonicalizeIpv4Cidr(cidrBlock) ?? cidrBlock;
15908
15903
  await this.reportPossibleEc2Orphans(logicalId, window, log, {
15909
15904
  action: "CreateVpc",
15910
15905
  listAction: "DescribeVpcs",
15911
15906
  subject: `a VPC with CIDR ${log.value(cidrBlock)}`,
15912
- noun: "untagged VPC(s)",
15907
+ noun: lostCreateNoun("VPC(s)", sent),
15913
15908
  list: () => collectOrphanIds(async (token) => {
15914
15909
  const page = await this.ec2Client.send(new DescribeVpcsCommand({
15915
15910
  MaxResults: ORPHAN_LIST_PAGE_SIZE$2,
@@ -15919,18 +15914,18 @@ var EC2Provider = class {
15919
15914
  items: page.Vpcs ?? [],
15920
15915
  next: page.NextToken
15921
15916
  };
15922
- }, (vpc) => vpc.VpcId !== void 0 && vpc.IsDefault !== true && isUntagged(vpc.Tags) && vpc.CidrBlock !== void 0 && (canonicalizeIpv4Cidr(vpc.CidrBlock) ?? vpc.CidrBlock) === wanted && !ec2IdsCreatedByThisProcess.has(vpc.VpcId) ? vpc.VpcId : void 0),
15917
+ }, (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
15918
  inspect: (aws, id, regionArg) => aws`aws ec2 describe-vpcs --vpc-ids ${id}${regionArg}`.render()
15924
15919
  });
15925
15920
  }
15926
- async reportPossibleOrphanSubnets(logicalId, vpcId, cidrBlock, window, context) {
15921
+ async reportPossibleOrphanSubnets(logicalId, vpcId, cidrBlock, sent, window, context) {
15927
15922
  const log = createMaskedLogSinks(this.logger, context?.maskSecrets);
15928
15923
  const wanted = canonicalizeIpv4Cidr(cidrBlock) ?? cidrBlock;
15929
15924
  await this.reportPossibleEc2Orphans(logicalId, window, log, {
15930
15925
  action: "CreateSubnet",
15931
15926
  listAction: "DescribeSubnets",
15932
15927
  subject: `a subnet with CIDR ${log.value(cidrBlock)} in VPC ${log.value(vpcId)}`,
15933
- noun: "untagged subnet(s)",
15928
+ noun: lostCreateNoun("subnet(s)", sent),
15934
15929
  afterward: "Creating it again, which fails with InvalidSubnet.Conflict while that subnet exists.",
15935
15930
  list: () => collectOrphanIds(async (token) => {
15936
15931
  const page = await this.ec2Client.send(new DescribeSubnetsCommand({
@@ -15945,17 +15940,17 @@ var EC2Provider = class {
15945
15940
  items: page.Subnets ?? [],
15946
15941
  next: page.NextToken
15947
15942
  };
15948
- }, (subnet) => subnet.SubnetId !== void 0 && isUntagged(subnet.Tags) && subnet.CidrBlock !== void 0 && (canonicalizeIpv4Cidr(subnet.CidrBlock) ?? subnet.CidrBlock) === wanted && !ec2IdsCreatedByThisProcess.has(subnet.SubnetId) ? subnet.SubnetId : void 0),
15943
+ }, (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
15944
  inspect: (aws, id, regionArg) => aws`aws ec2 describe-subnets --subnet-ids ${id}${regionArg}`.render()
15950
15945
  });
15951
15946
  }
15952
- async reportPossibleOrphanInternetGateways(logicalId, window, context) {
15947
+ async reportPossibleOrphanInternetGateways(logicalId, sent, window, context) {
15953
15948
  const log = createMaskedLogSinks(this.logger, context?.maskSecrets);
15954
15949
  await this.reportPossibleEc2Orphans(logicalId, window, log, {
15955
15950
  action: "CreateInternetGateway",
15956
15951
  listAction: "DescribeInternetGateways",
15957
15952
  subject: "an internet gateway",
15958
- noun: "detached, untagged internet gateway(s)",
15953
+ noun: lostCreateNoun("internet gateway(s)", sent, "detached"),
15959
15954
  list: () => collectOrphanIds(async (token) => {
15960
15955
  const page = await this.ec2Client.send(new DescribeInternetGatewaysCommand({
15961
15956
  MaxResults: ORPHAN_LIST_PAGE_SIZE$2,
@@ -15965,23 +15960,23 @@ var EC2Provider = class {
15965
15960
  items: page.InternetGateways ?? [],
15966
15961
  next: page.NextToken
15967
15962
  };
15968
- }, (igw) => igw.InternetGatewayId !== void 0 && (igw.Attachments ?? []).length === 0 && isUntagged(igw.Tags) && !ec2IdsCreatedByThisProcess.has(igw.InternetGatewayId) ? igw.InternetGatewayId : void 0),
15963
+ }, (igw) => igw.InternetGatewayId !== void 0 && (igw.Attachments ?? []).length === 0 && mayBeLostCreate(igw.Tags, sent) && !ec2IdsCreatedByThisProcess.has(igw.InternetGatewayId) ? igw.InternetGatewayId : void 0),
15969
15964
  inspect: (aws, id, regionArg) => aws`aws ec2 describe-internet-gateways --internet-gateway-ids ${id}${regionArg}`.render()
15970
15965
  });
15971
15966
  }
15972
- async reportPossibleOrphanAddresses(logicalId, input, window, context) {
15967
+ async reportPossibleOrphanAddresses(logicalId, input, sent, window, context) {
15973
15968
  const log = createMaskedLogSinks(this.logger, context?.maskSecrets);
15974
15969
  await this.reportPossibleEc2Orphans(logicalId, window, log, {
15975
15970
  action: "AllocateAddress",
15976
15971
  listAction: "DescribeAddresses",
15977
15972
  subject: `an Elastic IP address (domain ${log.value(input.Domain ?? "vpc")})`,
15978
- noun: "unassociated, untagged Elastic IP address(es)",
15973
+ noun: lostCreateNoun("Elastic IP address(es)", sent, "unassociated"),
15979
15974
  list: async () => {
15980
15975
  const response = await this.ec2Client.send(new DescribeAddressesCommand({}));
15981
15976
  const ids = [];
15982
15977
  for (const address of response.Addresses ?? []) {
15983
15978
  const id = address.AllocationId;
15984
- if (id === void 0 || (address.Domain ?? "vpc") !== (input.Domain ?? "vpc") || address.AssociationId !== void 0 || !isUntagged(address.Tags) || input.NetworkBorderGroup !== void 0 && address.NetworkBorderGroup !== input.NetworkBorderGroup || input.PublicIpv4Pool !== void 0 && address.PublicIpv4Pool !== input.PublicIpv4Pool || ec2IdsCreatedByThisProcess.has(id)) continue;
15979
+ 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
15980
  ids.push(id);
15986
15981
  }
15987
15982
  return {
@@ -16197,14 +16192,16 @@ var EC2Provider = class {
16197
16192
  try {
16198
16193
  const createClient = await this.getCreateClient();
16199
16194
  const orphanWindow = createVpcLatch.take(logicalId);
16200
- if (orphanWindow !== void 0) await this.reportPossibleOrphanVpcs(logicalId, cidrBlock, orphanWindow, context);
16195
+ if (orphanWindow !== void 0) await this.reportPossibleOrphanVpcs(logicalId, cidrBlock, desiredTags, orphanWindow, context);
16201
16196
  const attemptStartMs = Date.now();
16202
16197
  let response;
16198
+ let tagsApplied;
16203
16199
  try {
16204
- response = await createClient.send(new CreateVpcCommand({
16200
+ ({response, tagsApplied} = await this.sendTaggedCreate(logicalId, "vpc", desiredTags, (TagSpecifications) => createClient.send(new CreateVpcCommand({
16205
16201
  CidrBlock: cidrBlock,
16206
- InstanceTenancy: properties["InstanceTenancy"] ?? void 0
16207
- }));
16202
+ InstanceTenancy: properties["InstanceTenancy"] ?? void 0,
16203
+ ...TagSpecifications && { TagSpecifications }
16204
+ }))));
16208
16205
  } catch (error) {
16209
16206
  createVpcLatch.noteFailure(logicalId, error, attemptStartMs, orphanWindow);
16210
16207
  throw error;
@@ -16212,7 +16209,7 @@ var EC2Provider = class {
16212
16209
  const vpcId = response.Vpc.VpcId;
16213
16210
  ec2IdsCreatedByThisProcess.add(vpcId);
16214
16211
  const vpcReplayWindow = replayedSendWindow(response, attemptStartMs);
16215
- if (vpcReplayWindow !== void 0) await this.reportPossibleOrphanVpcs(logicalId, cidrBlock, vpcReplayWindow, context);
16212
+ if (vpcReplayWindow !== void 0) await this.reportPossibleOrphanVpcs(logicalId, cidrBlock, desiredTags, vpcReplayWindow, context);
16216
16213
  let defaultSgId;
16217
16214
  try {
16218
16215
  if (properties["EnableDnsHostnames"] === true || properties["EnableDnsHostnames"] === "true") await this.ec2Client.send(new ModifyVpcAttributeCommand({
@@ -16223,7 +16220,7 @@ var EC2Provider = class {
16223
16220
  VpcId: vpcId,
16224
16221
  EnableDnsSupport: { Value: false }
16225
16222
  }));
16226
- await this.applyTags(vpcId, desiredTags, logicalId);
16223
+ if (!tagsApplied) await this.applyTags(vpcId, desiredTags, logicalId);
16227
16224
  await this.ec2Client.send(new DescribeVpcsCommand({ VpcIds: [vpcId] }));
16228
16225
  try {
16229
16226
  defaultSgId = (await this.ec2Client.send(new DescribeSecurityGroupsCommand({ Filters: [{
@@ -16367,15 +16364,17 @@ var EC2Provider = class {
16367
16364
  try {
16368
16365
  const createClient = await this.getCreateClient();
16369
16366
  const orphanWindow = createSubnetLatch.take(logicalId);
16370
- if (orphanWindow !== void 0) await this.reportPossibleOrphanSubnets(logicalId, vpcId, cidrBlock, orphanWindow, context);
16367
+ if (orphanWindow !== void 0) await this.reportPossibleOrphanSubnets(logicalId, vpcId, cidrBlock, desiredTags, orphanWindow, context);
16371
16368
  const attemptStartMs = Date.now();
16372
16369
  let response;
16370
+ let tagsApplied;
16373
16371
  try {
16374
- response = await createClient.send(new CreateSubnetCommand({
16372
+ ({response, tagsApplied} = await this.sendTaggedCreate(logicalId, "subnet", desiredTags, (TagSpecifications) => createClient.send(new CreateSubnetCommand({
16375
16373
  VpcId: vpcId,
16376
16374
  CidrBlock: cidrBlock,
16377
- AvailabilityZone: properties["AvailabilityZone"] ?? void 0
16378
- }));
16375
+ AvailabilityZone: properties["AvailabilityZone"] ?? void 0,
16376
+ ...TagSpecifications && { TagSpecifications }
16377
+ }))));
16379
16378
  } catch (error) {
16380
16379
  createSubnetLatch.noteFailure(logicalId, error, attemptStartMs, orphanWindow);
16381
16380
  throw error;
@@ -16383,10 +16382,10 @@ var EC2Provider = class {
16383
16382
  const subnetId = response.Subnet.SubnetId;
16384
16383
  ec2IdsCreatedByThisProcess.add(subnetId);
16385
16384
  const subnetReplayWindow = replayedSendWindow(response, attemptStartMs);
16386
- if (subnetReplayWindow !== void 0) await this.reportPossibleOrphanSubnets(logicalId, vpcId, cidrBlock, subnetReplayWindow, context);
16385
+ if (subnetReplayWindow !== void 0) await this.reportPossibleOrphanSubnets(logicalId, vpcId, cidrBlock, desiredTags, subnetReplayWindow, context);
16387
16386
  const availabilityZone = response.Subnet.AvailabilityZone;
16388
16387
  try {
16389
- await this.applyTags(subnetId, desiredTags, logicalId);
16388
+ if (!tagsApplied) await this.applyTags(subnetId, desiredTags, logicalId);
16390
16389
  const mapPublicIp = properties["MapPublicIpOnLaunch"];
16391
16390
  if (mapPublicIp === true || mapPublicIp === "true") {
16392
16391
  await this.ec2Client.send(new ModifySubnetAttributeCommand({
@@ -16537,11 +16536,12 @@ var EC2Provider = class {
16537
16536
  try {
16538
16537
  const createClient = await this.getCreateClient();
16539
16538
  const orphanWindow = createInternetGatewayLatch.take(logicalId);
16540
- if (orphanWindow !== void 0) await this.reportPossibleOrphanInternetGateways(logicalId, orphanWindow, context);
16539
+ if (orphanWindow !== void 0) await this.reportPossibleOrphanInternetGateways(logicalId, desiredTags, orphanWindow, context);
16541
16540
  const attemptStartMs = Date.now();
16542
16541
  let response;
16542
+ let tagsApplied;
16543
16543
  try {
16544
- response = await createClient.send(new CreateInternetGatewayCommand({}));
16544
+ ({response, tagsApplied} = await this.sendTaggedCreate(logicalId, "internet-gateway", desiredTags, (TagSpecifications) => createClient.send(new CreateInternetGatewayCommand(TagSpecifications ? { TagSpecifications } : {}))));
16545
16545
  } catch (error) {
16546
16546
  createInternetGatewayLatch.noteFailure(logicalId, error, attemptStartMs, orphanWindow);
16547
16547
  throw error;
@@ -16549,8 +16549,8 @@ var EC2Provider = class {
16549
16549
  const igwId = response.InternetGateway.InternetGatewayId;
16550
16550
  ec2IdsCreatedByThisProcess.add(igwId);
16551
16551
  const igwReplayWindow = replayedSendWindow(response, attemptStartMs);
16552
- if (igwReplayWindow !== void 0) await this.reportPossibleOrphanInternetGateways(logicalId, igwReplayWindow, context);
16553
- await this.applyTags(igwId, desiredTags, logicalId);
16552
+ if (igwReplayWindow !== void 0) await this.reportPossibleOrphanInternetGateways(logicalId, desiredTags, igwReplayWindow, context);
16553
+ if (!tagsApplied) await this.applyTags(igwId, desiredTags, logicalId);
16554
16554
  this.logger.debug(`Successfully created InternetGateway ${logicalId}: ${igwId}`);
16555
16555
  return {
16556
16556
  physicalId: igwId,
@@ -16616,11 +16616,15 @@ var EC2Provider = class {
16616
16616
  };
16617
16617
  const createClient = await this.getCreateClient();
16618
16618
  const orphanWindow = allocateAddressLatch.take(logicalId);
16619
- if (orphanWindow !== void 0) await this.reportPossibleOrphanAddresses(logicalId, input, orphanWindow, context);
16619
+ if (orphanWindow !== void 0) await this.reportPossibleOrphanAddresses(logicalId, input, desiredTags, orphanWindow, context);
16620
16620
  const attemptStartMs = Date.now();
16621
16621
  let response;
16622
+ let tagsApplied;
16622
16623
  try {
16623
- response = await createClient.send(new AllocateAddressCommand(input));
16624
+ ({response, tagsApplied} = await this.sendTaggedCreate(logicalId, "elastic-ip", desiredTags, (TagSpecifications) => createClient.send(new AllocateAddressCommand(TagSpecifications ? {
16625
+ ...input,
16626
+ TagSpecifications
16627
+ } : input))));
16624
16628
  } catch (error) {
16625
16629
  allocateAddressLatch.noteFailure(logicalId, error, attemptStartMs, orphanWindow);
16626
16630
  throw error;
@@ -16636,8 +16640,8 @@ var EC2Provider = class {
16636
16640
  }
16637
16641
  ec2IdsCreatedByThisProcess.add(allocationId);
16638
16642
  const eipReplayWindow = replayedSendWindow(response, attemptStartMs);
16639
- if (eipReplayWindow !== void 0) await this.reportPossibleOrphanAddresses(logicalId, input, eipReplayWindow, context);
16640
- await this.applyTags(allocationId, desiredTags, logicalId);
16643
+ if (eipReplayWindow !== void 0) await this.reportPossibleOrphanAddresses(logicalId, input, desiredTags, eipReplayWindow, context);
16644
+ if (!tagsApplied) await this.applyTags(allocationId, desiredTags, logicalId);
16641
16645
  const instanceId = properties["InstanceId"];
16642
16646
  if (instanceId) {
16643
16647
  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 +16829,8 @@ var EC2Provider = class {
16825
16829
  });
16826
16830
  let createdId;
16827
16831
  try {
16828
- const natGatewayId = (await this.ec2Client.send(new CreateNatGatewayCommand({
16832
+ const { response, tagsApplied } = await this.sendTaggedCreate(logicalId, "natgateway", desiredTags, (TagSpecifications) => this.ec2Client.send(new CreateNatGatewayCommand({
16833
+ ...TagSpecifications && { TagSpecifications },
16829
16834
  ClientToken: natGatewayToken.value,
16830
16835
  SubnetId: subnetId,
16831
16836
  AllocationId: properties["AllocationId"],
@@ -16834,9 +16839,10 @@ var EC2Provider = class {
16834
16839
  SecondaryAllocationIds: properties["SecondaryAllocationIds"],
16835
16840
  SecondaryPrivateIpAddresses: properties["SecondaryPrivateIpAddresses"],
16836
16841
  SecondaryPrivateIpAddressCount: properties["SecondaryPrivateIpAddressCount"]
16837
- }))).NatGateway.NatGatewayId;
16842
+ })));
16843
+ const natGatewayId = response.NatGateway.NatGatewayId;
16838
16844
  createdId = natGatewayId;
16839
- await this.applyTags(natGatewayId, desiredTags, logicalId);
16845
+ if (!tagsApplied) await this.applyTags(natGatewayId, desiredTags, logicalId);
16840
16846
  if (process.env["CDKD_NO_WAIT"] !== "true") {
16841
16847
  this.logger.debug(`Waiting for NatGateway ${natGatewayId} to reach available state...`);
16842
16848
  await waitUntilNatGatewayAvailable({
@@ -16901,11 +16907,13 @@ var EC2Provider = class {
16901
16907
  logicalId
16902
16908
  });
16903
16909
  try {
16904
- const routeTableId = (await this.ec2Client.send(new CreateRouteTableCommand({
16910
+ const { response, tagsApplied } = await this.sendTaggedCreate(logicalId, "route-table", desiredTags, (TagSpecifications) => this.ec2Client.send(new CreateRouteTableCommand({
16905
16911
  VpcId: vpcId,
16906
- ClientToken: routeTableToken.value
16907
- }))).RouteTable.RouteTableId;
16908
- await this.applyTags(routeTableId, desiredTags, logicalId);
16912
+ ClientToken: routeTableToken.value,
16913
+ ...TagSpecifications && { TagSpecifications }
16914
+ })));
16915
+ const routeTableId = response.RouteTable.RouteTableId;
16916
+ if (!tagsApplied) await this.applyTags(routeTableId, desiredTags, logicalId);
16909
16917
  this.logger.debug(`Successfully created RouteTable ${logicalId}: ${routeTableId}`);
16910
16918
  routeTableToken.release();
16911
16919
  return {
@@ -17086,11 +17094,14 @@ var EC2Provider = class {
17086
17094
  if (!groupDescription) throw new ProvisioningError(`GroupDescription is required for SecurityGroup ${logicalId}`, resourceType, logicalId);
17087
17095
  let leftBehindId;
17088
17096
  try {
17089
- const groupId = (await (await this.getCreateClient()).send(new CreateSecurityGroupCommand({
17097
+ const createClient = await this.getCreateClient();
17098
+ const { response, tagsApplied } = await this.sendTaggedCreate(logicalId, "security-group", desiredTags, (TagSpecifications) => createClient.send(new CreateSecurityGroupCommand({
17090
17099
  GroupName: properties["GroupName"] ?? logicalId,
17091
17100
  Description: groupDescription,
17092
- VpcId: properties["VpcId"] ?? void 0
17093
- }))).GroupId;
17101
+ VpcId: properties["VpcId"] ?? void 0,
17102
+ ...TagSpecifications && { TagSpecifications }
17103
+ })));
17104
+ const groupId = response.GroupId;
17094
17105
  try {
17095
17106
  const ingressRules = properties["SecurityGroupIngress"];
17096
17107
  const egressRules = properties["SecurityGroupEgress"];
@@ -17099,7 +17110,7 @@ var EC2Provider = class {
17099
17110
  firstRejection ??= { error };
17100
17111
  });
17101
17112
  await Promise.all([
17102
- recordRejection(this.applyTags(groupId, desiredTags, logicalId)),
17113
+ recordRejection(this.applyTags(groupId, tagsApplied ? [] : desiredTags, logicalId)),
17103
17114
  recordRejection(this.authorizeInlineIngress(groupId, ingressRules)),
17104
17115
  recordRejection(this.applyInlineEgress(groupId, egressRules))
17105
17116
  ]);
@@ -17621,7 +17632,8 @@ var EC2Provider = class {
17621
17632
  scope: "RunInstances",
17622
17633
  logicalId
17623
17634
  });
17624
- const instance = (await this.ec2Client.send(new RunInstancesCommand({
17635
+ const { response, tagsApplied } = await this.sendTaggedCreate(logicalId, "instance", desiredTags, (TagSpecifications) => this.ec2Client.send(new RunInstancesCommand({
17636
+ ...TagSpecifications && { TagSpecifications },
17625
17637
  ClientToken: runInstancesToken.value,
17626
17638
  ImageId: imageId,
17627
17639
  InstanceType: instanceType,
@@ -17644,11 +17656,12 @@ var EC2Provider = class {
17644
17656
  MetadataOptions: this.buildMetadataOptions(properties),
17645
17657
  CreditSpecification: this.buildCreditSpecification(properties),
17646
17658
  Placement: this.buildPlacement(properties)
17647
- }))).Instances?.[0];
17659
+ })));
17660
+ const instance = response.Instances?.[0];
17648
17661
  if (!instance?.InstanceId) throw new Error("No instance ID returned from RunInstances");
17649
17662
  const instanceId = instance.InstanceId;
17650
17663
  try {
17651
- await this.applyTags(instanceId, desiredTags, logicalId);
17664
+ if (!tagsApplied) await this.applyTags(instanceId, desiredTags, logicalId);
17652
17665
  if (process.env["CDKD_NO_WAIT"] !== "true") {
17653
17666
  this.logger.debug(`Waiting for instance ${instanceId} to be running...`);
17654
17667
  await waitUntilInstanceRunning({
@@ -18079,11 +18092,13 @@ var EC2Provider = class {
18079
18092
  logicalId
18080
18093
  });
18081
18094
  try {
18082
- const networkAclId = (await this.ec2Client.send(new CreateNetworkAclCommand({
18095
+ const { response, tagsApplied } = await this.sendTaggedCreate(logicalId, "network-acl", desiredTags, (TagSpecifications) => this.ec2Client.send(new CreateNetworkAclCommand({
18083
18096
  VpcId: vpcId,
18084
- ClientToken: networkAclToken.value
18085
- }))).NetworkAcl.NetworkAclId;
18086
- await this.applyTags(networkAclId, desiredTags, logicalId);
18097
+ ClientToken: networkAclToken.value,
18098
+ ...TagSpecifications && { TagSpecifications }
18099
+ })));
18100
+ const networkAclId = response.NetworkAcl.NetworkAclId;
18101
+ if (!tagsApplied) await this.applyTags(networkAclId, desiredTags, logicalId);
18087
18102
  this.logger.debug(`Successfully created NetworkAcl ${logicalId}: ${networkAclId}`);
18088
18103
  networkAclToken.release();
18089
18104
  return {
@@ -18233,6 +18248,45 @@ var EC2Provider = class {
18233
18248
  throw new ProvisioningError(`Failed to create SubnetNetworkAclAssociation ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, void 0, cause);
18234
18249
  }
18235
18250
  }
18251
+ async sendTaggedCreate(logicalId, tagResourceType, tags, send) {
18252
+ if (tags.length === 0) return {
18253
+ response: await send(void 0),
18254
+ tagsApplied: false
18255
+ };
18256
+ const tagSpecifications = [{
18257
+ ResourceType: tagResourceType,
18258
+ Tags: tags.map((t) => ({
18259
+ Key: t.Key,
18260
+ Value: t.Value
18261
+ }))
18262
+ }];
18263
+ try {
18264
+ return {
18265
+ response: await send(tagSpecifications),
18266
+ tagsApplied: true
18267
+ };
18268
+ } catch (taggedError) {
18269
+ const tagsDenied = isCreateTagsDenial(taggedError);
18270
+ if (!tagsDenied && !isNamedError(taggedError, IDEMPOTENT_MISMATCH_NAMES)) throw taggedError;
18271
+ 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`);
18272
+ try {
18273
+ return {
18274
+ response: await send(void 0),
18275
+ tagsApplied: false
18276
+ };
18277
+ } catch (untaggedError) {
18278
+ if (!tagsDenied || !(taggedError instanceof Error) || !isNamedError(untaggedError, CREATE_TAGS_DENIAL_NAMES)) throw untaggedError;
18279
+ this.logger.debug(safeMsg`Create of ${logicalId} without tags was denied too; reporting the ec2:CreateTags denial`);
18280
+ const untaggedDetail = describeAwsFailure(untaggedError).detail;
18281
+ this.logger.debug(safeMsg`Create of ${logicalId} without tags was refused: ${untaggedDetail}`);
18282
+ const explicit = isExplicitDenyError(untaggedDetail);
18283
+ const kind = explicit ? explicitDenyPolicyKind(untaggedDetail) : void 0;
18284
+ taggedError.message = `${taggedError.message} The create without tags was refused too (UnauthorizedOperation)${explicit ? `; explicit deny${kind !== void 0 ? ` (${kind})` : ""}` : ""}.`;
18285
+ if (explicit) markNonRetryable(taggedError);
18286
+ throw taggedError;
18287
+ }
18288
+ }
18289
+ }
18236
18290
  async applyTags(resourceId, tags, logicalId) {
18237
18291
  if (tags.length > 0) try {
18238
18292
  await this.ec2Client.send(new CreateTagsCommand({
@@ -18325,6 +18379,14 @@ var EC2Provider = class {
18325
18379
  return null;
18326
18380
  }
18327
18381
  async readCurrentState(physicalId, logicalId, resourceType, properties, context) {
18382
+ const attempts = context?.afterOwnWrite === true ? OWN_WRITE_READ_ATTEMPTS : 1;
18383
+ for (let attempt = 1;; attempt++) {
18384
+ const read = await this.readCurrentStateOnce(physicalId, logicalId, resourceType, properties, context);
18385
+ if (read !== RESOURCE_NOT_FOUND || attempt >= attempts) return read;
18386
+ await new Promise((r) => setTimeout(r, OWN_WRITE_READ_DELAY_MS));
18387
+ }
18388
+ }
18389
+ async readCurrentStateOnce(physicalId, logicalId, resourceType, properties, context) {
18328
18390
  try {
18329
18391
  switch (resourceType) {
18330
18392
  case "AWS::EC2::VPC": return await this.readVpcCurrentState(physicalId);
@@ -37161,21 +37223,18 @@ var KinesisStreamProvider = class {
37161
37223
  const streamMode = readConfigString(streamModeDetails, "StreamMode", "PROVISIONED", "AWS::Kinesis::Stream StreamModeDetails");
37162
37224
  const shardCount = streamMode === "PROVISIONED" ? Number(properties["ShardCount"] ?? 1) : void 0;
37163
37225
  const maxRecordSizeInKiB = maxRecordRead.kind === "usable" ? maxRecordRead.size : void 0;
37226
+ const tags = {};
37227
+ for (const tag of desiredTags) tags[tag.Key] = tag.Value;
37164
37228
  await this.getCreateClient().send(new CreateStreamCommand({
37165
37229
  StreamName: streamName,
37166
37230
  ...shardCount !== void 0 && { ShardCount: shardCount },
37167
37231
  StreamModeDetails: { StreamMode: streamMode },
37168
- ...maxRecordSizeInKiB !== void 0 && { MaxRecordSizeInKiB: maxRecordSizeInKiB }
37232
+ ...maxRecordSizeInKiB !== void 0 && { MaxRecordSizeInKiB: maxRecordSizeInKiB },
37233
+ ...Object.keys(tags).length > 0 && { Tags: tags }
37169
37234
  }));
37170
37235
  streamCreated = true;
37171
37236
  this.logger.debug(`CreateStream initiated for ${streamName}, waiting for ACTIVE status`);
37172
37237
  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
37238
  const retentionPeriodHours = retentionRead.kind === "usable" ? retentionRead.hours : void 0;
37180
37239
  if (retentionPeriodHours !== void 0 && retentionPeriodHours !== 24) {
37181
37240
  this.logger.debug(`Setting retention period to ${retentionPeriodHours} hours for ${streamName}`);
@@ -46664,4 +46723,4 @@ var ACMCertificateProvider = class {
46664
46723
 
46665
46724
  //#endregion
46666
46725
  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-DzoIZFZK.js.map
46726
+ //# sourceMappingURL=provider-classes-gt8C7wFO.js.map