@go-to-k/cdkd 0.268.3 → 0.268.4

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 WorkGraph, A as slowCcOperationTimeoutMs, At as warnDeprecatedNoPrefixCliFlag, B as applyRoleArnIfSet, Bt as resolveBucketRegion, C as yellow, Ct as resolveAutoAssetStorage, D as ProviderRegistry, Dt as resolveStateBucketWithDefaultAndSource, E as clearOnUpdateRemoval, Et as resolveStateBucketWithDefault, F as refStateLookupFromResource, Ft as uploadCfnTemplate, G as DagBuilder, H as describeTypeWithThrottleRetry, Ht as getAwsClients, I as WAFv2WebACLProvider, It as expectedOwnerParam, J as S3StateBackend, K as TemplateParser, Kt as CdkdError, L as normalizeAwsTagsToCfn, Lt as AssemblyReader, M as isTerminationProtectionPropagationError, Mt as CFN_TEMPLATE_URL_LIMIT, N as IntrinsicFunctionResolver, Nt as MIGRATE_TMP_PREFIX, O as findActionableSilentDrops, Ot as resolveUseCdkBootstrapAssets, P as cfnRefValueFromPhysicalId, Pt as findLargeInlineResources, Q as stringifyValue, Qt as LocalStartServiceError, R as resolveExplicitPhysicalId, Rt as processStackMessages, S as red, St as resolveApp, T as collectInlinePolicyNamesManagedBySiblings, Tt as resolveSkipPrefix, U as withRetry, Ut as resetAwsClients, V as DiffCalculator, Vt as AwsClients, W as isRetryableTransientError, Wt as setAwsClients, X as shouldRetainResource, Xt as LocalInvokeBuildError$1, Y as rebuildClientForBucketRegion, Yt as DeployCancelledError, Z as AssetPublisher, Zt as LocalMigrateError, _ as formatResourceLine, _t as getDockerImageBySourceHash, a as DeploymentEventsStore, an as ResourceUpdateNotSupportedError, at as BOOTSTRAP_MARKER_PREFIX, b as gray, bt as getDefaultStateBucketName, c as replayFailedOperations, ct as parseBootstrapMarker, d as IMPLICIT_DELETE_DEPENDENCIES, dt as buildDockerImage, en as MissingCdkCliError, et as buildAssetRedirectMap, f as computeImplicitDeleteEdges, fn as normalizeAwsError, ft as formatDockerLoginError, g as renderStatefulReason, gt as AssetManifestLoader, h as isStatefulRecreateTargetSync, ht as runDockerStreaming, i as DeploymentEventsReader, in as ResourceTimeoutError, it as AssetModeResolver, j as disableInstanceApiTermination, jt as CFN_TEMPLATE_BODY_LIMIT, k as CloudControlProvider, kt as stateBucketExistenceConfirmed, l as replayRollback, lt as validateAssetBucketName, m as MULTI_REGION_RECREATE_BLOCKED_TYPES, mt as runDockerForeground, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nn as PartialFailureError, nt as loadPublishableAssetManifest, o as planFailedOps, on as StackHasActiveImportsError, ot as ensureAssetStorage, p as extractDeploymentEventError, pn as withErrorHandling, pt as getDockerCmd, q as LockManager, r as DeployEngine, rn as ProvisioningError, rt as rewriteTemplateAssetReferences, s as planRollback, sn as StackTerminationProtectionError, st as getBootstrapMarkerKey, t as DEFAULT_RESOURCE_TIMEOUT_MS, tn as NestedStackChildDirectDestroyError, tt as createAssetRedirectResolver, u as withResourceDeadline, ut as validateContainerRepoName, v as bold, vt as Synthesizer, w as IAMRoleProvider, wt as resolveCaptureObservedState, x as green, xt as getLegacyStateBucketName, y as cyan, yt as synthesisStatusMessage, z as assertRegionMatch } from "./deploy-engine-DEi5-8x-.js";
2
+ import { $ as WorkGraph, A as slowCcOperationTimeoutMs, At as warnDeprecatedNoPrefixCliFlag, B as applyRoleArnIfSet, Bt as resolveBucketRegion, C as yellow, Ct as resolveAutoAssetStorage, D as ProviderRegistry, Dt as resolveStateBucketWithDefaultAndSource, E as clearOnUpdateRemoval, Et as resolveStateBucketWithDefault, F as refStateLookupFromResource, Ft as uploadCfnTemplate, G as DagBuilder, H as describeTypeWithThrottleRetry, Ht as getAwsClients, I as WAFv2WebACLProvider, It as expectedOwnerParam, J as S3StateBackend, K as TemplateParser, Kt as CdkdError, L as normalizeAwsTagsToCfn, Lt as AssemblyReader, M as isTerminationProtectionPropagationError, Mt as CFN_TEMPLATE_URL_LIMIT, N as IntrinsicFunctionResolver, Nt as MIGRATE_TMP_PREFIX, O as findActionableSilentDrops, Ot as resolveUseCdkBootstrapAssets, P as cfnRefValueFromPhysicalId, Pt as findLargeInlineResources, Q as stringifyValue, Qt as LocalStartServiceError, R as resolveExplicitPhysicalId, Rt as processStackMessages, S as red, St as resolveApp, T as collectInlinePolicyNamesManagedBySiblings, Tt as resolveSkipPrefix, U as withRetry, Ut as resetAwsClients, V as DiffCalculator, Vt as AwsClients, W as isRetryableTransientError, Wt as setAwsClients, X as shouldRetainResource, Xt as LocalInvokeBuildError$1, Y as rebuildClientForBucketRegion, Yt as DeployCancelledError, Z as AssetPublisher, Zt as LocalMigrateError, _ as formatResourceLine, _t as getDockerImageBySourceHash, a as DeploymentEventsStore, an as ResourceUpdateNotSupportedError, at as BOOTSTRAP_MARKER_PREFIX, b as gray, bt as getDefaultStateBucketName, c as replayFailedOperations, ct as parseBootstrapMarker, d as IMPLICIT_DELETE_DEPENDENCIES, dt as buildDockerImage, en as MissingCdkCliError, et as buildAssetRedirectMap, f as computeImplicitDeleteEdges, fn as normalizeAwsError, ft as formatDockerLoginError, g as renderStatefulReason, gt as AssetManifestLoader, h as isStatefulRecreateTargetSync, ht as runDockerStreaming, i as DeploymentEventsReader, in as ResourceTimeoutError, it as AssetModeResolver, j as disableInstanceApiTermination, jt as CFN_TEMPLATE_BODY_LIMIT, k as CloudControlProvider, kt as stateBucketExistenceConfirmed, l as replayRollback, lt as validateAssetBucketName, m as MULTI_REGION_RECREATE_BLOCKED_TYPES, mt as runDockerForeground, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nn as PartialFailureError, nt as loadPublishableAssetManifest, o as planFailedOps, on as StackHasActiveImportsError, ot as ensureAssetStorage, p as extractDeploymentEventError, pn as withErrorHandling, pt as getDockerCmd, q as LockManager, r as DeployEngine, rn as ProvisioningError, rt as rewriteTemplateAssetReferences, s as planRollback, sn as StackTerminationProtectionError, st as getBootstrapMarkerKey, t as DEFAULT_RESOURCE_TIMEOUT_MS, tn as NestedStackChildDirectDestroyError, tt as createAssetRedirectResolver, u as withResourceDeadline, ut as validateContainerRepoName, v as bold, vt as Synthesizer, w as IAMRoleProvider, wt as resolveCaptureObservedState, x as green, xt as getLegacyStateBucketName, y as cyan, yt as synthesisStatusMessage, z as assertRegionMatch } from "./deploy-engine--qUEKkTR.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-bxS6B6Ja.js";
4
+ import { t as ASGProvider } from "./asg-provider-iWNOeyib.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, DeleteBucketIntelligentTieringConfigurationCommand, DeleteBucketInventoryConfigurationCommand, DeleteBucketLifecycleCommand, DeleteBucketMetricsConfigurationCommand, DeleteBucketPolicyCommand, DeleteBucketReplicationCommand, DeleteBucketTaggingCommand, DeleteBucketWebsiteCommand, DeleteObjectsCommand, GetBucketAccelerateConfigurationCommand, GetBucketCorsCommand, GetBucketEncryptionCommand, GetBucketLifecycleConfigurationCommand, GetBucketLocationCommand, GetBucketLoggingCommand, GetBucketNotificationConfigurationCommand, 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";
@@ -404,6 +404,28 @@ function validateWaitFlags(opts) {
404
404
  if (opts.wait === false && opts.fullWait === true) throw new Error("--no-wait and --full-wait cannot be combined: --no-wait skips stabilization waits, --full-wait adds them. Pick one.");
405
405
  }
