@go-to-k/cdkd 0.280.23 → 0.280.24

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/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { $ as requireConfigString, $t as processStackMessages, A as red, At as runDockerStreaming, B as isTerminationProtectionPropagationError, Bt as resolveSkipPrefix, C as isStatefulRecreateTargetSync, Ct as parseBootstrapMarker, D as cyan, Dn as normalizeAwsError, Dt as formatDockerLoginError, E as bold, Et as buildDockerImage, F as ProviderRegistry, Ft as getDefaultStateBucketName, G as normalizeAwsTagsToCfn, Gt as warnDeprecatedNoPrefixCliFlag, H as cfnRefValueFromPhysicalId, Ht as resolveStateBucketWithDefaultAndSource, I as findActionableSilentDrops, It as getLegacyStateBucketName, J as configStringRefusal, Jt as MIGRATE_TMP_PREFIX, K as resolveExplicitPhysicalId, Kt as CFN_TEMPLATE_BODY_LIMIT, L as CloudControlProvider, Lt as resolveApp, M as IAMRoleProvider, Mt as getDockerImageBySourceHash, N as collectInlinePolicyNamesManagedBySiblings, Nt as Synthesizer, O as gray, On as withErrorHandling, Ot as getDockerCmd, P as clearOnUpdateRemoval, Pt as synthesisStatusMessage, Q as requireConfigObject, Qt as AssemblyReader, R as slowCcOperationTimeoutMs, Rt as resolveAutoAssetStorage, S as MULTI_REGION_RECREATE_BLOCKED_TYPES, Sn as StackTerminationProtectionError, St as getBootstrapMarkerKey, T as formatResourceLine, Tt as validateContainerRepoName, U as refStateLookupFromResource, Ut as resolveUseCdkBootstrapAssets, V as IntrinsicFunctionResolver, Vt as resolveStateBucketWithDefault, W as WAFv2WebACLProvider, Wt as stateBucketExistenceConfirmed, X as replayWarn, Xt as uploadCfnTemplate, Y as readConfigString, Yt as findLargeInlineResources, Z as requireConfigArray, Zt as expectedOwnerParam, _ as createPreDeleteFinalSnapshot, _n as PartialFailureError, _t as loadPublishableAssetManifest, a as DeploymentEventsStore, an as setAwsClients, at as isThrottlingError, b as unsupportedFinalSnapshotError, bn as ResourceUpdateNotSupportedError, bt as BOOTSTRAP_MARKER_PREFIX, c as replayFailedOperations, ct as LockManager, d as IMPLICIT_DELETE_DEPENDENCIES, dn as LocalInvokeBuildError$1, dt as shouldRetainResource, et as applyRoleArnIfSet, f as computeImplicitDeleteEdges, fn as LocalMigrateError, ft as AssetPublisher, g as ccRoutedFinalSnapshotError, gn as NestedStackChildDirectDestroyError, gt as createAssetRedirectResolver, h as buildFinalSnapshotIdentifier, hn as MissingCdkCliError, ht as buildAssetRedirectMap, i as DeploymentEventsReader, in as resetAwsClients, it as isRetryableTransientError, j as yellow, jt as AssetManifestLoader, k as green, kt as runDockerForeground, l as replayRollback, lt as S3StateBackend, m as PRE_DELETE_SNAPSHOT_TYPES, mt as WorkGraph, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nn as AwsClients, nt as describeTypeWithThrottleRetry, o as planFailedOps, ot as DagBuilder, p as ATOMIC_FINAL_SNAPSHOT_TYPES, pn as LocalStartServiceError, pt as stringifyValue, q as assertRegionMatch, qt as CFN_TEMPLATE_URL_LIMIT, r as DeployEngine, rn as getAwsClients, rt as withRetry, s as planRollback, sn as CdkdError, st as TemplateParser, t as DEFAULT_RESOURCE_TIMEOUT_MS, tn as resolveBucketRegion, tt as DiffCalculator, u as withResourceDeadline, un as DeployCancelledError, ut as rebuildClientForBucketRegion, v as isFinalSnapshotError, vn as ProvisioningError, vt as rewriteTemplateAssetReferences, w as renderStatefulReason, wt as validateAssetBucketName, x as extractDeploymentEventError, xn as StackHasActiveImportsError, xt as ensureAssetStorage, y as refusesFinalSnapshot, yn as ResourceTimeoutError, yt as AssetModeResolver, z as disableInstanceApiTermination, zt as resolveCaptureObservedState } from "./deploy-engine-DmxpjXP8.js";
2
+ import { $ as requireConfigObject, $t as AssemblyReader, A as green, At as runDockerForeground, B as disableInstanceApiTermination, Bt as resolveCaptureObservedState, C as MULTI_REGION_RECREATE_BLOCKED_TYPES, Cn as StackTerminationProtectionError, Ct as getBootstrapMarkerKey, D as bold, Dt as buildDockerImage, E as formatResourceLine, Et as validateContainerRepoName, F as clearOnUpdateRemoval, Ft as synthesisStatusMessage, G as WAFv2WebACLProvider, Gt as stateBucketExistenceConfirmed, H as IntrinsicFunctionResolver, Ht as resolveStateBucketWithDefault, I as ProviderRegistry, It as getDefaultStateBucketName, J as assertRegionMatch, Jt as CFN_TEMPLATE_URL_LIMIT, K as normalizeAwsTagsToCfn, Kt as warnDeprecatedNoPrefixCliFlag, L as findActionableSilentDrops, Lt as getLegacyStateBucketName, M as yellow, Mt as AssetManifestLoader, N as IAMRoleProvider, Nt as getDockerImageBySourceHash, O as cyan, On as normalizeAwsError, Ot as formatDockerLoginError, P as collectInlinePolicyNamesManagedBySiblings, Pt as Synthesizer, Q as requireConfigArray, Qt as expectedOwnerParam, R as CloudControlProvider, Rt as resolveApp, S as extractDeploymentEventError, Sn as StackHasActiveImportsError, St as ensureAssetStorage, T as renderStatefulReason, Tt as validateAssetBucketName, U as cfnRefValueFromPhysicalId, Ut as resolveStateBucketWithDefaultAndSource, V as isTerminationProtectionPropagationError, Vt as resolveSkipPrefix, W as refStateLookupFromResource, Wt as resolveUseCdkBootstrapAssets, X as readConfigString, Xt as findLargeInlineResources, Y as configStringRefusal, Yt as MIGRATE_TMP_PREFIX, Z as replayWarn, Zt as uploadCfnTemplate, _ as createPreDeleteFinalSnapshot, _n as NestedStackChildDirectDestroyError, _t as createAssetRedirectResolver, a as DeploymentEventsStore, an as resetAwsClients, at as isRetryableTransientError, b as unsupportedFinalSnapshotError, bn as ResourceTimeoutError, bt as AssetModeResolver, c as replayFailedOperations, cn as CdkdError, ct as TemplateParser, d as IMPLICIT_DELETE_DEPENDENCIES, dn as DeployCancelledError, dt as rebuildClientForBucketRegion, en as processStackMessages, et as requireConfigString, f as computeImplicitDeleteEdges, fn as LocalInvokeBuildError$1, ft as shouldRetainResource, g as ccRoutedFinalSnapshotError, gn as MissingCdkCliError, gt as buildAssetRedirectMap, h as buildFinalSnapshotIdentifier, ht as WorkGraph, i as DeploymentEventsReader, in as getAwsClients, it as withRetry, j as red, jt as runDockerStreaming, k as gray, kn as withErrorHandling, kt as getDockerCmd, l as replayRollback, lt as LockManager, m as PRE_DELETE_SNAPSHOT_TYPES, mn as LocalStartServiceError, mt as stringifyValue, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nn as resolveBucketRegion, nt as DiffCalculator, o as planFailedOps, on as setAwsClients, ot as isThrottlingError, p as ATOMIC_FINAL_SNAPSHOT_TYPES, pn as LocalMigrateError, pt as AssetPublisher, q as resolveExplicitPhysicalId, qt as CFN_TEMPLATE_BODY_LIMIT, r as DeployEngine, rn as AwsClients, rt as describeTypeWithThrottleRetry, s as planRollback, st as DagBuilder, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as applyRoleArnIfSet, u as withResourceDeadline, ut as S3StateBackend, v as isFinalSnapshotError, vn as PartialFailureError, vt as loadPublishableAssetManifest, w as isStatefulRecreateTargetSync, wt as parseBootstrapMarker, x as makeCanonicalizePropertiesFn, xn as ResourceUpdateNotSupportedError, xt as BOOTSTRAP_MARKER_PREFIX, y as refusesFinalSnapshot, yn as ProvisioningError, yt as rewriteTemplateAssetReferences, z as slowCcOperationTimeoutMs, zt as resolveAutoAssetStorage } from "./deploy-engine-60FIug-P.js";
3
3
  import { a as getLiveRenderer, c as PATTERN_B_RESOURCE_TYPES, d as generateResourceNameWithFallback, f as withSkipPrefix, i as runStackBuffered, n as getLogger, o as PATTERN_B_NAME_OPTIONS, p as withStackName, s as PATTERN_B_NAME_PROPERTIES, u as generateResourceName } from "./logger-BYMEE-BS.js";
