cdk-real-drift 0.22.5 → 0.22.7
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 +75 -4
- package/dist/cli.js.map +1 -1
- package/package.json +4 -10
package/dist/cli.js
CHANGED
|
@@ -1925,6 +1925,8 @@ function buildCorpusCase(resource, liveRaw, schema, opts, findings) {
|
|
|
1925
1925
|
const dmsStorageDefault = typeof dmsClass === "string" && opts.accountDefaults?.dmsAllocatedStorageDefaults?.[dmsClass] !== void 0 ? { dmsAllocatedStorageDefaults: { [dmsClass]: opts.accountDefaults.dmsAllocatedStorageDefaults[dmsClass] } } : void 0;
|
|
1926
1926
|
const cvpnVpcMap = opts.siblingClientVpnEndpointVpcs;
|
|
1927
1927
|
const cvpnVpcKey = resource.resourceType !== "AWS::EC2::ClientVpnEndpoint" || cvpnVpcMap === void 0 ? void 0 : resource.logicalId in cvpnVpcMap ? resource.logicalId : resource.physicalId !== void 0 && resource.physicalId in cvpnVpcMap ? resource.physicalId : void 0;
|
|
1928
|
+
const cfCdMap = opts.siblingCloudFrontCdPolicyIds;
|
|
1929
|
+
const cfCdKey = resource.resourceType !== "AWS::CloudFront::Distribution" || cfCdMap === void 0 ? void 0 : resource.logicalId in cfCdMap ? resource.logicalId : resource.physicalId !== void 0 && resource.physicalId in cfCdMap ? resource.physicalId : void 0;
|
|
1928
1930
|
return sanitizeAccountId({
|
|
1929
1931
|
corpusVersion: 1,
|
|
1930
1932
|
resource: {
|
|
@@ -1963,7 +1965,8 @@ function buildCorpusCase(resource, liveRaw, schema, opts, findings) {
|
|
|
1963
1965
|
...rdsOptCatalog && resource.physicalId ? { rdsOptionSettingDefaults: { [resource.physicalId]: rdsOptCatalog } } : {},
|
|
1964
1966
|
...gaListenerPort ? { siblingListenerPorts: gaListenerPort } : {},
|
|
1965
1967
|
...dmsStorageDefault ? { accountDefaults: dmsStorageDefault } : {},
|
|
1966
|
-
...cvpnVpcKey !== void 0 && cvpnVpcMap !== void 0 ? { siblingClientVpnEndpointVpcs: { [cvpnVpcKey]: cvpnVpcMap[cvpnVpcKey] ?? null } } : {}
|
|
1968
|
+
...cvpnVpcKey !== void 0 && cvpnVpcMap !== void 0 ? { siblingClientVpnEndpointVpcs: { [cvpnVpcKey]: cvpnVpcMap[cvpnVpcKey] ?? null } } : {},
|
|
1969
|
+
...cfCdKey !== void 0 && cfCdMap !== void 0 ? { siblingCloudFrontCdPolicyIds: { [cfCdKey]: cfCdMap[cfCdKey] ?? null } } : {}
|
|
1967
1970
|
},
|
|
1968
1971
|
expected: findings
|
|
1969
1972
|
}, opts.accountId);
|
|
@@ -2528,7 +2531,10 @@ const KNOWN_DEFAULTS = {
|
|
|
2528
2531
|
KeyUsage: "ENCRYPT_DECRYPT",
|
|
2529
2532
|
Origin: "AWS_KMS"
|
|
2530
2533
|
},
|
|
2531
|
-
"AWS::DLM::LifecyclePolicy": {
|
|
2534
|
+
"AWS::DLM::LifecyclePolicy": {
|
|
2535
|
+
RetainInterval: 7,
|
|
2536
|
+
CreateInterval: 1
|
|
2537
|
+
},
|
|
2532
2538
|
"AWS::IAM::Group": { Path: "/" },
|
|
2533
2539
|
"AWS::IAM::User": { Path: "/" },
|
|
2534
2540
|
"AWS::IAM::InstanceProfile": { Path: "/" },
|
|
@@ -5978,6 +5984,7 @@ const MEANINGFUL_WHEN_OFF_NESTED = {
|
|
|
5978
5984
|
"WorkGroupConfiguration.PublishCloudWatchMetricsEnabled": () => true
|
|
5979
5985
|
},
|
|
5980
5986
|
"AWS::EKS::Cluster": { "ResourcesVpcConfig.EndpointPublicAccess": () => true },
|
|
5987
|
+
"AWS::Budgets::Budget": { "Budget.CostTypes": () => true },
|
|
5981
5988
|
"AWS::ECS::Service": { "DeploymentConfiguration.DeploymentCircuitBreaker.ResetOnHealthyTask": ({ declared, live }) => {
|
|
5982
5989
|
const enabled = (v) => typeof v === "object" && v !== null && v["DeploymentCircuitBreaker"]?.["Enable"] === true;
|
|
5983
5990
|
return enabled(declared["DeploymentConfiguration"]) || enabled(live["DeploymentConfiguration"]);
|
|
@@ -6379,6 +6386,27 @@ function glueIcebergManagedParamsAtDefault(resourceType, schemaPath, value, decl
|
|
|
6379
6386
|
if (!Object.keys(params).every((k) => managed.has(k))) return false;
|
|
6380
6387
|
return params.table_type === "ICEBERG";
|
|
6381
6388
|
}
|
|
6389
|
+
function cloudFrontCdPolicySynonymAtDefault(resourceType, schemaPath, value, declared) {
|
|
6390
|
+
if (resourceType !== "AWS::CloudFront::ContinuousDeploymentPolicy") return false;
|
|
6391
|
+
const cfg = declared.ContinuousDeploymentPolicyConfig;
|
|
6392
|
+
if (!isNestedObject(cfg)) return false;
|
|
6393
|
+
const c = cfg;
|
|
6394
|
+
const traffic = isNestedObject(c.TrafficConfig) ? c.TrafficConfig : void 0;
|
|
6395
|
+
switch (schemaPath) {
|
|
6396
|
+
case "ContinuousDeploymentPolicyConfig.Type": return traffic !== void 0 && deepEqual(value, traffic.Type);
|
|
6397
|
+
case "ContinuousDeploymentPolicyConfig.SingleWeightPolicyConfig": return traffic !== void 0 && deepEqual(value, traffic.SingleWeightConfig);
|
|
6398
|
+
case "ContinuousDeploymentPolicyConfig.SingleHeaderPolicyConfig": return traffic !== void 0 && deepEqual(value, traffic.SingleHeaderConfig);
|
|
6399
|
+
case "ContinuousDeploymentPolicyConfig.TrafficConfig": {
|
|
6400
|
+
if (traffic !== void 0 || !isNestedObject(value)) return false;
|
|
6401
|
+
if (c.Type === void 0) return false;
|
|
6402
|
+
const derived = { Type: c.Type };
|
|
6403
|
+
if (c.SingleWeightPolicyConfig !== void 0) derived.SingleWeightConfig = c.SingleWeightPolicyConfig;
|
|
6404
|
+
if (c.SingleHeaderPolicyConfig !== void 0) derived.SingleHeaderConfig = c.SingleHeaderPolicyConfig;
|
|
6405
|
+
return deepEqual(value, derived);
|
|
6406
|
+
}
|
|
6407
|
+
default: return false;
|
|
6408
|
+
}
|
|
6409
|
+
}
|
|
6382
6410
|
const CLB_DEFAULT_SSL_POLICY_NAME = "ELBSecurityPolicy-2016-08";
|
|
6383
6411
|
function clbDefaultSslPoliciesAtDefault(resourceType, key, value) {
|
|
6384
6412
|
if (resourceType !== "AWS::ElasticLoadBalancing::LoadBalancer" || key !== "Policies") return false;
|
|
@@ -7302,7 +7330,11 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
7302
7330
|
const parentKey = (path.split(".").pop() ?? "").replace(/\[.*$/, "");
|
|
7303
7331
|
if (!isObjectForm || /tags$/i.test(parentKey)) return;
|
|
7304
7332
|
}
|
|
7305
|
-
const tier = schemaPath in schema.defaultPaths && matchesKnownDefault(value, schema.defaultPaths[schemaPath]) || schemaPath in knownDefPaths && matchesKnownDefault(value, knownDefPaths[schemaPath]) || (KNOWN_DEFAULT_ONE_OF_PATHS[resourceType]?.[schemaPath]?.some((d) => matchesKnownDefault(value, d)) ?? false) || VALUE_INDEPENDENT_DEFAULT_NESTED_PATHS[resourceType]?.has(schemaPath) && !(schemaPath in knownDefPaths) || dynamoGsiWarmThroughputAtDefault(resourceType, path, value, live, declared) || resourceType === "AWS::Events::EventBusPolicy" && schemaPath === "Statement.*.Sid" && typeof value === "string" && value === declared["StatementId"] || configRecordingStrategyAtDefault(resourceType, schemaPath, value, live) ||
|
|
7333
|
+
const tier = schemaPath in schema.defaultPaths && matchesKnownDefault(value, schema.defaultPaths[schemaPath]) || schemaPath in knownDefPaths && matchesKnownDefault(value, knownDefPaths[schemaPath]) || (KNOWN_DEFAULT_ONE_OF_PATHS[resourceType]?.[schemaPath]?.some((d) => matchesKnownDefault(value, d)) ?? false) || VALUE_INDEPENDENT_DEFAULT_NESTED_PATHS[resourceType]?.has(schemaPath) && !(schemaPath in knownDefPaths) || dynamoGsiWarmThroughputAtDefault(resourceType, path, value, live, declared) || resourceType === "AWS::Events::EventBusPolicy" && schemaPath === "Statement.*.Sid" && typeof value === "string" && value === declared["StatementId"] || configRecordingStrategyAtDefault(resourceType, schemaPath, value, live) || cloudFrontCdPolicySynonymAtDefault(resourceType, schemaPath, value, declared) || resourceType === "AWS::CloudFront::Distribution" && schemaPath === "DistributionConfig.ContinuousDeploymentPolicyId" && typeof value === "string" && (() => {
|
|
7334
|
+
const m = opts.siblingCloudFrontCdPolicyIds;
|
|
7335
|
+
const derived = m === void 0 ? void 0 : logicalId in m ? m[logicalId] : physicalId !== void 0 && physicalId in m ? m[physicalId] : void 0;
|
|
7336
|
+
return derived !== void 0 && (derived === null || derived === value);
|
|
7337
|
+
})() || glueIcebergManagedParamsAtDefault(resourceType, schemaPath, value, declared) ? "atDefault" : generatedPaths.includes(schemaPath) && isPhysicalIdSegment(value, physicalId) || generatedNestedPaths?.has(schemaPath) && !(schemaPath in knownDefPaths) && (!(schemaPath in (MANAGED_KEY_ALIAS_PATHS[resourceType] ?? {})) || shouldFoldManagedServiceKey(resourceType, schemaPath, value, opts.kmsAliasTargets)) ? "generated" : "undeclared";
|
|
7306
7338
|
const freeFormKey = tier === "undeclared" && underFreeFormMap(schemaPath);
|
|
7307
7339
|
findings.push({
|
|
7308
7340
|
tier,
|
|
@@ -11771,7 +11803,7 @@ const readDlmLifecyclePolicy = async ({ physicalId, declared, region }) => {
|
|
|
11771
11803
|
if (str$1(p.State) !== void 0) model.State = p.State;
|
|
11772
11804
|
if (str$1(p.ExecutionRoleArn) !== void 0) model.ExecutionRoleArn = p.ExecutionRoleArn;
|
|
11773
11805
|
const details = p.PolicyDetails ?? {};
|
|
11774
|
-
if (declared.PolicyDetails === void 0 && DLM_DEFAULT_POLICY_SHORTHAND.some((k) => declared[k] !== void 0)) {
|
|
11806
|
+
if (p.DefaultPolicy === true || declared.PolicyDetails === void 0 && DLM_DEFAULT_POLICY_SHORTHAND.some((k) => declared[k] !== void 0)) {
|
|
11775
11807
|
for (const k of DLM_DEFAULT_POLICY_SHORTHAND) if (details[k] !== void 0) model[k] = details[k];
|
|
11776
11808
|
} else if (Object.keys(details).length > 0) model.PolicyDetails = details;
|
|
11777
11809
|
if (p.DefaultPolicy === true) {
|
|
@@ -14894,6 +14926,42 @@ function buildClientVpnEndpointSiblingVpcs(desired) {
|
|
|
14894
14926
|
}
|
|
14895
14927
|
return out;
|
|
14896
14928
|
}
|
|
14929
|
+
function buildCloudFrontStagingDistCdPolicyIds(desired, liveByLogical) {
|
|
14930
|
+
const refLogicalId = (ref) => {
|
|
14931
|
+
if (ref && typeof ref === "object") {
|
|
14932
|
+
if ("Ref" in ref && typeof ref.Ref === "string") return ref.Ref;
|
|
14933
|
+
if ("Fn::GetAtt" in ref) {
|
|
14934
|
+
const g = ref["Fn::GetAtt"];
|
|
14935
|
+
if (Array.isArray(g) && typeof g[0] === "string") return g[0];
|
|
14936
|
+
}
|
|
14937
|
+
}
|
|
14938
|
+
};
|
|
14939
|
+
const distIdentities = /* @__PURE__ */ new Map();
|
|
14940
|
+
const distByDomain = /* @__PURE__ */ new Map();
|
|
14941
|
+
for (const r of desired.resources) {
|
|
14942
|
+
if (r.resourceType !== "AWS::CloudFront::Distribution") continue;
|
|
14943
|
+
const ids = [r.logicalId];
|
|
14944
|
+
if (r.physicalId) ids.push(r.physicalId);
|
|
14945
|
+
distIdentities.set(r.logicalId, ids);
|
|
14946
|
+
const domain = liveByLogical?.get(r.logicalId)?.["DomainName"];
|
|
14947
|
+
if (typeof domain === "string" && domain) distByDomain.set(domain.toLowerCase(), r.logicalId);
|
|
14948
|
+
}
|
|
14949
|
+
const out = {};
|
|
14950
|
+
for (const r of desired.resources) {
|
|
14951
|
+
if (r.resourceType !== "AWS::CloudFront::ContinuousDeploymentPolicy") continue;
|
|
14952
|
+
const cfg = r.declared?.["ContinuousDeploymentPolicyConfig"];
|
|
14953
|
+
const dns = cfg !== null && typeof cfg === "object" && !Array.isArray(cfg) ? cfg["StagingDistributionDnsNames"] : void 0;
|
|
14954
|
+
if (!Array.isArray(dns)) continue;
|
|
14955
|
+
const policyId = r.physicalId ?? null;
|
|
14956
|
+
for (const el of dns) {
|
|
14957
|
+
const distLogical = refLogicalId(el) ?? (typeof el === "string" ? distByDomain.get(el.toLowerCase()) : void 0);
|
|
14958
|
+
if (distLogical === void 0) continue;
|
|
14959
|
+
for (const key of distIdentities.get(distLogical) ?? []) if (key in out && out[key] !== policyId) out[key] = null;
|
|
14960
|
+
else out[key] = policyId;
|
|
14961
|
+
}
|
|
14962
|
+
}
|
|
14963
|
+
return out;
|
|
14964
|
+
}
|
|
14897
14965
|
function buildSiblingSubnetCidrBlocks(desired) {
|
|
14898
14966
|
const subnetIdentities = /* @__PURE__ */ new Map();
|
|
14899
14967
|
for (const r of desired.resources) {
|
|
@@ -15323,6 +15391,7 @@ async function gatherFindings(stackName, region, templateOverride, recoveryTempl
|
|
|
15323
15391
|
clusterEchoModel: buildClusterEchoModels(desired),
|
|
15324
15392
|
scalableTargetBands: buildScalableTargetBands(desired),
|
|
15325
15393
|
siblingClientVpnEndpointVpcs: buildClientVpnEndpointSiblingVpcs(desired),
|
|
15394
|
+
siblingCloudFrontCdPolicyIds: buildCloudFrontStagingDistCdPolicyIds(desired, liveModelMap(reads)),
|
|
15326
15395
|
rdsOptionSettingDefaults: await buildRdsOptionSettingDefaults(desired, region)
|
|
15327
15396
|
};
|
|
15328
15397
|
const corpusDir = process.env[CORPUS_DIR_ENV];
|
|
@@ -15400,6 +15469,7 @@ async function regatherTouched(gathered, touched, region) {
|
|
|
15400
15469
|
clusterEchoModel: buildClusterEchoModels(desired),
|
|
15401
15470
|
scalableTargetBands: buildScalableTargetBands(desired),
|
|
15402
15471
|
siblingClientVpnEndpointVpcs: buildClientVpnEndpointSiblingVpcs(desired),
|
|
15472
|
+
siblingCloudFrontCdPolicyIds: buildCloudFrontStagingDistCdPolicyIds(desired, liveModelMap(reads)),
|
|
15403
15473
|
rdsOptionSettingDefaults: await buildRdsOptionSettingDefaults(desired, region)
|
|
15404
15474
|
};
|
|
15405
15475
|
const fresh = [];
|
|
@@ -19355,6 +19425,7 @@ const CC_REVERTABLE_DESPITE_READ_OVERRIDE = new Set([
|
|
|
19355
19425
|
]);
|
|
19356
19426
|
const REVERT_SET_DEFAULT_PATHS = new Set([
|
|
19357
19427
|
"AWS::DLM::LifecyclePolicy\0RetainInterval",
|
|
19428
|
+
"AWS::DLM::LifecyclePolicy\0CreateInterval",
|
|
19358
19429
|
"AWS::IAM::Role\0MaxSessionDuration",
|
|
19359
19430
|
"AWS::IAM::Role\0Description",
|
|
19360
19431
|
"AWS::Lambda::Alias\0Description",
|