cdk-real-drift 0.22.6 → 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 +69 -2
- 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);
|
|
@@ -5981,6 +5984,7 @@ const MEANINGFUL_WHEN_OFF_NESTED = {
|
|
|
5981
5984
|
"WorkGroupConfiguration.PublishCloudWatchMetricsEnabled": () => true
|
|
5982
5985
|
},
|
|
5983
5986
|
"AWS::EKS::Cluster": { "ResourcesVpcConfig.EndpointPublicAccess": () => true },
|
|
5987
|
+
"AWS::Budgets::Budget": { "Budget.CostTypes": () => true },
|
|
5984
5988
|
"AWS::ECS::Service": { "DeploymentConfiguration.DeploymentCircuitBreaker.ResetOnHealthyTask": ({ declared, live }) => {
|
|
5985
5989
|
const enabled = (v) => typeof v === "object" && v !== null && v["DeploymentCircuitBreaker"]?.["Enable"] === true;
|
|
5986
5990
|
return enabled(declared["DeploymentConfiguration"]) || enabled(live["DeploymentConfiguration"]);
|
|
@@ -6382,6 +6386,27 @@ function glueIcebergManagedParamsAtDefault(resourceType, schemaPath, value, decl
|
|
|
6382
6386
|
if (!Object.keys(params).every((k) => managed.has(k))) return false;
|
|
6383
6387
|
return params.table_type === "ICEBERG";
|
|
6384
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
|
+
}
|
|
6385
6410
|
const CLB_DEFAULT_SSL_POLICY_NAME = "ELBSecurityPolicy-2016-08";
|
|
6386
6411
|
function clbDefaultSslPoliciesAtDefault(resourceType, key, value) {
|
|
6387
6412
|
if (resourceType !== "AWS::ElasticLoadBalancing::LoadBalancer" || key !== "Policies") return false;
|
|
@@ -7305,7 +7330,11 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
7305
7330
|
const parentKey = (path.split(".").pop() ?? "").replace(/\[.*$/, "");
|
|
7306
7331
|
if (!isObjectForm || /tags$/i.test(parentKey)) return;
|
|
7307
7332
|
}
|
|
7308
|
-
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";
|
|
7309
7338
|
const freeFormKey = tier === "undeclared" && underFreeFormMap(schemaPath);
|
|
7310
7339
|
findings.push({
|
|
7311
7340
|
tier,
|
|
@@ -14897,6 +14926,42 @@ function buildClientVpnEndpointSiblingVpcs(desired) {
|
|
|
14897
14926
|
}
|
|
14898
14927
|
return out;
|
|
14899
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
|
+
}
|
|
14900
14965
|
function buildSiblingSubnetCidrBlocks(desired) {
|
|
14901
14966
|
const subnetIdentities = /* @__PURE__ */ new Map();
|
|
14902
14967
|
for (const r of desired.resources) {
|
|
@@ -15326,6 +15391,7 @@ async function gatherFindings(stackName, region, templateOverride, recoveryTempl
|
|
|
15326
15391
|
clusterEchoModel: buildClusterEchoModels(desired),
|
|
15327
15392
|
scalableTargetBands: buildScalableTargetBands(desired),
|
|
15328
15393
|
siblingClientVpnEndpointVpcs: buildClientVpnEndpointSiblingVpcs(desired),
|
|
15394
|
+
siblingCloudFrontCdPolicyIds: buildCloudFrontStagingDistCdPolicyIds(desired, liveModelMap(reads)),
|
|
15329
15395
|
rdsOptionSettingDefaults: await buildRdsOptionSettingDefaults(desired, region)
|
|
15330
15396
|
};
|
|
15331
15397
|
const corpusDir = process.env[CORPUS_DIR_ENV];
|
|
@@ -15403,6 +15469,7 @@ async function regatherTouched(gathered, touched, region) {
|
|
|
15403
15469
|
clusterEchoModel: buildClusterEchoModels(desired),
|
|
15404
15470
|
scalableTargetBands: buildScalableTargetBands(desired),
|
|
15405
15471
|
siblingClientVpnEndpointVpcs: buildClientVpnEndpointSiblingVpcs(desired),
|
|
15472
|
+
siblingCloudFrontCdPolicyIds: buildCloudFrontStagingDistCdPolicyIds(desired, liveModelMap(reads)),
|
|
15406
15473
|
rdsOptionSettingDefaults: await buildRdsOptionSettingDefaults(desired, region)
|
|
15407
15474
|
};
|
|
15408
15475
|
const fresh = [];
|