@go-to-k/cdkd 0.281.11 → 0.281.13

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 replayWarn, $t as uploadCfnTemplate, A as green, An as normalizeAwsError, At as formatDockerLoginError, B as slowCcOperationTimeoutMs, Bt as resolveApp, C as MULTI_REGION_RECREATE_BLOCKED_TYPES, Cn as ResourceUpdateNotSupportedError, Ct as BOOTSTRAP_MARKER_PREFIX, D as bold, Dt as validateAssetBucketName, E as formatResourceLine, Et as parseBootstrapMarker, F as clearOnUpdateRemoval, Ft as getDockerImageBySourceHash, G as getAccountInfo, Gt as resolveStateBucketWithDefaultAndSource, H as isTerminationProtectionPropagationError, Ht as resolveCaptureObservedState, I as ProviderRegistry, It as Synthesizer, J as normalizeAwsTagsToCfn, Jt as warnDeprecatedNoPrefixCliFlag, K as refStateLookupFromResource, Kt as resolveUseCdkBootstrapAssets, L as findActionableSilentDrops, Lt as synthesisStatusMessage, M as yellow, Mt as runDockerForeground, N as IAMRoleProvider, Nt as runDockerStreaming, O as cyan, Ot as validateContainerRepoName, P as collectInlinePolicyNamesManagedBySiblings, Pt as AssetManifestLoader, Q as readConfigString, Qt as findLargeInlineResources, R as findSilentDropProperties, Rt as getDefaultStateBucketName, S as extractDeploymentEventError, Sn as ResourceTimeoutError, St as AssetModeResolver, T as renderStatefulReason, Tn as StackTerminationProtectionError, Tt as getBootstrapMarkerKey, U as IntrinsicFunctionResolver, Ut as resolveSkipPrefix, V as disableInstanceApiTermination, Vt as resolveAutoAssetStorage, W as cfnRefValueFromPhysicalId, Wt as resolveStateBucketWithDefault, X as assertRegionMatch, Xt as CFN_TEMPLATE_URL_LIMIT, Y as resolveExplicitPhysicalId, Yt as CFN_TEMPLATE_BODY_LIMIT, Z as configStringRefusal, Zt as MIGRATE_TMP_PREFIX, _ as createPreDeleteFinalSnapshot, _t as WorkGraph, a as DeploymentEventsStore, an as AwsClients, at as describeTypeWithThrottleRetry, b as unsupportedFinalSnapshotError, bn as PartialFailureError, bt as loadPublishableAssetManifest, c as replayFailedOperations, cn as setAwsClients, ct as isThrottlingError, d as IMPLICIT_DELETE_DEPENDENCIES, dt as LockManager, en as expectedOwnerParam, et as requireConfigArray, f as computeImplicitDeleteEdges, ft as S3StateBackend, g as ccRoutedFinalSnapshotError, gn as LocalStartServiceError, gt as stringifyValue, h as buildFinalSnapshotIdentifier, hn as LocalMigrateError, ht as AssetPublisher, i as DeploymentEventsReader, in as resolveBucketRegion, it as DiffCalculator, j as red, jn as withErrorHandling, jt as getDockerCmd, k as gray, kt as buildDockerImage, l as replayRollback, lt as DagBuilder, m as PRE_DELETE_SNAPSHOT_TYPES, mn as LocalInvokeBuildError$1, mt as shouldRetainResource, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nn as processStackMessages, nt as requireConfigString, o as planFailedOps, on as getAwsClients, ot as withRetry, p as ATOMIC_FINAL_SNAPSHOT_TYPES, pn as DeployCancelledError, pt as rebuildClientForBucketRegion, q as WAFv2WebACLProvider, qt as stateBucketExistenceConfirmed, r as DeployEngine, rt as applyRoleArnIfSet, s as planRollback, sn as resetAwsClients, st as isRetryableTransientError, t as DEFAULT_RESOURCE_TIMEOUT_MS, tn as AssemblyReader, tt as requireConfigObject, u as withResourceDeadline, un as CdkdError, ut as TemplateParser, v as isFinalSnapshotError, vn as MissingCdkCliError, vt as buildAssetRedirectMap, w as isStatefulRecreateTargetSync, wn as StackHasActiveImportsError, wt as ensureAssetStorage, x as makeCanonicalizePropertiesFn, xn as ProvisioningError, xt as rewriteTemplateAssetReferences, y as refusesFinalSnapshot, yn as NestedStackChildDirectDestroyError, yt as createAssetRedirectResolver, z as CloudControlProvider, zt as getLegacyStateBucketName } from "./deploy-engine-BErTJjXl.js";
2
+ import { $ as replayWarn, $t as uploadCfnTemplate, A as green, An as normalizeAwsError, At as formatDockerLoginError, B as slowCcOperationTimeoutMs, Bt as resolveApp, C as MULTI_REGION_RECREATE_BLOCKED_TYPES, Cn as ResourceUpdateNotSupportedError, Ct as BOOTSTRAP_MARKER_PREFIX, D as bold, Dt as validateAssetBucketName, E as formatResourceLine, Et as parseBootstrapMarker, F as clearOnUpdateRemoval, Ft as getDockerImageBySourceHash, G as getAccountInfo, Gt as resolveStateBucketWithDefaultAndSource, H as isTerminationProtectionPropagationError, Ht as resolveCaptureObservedState, I as ProviderRegistry, It as Synthesizer, J as normalizeAwsTagsToCfn, Jt as warnDeprecatedNoPrefixCliFlag, K as refStateLookupFromResource, Kt as resolveUseCdkBootstrapAssets, L as findActionableSilentDrops, Lt as synthesisStatusMessage, M as yellow, Mt as runDockerForeground, N as IAMRoleProvider, Nt as runDockerStreaming, O as cyan, Ot as validateContainerRepoName, P as collectInlinePolicyNamesManagedBySiblings, Pt as AssetManifestLoader, Q as readConfigString, Qt as findLargeInlineResources, R as findSilentDropProperties, Rt as getDefaultStateBucketName, S as extractDeploymentEventError, Sn as ResourceTimeoutError, St as AssetModeResolver, T as renderStatefulReason, Tn as StackTerminationProtectionError, Tt as getBootstrapMarkerKey, U as IntrinsicFunctionResolver, Ut as resolveSkipPrefix, V as disableInstanceApiTermination, Vt as resolveAutoAssetStorage, W as cfnRefValueFromPhysicalId, Wt as resolveStateBucketWithDefault, X as assertRegionMatch, Xt as CFN_TEMPLATE_URL_LIMIT, Y as resolveExplicitPhysicalId, Yt as CFN_TEMPLATE_BODY_LIMIT, Z as configStringRefusal, Zt as MIGRATE_TMP_PREFIX, _ as createPreDeleteFinalSnapshot, _t as WorkGraph, a as DeploymentEventsStore, an as AwsClients, at as describeTypeWithThrottleRetry, b as unsupportedFinalSnapshotError, bn as PartialFailureError, bt as loadPublishableAssetManifest, c as replayFailedOperations, cn as setAwsClients, ct as isThrottlingError, d as IMPLICIT_DELETE_DEPENDENCIES, dt as LockManager, en as expectedOwnerParam, et as requireConfigArray, f as computeImplicitDeleteEdges, ft as S3StateBackend, g as ccRoutedFinalSnapshotError, gn as LocalStartServiceError, gt as stringifyValue, h as buildFinalSnapshotIdentifier, hn as LocalMigrateError, ht as AssetPublisher, i as DeploymentEventsReader, in as resolveBucketRegion, it as DiffCalculator, j as red, jn as withErrorHandling, jt as getDockerCmd, k as gray, kt as buildDockerImage, l as replayRollback, lt as DagBuilder, m as PRE_DELETE_SNAPSHOT_TYPES, mn as LocalInvokeBuildError$1, mt as shouldRetainResource, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nn as processStackMessages, nt as requireConfigString, o as planFailedOps, on as getAwsClients, ot as withRetry, p as ATOMIC_FINAL_SNAPSHOT_TYPES, pn as DeployCancelledError, pt as rebuildClientForBucketRegion, q as WAFv2WebACLProvider, qt as stateBucketExistenceConfirmed, r as DeployEngine, rt as applyRoleArnIfSet, s as planRollback, sn as resetAwsClients, st as isRetryableTransientError, t as DEFAULT_RESOURCE_TIMEOUT_MS, tn as AssemblyReader, tt as requireConfigObject, u as withResourceDeadline, un as CdkdError, ut as TemplateParser, v as isFinalSnapshotError, vn as MissingCdkCliError, vt as buildAssetRedirectMap, w as isStatefulRecreateTargetSync, wn as StackHasActiveImportsError, wt as ensureAssetStorage, x as makeCanonicalizePropertiesFn, xn as ProvisioningError, xt as rewriteTemplateAssetReferences, y as refusesFinalSnapshot, yn as NestedStackChildDirectDestroyError, yt as createAssetRedirectResolver, z as CloudControlProvider, zt as getLegacyStateBucketName } from "./deploy-engine-BWM9RxAW.js";
3
3
  import { a as getLiveRenderer, c as PATTERN_B_RESOURCE_TYPES, d as generateResourceNameWithFallback, h as withStackName, i as runStackBuffered, m as withSkipPrefix, n as getLogger, o as PATTERN_B_NAME_OPTIONS, s as PATTERN_B_NAME_PROPERTIES, u as generateResourceName } from "./logger-zRrlbaQt.js";