4
- import { t as ASGProvider } from "./asg-provider-DsxUvLEc.js";
4
+ import { t as ASGProvider } from "./asg-provider-Dpx4B6UA.js";
5
5
  import { AsyncLocalStorage } from "node:async_hooks";
6
6
  import { createHash, randomBytes, randomUUID } from "node:crypto";
7
7
  import { CopyObjectCommand, CreateBucketCommand, DeleteBucketAnalyticsConfigurationCommand, DeleteBucketCommand, DeleteBucketCorsCommand, DeleteBucketEncryptionCommand, DeleteBucketIntelligentTieringConfigurationCommand, DeleteBucketInventoryConfigurationCommand, DeleteBucketLifecycleCommand, DeleteBucketMetricsConfigurationCommand, DeleteBucketOwnershipControlsCommand, DeleteBucketPolicyCommand, DeleteBucketReplicationCommand, DeleteBucketTaggingCommand, DeleteBucketWebsiteCommand, DeleteObjectsCommand, GetBucketAccelerateConfigurationCommand, GetBucketCorsCommand, GetBucketEncryptionCommand, GetBucketLifecycleConfigurationCommand, GetBucketLocationCommand, GetBucketLoggingCommand, GetBucketNotificationConfigurationCommand, GetBucketOwnershipControlsCommand, GetBucketPolicyCommand, GetBucketReplicationCommand, GetBucketTaggingCommand, GetBucketVersioningCommand, GetBucketWebsiteCommand, GetObjectCommand, GetObjectLockConfigurationCommand, GetPublicAccessBlockCommand, HeadBucketCommand, ListBucketAnalyticsConfigurationsCommand, ListBucketIntelligentTieringConfigurationsCommand, ListBucketInventoryConfigurationsCommand, ListBucketMetricsConfigurationsCommand, ListObjectVersionsCommand, ListObjectsV2Command, NoSuchBucket, PutBucketAccelerateConfigurationCommand, PutBucketAnalyticsConfigurationCommand, PutBucketCorsCommand, PutBucketEncryptionCommand, PutBucketIntelligentTieringConfigurationCommand, PutBucketInventoryConfigurationCommand, PutBucketLifecycleConfigurationCommand, PutBucketLoggingCommand, PutBucketMetricsConfigurationCommand, PutBucketNotificationConfigurationCommand, PutBucketOwnershipControlsCommand, PutBucketPolicyCommand, PutBucketReplicationCommand, PutBucketTaggingCommand, PutBucketVersioningCommand, PutBucketWebsiteCommand, PutObjectCommand, PutObjectLockConfigurationCommand, PutPublicAccessBlockCommand, S3Client, S3ServiceException } from "@aws-sdk/client-s3";