406
406
  /**
407
+ * Validate the wait-flag pair and project it onto the process env the
408
+ * providers read. One helper instead of three separate lines in deploy.ts
409
+ * so the validation, the two mode envs, and the availability marker cannot
410
+ * drift apart individually (issue #1291 item 6 — the wiring had no unit
411
+ * coverage because it lived inline in the deploy command's action).
412
+ *
413
+ * - `CDKD_NO_WAIT` — set when `--no-wait` was passed; providers skip
414
+ * convenience stabilization waits.
415
+ * - `CDKD_FULL_WAIT` — set when `--full-wait` was passed; providers add
416
+ * the CloudFormation-side waits cdkd skips by default.
417
+ * - `CDKD_WAIT_FLAGS_AVAILABLE` — set unconditionally by commands that
418
+ * DECLARE the wait flags (today: deploy). Providers gate flag-mentioning
419
+ * hints on it, so `cdkd drift --revert` reaching the same provider code
420
+ * never advertises a flag drift does not accept (issue #1291 item 1).
421
+ */
422
+ function applyWaitFlagEnv(opts) {
423
+ validateWaitFlags(opts);
424
+ process.env["CDKD_WAIT_FLAGS_AVAILABLE"] = "true";
425
+ if (opts.wait === false) process.env["CDKD_NO_WAIT"] = "true";
426
+ if (opts.fullWait === true) process.env["CDKD_FULL_WAIT"] = "true";
427
+ }
428
+ /**
407
429
  * Drop the CDK-injected defensive `DependsOn` edges from VPC Lambdas (and
408
430
  * adjacent IAM Role / Policy / Lambda::Url / EventSourceMapping resources)
409
431
  * onto the private subnet's `DefaultRoute` / `RouteTableAssociation`. CDK
@@ -8446,7 +8468,9 @@ var LambdaFunctionProvider = class {
8446
8468
  try {
8447
8469
  await waitUntilFunctionUpdatedV2({
8448
8470
  client: this.lambdaClient,
8449
- maxWaitTime: this.functionUpdateMaxWaitSeconds
8471
+ maxWaitTime: this.functionUpdateMaxWaitSeconds,
8472
+ minDelay: 1,
8473
+ maxDelay: 5
8450
8474
  }, { FunctionName: functionName });
8451
8475
  } catch (error) {
8452
8476
  const cause = error instanceof Error ? error : void 0;
@@ -16979,6 +17003,15 @@ var EC2Provider = class {
16979
17003
  }
16980
17004
  if (instance.Placement?.Tenancy !== void 0) result["Tenancy"] = instance.Placement.Tenancy;
16981
17005
  if (instance.IamInstanceProfile?.Arn !== void 0) result["IamInstanceProfile"] = instance.IamInstanceProfile.Arn;
17006
+ else if (process.env["CDKD_NO_WAIT"] === "true" && instance.State?.Name === "pending") try {
17007
+ const live = (await this.ec2Client.send(new DescribeIamInstanceProfileAssociationsCommand({ Filters: [{
17008
+ Name: "instance-id",
17009
+ Values: [physicalId]
17010
+ }] }))).IamInstanceProfileAssociations?.find((a) => a.State === "associated" || a.State === "associating");
17011
+ if (live?.IamInstanceProfile?.Arn !== void 0) result["IamInstanceProfile"] = live.IamInstanceProfile.Arn;
17012
+ } catch (error) {
17013
+ this.logger.warn(`Could not backfill IamInstanceProfile for ${physicalId} during the --no-wait capture (${error instanceof Error ? error.message : String(error)}); the field is omitted from the observed snapshot`);
17014
+ }
16982
17015
  const volumeIds = (instance.BlockDeviceMappings ?? []).filter((m) => m.Ebs?.VolumeId !== void 0).map((m) => m.Ebs.VolumeId);
16983
17016
  let volumesById = /* @__PURE__ */ new Map();
