@go-to-k/cdkd 0.94.12 → 0.94.14
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 +78 -2
- package/dist/cli.js.map +1 -1
- package/dist/{deploy-engine-SarGY6-L.js → deploy-engine-Cl7v7Ml5.js} +4 -1
- package/dist/{deploy-engine-SarGY6-L.js.map → deploy-engine-Cl7v7Ml5.js.map} +1 -1
- package/dist/go-to-k-cdkd-0.94.14.tgz +0 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/go-to-k-cdkd-0.94.12.tgz +0 -0
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { a as setAwsClients, i as resetAwsClients, r as getAwsClients, t as AwsClients } from "./aws-clients-CuHRHcyW.js";
|
|
3
|
-
import { A as resolveCaptureObservedState, C as stringifyValue, D as getDefaultStateBucketName, E as Synthesizer, F as AssemblyReader, G as ProvisioningError, H as LocalInvokeBuildError, J as RouteDiscoveryError, K as ResourceTimeoutError, L as resolveBucketRegion, M as resolveStateBucketWithDefault, N as resolveStateBucketWithDefaultAndSource, O as getLegacyStateBucketName, P as warnDeprecatedNoPrefixCliFlag, S as AssetPublisher, T as buildDockerImage, W as PartialFailureError, Y as StackTerminationProtectionError, _ as DiffCalculator, a as withRetry, at as runStackBuffered, b as LockManager, c as collectInlinePolicyNamesManagedBySiblings, ct as PATTERN_B_RESOURCE_TYPES, d as normalizeAwsTagsToCfn, dt as withSkipPrefix, et as normalizeAwsError, f as resolveExplicitPhysicalId, ft as withStackName, g as IntrinsicFunctionResolver, h as assertRegionMatch, i as withResourceDeadline, j as resolveSkipPrefix, k as resolveApp, l as CDK_PATH_TAG, lt as generateResourceName, m as CloudControlProvider, n as DEFAULT_RESOURCE_WARN_AFTER_MS, o as IMPLICIT_DELETE_DEPENDENCIES, ot as getLiveRenderer, p as ProviderRegistry, q as ResourceUpdateNotSupportedError, r as DeployEngine, rt as getLogger, s as IAMRoleProvider, st as PATTERN_B_NAME_PROPERTIES, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as withErrorHandling, u as matchesCdkPath, ut as generateResourceNameWithFallback, v as DagBuilder, w as WorkGraph, x as S3StateBackend, y as TemplateParser, z as CdkdError } from "./deploy-engine-
|
|
3
|
+
import { A as resolveCaptureObservedState, C as stringifyValue, D as getDefaultStateBucketName, E as Synthesizer, F as AssemblyReader, G as ProvisioningError, H as LocalInvokeBuildError, J as RouteDiscoveryError, K as ResourceTimeoutError, L as resolveBucketRegion, M as resolveStateBucketWithDefault, N as resolveStateBucketWithDefaultAndSource, O as getLegacyStateBucketName, P as warnDeprecatedNoPrefixCliFlag, S as AssetPublisher, T as buildDockerImage, W as PartialFailureError, Y as StackTerminationProtectionError, _ as DiffCalculator, a as withRetry, at as runStackBuffered, b as LockManager, c as collectInlinePolicyNamesManagedBySiblings, ct as PATTERN_B_RESOURCE_TYPES, d as normalizeAwsTagsToCfn, dt as withSkipPrefix, et as normalizeAwsError, f as resolveExplicitPhysicalId, ft as withStackName, g as IntrinsicFunctionResolver, h as assertRegionMatch, i as withResourceDeadline, j as resolveSkipPrefix, k as resolveApp, l as CDK_PATH_TAG, lt as generateResourceName, m as CloudControlProvider, n as DEFAULT_RESOURCE_WARN_AFTER_MS, o as IMPLICIT_DELETE_DEPENDENCIES, ot as getLiveRenderer, p as ProviderRegistry, q as ResourceUpdateNotSupportedError, r as DeployEngine, rt as getLogger, s as IAMRoleProvider, st as PATTERN_B_NAME_PROPERTIES, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as withErrorHandling, u as matchesCdkPath, ut as generateResourceNameWithFallback, v as DagBuilder, w as WorkGraph, x as S3StateBackend, y as TemplateParser, z as CdkdError } from "./deploy-engine-Cl7v7Ml5.js";
|
|
4
4
|
import { createHash, createPublicKey, createVerify, randomBytes, randomUUID } from "node:crypto";
|
|
5
5
|
import { CopyObjectCommand, CreateBucketCommand, DeleteBucketAnalyticsConfigurationCommand, DeleteBucketCommand, DeleteBucketCorsCommand, DeleteBucketIntelligentTieringConfigurationCommand, DeleteBucketInventoryConfigurationCommand, DeleteBucketLifecycleCommand, DeleteBucketMetricsConfigurationCommand, DeleteBucketPolicyCommand, DeleteBucketReplicationCommand, DeleteBucketTaggingCommand, DeleteBucketWebsiteCommand, DeleteObjectCommand, DeleteObjectsCommand, GetBucketAccelerateConfigurationCommand, GetBucketCorsCommand, GetBucketEncryptionCommand, GetBucketLifecycleConfigurationCommand, GetBucketLocationCommand, GetBucketLoggingCommand, GetBucketNotificationConfigurationCommand, GetBucketPolicyCommand, GetBucketReplicationCommand, GetBucketTaggingCommand, GetBucketVersioningCommand, GetBucketWebsiteCommand, GetObjectCommand, GetObjectLockConfigurationCommand, GetPublicAccessBlockCommand, HeadBucketCommand, ListBucketAnalyticsConfigurationsCommand, ListBucketIntelligentTieringConfigurationsCommand, ListBucketInventoryConfigurationsCommand, ListBucketMetricsConfigurationsCommand, ListBucketsCommand, ListDirectoryBucketsCommand, ListObjectVersionsCommand, ListObjectsV2Command, NoSuchBucket, PutBucketAccelerateConfigurationCommand, PutBucketAnalyticsConfigurationCommand, PutBucketCorsCommand, PutBucketEncryptionCommand, PutBucketIntelligentTieringConfigurationCommand, PutBucketInventoryConfigurationCommand, PutBucketLifecycleConfigurationCommand, PutBucketLoggingCommand, PutBucketMetricsConfigurationCommand, PutBucketNotificationConfigurationCommand, PutBucketOwnershipControlsCommand, PutBucketPolicyCommand, PutBucketReplicationCommand, PutBucketTaggingCommand, PutBucketVersioningCommand, PutBucketWebsiteCommand, PutObjectCommand, PutObjectLockConfigurationCommand, PutPublicAccessBlockCommand, S3Client } from "@aws-sdk/client-s3";
|
|
6
6
|
import { AddRoleToInstanceProfileCommand, AddUserToGroupCommand, AttachGroupPolicyCommand, AttachUserPolicyCommand, CreateGroupCommand, CreateInstanceProfileCommand, CreateLoginProfileCommand, CreateUserCommand, DeleteAccessKeyCommand, DeleteGroupCommand, DeleteGroupPolicyCommand, DeleteInstanceProfileCommand, DeleteLoginProfileCommand, DeleteRolePolicyCommand, DeleteUserCommand, DeleteUserPermissionsBoundaryCommand, DeleteUserPolicyCommand, DetachGroupPolicyCommand, DetachUserPolicyCommand, GetGroupCommand, GetGroupPolicyCommand, GetInstanceProfileCommand, GetRolePolicyCommand, GetUserCommand, GetUserPolicyCommand, IAMClient, ListAccessKeysCommand, ListAttachedGroupPoliciesCommand, ListAttachedUserPoliciesCommand, ListGroupPoliciesCommand, ListGroupsForUserCommand, ListInstanceProfilesCommand, ListUserPoliciesCommand, ListUserTagsCommand, ListUsersCommand, NoSuchEntityException, PutGroupPolicyCommand, PutRolePolicyCommand, PutUserPermissionsBoundaryCommand, PutUserPolicyCommand, RemoveRoleFromInstanceProfileCommand, RemoveUserFromGroupCommand, TagUserCommand, UntagUserCommand, UpdateLoginProfileCommand } from "@aws-sdk/client-iam";
|
|
@@ -31567,6 +31567,7 @@ async function importCommand(stackArg, options) {
|
|
|
31567
31567
|
}
|
|
31568
31568
|
}
|
|
31569
31569
|
const stackState = buildStackState(stackInfo.stackName, targetRegion, rows, templateParser, template, existingState, selectiveMode);
|
|
31570
|
+
await resolveImportedProperties(stackState, template, targetRegion, stateBackend, logger);
|
|
31570
31571
|
await captureObservedForImportedResources(stackState, providerRegistry, logger);
|
|
31571
31572
|
const saveOptions = {};
|
|
31572
31573
|
if (existingEtag) saveOptions.expectedEtag = existingEtag;
|
|
@@ -31791,6 +31792,81 @@ function buildStackState(stackName, region, rows, templateParser, template, exis
|
|
|
31791
31792
|
lastModified: Date.now()
|
|
31792
31793
|
};
|
|
31793
31794
|
}
|
|
31795
|
+
/**
|
|
31796
|
+
* Walk every resource in `stackState.resources` and overwrite its
|
|
31797
|
+
* `properties` with the result of running the synth template's raw
|
|
31798
|
+
* Properties through `IntrinsicFunctionResolver` against the assembled
|
|
31799
|
+
* state map.
|
|
31800
|
+
*
|
|
31801
|
+
* Closes issue #328. `cdkd deploy` runs the resolver against each
|
|
31802
|
+
* resource's Properties before calling `provider.create()` and stores
|
|
31803
|
+
* the resolved shape in state — this brings `cdkd import` in line so
|
|
31804
|
+
* the v3 schema's `properties` field consistently holds "resolved
|
|
31805
|
+
* template intent" (post-intrinsic substitution) across both write
|
|
31806
|
+
* paths. Without this, sub-resource types whose `delete()` reads
|
|
31807
|
+
* properties at delete time (e.g. `AWS::Lambda::Permission` whose
|
|
31808
|
+
* `FunctionName` is `{Fn::GetAtt: [..., 'Arn']}`) get raw intrinsic
|
|
31809
|
+
* objects passed to the AWS SDK and fail validation.
|
|
31810
|
+
*
|
|
31811
|
+
* The resolver is run AFTER all `provider.import()` calls finish, so by
|
|
31812
|
+
* the time it walks each resource every logicalId in the importable set
|
|
31813
|
+
* has a known `physicalId` in `stackState.resources` for Ref / GetAtt
|
|
31814
|
+
* to bind against.
|
|
31815
|
+
*
|
|
31816
|
+
* Edge cases:
|
|
31817
|
+
* - Parameters / Conditions are resolved from the template up front
|
|
31818
|
+
* (same shape the deploy engine builds for its CREATE / UPDATE
|
|
31819
|
+
* intrinsic context). Resolution failures here log + leave the
|
|
31820
|
+
* template's defaults untouched — the resolver itself tolerates
|
|
31821
|
+
* missing parameter / condition entries.
|
|
31822
|
+
* - Per-resource try/catch: if a Properties tree references a
|
|
31823
|
+
* resource not in the importable set (custom resource that wasn't
|
|
31824
|
+
* adopted, out-of-scope sibling in selective mode), the resolver
|
|
31825
|
+
* throws `Ref <X> not found` / `Resource <X> not found for
|
|
31826
|
+
* Fn::GetAtt`. We log the failure and leave the resource's
|
|
31827
|
+
* original properties intact. The eventual `cdkd destroy` failure
|
|
31828
|
+
* on the un-resolved props is a narrower problem than aborting the
|
|
31829
|
+
* whole adoption flow.
|
|
31830
|
+
*
|
|
31831
|
+
* `existingState`'s `resources` survive the walk only when they
|
|
31832
|
+
* weren't re-imported in this run — selective merge preserves them as
|
|
31833
|
+
* already-stored, which on the v3 baseline is already resolved-shape
|
|
31834
|
+
* from a prior import / deploy, so re-resolving is a no-op.
|
|
31835
|
+
*/
|
|
31836
|
+
async function resolveImportedProperties(stackState, template, region, stateBackend, logger) {
|
|
31837
|
+
const entries = Object.entries(stackState.resources);
|
|
31838
|
+
if (entries.length === 0) return;
|
|
31839
|
+
const resolver = new IntrinsicFunctionResolver(region);
|
|
31840
|
+
let parameters = {};
|
|
31841
|
+
let conditions = {};
|
|
31842
|
+
try {
|
|
31843
|
+
parameters = await resolver.resolveParameters(template);
|
|
31844
|
+
} catch (err) {
|
|
31845
|
+
logger.debug(`Template parameter resolution failed during import-time property resolution: ${err instanceof Error ? err.message : String(err)} — continuing without parameters; resources referencing them will be skipped per-resource.`);
|
|
31846
|
+
}
|
|
31847
|
+
try {
|
|
31848
|
+
conditions = await resolver.evaluateConditions({
|
|
31849
|
+
template,
|
|
31850
|
+
resources: stackState.resources,
|
|
31851
|
+
parameters
|
|
31852
|
+
});
|
|
31853
|
+
} catch (err) {
|
|
31854
|
+
logger.debug(`Template condition evaluation failed during import-time property resolution: ${err instanceof Error ? err.message : String(err)} — continuing without conditions.`);
|
|
31855
|
+
}
|
|
31856
|
+
const baseContext = {
|
|
31857
|
+
template,
|
|
31858
|
+
resources: stackState.resources,
|
|
31859
|
+
...Object.keys(parameters).length > 0 && { parameters },
|
|
31860
|
+
...Object.keys(conditions).length > 0 && { conditions },
|
|
31861
|
+
stateBackend,
|
|
31862
|
+
stackName: stackState.stackName
|
|
31863
|
+
};
|
|
31864
|
+
for (const [logicalId, resource] of entries) try {
|
|
31865
|
+
resource.properties = await resolver.resolve(resource.properties ?? {}, baseContext);
|
|
31866
|
+
} catch (err) {
|
|
31867
|
+
logger.warn(`Failed to resolve intrinsics in Properties for imported resource '${logicalId}' (${resource.resourceType}): ${err instanceof Error ? err.message : String(err)}. State will be written with the raw intrinsic shape, which may cause 'cdkd destroy' to fail on this resource — re-import once every referenced sibling is in state, or remove this resource via 'cdkd state orphan'.`);
|
|
31868
|
+
}
|
|
31869
|
+
}
|
|
31794
31870
|
function printSummary(rows) {
|
|
31795
31871
|
const logger = getLogger();
|
|
31796
31872
|
const counts = {
|
|
@@ -41695,7 +41771,7 @@ function reorderArgs(argv) {
|
|
|
41695
41771
|
*/
|
|
41696
41772
|
async function main() {
|
|
41697
41773
|
const program = new Command();
|
|
41698
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.94.
|
|
41774
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.94.13");
|
|
41699
41775
|
program.addCommand(createBootstrapCommand());
|
|
41700
41776
|
program.addCommand(createSynthCommand());
|
|
41701
41777
|
program.addCommand(createListCommand());
|