@go-to-k/cdkd 0.94.10 → 0.94.11
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 +56 -25
- package/dist/cli.js.map +1 -1
- package/dist/{deploy-engine-Cg4l-zyr.js → deploy-engine-627W8bPG.js} +59 -7
- package/dist/{deploy-engine-Cg4l-zyr.js.map → deploy-engine-627W8bPG.js.map} +1 -1
- package/dist/go-to-k-cdkd-0.94.11.tgz +0 -0
- package/dist/index.d.ts +8 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/go-to-k-cdkd-0.94.10.tgz +0 -0
|
@@ -7698,7 +7698,7 @@ var IAMRoleProvider = class {
|
|
|
7698
7698
|
*
|
|
7699
7699
|
* Returns `undefined` when the role is gone (`NoSuchEntityException`).
|
|
7700
7700
|
*/
|
|
7701
|
-
async readCurrentState(physicalId, _logicalId, _resourceType, properties) {
|
|
7701
|
+
async readCurrentState(physicalId, _logicalId, _resourceType, properties, context) {
|
|
7702
7702
|
let role;
|
|
7703
7703
|
try {
|
|
7704
7704
|
role = (await this.iamClient.send(new GetRoleCommand({ RoleName: physicalId }))).Role;
|
|
@@ -7735,8 +7735,10 @@ var IAMRoleProvider = class {
|
|
|
7735
7735
|
if (!listResp.IsTruncated) break;
|
|
7736
7736
|
policyMarker = listResp.Marker;
|
|
7737
7737
|
}
|
|
7738
|
+
const managedByOtherResource = collectInlinePolicyNamesManagedBySiblings(physicalId, context, "Roles");
|
|
7739
|
+
const filteredNames = policyNames.filter((n) => !managedByOtherResource.has(n));
|
|
7738
7740
|
const bodies = /* @__PURE__ */ new Map();
|
|
7739
|
-
await Promise.all(
|
|
7741
|
+
await Promise.all(filteredNames.map(async (name) => {
|
|
7740
7742
|
const resp = await this.iamClient.send(new GetRolePolicyCommand({
|
|
7741
7743
|
RoleName: physicalId,
|
|
7742
7744
|
PolicyName: name
|
|
@@ -7839,6 +7841,49 @@ var IAMRoleProvider = class {
|
|
|
7839
7841
|
return null;
|
|
7840
7842
|
}
|
|
7841
7843
|
};
|
|
7844
|
+
/**
|
|
7845
|
+
* Issue #323: build the set of inline-policy names that are managed by
|
|
7846
|
+
* a sibling `AWS::IAM::Policy` resource in the same stack via the given
|
|
7847
|
+
* attachment field (`Roles` / `Users` / `Groups`). cdkd's IAM Role /
|
|
7848
|
+
* User / Group `readCurrentState` helpers exclude these from
|
|
7849
|
+
* `ListRolePolicies` / `ListUserPolicies` / `ListGroupPolicies` output
|
|
7850
|
+
* to avoid false drift — the inline policy is faithfully managed by
|
|
7851
|
+
* the sibling `AWS::IAM::Policy` resource, not the role/user/group
|
|
7852
|
+
* itself. The CDK patterns that produce this shape are pervasive:
|
|
7853
|
+
* `role.addToPolicy(...)`, `taskRole.addToPolicy(...)`,
|
|
7854
|
+
* `bucket.grantRead(role)`, `ContainerImage.fromEcrRepository(repo)`'s
|
|
7855
|
+
* execution-role grant, every L2-construct's auto-emitted `Default
|
|
7856
|
+
* Policy*`.
|
|
7857
|
+
*
|
|
7858
|
+
* @param targetPhysicalId The physicalId of the role/user/group being
|
|
7859
|
+
* read (matches values in the sibling's
|
|
7860
|
+
* `Properties.Roles` / `Users` / `Groups`).
|
|
7861
|
+
* @param context Cross-resource context (may be `undefined`
|
|
7862
|
+
* for callers that don't supply it — e.g.
|
|
7863
|
+
* deploy-time observed-capture before state
|
|
7864
|
+
* is complete; the filter then no-ops which
|
|
7865
|
+
* is safe because the sibling's
|
|
7866
|
+
* `PutRolePolicy` hasn't fired yet at that
|
|
7867
|
+
* point).
|
|
7868
|
+
* @param attachmentField Which sibling field to inspect: `'Roles'`,
|
|
7869
|
+
* `'Users'`, or `'Groups'`.
|
|
7870
|
+
* @returns Set of `PolicyName` values to exclude. Empty when no
|
|
7871
|
+
* sibling matches OR when context is undefined.
|
|
7872
|
+
*/
|
|
7873
|
+
function collectInlinePolicyNamesManagedBySiblings(targetPhysicalId, context, attachmentField) {
|
|
7874
|
+
const result = /* @__PURE__ */ new Set();
|
|
7875
|
+
const siblings = context?.siblings;
|
|
7876
|
+
if (!siblings) return result;
|
|
7877
|
+
for (const sibling of Object.values(siblings)) {
|
|
7878
|
+
if (sibling.resourceType !== "AWS::IAM::Policy") continue;
|
|
7879
|
+
const attachments = sibling.properties[attachmentField];
|
|
7880
|
+
if (!Array.isArray(attachments)) continue;
|
|
7881
|
+
if (!attachments.some((a) => a === targetPhysicalId)) continue;
|
|
7882
|
+
const name = sibling.properties["PolicyName"];
|
|
7883
|
+
if (typeof name === "string") result.add(name);
|
|
7884
|
+
}
|
|
7885
|
+
return result;
|
|
7886
|
+
}
|
|
7842
7887
|
|
|
7843
7888
|
//#endregion
|
|
7844
7889
|
//#region src/deployment/dag-executor.ts
|
|
@@ -8266,10 +8311,10 @@ var DeployEngine = class {
|
|
|
8266
8311
|
* the merge step, which is fine: drift falls back to comparing
|
|
8267
8312
|
* against `properties`.
|
|
8268
8313
|
*/
|
|
8269
|
-
kickOffObservedCapture(provider, logicalId, physicalId, resourceType, resolvedProps) {
|
|
8314
|
+
kickOffObservedCapture(provider, logicalId, physicalId, resourceType, resolvedProps, context) {
|
|
8270
8315
|
if (this.options.captureObservedState !== true) return;
|
|
8271
8316
|
if (!provider.readCurrentState) return;
|
|
8272
|
-
const promise = provider.readCurrentState(physicalId, logicalId, resourceType, resolvedProps).catch((err) => {
|
|
8317
|
+
const promise = provider.readCurrentState(physicalId, logicalId, resourceType, resolvedProps, context).catch((err) => {
|
|
8273
8318
|
this.logger.debug(`observedProperties capture for ${logicalId} (${resourceType}) failed: ${err instanceof Error ? err.message : String(err)} — drift will fall back to template properties for this resource until the next successful deploy.`);
|
|
8274
8319
|
});
|
|
8275
8320
|
this.observedCaptureTasks.set(logicalId, promise);
|
|
@@ -8332,6 +8377,11 @@ var DeployEngine = class {
|
|
|
8332
8377
|
});
|
|
8333
8378
|
}
|
|
8334
8379
|
if (candidates.length === 0) return;
|
|
8380
|
+
const allSiblings = {};
|
|
8381
|
+
for (const [lid, res] of Object.entries(stateResources)) allSiblings[lid] = {
|
|
8382
|
+
resourceType: res.resourceType,
|
|
8383
|
+
properties: res.properties ?? {}
|
|
8384
|
+
};
|
|
8335
8385
|
for (const { logicalId, resource } of candidates) {
|
|
8336
8386
|
let provider;
|
|
8337
8387
|
try {
|
|
@@ -8340,7 +8390,9 @@ var DeployEngine = class {
|
|
|
8340
8390
|
continue;
|
|
8341
8391
|
}
|
|
8342
8392
|
if (!provider.readCurrentState) continue;
|
|
8343
|
-
|
|
8393
|
+
const siblings = { ...allSiblings };
|
|
8394
|
+
delete siblings[logicalId];
|
|
8395
|
+
this.kickOffObservedCapture(provider, logicalId, resource.physicalId, resource.resourceType, resource.properties ?? {}, { siblings });
|
|
8344
8396
|
toRefresh++;
|
|
8345
8397
|
}
|
|
8346
8398
|
if (toRefresh > 0) this.logger.warn(`cdkd state schema upgrade detected — refreshing observed-properties baseline for ${toRefresh} resource(s) (one-time, runs in parallel with deploy)`);
|
|
@@ -9179,5 +9231,5 @@ var DeployEngine = class {
|
|
|
9179
9231
|
};
|
|
9180
9232
|
|
|
9181
9233
|
//#endregion
|
|
9182
|
-
export {
|
|
9183
|
-
//# sourceMappingURL=deploy-engine-
|
|
9234
|
+
export { isCdkdError as $, resolveCaptureObservedState as A, ConfigError as B, stringifyValue as C, getDefaultStateBucketName as D, Synthesizer as E, AssemblyReader as F, ProvisioningError as G, LocalInvokeBuildError as H, clearBucketRegionCache as I, RouteDiscoveryError as J, ResourceTimeoutError as K, resolveBucketRegion as L, resolveStateBucketWithDefault as M, resolveStateBucketWithDefaultAndSource as N, getLegacyStateBucketName as O, warnDeprecatedNoPrefixCliFlag as P, formatError as Q, AssetError as R, AssetPublisher as S, buildDockerImage as T, LockError as U, DependencyError as V, PartialFailureError as W, StateError as X, StackTerminationProtectionError as Y, SynthesisError as Z, DiffCalculator as _, withRetry as a, runStackBuffered as at, LockManager as b, collectInlinePolicyNamesManagedBySiblings as c, PATTERN_B_RESOURCE_TYPES as ct, normalizeAwsTagsToCfn as d, withSkipPrefix as dt, normalizeAwsError as et, resolveExplicitPhysicalId as f, withStackName as ft, IntrinsicFunctionResolver as g, assertRegionMatch as h, withResourceDeadline as i, setLogger as it, resolveSkipPrefix as j, resolveApp as k, CDK_PATH_TAG as l, generateResourceName as lt, CloudControlProvider as m, DEFAULT_RESOURCE_WARN_AFTER_MS as n, ConsoleLogger as nt, IMPLICIT_DELETE_DEPENDENCIES as o, getLiveRenderer as ot, ProviderRegistry as p, ResourceUpdateNotSupportedError as q, DeployEngine as r, getLogger as rt, IAMRoleProvider as s, PATTERN_B_NAME_PROPERTIES as st, DEFAULT_RESOURCE_TIMEOUT_MS as t, withErrorHandling as tt, matchesCdkPath as u, generateResourceNameWithFallback as ut, DagBuilder as v, WorkGraph as w, S3StateBackend as x, TemplateParser as y, CdkdError as z };
|
|
9235
|
+
//# sourceMappingURL=deploy-engine-627W8bPG.js.map
|