16984
17017
  if (volumeIds.length > 0) try {
@@ -22533,7 +22566,8 @@ var ECSProvider = class {
22533
22566
  return;
22534
22567
  }
22535
22568
  const clusterArg = cluster ? ` --cluster ${cluster}` : "";
22536
- this.logger.info(`ECS service ${logicalId} accepted (not waiting for steady state; pass --full-wait to wait). To wait manually: aws ecs wait services-stable${clusterArg} --services ${serviceRef}`);
22569
+ const fullWaitHint = process.env["CDKD_WAIT_FLAGS_AVAILABLE"] === "true" ? "; pass --full-wait to wait" : "";
22570
+ this.logger.info(`ECS service ${logicalId} accepted (not waiting for steady state${fullWaitHint}). To wait manually: aws ecs wait services-stable${clusterArg} --services ${serviceRef}`);
22537
22571
  }
22538
22572
  async updateService(logicalId, physicalId, resourceType, properties, previousProperties) {
22539
22573
  this.logger.debug(`Updating ECS service ${logicalId}: ${physicalId}`);
@@ -43079,13 +43113,11 @@ async function deployCommand(stacks, options) {
43079
43113
  }
43080
43114
  warnIfDeprecatedRegion(options);
43081
43115
  validateResourceTimeouts(options);
43082
- validateWaitFlags(options);
43116
+ applyWaitFlagEnv(options);
43083
43117
  await applyRoleArnIfSet({
43084
43118
  roleArn: options.roleArn,
43085
43119
  region: options.region
43086
43120
  });
43087
- if (!options.wait) process.env["CDKD_NO_WAIT"] = "true";
43088
- if (options.fullWait) process.env["CDKD_FULL_WAIT"] = "true";
43089
43121
  warnDeprecatedNoPrefixCliFlag();
43090
43122
  const skipPrefix = resolveSkipPrefix({ prefixUserSuppliedNames: options.prefixUserSuppliedNames });
43091
43123
  if (skipPrefix) logger.debug("Skipping stack-name prefix on user-supplied physical names (default since v0.94.0)");
@@ -43944,7 +43976,9 @@ async function retireCloudFormationStack(options) {
43944
43976
  }
43945
43977
  if (updateRan) await waitUntilStackUpdateComplete({
43946
43978
  client: cfnClient,
43947
- maxWaitTime: 1800
43979
+ maxWaitTime: 1800,
43980
+ minDelay: 5,
43981
+ maxDelay: 10
43948
43982
  }, { StackName: cfnStackName });
43949
43983
  } finally {
43950
43984
  const allCleanups = [...s3Cleanup ? [s3Cleanup] : [], ...nestedCleanups];
@@ -43960,7 +43994,9 @@ async function retireCloudFormationStack(options) {
43960
43994
  await cfnClient.send(new DeleteStackCommand({ StackName: cfnStackName }));
43961
43995
  await waitUntilStackDeleteComplete({
43962
43996
  client: cfnClient,
43963
- maxWaitTime: 1800
43997
+ maxWaitTime: 1800,
43998
+ minDelay: 5,
43999
+ maxDelay: 10
43964
44000
  }, { StackName: cfnStackName });
43965
44001
  logger.info(`✓ CloudFormation stack '${cfnStackName}' retired. AWS resources are now solely managed by cdkd.`);
43966
44002
  return { outcome: modified ? "retired" : "no-template-change" };
@@ -48153,7 +48189,9 @@ async function submitImportChangeSet(cfnClient, stackName, template, resourcesTo
48153
48189
  try {
48154
48190
  await waitUntilChangeSetCreateComplete({
48155
48191
  client: cfnClient,
48156
- maxWaitTime: 600
48192
+ maxWaitTime: 600,
48193
+ minDelay: 2,
48194
+ maxDelay: 5
48157
48195
  }, {
48158
48196
  StackName: stackName,
48159
48197
  ChangeSetName: changeSetName
@@ -48182,7 +48220,9 @@ async function submitImportChangeSet(cfnClient, stackName, template, resourcesTo
48182
48220
  }));
48183
48221
  await waitUntilStackImportComplete({
48184
48222
  client: cfnClient,
48185
- maxWaitTime: 3600
48223
+ maxWaitTime: 3600,
48224
+ minDelay: 5,
48225
+ maxDelay: 10
48186
48226
  }, { StackName: stackName });
48187
48227
  } catch (err) {
48188
48228
  const failureSummary = await collectImportFailureSummary(cfnClient, stackName).catch(() => "");
@@ -48282,7 +48322,9 @@ async function flipStackToUpdateComplete(cfnClient, cfnStackName, parameters) {
48282
48322
  }));
48283
48323
  await waitUntilStackUpdateComplete({
48284
48324
  client: cfnClient,
48285
- maxWaitTime: 1800
48325
+ maxWaitTime: 1800,
48326
+ minDelay: 5,
48327
+ maxDelay: 10
48286
48328
  }, { StackName: cfnStackName });
48287
48329
  }
48288
48330
  /**
@@ -48881,7 +48923,9 @@ async function executeUpdateChangeSet(cfnClient, stackName, template, parameters
48881
48923
  try {
48882
48924
  await waitUntilChangeSetCreateComplete({
48883
48925
  client: cfnClient,
48884
- maxWaitTime: 600
48926
+ maxWaitTime: 600,
48927
+ minDelay: 2,
48928
+ maxDelay: 5
48885
48929
  }, {
48886
48930
  StackName: stackName,
48887
48931
  ChangeSetName: changeSetName
@@ -48910,7 +48954,9 @@ async function executeUpdateChangeSet(cfnClient, stackName, template, parameters
48910
48954
  }));
48911
48955
  await waitUntilStackUpdateComplete({
48912
48956
  client: cfnClient,
48913
- maxWaitTime: 3600
48957
+ maxWaitTime: 3600,
48958
+ minDelay: 5,
48959
+ maxDelay: 10
48914
48960
  }, { StackName: stackName });
48915
48961
  } catch (err) {
48916
48962
  await cfnClient.send(new DeleteChangeSetCommand({
@@ -62725,7 +62771,7 @@ function createMigrateCommand() {
62725
62771
  */
62726
62772
  function buildProgram() {
62727
62773
  const program = new Command();
62728
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.268.3");
62774
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.268.4");
62729
62775
  program.hook("preAction", (_thisCommand, actionCommand) => {
62730
62776
  const { profile } = actionCommand.optsWithGlobals();
62731
62777
  if (profile !== void 0) process.env["AWS_PROFILE"] = profile;