cdk-real-drift 0.9.13 → 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";
@@ -5059,9 +5067,11 @@ const IAM_ATTACHMENT_SUBSET = { "AWS::IAM::ManagedPolicy": new Set([
5059
5067
  "Groups"
5060
5068
  ]) };
5061
5069
  const ebOptionSettingsEntryTier = (entry, liveArray) => {
5062
- 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");
5063
5072
  const envType = typeof envEntry?.Value === "string" ? envEntry.Value : "LoadBalanced";
5064
- 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);
5065
5075
  };
5066
5076
  const ebOptionSettingsSubsetSpec = {
5067
5077
  re: /(^|\.)OptionSettings$/,
@@ -10646,9 +10656,7 @@ function isDefinitiveNotManaged(physicalId, accountId, region) {
10646
10656
  if (arnAccount !== "" && arnAccount !== accountId) return false;
10647
10657
  return true;
10648
10658
  }
10649
- async function isManagedBySiblingStack(cfn, c, cache, accountId, region) {
10650
- const physicalId = c.siblingLookupId ?? c.identifier;
10651
- if (c.siblingLookupId === void 0 && physicalId.includes("|")) return "notManaged";
10659
+ async function probeSiblingPhysicalId(cfn, c, physicalId, cache, accountId, region) {
10652
10660
  const cached = cache.get(physicalId);
10653
10661
  if (cached !== void 0) return cached;
10654
10662
  let managed = false;
@@ -10685,6 +10693,18 @@ async function isManagedBySiblingStack(cfn, c, cache, accountId, region) {
10685
10693
  cache.set(physicalId, result);
10686
10694
  return result;
10687
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
+ }
10688
10708
  const SG_RULE_RESOURCE_SIDE = {
10689
10709
  "AWS::EC2::SecurityGroupIngress": "ingress",
10690
10710
  "AWS::EC2::SecurityGroupEgress": "egress"