cdk-real-drift 0.2.38 → 0.2.40

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
@@ -3243,6 +3243,9 @@ async function loadDesired(client, stackName, region, templateOverride, recovery
3243
3243
  const clustersWithSiblingCapacityProviders = collectClustersWithSiblingCapacityProviders(template.Resources ?? {});
3244
3244
  for (const [logicalId, res] of Object.entries(template.Resources ?? {})) {
3245
3245
  if (res.Type === "AWS::CDK::Metadata") continue;
3246
+ if (typeof res.Condition === "string" && !physIds[logicalId]) {
3247
+ if (evalCondition(res.Condition, ctx) === false) continue;
3248
+ }
3246
3249
  const cdkPath = res.Metadata?.["aws:cdk:path"];
3247
3250
  const declaredRaw = res.Properties ?? {};
3248
3251
  resources.push({
@@ -4018,6 +4021,28 @@ function remapSortedIndexToDeclared(path, arrayKey, sortedDeclared, rawDeclared)
4018
4021
  const rawIdx = rawDeclared.findIndex((e) => deepEqual(e, el));
4019
4022
  return rawIdx < 0 ? path : `${arrayKey}.${rawIdx}${m[2]}`;
4020
4023
  }
4024
+ function expandExecuteApiResources(policy, arnPrefix) {
4025
+ if (!policy || typeof policy !== "object" || Array.isArray(policy)) return policy;
4026
+ const p = policy;
4027
+ const stmts = p["Statement"];
4028
+ if (!Array.isArray(stmts)) return policy;
4029
+ const PREFIX = "execute-api:";
4030
+ const expand = (r) => typeof r === "string" && r.startsWith(PREFIX) ? arnPrefix + r.slice(12) : r;
4031
+ const newStmts = stmts.map((s) => {
4032
+ if (!s || typeof s !== "object" || Array.isArray(s)) return s;
4033
+ const stmt = { ...s };
4034
+ for (const key of ["Resource", "NotResource"]) {
4035
+ const v = stmt[key];
4036
+ if (typeof v === "string") stmt[key] = expand(v);
4037
+ else if (Array.isArray(v)) stmt[key] = v.map(expand);
4038
+ }
4039
+ return stmt;
4040
+ });
4041
+ return {
4042
+ ...p,
4043
+ Statement: newStmts
4044
+ };
4045
+ }
4021
4046
  function classifyResource(resource, liveRaw, schema, opts = {}) {
4022
4047
  const { logicalId, resourceType, physicalId, declared: declaredIn } = resource;
4023
4048
  const findings = [];
@@ -4148,6 +4173,10 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
4148
4173
  "EndpointConfiguration.IpAddressType": "dualstack"
4149
4174
  };
4150
4175
  }
4176
+ if (physicalId && opts.accountId !== void 0 && declared["Policy"]) {
4177
+ const arnPrefix = `arn:${opts.region?.startsWith("cn-") ? "aws-cn" : opts.region?.startsWith("us-gov-") ? "aws-us-gov" : "aws"}:execute-api:${opts.region ?? ""}:${opts.accountId}:${physicalId}`;
4178
+ declared["Policy"] = canonicalizePolicy(expandExecuteApiResources(declared["Policy"], arnPrefix));
4179
+ }
4151
4180
  }
4152
4181
  if (resourceType === "AWS::Cognito::UserPool") {
4153
4182
  const tpvd = (declared["Policies"]?.["PasswordPolicy"])?.["TemporaryPasswordValidityDays"];