cdk-real-drift 0.12.80 → 0.12.81

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
@@ -10,9 +10,9 @@ import { CloudControlClient, DeleteResourceCommand, GetResourceCommand, GetResou
10
10
  import { homedir } from "node:os";
11
11
  import { BaseCredentials, CdkAppMultiContext, NonInteractiveIoHost, StackSelectionStrategy, Toolkit } from "@aws-cdk/toolkit-lib";
12
12
  import { CloudFormationClient, DescribeStackResourcesCommand, DescribeStacksCommand, DescribeTypeCommand, GetTemplateCommand, ListExportsCommand, ListStackResourcesCommand } from "@aws-sdk/client-cloudformation";
13
- import { DescribeAddressesCommand, DescribeClientVpnAuthorizationRulesCommand, DescribeClientVpnEndpointsCommand, DescribeClientVpnTargetNetworksCommand, DescribeInternetGatewaysCommand, DescribeLaunchTemplateVersionsCommand, DescribeNetworkAclsCommand, DescribeRouteTablesCommand, DescribeSecurityGroupsCommand, DescribeSubnetsCommand, DescribeVpcEndpointsCommand, DescribeVpcsCommand, EC2Client, GetEbsEncryptionByDefaultCommand, ModifyClientVpnEndpointCommand } from "@aws-sdk/client-ec2";
13
+ import { DescribeAddressesCommand, DescribeClientVpnAuthorizationRulesCommand, DescribeClientVpnEndpointsCommand, DescribeClientVpnTargetNetworksCommand, DescribeInternetGatewaysCommand, DescribeLaunchTemplateVersionsCommand, DescribeNetworkAclsCommand, DescribeRouteTablesCommand, DescribeSecurityGroupsCommand, DescribeSubnetsCommand, DescribeVpcEndpointsCommand, DescribeVpcsCommand, EC2Client, GetDefaultCreditSpecificationCommand, GetEbsEncryptionByDefaultCommand, ModifyClientVpnEndpointCommand } from "@aws-sdk/client-ec2";
14
14
  import { DescribeServicesCommand, ECSClient, ListAccountSettingsCommand, ListServicesCommand, UpdateServiceCommand } from "@aws-sdk/client-ecs";
15
- import { DescribeDBClustersCommand, DescribeDBInstancesCommand, DescribeOptionGroupOptionsCommand, RDSClient } from "@aws-sdk/client-rds";
15
+ import { DescribeCertificatesCommand, DescribeDBClustersCommand, DescribeDBInstancesCommand, DescribeOptionGroupOptionsCommand, RDSClient } from "@aws-sdk/client-rds";
16
16
  import { DescribeParametersCommand, GetParametersCommand, GetServiceSettingCommand, SSMClient } from "@aws-sdk/client-ssm";
17
17
  import jsonata from "jsonata";
18
18
  import { KMSClient, ListAliasesCommand } from "@aws-sdk/client-kms";
@@ -5584,6 +5584,7 @@ function accountDerivedDefault(resourceType, key, ad) {
5584
5584
  }] };
5585
5585
  if (resourceType === "AWS::SSM::Parameter" && key === "Tier" && ad.ssmParameterTier !== void 0) return { value: ad.ssmParameterTier };
5586
5586
  if (resourceType === "AWS::EC2::Volume" && key === "Encrypted" && ad.ebsEncryptionByDefault !== void 0) return { value: ad.ebsEncryptionByDefault };
5587
+ if ((resourceType === "AWS::RDS::DBInstance" || resourceType === "AWS::DocDB::DBInstance") && key === "CACertificateIdentifier" && ad.rdsDefaultCaIdentifier !== void 0) return { value: ad.rdsDefaultCaIdentifier };
5587
5588
  }
5588
5589
  const stripCognitoAttrPrefix = (id) => id.replace(/^(custom|dev):/, "");
