cdk-real-drift 0.12.79 → 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 +67 -6
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
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
|
|
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,
|
|
@@ -14913,13 +14963,22 @@ const assertOpsConsumed = (resourceType, ops, handled) => {
|
|
|
14913
14963
|
const dropped = [...new Set(ops.map((o) => opTopSeg(o.path)).filter((s) => !isHandled(s)))];
|
|
14914
14964
|
if (dropped.length > 0) throw new Error(`${resourceType} revert cannot apply ${dropped.join(", ")}: this SDK writer supports only a subset of properties and does not handle ${dropped.length > 1 ? "these" : "this one"}; update ${dropped.length > 1 ? "them" : "it"} manually`);
|
|
14915
14965
|
};
|
|
14966
|
+
function assertIndexedPriorsFresh(resourceType, freshModel, ops) {
|
|
14967
|
+
for (const { path, prior } of ops) {
|
|
14968
|
+
if (!hasArrayIndexSegment(path) || prior === void 0) continue;
|
|
14969
|
+
const fresh = rawValueAtPointer(freshModel, path);
|
|
14970
|
+
if (fresh === POINTER_ABSENT || !deepEqual(fresh, prior)) throw new Error(`${resourceType} revert aborted: the live value at ${path} changed since check (an element was added, removed, or reordered) — re-run check and revert again`);
|
|
14971
|
+
}
|
|
14972
|
+
}
|
|
14916
14973
|
async function desiredModel(type, ctx, ops) {
|
|
14917
14974
|
const reader = SDK_OVERRIDES[type];
|
|
14918
14975
|
const current = (reader && await reader(ctx)) ?? {};
|
|
14919
|
-
|
|
14976
|
+
const aligned = current.PolicyDocument === void 0 ? current : {
|
|
14920
14977
|
...current,
|
|
14921
14978
|
PolicyDocument: canonicalizeForCompare(current.PolicyDocument)
|
|
14922
|
-
}
|
|
14979
|
+
};
|
|
14980
|
+
assertIndexedPriorsFresh(type, aligned, ops);
|
|
14981
|
+
return applyOps(aligned, ops);
|
|
14923
14982
|
}
|
|
14924
14983
|
const policyJson = (m) => m.PolicyDocument === void 0 ? void 0 : JSON.stringify(m.PolicyDocument);
|
|
14925
14984
|
const writeS3BucketPolicy = async (ctx, ops) => {
|
|
@@ -15279,7 +15338,9 @@ const writeWafv2WebAcl = async (ctx, ops) => {
|
|
|
15279
15338
|
Scope: scope
|
|
15280
15339
|
}));
|
|
15281
15340
|
if (!cur.WebACL || !cur.LockToken) throw new Error("could not read current WebACL for revert");
|
|
15282
|
-
const
|
|
15341
|
+
const canonWebAcl = canonicalizeForCompare(cur.WebACL);
|
|
15342
|
+
assertIndexedPriorsFresh("AWS::WAFv2::WebACL", canonWebAcl, ops);
|
|
15343
|
+
const m = applyOps(canonWebAcl, ops);
|
|
15283
15344
|
const desc = m.Description;
|
|
15284
15345
|
await c.send(new UpdateWebACLCommand({
|
|
15285
15346
|
Name: name,
|