@@ -17949,6 +17949,47 @@ var EventBridgeBusProvider = class {
17949
17949
  //#endregion
17950
17950
  //#region src/provisioning/providers/ec2-provider.ts
17951
17951
  /**
17952
+ * The `AWS::EC2::Route` destination keys, in CloudFormation's own precedence
17953
+ * order — which is also the order `createRoute`'s
17954
+ * `DestinationCidrBlock || DestinationIpv6CidrBlock || DestinationPrefixListId`
17955
+ * chain resolves them.
17956
+ */
17957
+ const ROUTE_DESTINATION_KEYS = [
17958
+ "DestinationCidrBlock",
17959
+ "DestinationIpv6CidrBlock",
17960
+ "DestinationPrefixListId"
17961
+ ];
17962
+ /**
17963
+ * Split a Route property bag into the destination keys it DECLARES and the bag
17964
+ * carrying only the one that would actually be sent (issue #1591).
17965
+ *
17966
+ * ONE source for a decision two very different call sites have to agree on: the
17967
+ * provisioning path (`createRoute`, which narrows and warns) and the DIFF path
17968
+ * (the engine's canonicalizer, which must not report the losers as a change).
17969
+ * If those two disagreed the fix would be worse than the bug — state and
17970
+ * template would each be narrowed to a different key.
17971
+ *
17972
+ * The winner is simply `declared[0]`. That is not a shortcut: the list is built
17973
+ * in the same order and with the same truthiness predicate as the `||` chain,
17974
+ * so the first declared key IS what the chain resolves to. The predicate is
17975
+ * `Boolean`, not a hand-listed `undefined | null | ''` set, because the bag is
17976
+ * `unknown`-valued at runtime — an unquoted YAML `0` must be skipped by the
17977
+ * narrowing exactly as the chain skips it, or the two disagree on which key
17978
+ * was sent.
17979
+ *
17980
+ * `narrowed` is always a fresh object: the caller's bag is the engine's
17981
+ * `resolvedProps`, which it records for every resource that does NOT narrow.
17982
+ */
17983
+ function narrowRouteDestinations(properties) {
17984
+ const declared = ROUTE_DESTINATION_KEYS.filter((key) => Boolean(properties[key]));
17985
+ const narrowed = { ...properties };
17986
+ for (const losingKey of declared.slice(1)) delete narrowed[losingKey];
17987
+ return {
17988
+ declared,
17989
+ narrowed
17990
+ };
17991
+ }
17992
+ /**
17952
17993
  * AWS EC2 Networking Provider
17953
17994
  *
17954
17995
  * Implements resource provisioning for EC2 networking resources:
@@ -18796,15 +18837,15 @@ var EC2Provider = class {
18796
18837
  const destinationPrefixListId = properties["DestinationPrefixListId"];
18797
18838
  const destination = destinationCidrBlock || destinationIpv6CidrBlock || destinationPrefixListId;
18798
18839
  if (!routeTableId || !destination) throw new ProvisioningError(`RouteTableId and one of DestinationCidrBlock/DestinationIpv6CidrBlock/DestinationPrefixListId are required for Route ${logicalId}`, resourceType, logicalId);
18799
- const declaredDestinations = [
18800
- ["DestinationCidrBlock", destinationCidrBlock],
18801
- ["DestinationIpv6CidrBlock", destinationIpv6CidrBlock],
18802
- ["DestinationPrefixListId", destinationPrefixListId]
18803
- ].filter(([, value]) => Boolean(value)).map(([key]) => key);
18840
+ const { declared: declaredDestinations, narrowed: narrowedProperties } = narrowRouteDestinations(properties);
18841
+ let effectiveProperties;
18804
18842
  if (declaredDestinations.length > 1) {
18805
18843
  const message = `Route ${logicalId} declares more than one destination (${declaredDestinations.join(", ")}). CloudFormation and EC2 accept exactly one of DestinationCidrBlock/DestinationIpv6CidrBlock/DestinationPrefixListId; remove the extra keys from the template.`;
18806
- if (onMultipleDestinations) onMultipleDestinations(`${message} Continuing with ${destination === destinationCidrBlock ? "DestinationCidrBlock" : destination === destinationIpv6CidrBlock ? "DestinationIpv6CidrBlock" : "DestinationPrefixListId"} and ignoring the rest.`);
18807
- else throw new ProvisioningError(message, resourceType, logicalId);
18844
+ if (onMultipleDestinations) {
18845
+ const usedKey = declaredDestinations[0];
18846
+ effectiveProperties = narrowedProperties;
18847
+ onMultipleDestinations(`${message} Continuing with ${usedKey} and ignoring the rest.`);
18848
+ } else throw new ProvisioningError(message, resourceType, logicalId);
18808
18849
  }
18809
18850
  try {
18810
18851
  await this.ec2Client.send(new CreateRouteCommand({
@@ -18826,7 +18867,8 @@ var EC2Provider = class {
18826
18867
  this.logger.debug(`Successfully created Route ${logicalId}: ${physicalId}`);
18827
18868
  return {
18828
18869
  physicalId,
18829
- attributes: {}
18870
+ attributes: {},
18871
+ ...effectiveProperties && { effectiveProperties }
18830
18872
  };
18831
18873
  } catch (error) {
18832
18874
  const cause = error instanceof Error ? error : void 0;
@@ -18845,7 +18887,8 @@ var EC2Provider = class {
18845
18887
  return {
18846
18888
  physicalId: createResult.physicalId,
18847
18889
  wasReplaced: true,
18848
- ...createResult.attributes && { attributes: createResult.attributes }
18890
+ ...createResult.attributes && { attributes: createResult.attributes },
18891
+ ...createResult.effectiveProperties && { effectiveProperties: createResult.effectiveProperties }
18849
18892
  };
18850
18893
  } catch (error) {
18851
18894
  if (error instanceof CdkdError) throw error;
@@ -20249,6 +20292,26 @@ var EC2Provider = class {
20249
20292
  default: return [];
20250
20293
  }
20251
20294
  }
20295
+ /**
20296
+ * The diff-side half of the Route multi-destination narrowing (issue #1591).
20297
+ *
20298
+ * `createRoute` sends exactly one destination key and reports the narrowed
20299
+ * bag via `effectiveProperties`, so state carries one key. Without the same
20300
+ * narrowing here the template's extra keys read as an ADDED property on the
20301
+ * next deploy — and every destination key is create-only in the registry
20302
+ * schema, so the diff would classify a REPLACEMENT and the engine's
20303
+ * replacement create (which passes no context, and so gets no
20304
+ * `onMultipleDestinations` downgrade) would hit the #1566 refusal. A
20305
+ * previously-green no-op deploy would start failing.
20306
+ *
20307
+ * Shares `narrowRouteDestinations` with the provisioning path so the two
20308
+ * cannot disagree about which key survives.
20309
+ */
20310
+ canonicalizeDesiredProperties(resourceType, properties) {
20311
+ if (resourceType !== "AWS::EC2::Route") return properties;
20312
+ const { declared, narrowed } = narrowRouteDestinations(properties);
20313
+ return declared.length > 1 ? narrowed : properties;
20314
+ }
20252
20315
  async readVpcCurrentState(physicalId) {
20253
20316
  const vpc = (await this.ec2Client.send(new DescribeVpcsCommand({ VpcIds: [physicalId] }))).Vpcs?.[0];
20254
20317
  if (!vpc) return void 0;
@@ -51274,7 +51337,7 @@ async function loadStateOrEmpty(stackName, region, stateBackend) {
51274
51337
  * Pure with respect to AWS state mutation — only reads state (the resolver
51275
51338
  * may read producer state for `Fn::ImportValue` / `Fn::GetStackOutput`).
51276
51339
  */
51277
- async function computeStackDiff(currentState, template, region, stackName, stateBackend, diffCalculator, parameters) {
51340
+ async function computeStackDiff(currentState, template, region, stackName, stateBackend, diffCalculator, parameters, canonicalizeProperties) {
51278
51341
  const intrinsicResolver = new IntrinsicFunctionResolver(region);
51279
51342
  let mergedParameters = parameters;
51280
51343
  let parametersBound = false;
@@ -51314,7 +51377,7 @@ async function computeStackDiff(currentState, template, region, stackName, state
51314
51377
  ...mergedParameters && { parameters: mergedParameters },
51315
51378
  ...conditions && { conditions }
51316
51379
  });
51317
- return diffCalculator.calculateDiff(currentState, effectiveTemplate, resolveFn);
51380
+ return diffCalculator.calculateDiff(currentState, effectiveTemplate, resolveFn, canonicalizeProperties);
51318
51381
  }
51319
51382
  /**
51320
51383
  * Resolve a nested-stack child's input `Parameters` (declared on the parent's
@@ -51375,13 +51438,13 @@ async function resolveChildStackParameters(parentStackRow, parentTemplate, paren
51375
51438
  * fail at deploy time.
51376
51439
  */
51377
51440
  async function buildDiffTree(args) {
51378
- const { stackName, displayName, region, template, nestedTemplates, recursive, stateBackend, diffCalculator, parameters, assetRedirect } = args;
51441
+ const { stackName, displayName, region, template, nestedTemplates, recursive, stateBackend, diffCalculator, parameters, canonicalizeProperties, assetRedirect } = args;
51379
51442
  const state = await loadStateOrEmpty(stackName, region, stateBackend);
51380
51443
  const node = {
51381
51444
  stackName,
51382
51445
  displayName,
51383
51446
  region,
51384
- changes: await computeStackDiff(state, template, region, stackName, stateBackend, diffCalculator, parameters),
51447
+ changes: await computeStackDiff(state, template, region, stackName, stateBackend, diffCalculator, parameters, canonicalizeProperties),
51385
51448
  ccApiRoutes: collectCcApiRoutes(template, state),
51386
51449
  children: []
51387
51450
  };
@@ -51407,6 +51470,7 @@ async function buildDiffTree(args) {
51407
51470
  stateBackend,
51408
51471
  diffCalculator,
51409
51472
  parameters: childParameters,
51473
+ ...canonicalizeProperties && { canonicalizeProperties },
51410
51474
  ...assetRedirect && { assetRedirect }
51411
51475
  }));
51412
51476
  }
@@ -51764,6 +51828,9 @@ async function diffCommand(stacks, options) {
51764
51828
  ...options.profile && { profile: options.profile }
51765
51829
  });
51766
51830
  const diffCalculator = new DiffCalculator();
51831
+ const diffProviderRegistry = new ProviderRegistry();
51832
+ registerAllProviders(diffProviderRegistry);
51833
+ const canonicalizeProperties = makeCanonicalizePropertiesFn(diffProviderRegistry);
51767
51834
  const recursive = options.recursive ?? false;
51768
51835
  const resolveAssetRedirect = createAssetRedirectResolver({
51769
51836
  stateBackend,
@@ -51790,6 +51857,7 @@ async function diffCommand(stacks, options) {
51790
51857
  recursive,
51791
51858
  stateBackend,
51792
51859
  diffCalculator,
51860
+ canonicalizeProperties,
51793
51861
  ...assetRedirect && { assetRedirect }
51794
51862
  }));
51795
51863
  }
@@ -70273,7 +70341,7 @@ function createMigrateCommand() {
70273
70341
  */
70274
70342
  function buildProgram() {
70275
70343
  const program = new Command();
70276
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.280.23");
70344
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.280.24");
70277
70345
  program.hook("preAction", (_thisCommand, actionCommand) => {
70278
70346
  const { profile } = actionCommand.optsWithGlobals();
70279
70347
  if (profile !== void 0) process.env["AWS_PROFILE"] = profile;