4
- import { t as ASGProvider } from "./asg-provider-AKp6xuP0.js";
4
+ import { t as ASGProvider } from "./asg-provider-CsY1ahKM.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";
@@ -12859,7 +12859,7 @@ var DynamoDBTableProvider = class {
12859
12859
  let billingModeUnusable = false;
12860
12860
  const requestedBillingMode = properties["BillingMode"] === void 0 ? "PROVISIONED" : requireConfigString(properties["BillingMode"], "PROVISIONED", "AWS::DynamoDB::Table BillingMode", { onUnusable: (message) => {
12861
12861
  billingModeUnusable = true;
12862
- this.logger.warn(`${message} The table's current billing mode (${prevBillingMode}) is kept for this update rather than flipped to the default.`);
12862
+ this.logger.warn(`AWS::DynamoDB::Table ${logicalId}: ${message} The mode this update compared against (${prevBillingMode}) is kept rather than flipped to the default.`);
12863
12863
  } });
12864
12864
  const billingMode = billingModeUnusable ? prevBillingMode : requestedBillingMode;
12865
12865
  const billingOrThroughputChanged = billingMode !== prevBillingMode || JSON.stringify(properties["ProvisionedThroughput"]) !== JSON.stringify(previousProperties["ProvisionedThroughput"]);
@@ -37050,8 +37050,9 @@ var AppSyncProvider = class {
37050
37050
  * `CloudControlProvider` uses for its own ARN reconstruction, so this costs
37051
37051
  * at most one `GetCallerIdentity` per deploy.
37052
37052
  */
37053
- async buildAppSyncArn(suffix) {
37054
- const accountInfo = await getAccountInfo(this.providerRegion ?? await this.getClient().config.region());
37053
+ async buildAppSyncArn(suffix, regionOverride) {
37054
+ const accountInfo = await getAccountInfo(regionOverride ?? this.providerRegion ?? await this.getClient().config.region());
37055
+ if (accountInfo.fabricated) throw new Error(`cannot determine the AWS account (STS is unreachable, and the resolved account id is a placeholder), so an ARN for ${suffix} would be fabricated`);
37055
37056
  const { partition } = derivePartitionAndUrlSuffix(accountInfo.region);
37056
37057
  return `arn:${partition}:appsync:${accountInfo.region}:${accountInfo.accountId}:${suffix}`;
37057
37058
  }
@@ -37098,25 +37099,45 @@ var AppSyncProvider = class {
37098
37099
  * Returns `undefined` for an id whose arity does not match the type — a
37099
37100
  * record that malformed cannot be healed by guessing, and carrying the
37100
37101
  * existing attributes forward is the safe answer.
37102
+ *
37103
+ * `omitArnOnFailure` is for the IMPORT path only (issue #1728 review). The
37104
+ * non-ARN keys — `Name`, `ApiKey` — are split straight out of the physical id
37105
+ * and involve no account at all, so dropping them because the ACCOUNT could
37106
+ * not be resolved would fail `Fn::GetAtt Name` for a reason that has nothing
37107
+ * to do with it. Import has no prior record to preserve, so keeping what it
37108
+ * can beats keeping nothing. `update()` must NOT pass it: there a partial map
37109
+ * replaces the record's wholesale and would delete a good ARN.
37101
37110
  */
37102
- async childRefAttributes(resourceType, physicalId) {
37111
+ async childRefAttributes(resourceType, physicalId, regionOverride, omitArnOnFailure = false) {
37103
37112
  const parts = physicalId.split("|");
37113
+ const arn = async (suffix) => {
37114
+ try {
37115
+ return await this.buildAppSyncArn(suffix, regionOverride);
37116
+ } catch (error) {
37117
+ if (!omitArnOnFailure) throw error;
37118
+ this.logger.warn(`Imported ${resourceType} (${physicalId}) but its ARN attribute was NOT recorded: ${error instanceof Error ? error.message : String(error)}. Ref will resolve to the compound physical id, and Fn::GetAtt on the ARN will fail, until the resource's next update heals the record.`);
37119
+ return;
37120
+ }
37121
+ };
37104
37122
  if (resourceType === "AWS::AppSync::DataSource" && parts.length === 2) {
37105
37123
  const [apiId, name] = parts;
37124
+ const dataSourceArn = await arn(`apis/${apiId}/datasources/${name}`);
37106
37125
  return {
37107
- DataSourceArn: await this.buildAppSyncArn(`apis/${apiId}/datasources/${name}`),
37126
+ ...dataSourceArn && { DataSourceArn: dataSourceArn },
37108
37127
  Name: name
37109
37128
  };
37110
37129
  }
37111
37130
  if (resourceType === "AWS::AppSync::Resolver" && parts.length === 3) {
37112
37131
  const [apiId, typeName, fieldName] = parts;
37113
- return { ResolverArn: await this.buildAppSyncArn(`apis/${apiId}/types/${typeName}/resolvers/${fieldName}`) };
37132
+ const resolverArn = await arn(`apis/${apiId}/types/${typeName}/resolvers/${fieldName}`);
37133
+ return { ...resolverArn && { ResolverArn: resolverArn } };
37114
37134
  }
37115
37135
  if (resourceType === "AWS::AppSync::ApiKey" && parts.length === 2) {
37116
37136
  const [apiId, apiKeyId] = parts;
37137
+ const apiKeyArn = await arn(`apis/${apiId}/apikey/${apiKeyId}`);
37117
37138
  return {
37118
37139
  ApiKey: apiKeyId,
37119
- Arn: await this.buildAppSyncArn(`apis/${apiId}/apikey/${apiKeyId}`)
37140
+ ...apiKeyArn && { Arn: apiKeyArn }
37120
37141
  };
37121
37142
  }
37122
37143
  }
@@ -37124,9 +37145,21 @@ var AppSyncProvider = class {
37124
37145
  * The no-replacement update result for a child type, carrying the healed
37125
37146
  * attribute set (issue #1681). Reporting none is still the correct answer for
37126
37147
  * an unhealable id — the engine then carries the existing attributes forward.
37148
+ *
37149
+ * An ARN that cannot be built takes the SAME answer, and it must (issue #1728
37150
+ * review). An `update()` attribute map REPLACES the record's wholesale, so
37151
+ * reporting a partial set here would DELETE the ARN a previous deploy
37152
+ * correctly recorded; reporting none carries it forward untouched. That is
37153
+ * why this arm differs from the import one below, which has no prior record
37154
+ * to preserve and therefore keeps what it can.
37127
37155
  */
37128
37156
  async childUpdateResult(resourceType, physicalId) {
37129
- const attributes = await this.childRefAttributes(resourceType, physicalId);
37157
+ let attributes;
37158
+ try {
37159
+ attributes = await this.childRefAttributes(resourceType, physicalId);
37160
+ } catch (error) {
37161
+ this.logger.warn(`Updated ${resourceType} (${physicalId}) but could not rebuild its ARN attribute: ${error instanceof Error ? error.message : String(error)}. The previously recorded attributes are kept.`);
37162
+ }
37130
37163
  return {
37131
37164
  physicalId,
37132
37165
  wasReplaced: false,
@@ -37134,6 +37167,47 @@ var AppSyncProvider = class {
37134
37167
  };
37135
37168
  }
37136
37169
  /**
37170
+ * The child attribute set for an ADOPTED resource (issue #1728).
37171
+ *
37172
+ * `import()` used to record `attributes: {}` for every child type, so a child
37173
+ * adopted via `cdkd import` had no ARN in state and the resolver's
37174
+ * `REF_RETURNS_ARN_FROM_STATE` lookup missed — `Ref` fell back to the raw
37175
+ * compound id, i.e. the pre-#1681 behavior, and `Fn::GetAtt DataSourceArn` /
37176
+ * `ResolverArn` / `Arn` were equally unresolved. The record healed only on the
37177
+ * resource's next UPDATE (#1727), so an imported-and-untouched child stayed
37178
+ * broken indefinitely.
37179
+ *
37180
+ * RECONSTRUCTED rather than read back from AWS. Every segment is already in
37181
+ * the physical id the import receives, `childRefAttributes` is the SAME
37182
+ * mapping `create()` / `update()` use (so the three spellings cannot drift),
37183
+ * and the reconstruction costs one process-cached STS call instead of one
37184
+ * DescribeApi-family call per imported child. A readback would be
37185
+ * authoritative but cannot be more correct for a well-formed id: `import`
37186
+ * adopts a resource in the caller's own account, which is exactly the context
37187
+ * `buildAppSyncArn` derives from.
37188
+ *
37189
+ * Never throws: a failure degrades to `{}` (or to the account-independent
37190
+ * keys — see `omitArnOnFailure`), which is at worst the exact pre-#1728
37191
+ * behavior, because adopting the resource is worth more than its bookkeeping
37192
+ * attribute. `childRefAttributes` already answers `undefined` for a mis-arity
37193
+ * id, which degrades the same way rather than guessing.
37194
+ *
37195
+ * The fabricated-account refusal that makes this honest lives in
37196
+ * `buildAppSyncArn`, not here (issue #1728 review): the UPDATE path rebuilds
37197
+ * the ARN on every in-place update, so an STS blip there would REPLACE a
37198
+ * correct recorded ARN rather than merely fail to write one. Guarding only
37199
+ * this call site would have left the worse path open. The fabrication itself
37200
+ * is issue #1730.
37201
+ */
37202
+ async childImportAttributes(resourceType, physicalId, region) {
37203
+ try {
37204
+ return await this.childRefAttributes(resourceType, physicalId, region, true) ?? {};
37205
+ } catch (error) {
37206
+ this.logger.warn(`Imported ${resourceType} (${physicalId}) but could not build its ARN attribute: ${error instanceof Error ? error.message : String(error)}. Ref will resolve to the compound physical id, and Fn::GetAtt on the ARN will fail, until the resource's next update heals the record.`);
37207
+ return {};
37208
+ }
37209
+ }
37210
+ /**
37137
37211
  * Lazy S3 client for the `*S3Location` properties (Resolver
37138
37212
  * `CodeS3Location` / `RequestMappingTemplateS3Location` /
37139
37213
  * `ResponseMappingTemplateS3Location`, GraphQLSchema
@@ -38564,13 +38638,16 @@ var AppSyncProvider = class {
38564
38638
  * real resource (issue #1134); auto-mode import resolves ids from
38565
38639
  * CloudFormation's `DescribeStackResources` instead. AppSync sub-resources
38566
38640
  * (`GraphQLSchema`, `DataSource`, `Resolver`, `ApiKey`) are scoped under a
38567
- * parent `apiId` — explicit-override only.
38641
+ * parent `apiId` — explicit-override only. The three ARN-`Ref` children
38642
+ * additionally record the same attribute set `create()` does, so an adopted
38643
+ * child's `Ref` / `Fn::GetAtt` resolve immediately rather than only after its
38644
+ * first update (issue #1728) — see {@link childImportAttributes}.
38568
38645
  */
38569
38646
  async import(input) {
38570
38647
  if (input.resourceType !== "AWS::AppSync::GraphQLApi") {
38571
38648
  if (input.knownPhysicalId) return {
38572
38649
  physicalId: input.knownPhysicalId,
38573
- attributes: {}
38650
+ attributes: await this.childImportAttributes(input.resourceType, input.knownPhysicalId, input.region)
38574
38651
  };
38575
38652
  return null;
38576
38653
  }
@@ -73513,7 +73590,7 @@ function createMigrateCommand() {
73513
73590
  */
73514
73591
  function buildProgram() {
73515
73592
  const program = new Command();
73516
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.281.11");
73593
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.281.13");
73517
73594
  program.hook("preAction", (_thisCommand, actionCommand) => {
73518
73595
  const { profile } = actionCommand.optsWithGlobals();
73519
73596
  if (profile !== void 0) process.env["AWS_PROFILE"] = profile;