@go-to-k/cdkd 0.269.1 → 0.269.3

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-DVP0nckx.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-B-igYtBj.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-DoeGv39F.js";
4
+ import { t as ASGProvider } from "./asg-provider-D-XHoXeI.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";
@@ -14935,7 +14935,7 @@ var EC2Provider = class {
14935
14935
  async applyUpdate(logicalId, physicalId, resourceType, properties, previousProperties) {
14936
14936
  switch (resourceType) {
14937
14937
  case "AWS::EC2::VPC": return this.updateVpc(logicalId, physicalId, resourceType, properties, previousProperties);
14938
- case "AWS::EC2::Subnet": return this.updateSubnet(logicalId, physicalId);
14938
+ case "AWS::EC2::Subnet": return this.updateSubnet(logicalId, physicalId, resourceType, properties, previousProperties);
14939
14939
  case "AWS::EC2::InternetGateway": return this.updateInternetGateway(logicalId, physicalId);
14940
14940
  case "AWS::EC2::EIP": return this.updateEip(logicalId, physicalId, properties, previousProperties);
14941
14941
  case "AWS::EC2::VPCGatewayAttachment": return this.updateVpcGatewayAttachment(logicalId, physicalId);
@@ -15157,10 +15157,13 @@ var EC2Provider = class {
15157
15157
  try {
15158
15158
  await this.applyTags(subnetId, properties, logicalId);
15159
15159
  const mapPublicIp = properties["MapPublicIpOnLaunch"];
15160
- if (mapPublicIp === true || mapPublicIp === "true") await this.ec2Client.send(new ModifySubnetAttributeCommand({
15161
- SubnetId: subnetId,
15162
- MapPublicIpOnLaunch: { Value: true }
15163
- }));
15160
+ if (mapPublicIp === true || mapPublicIp === "true") {
15161
+ await this.ec2Client.send(new ModifySubnetAttributeCommand({
15162
+ SubnetId: subnetId,
15163
+ MapPublicIpOnLaunch: { Value: true }
15164
+ }));
15165
+ await this.waitForSubnetMapPublicIp(subnetId, true);
15166
+ }
15164
15167
  } catch (innerError) {
15165
15168
  try {
15166
15169
  await this.ec2Client.send(new DeleteSubnetCommand({ SubnetId: subnetId }));
@@ -15183,8 +15186,66 @@ var EC2Provider = class {
15183
15186
  throw new ProvisioningError(`Failed to create Subnet ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, void 0, cause);
15184
15187
  }
15185
15188
  }
15186
- updateSubnet(logicalId, physicalId) {
15187
- return Promise.reject(new ResourceUpdateNotSupportedError("AWS::EC2::Subnet", logicalId, "destroy + redeploy the Subnet (and the resources that depend on it). Subnet properties are immutable in AWS."));
15189
+ async updateSubnet(logicalId, physicalId, resourceType, properties, previousProperties) {
15190
+ this.logger.debug(`Updating Subnet ${logicalId}: ${physicalId}`);
15191
+ try {
15192
+ for (const createOnly of [
15193
+ "VpcId",
15194
+ "CidrBlock",
15195
+ "AvailabilityZone"
15196
+ ]) {
15197
+ const next = properties[createOnly];
15198
+ const prev = previousProperties[createOnly];
15199
+ if (next !== void 0 && prev !== void 0 && next !== prev) throw new ResourceUpdateNotSupportedError(resourceType, logicalId, `destroy + redeploy the Subnet (and the resources that depend on it). ${createOnly} is immutable in AWS`);
15200
+ }
15201
+ const asBool = (v) => v === true || v === "true";
15202
+ const newMapPublicIp = asBool(properties["MapPublicIpOnLaunch"]);
15203
+ if (newMapPublicIp !== asBool(previousProperties["MapPublicIpOnLaunch"])) {
15204
+ await this.ec2Client.send(new ModifySubnetAttributeCommand({
15205
+ SubnetId: physicalId,
15206
+ MapPublicIpOnLaunch: { Value: newMapPublicIp }
15207
+ }));
15208
+ await this.waitForSubnetMapPublicIp(physicalId, newMapPublicIp);
15209
+ }
15210
+ await this.applyTagDiff(physicalId, previousProperties["Tags"], properties["Tags"]);
15211
+ this.logger.debug(`Successfully updated Subnet ${logicalId}`);
15212
+ return {
15213
+ physicalId,
15214
+ wasReplaced: false
15215
+ };
15216
+ } catch (error) {
15217
+ if (error instanceof CdkdError) throw error;
15218
+ const cause = error instanceof Error ? error : void 0;
15219
+ throw new ProvisioningError(`Failed to update Subnet ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
15220
+ }
15221
+ }
15222
+ /**
15223
+ * Read back `MapPublicIpOnLaunch` until AWS reflects the value a
15224
+ * `ModifySubnetAttribute` just wrote (issue #1299). EC2 `Describe*` is
15225
+ * eventually consistent, so the deploy engine's async observed-state
15226
+ * capture (`kickOffObservedCapture` → `readCurrentState` →
15227
+ * `DescribeSubnets`), which fires milliseconds after `create()` /
15228
+ * `update()` returns, could read the STALE pre-modify value and persist
15229
+ * it as the drift baseline — every later `cdkd drift` then reported
15230
+ * phantom `MapPublicIpOnLaunch` drift on a resource nothing touched.
15231
+ *
15232
+ * Bounded and best-effort: the first read usually already reflects the
15233
+ * write (zero added latency beyond one DescribeSubnets round trip); on
15234
+ * exhaustion we log and return — behavior then degrades to the pre-fix
15235
+ * race instead of failing a deploy over a read-side consistency lag.
15236
+ */
15237
+ async waitForSubnetMapPublicIp(subnetId, expected) {
15238
+ const maxAttempts = 6;
15239
+ for (let attempt = 1; attempt <= maxAttempts; attempt++) {
15240
+ try {
15241
+ if ((await this.ec2Client.send(new DescribeSubnetsCommand({ SubnetIds: [subnetId] }))).Subnets?.[0]?.MapPublicIpOnLaunch === expected) return;
15242
+ } catch (error) {
15243
+ this.logger.debug(`MapPublicIpOnLaunch read-back for ${subnetId} failed (attempt ${attempt}/${maxAttempts}): ${error instanceof Error ? error.message : String(error)}`);
15244
+ return;
15245
+ }
15246
+ if (attempt < maxAttempts) await this.sleep(100 * 2 ** (attempt - 1));
15247
+ }
15248
+ this.logger.debug(`MapPublicIpOnLaunch=${expected} not yet visible on ${subnetId} after ${maxAttempts} reads — the observed-state capture may record the stale value (issue #1299)`);
15188
15249
  }
15189
15250
  async deleteSubnet(logicalId, physicalId, resourceType, context) {
15190
15251
  this.logger.debug(`Deleting Subnet ${logicalId}: ${physicalId}`);
@@ -16956,9 +17017,12 @@ var EC2Provider = class {
16956
17017
  *
16957
17018
  * Other EC2 types (`VPC` / `Subnet` / `InternetGateway` /
16958
17019
  * `NatGateway` / `RouteTable` / `SecurityGroup` / `Instance` /
16959
- * `NetworkAcl`) have first-class Tags support via
16960
- * `DescribeTags` they surface `Tags` directly in
16961
- * `readCurrentState` and don't need this declaration.
17020
+ * `NetworkAcl`) have first-class Tags support on the WRITE side
17021
+ * (create/update tag wiring) and don't need this declaration.
17022
+ * NOTE: `readVpcCurrentState` / `readSubnetCurrentState` do NOT
17023
+ * currently surface `Tags`, so Tags drift on those types is out of
17024
+ * v1 drift scope — `AWS::EC2::Subnet`'s `updateableProperties:
17025
+ * Tags` entry serves only the template-update path today.
16962
17026
  */
16963
17027
  getDriftUnknownPaths(resourceType) {
16964
17028
  switch (resourceType) {
@@ -42148,7 +42212,7 @@ async function runDestroyForStack(stackName, state, ctx) {
42148
42212
  const retainedSuffix = result.retainedCount > 0 ? `, ${result.retainedCount} retained` : "";
42149
42213
  if (!preserveState) logger.info(`\n${green("✓")} ${bold(`Stack ${stackName} destroyed`)} (${green(result.deletedCount)} deleted${retainedSuffix}, ${result.errorCount} errors)`);
42150
42214
  else if (result.interrupted && result.errorCount === 0) logger.warn(`\n${yellow("⚠")} ${bold(`Stack ${stackName} destroy interrupted`)} (${green(result.deletedCount)} deleted${retainedSuffix}, ${result.errorCount} errors). State preserved — re-run 'cdkd destroy' / 'cdkd state destroy' to finish.`);
42151
- else logger.warn(`\n${yellow("⚠")} ${bold(`Stack ${stackName} partially destroyed`)} (${green(result.deletedCount)} deleted${retainedSuffix}, ${red(result.errorCount)} errors). State preserved — re-run 'cdkd destroy' / 'cdkd state destroy' to clean up.`);
42215
+ else logger.warn(`\n${yellow("⚠")} ${bold(`Stack ${stackName} partially destroyed`)} (${green(result.deletedCount)} deleted${retainedSuffix}, ${red(result.errorCount)} errors). State preserved — re-run 'cdkd destroy' / 'cdkd state destroy' to clean up. If the same resource keeps failing, 'cdkd state orphan ${stackName}' is the last resort: it removes the state record without deleting AWS resources.`);
42152
42216
  } finally {
42153
42217
  process.removeListener("SIGINT", sigintHandler);
42154
42218
  renderer.stop();
@@ -46416,7 +46480,7 @@ async function destroyCommand(stackArgs, options) {
46416
46480
  }, logger);
46417
46481
  if (interrupted) break;
46418
46482
  }
46419
- if (totalErrors > 0) throw new PartialFailureError(`Destroy completed with ${totalErrors} resource error(s). State preserved — inspect 'cdkd state show <stack>' and re-run 'cdkd destroy' to retry.`);
46483
+ if (totalErrors > 0) throw new PartialFailureError(`Destroy completed with ${totalErrors} resource error(s). State preserved — inspect 'cdkd state show <stack>' and re-run 'cdkd destroy' to retry. If the same resource keeps failing, 'cdkd state orphan <stack>' removes the state record without deleting AWS resources.`);
46420
46484
  if (interrupted) throw new PartialFailureError(`Destroy interrupted by Ctrl-C. State preserved — re-run 'cdkd destroy' to finish.`);
46421
46485
  } finally {
46422
46486
  awsClients.destroy();
@@ -49873,7 +49937,7 @@ async function stateDestroyCommand(stackArgs, options) {
49873
49937
  }
49874
49938
  if (interrupted) break;
49875
49939
  }
49876
- if (totalErrors > 0) throw new PartialFailureError(`Destroy completed with ${totalErrors} resource error(s). State preserved — inspect 'cdkd state show <stack>' and re-run 'cdkd state destroy' to retry.`);
49940
+ if (totalErrors > 0) throw new PartialFailureError(`Destroy completed with ${totalErrors} resource error(s). State preserved — inspect 'cdkd state show <stack>' and re-run 'cdkd state destroy' to retry. If the same resource keeps failing, 'cdkd state orphan <stack>' removes the state record without deleting AWS resources.`);
49877
49941
  if (interrupted) throw new PartialFailureError(`Destroy interrupted by Ctrl-C. State preserved — re-run 'cdkd state destroy' to finish.`);
49878
49942
  } finally {
49879
49943
  setup.dispose();
@@ -62870,7 +62934,7 @@ function createMigrateCommand() {
62870
62934
  */
62871
62935
  function buildProgram() {
62872
62936
  const program = new Command();
62873
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.269.1");
62937
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.269.3");
62874
62938
  program.hook("preAction", (_thisCommand, actionCommand) => {
62875
62939
  const { profile } = actionCommand.optsWithGlobals();
62876
62940
  if (profile !== void 0) process.env["AWS_PROFILE"] = profile;