5589
5590
  const IDENTITY_KEYED_SUBSET_ARRAYS = {
@@ -6543,7 +6544,8 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
6543
6544
  if (resourceType === "AWS::EC2::Instance") {
6544
6545
  const instanceType = declared["InstanceType"];
6545
6546
  const family = typeof instanceType === "string" ? instanceType.split(".")[0] : void 0;
6546
- const creditDefault = family === "t2" ? "standard" : family === "t3" || family === "t3a" || family === "t4g" ? "unlimited" : void 0;
6547
+ const factoryDefault = family === "t2" ? "standard" : family === "t3" || family === "t3a" || family === "t4g" ? "unlimited" : void 0;
6548
+ const creditDefault = (family !== void 0 ? opts.accountDefaults?.ec2FamilyCreditDefaults?.[family] : void 0) ?? factoryDefault;
6547
6549
  if (creditDefault !== void 0) knownDef = {
6548
6550
  ...knownDef,
6549
6551
  CreditSpecification: { CPUCredits: creditDefault }
@@ -12648,6 +12650,35 @@ async function fetchEbsEncryptionByDefault(region) {
12648
12650
  return;
12649
12651
  }
12650
12652
  }
12653
+ const ec2CreditDefaultCache = /* @__PURE__ */ new Map();
12654
+ async function fetchEc2FamilyCreditDefault(region, family) {
12655
+ const cacheKey = `${region}|${family}`;
12656
+ if (ec2CreditDefaultCache.has(cacheKey)) return ec2CreditDefaultCache.get(cacheKey);
12657
+ try {
12658
+ const value = (await new EC2Client({
12659
+ region,
12660
+ ...READ_RETRY
12661
+ }).send(new GetDefaultCreditSpecificationCommand({ InstanceFamily: family }))).InstanceFamilyCreditSpecification?.CpuCredits;
12662
+ ec2CreditDefaultCache.set(cacheKey, value);
12663
+ return value;
12664
+ } catch {
12665
+ return;
12666
+ }
12667
+ }
12668
+ const rdsDefaultCaCache = /* @__PURE__ */ new Map();
12669
+ async function fetchRdsDefaultCaIdentifier(region) {
12670
+ if (rdsDefaultCaCache.has(region)) return rdsDefaultCaCache.get(region);
12671
+ try {
12672
+ const value = ((await new RDSClient({
12673
+ region,
12674
+ ...READ_RETRY
12675
+ }).send(new DescribeCertificatesCommand({}))).Certificates ?? []).find((cert) => cert.CustomerOverride === true)?.CertificateIdentifier;
12676
+ rdsDefaultCaCache.set(region, value);
12677
+ return value;
12678
+ } catch {
12679
+ return;
12680
+ }
12681
+ }
12651
12682
  const kmsDeniedWarned = /* @__PURE__ */ new Set();
12652
12683
  const kmsTransientWarned = /* @__PURE__ */ new Set();
12653
12684
  const POOL_SIZE = 6;
@@ -13238,6 +13269,25 @@ async function gatherFindings(stackName, region, templateOverride, recoveryTempl
13238
13269
  const v = await fetchEbsEncryptionByDefault(region);
13239
13270
  if (v !== void 0) accountDefaults.ebsEncryptionByDefault = v;
13240
13271
  }
13272
+ const burstableFamilies = /* @__PURE__ */ new Set();
13273
+ for (const r of desired.resources) {
13274
+ if (r.resourceType !== "AWS::EC2::Instance") continue;
13275
+ const it = r.declared?.InstanceType;
13276
+ const fam = typeof it === "string" ? it.split(".")[0] : void 0;
13277
+ if (fam !== void 0 && /^t\d/.test(fam)) burstableFamilies.add(fam);
13278
+ }
13279
+ if (burstableFamilies.size > 0) {
13280
+ const map = {};
13281
+ for (const fam of burstableFamilies) {
13282
+ const v = await fetchEc2FamilyCreditDefault(region, fam);
13283
+ if (v !== void 0) map[fam] = v;
13284
+ }
13285
+ if (Object.keys(map).length > 0) accountDefaults.ec2FamilyCreditDefaults = map;
13286
+ }
13287
+ if (desired.resources.some((r) => r.resourceType === "AWS::RDS::DBInstance" || r.resourceType === "AWS::DocDB::DBInstance")) {
13288
+ const v = await fetchRdsDefaultCaIdentifier(region);
13289
+ if (v !== void 0) accountDefaults.rdsDefaultCaIdentifier = v;
13290
+ }
13241
13291
  const classifyOpts = {
13242
13292
  accountId: desired.accountId,
13243
13293
  region,