cdk-real-drift 0.9.12 → 0.9.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 CHANGED
@@ -2998,9 +2998,6 @@ const EB_OPTION_DERIVED = {
2998
2998
  };
2999
2999
  const EB_OPTION_VALUE_INDEPENDENT = new Set([
3000
3000
  "aws:autoscaling:launchconfiguration|ImageId",
3001
- "aws:autoscaling:launchconfiguration|InstanceType",
3002
- "aws:autoscaling:launchconfiguration|SecurityGroups",
3003
- "aws:elb:loadbalancer|SecurityGroups",
3004
3001
  "aws:cloudformation:template:parameter|AppSource",
3005
3002
  "aws:cloudformation:template:parameter|HooksPkgUrl",
3006
3003
  "aws:cloudformation:template:parameter|InstanceTypeFamily",
@@ -3011,9 +3008,20 @@ const EB_OPTION_VALUE_INDEPENDENT = new Set([
3011
3008
  "aws:elasticbeanstalk:healthreporting:system|ConfigDocument",
3012
3009
  "aws:elasticbeanstalk:healthreporting:system|EnhancedHealthAuthEnabled"
3013
3010
  ]);
3014
- function ebOptionSettingTier(namespace, optionName, value, envType) {
3011
+ function isAllEbGeneratedGroups(value) {
3012
+ if (typeof value !== "string" || value === "") return false;
3013
+ return value.split(",").every((el) => /awseb/i.test(el.trim()));
3014
+ }
3015
+ function ebOptionSettingTier(namespace, optionName, value, envType, siblingOption) {
3015
3016
  if (value == null || value === "") return "atDefault";
3016
3017
  const key = `${String(namespace)}|${String(optionName)}`;
3018
+ if (key === "aws:autoscaling:launchconfiguration|SecurityGroups" || key === "aws:elb:loadbalancer|SecurityGroups") return isAllEbGeneratedGroups(value) ? "atDefault" : "undeclared";
3019
+ if (key === "aws:autoscaling:launchconfiguration|InstanceType") {
3020
+ const instanceTypes = siblingOption?.("aws:ec2:instances", "InstanceTypes");
3021
+ const first = typeof instanceTypes === "string" ? instanceTypes.split(",")[0]?.trim() : void 0;
3022
+ if (first !== void 0) return first === value ? "atDefault" : "undeclared";
3023
+ return "atDefault";
3024
+ }
3017
3025
  if (EB_OPTION_VALUE_INDEPENDENT.has(key)) return "atDefault";
3018
3026
  const derived = EB_OPTION_DERIVED[key];
3019
3027
  if (derived) return derived[envType] === value ? "atDefault" : "undeclared";
@@ -3049,7 +3057,6 @@ const VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS = {
3049
3057
  "PreferredBackupWindow",
3050
3058
  "EngineLifecycleSupport"
3051
3059
  ]),
3052
- "AWS::EKS::AccessEntry": new Set(["Username"]),
3053
3060
  "AWS::EKS::Cluster": new Set(["Version"]),
3054
3061
  "AWS::EKS::Addon": new Set(["AddonVersion"]),
3055
3062
  "AWS::Glue::Job": new Set(["MaxCapacity", "AllocatedCapacity"]),
@@ -5060,9 +5067,11 @@ const IAM_ATTACHMENT_SUBSET = { "AWS::IAM::ManagedPolicy": new Set([
5060
5067
  "Groups"
5061
5068
  ]) };
5062
5069
  const ebOptionSettingsEntryTier = (entry, liveArray) => {
5063
- const envEntry = (Array.isArray(liveArray) ? liveArray : []).find((e) => e && e.OptionName === "EnvironmentType");
5070
+ const arr = Array.isArray(liveArray) ? liveArray : [];
5071
+ const envEntry = arr.find((e) => e && e.OptionName === "EnvironmentType");
5064
5072
  const envType = typeof envEntry?.Value === "string" ? envEntry.Value : "LoadBalanced";
5065
- return ebOptionSettingTier(entry.Namespace, entry.OptionName, entry.Value, envType);
5073
+ const siblingOption = (ns, opt) => arr.find((e) => e && e.Namespace === ns && e.OptionName === opt)?.Value;
5074
+ return ebOptionSettingTier(entry.Namespace, entry.OptionName, entry.Value, envType, siblingOption);
5066
5075
  };
5067
5076
  const ebOptionSettingsSubsetSpec = {
5068
5077
  re: /(^|\.)OptionSettings$/,
@@ -5474,6 +5483,23 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
5474
5483
  ...protocolVersion === "GRPC" ? { Matcher: { GrpcCode: "12" } } : {}
5475
5484
  };
5476
5485
  }
5486
+ if (resourceType === "AWS::EKS::AccessEntry") {
5487
+ const principalArn = declared["PrincipalArn"];
5488
+ if (typeof principalArn === "string") {
5489
+ const roleMatch = /^arn:([^:]+):iam::([^:]*):role\/(.+)$/.exec(principalArn);
5490
+ let derivedUsername = principalArn;
5491
+ if (roleMatch) {
5492
+ const partition = roleMatch[1] ?? "aws";
5493
+ const acct = roleMatch[2] ?? "";
5494
+ const pathAndName = roleMatch[3] ?? "";
5495
+ derivedUsername = `arn:${partition}:sts::${acct}:assumed-role/${pathAndName.split("/").pop() ?? pathAndName}/{{SessionName}}`;
5496
+ }
5497
+ knownDef = {
5498
+ ...knownDef,
5499
+ Username: derivedUsername
5500
+ };
5501
+ }
5502
+ }
5477
5503
  const genDef = resolveGeneratedDefault(resourceType, physicalId) ?? {};
5478
5504
  let knownDefPaths = KNOWN_DEFAULT_PATHS[resourceType] ?? {};
5479
5505
  if (resourceType === "AWS::Lambda::Function" && "DurableConfig" in declared) knownDefPaths = {
@@ -10630,9 +10656,7 @@ function isDefinitiveNotManaged(physicalId, accountId, region) {
10630
10656
  if (arnAccount !== "" && arnAccount !== accountId) return false;
10631
10657
  return true;
10632
10658
  }
10633
- async function isManagedBySiblingStack(cfn, c, cache, accountId, region) {
10634
- const physicalId = c.siblingLookupId ?? c.identifier;
10635
- if (c.siblingLookupId === void 0 && physicalId.includes("|")) return "notManaged";
10659
+ async function probeSiblingPhysicalId(cfn, c, physicalId, cache, accountId, region) {
10636
10660
  const cached = cache.get(physicalId);
10637
10661
  if (cached !== void 0) return cached;
10638
10662
  let managed = false;
@@ -10669,6 +10693,18 @@ async function isManagedBySiblingStack(cfn, c, cache, accountId, region) {
10669
10693
  cache.set(physicalId, result);
10670
10694
  return result;
10671
10695
  }
10696
+ async function isManagedBySiblingStack(cfn, c, cache, accountId, region) {
10697
+ const physicalId = c.siblingLookupId ?? c.identifier;
10698
+ if (c.siblingLookupId !== void 0 || !physicalId.includes("|")) return probeSiblingPhysicalId(cfn, c, physicalId, cache, accountId, region);
10699
+ let sawUnverified = false;
10700
+ for (const segment of physicalId.split("|")) {
10701
+ if (!segment) continue;
10702
+ const seg = await probeSiblingPhysicalId(cfn, c, segment, cache, accountId, region);
10703
+ if (seg === "managed") return "managed";
10704
+ if (seg === "unverified") sawUnverified = true;
10705
+ }
10706
+ return sawUnverified ? "unverified" : "notManaged";
10707
+ }
10672
10708
  const SG_RULE_RESOURCE_SIDE = {
10673
10709
  "AWS::EC2::SecurityGroupIngress": "ingress",
10674
10710
  "AWS::EC2::SecurityGroupEgress": "egress"