cdk-real-drift 0.1.9 → 0.1.11
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 +118 -3
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1103,6 +1103,13 @@ const KNOWN_DEFAULTS = {
|
|
|
1103
1103
|
Version: "1.0",
|
|
1104
1104
|
Name: "WebServer"
|
|
1105
1105
|
} },
|
|
1106
|
+
"AWS::ElasticLoadBalancing::LoadBalancer": {
|
|
1107
|
+
ConnectionSettings: { IdleTimeout: 60 },
|
|
1108
|
+
ConnectionDrainingPolicy: {
|
|
1109
|
+
Enabled: false,
|
|
1110
|
+
Timeout: 300
|
|
1111
|
+
}
|
|
1112
|
+
},
|
|
1106
1113
|
"AWS::S3::Bucket": {
|
|
1107
1114
|
VersioningConfiguration: { Status: "Suspended" },
|
|
1108
1115
|
AbacStatus: "Disabled",
|
|
@@ -1932,11 +1939,113 @@ const GENERATED_NESTED_PATHS = {
|
|
|
1932
1939
|
"AWS::Lambda::Function": new Set(["LoggingConfig.LogGroup"]),
|
|
1933
1940
|
"AWS::OpenSearchService::Domain": new Set(["EncryptionAtRestOptions.KmsKeyId"])
|
|
1934
1941
|
};
|
|
1942
|
+
const EB_OPTION_DEFAULTS = {
|
|
1943
|
+
"aws:autoscaling:asg|Availability Zones": "Any",
|
|
1944
|
+
"aws:autoscaling:asg|Cooldown": "360",
|
|
1945
|
+
"aws:autoscaling:asg|EnableCapacityRebalancing": "false",
|
|
1946
|
+
"aws:autoscaling:asg|MinSize": "1",
|
|
1947
|
+
"aws:autoscaling:launchconfiguration|DisableDefaultEC2SecurityGroup": "false",
|
|
1948
|
+
"aws:autoscaling:launchconfiguration|DisableIMDSv1": "true",
|
|
1949
|
+
"aws:autoscaling:launchconfiguration|MonitoringInterval": "5 minute",
|
|
1950
|
+
"aws:autoscaling:launchconfiguration|SSHSourceRestriction": "tcp,22,22,0.0.0.0/0",
|
|
1951
|
+
"aws:autoscaling:trigger|BreachDuration": "5",
|
|
1952
|
+
"aws:autoscaling:trigger|EvaluationPeriods": "1",
|
|
1953
|
+
"aws:autoscaling:trigger|LowerBreachScaleIncrement": "-1",
|
|
1954
|
+
"aws:autoscaling:trigger|LowerThreshold": "2000000",
|
|
1955
|
+
"aws:autoscaling:trigger|MeasureName": "NetworkOut",
|
|
1956
|
+
"aws:autoscaling:trigger|Period": "5",
|
|
1957
|
+
"aws:autoscaling:trigger|Statistic": "Average",
|
|
1958
|
+
"aws:autoscaling:trigger|Unit": "Bytes",
|
|
1959
|
+
"aws:autoscaling:trigger|UpperBreachScaleIncrement": "1",
|
|
1960
|
+
"aws:autoscaling:trigger|UpperThreshold": "6000000",
|
|
1961
|
+
"aws:autoscaling:updatepolicy:rollingupdate|RollingUpdateEnabled": "false",
|
|
1962
|
+
"aws:autoscaling:updatepolicy:rollingupdate|RollingUpdateType": "Time",
|
|
1963
|
+
"aws:autoscaling:updatepolicy:rollingupdate|Timeout": "PT30M",
|
|
1964
|
+
"aws:cloudformation:template:parameter|InstancePort": "80",
|
|
1965
|
+
"aws:ec2:instances|EnableSpot": "false",
|
|
1966
|
+
"aws:ec2:instances|SpotAllocationStrategy": "capacity-optimized",
|
|
1967
|
+
"aws:ec2:instances|SpotFleetOnDemandBase": "0",
|
|
1968
|
+
"aws:ec2:vpc|ELBScheme": "public",
|
|
1969
|
+
"aws:elasticbeanstalk:cloudwatch:logs:health|DeleteOnTerminate": "false",
|
|
1970
|
+
"aws:elasticbeanstalk:cloudwatch:logs:health|HealthStreamingEnabled": "false",
|
|
1971
|
+
"aws:elasticbeanstalk:cloudwatch:logs:health|RetentionInDays": "7",
|
|
1972
|
+
"aws:elasticbeanstalk:cloudwatch:logs|DeleteOnTerminate": "false",
|
|
1973
|
+
"aws:elasticbeanstalk:cloudwatch:logs|RetentionInDays": "7",
|
|
1974
|
+
"aws:elasticbeanstalk:cloudwatch:logs|StreamLogs": "false",
|
|
1975
|
+
"aws:elasticbeanstalk:command|BatchSize": "100",
|
|
1976
|
+
"aws:elasticbeanstalk:command|BatchSizeType": "Percentage",
|
|
1977
|
+
"aws:elasticbeanstalk:command|DeploymentPolicy": "AllAtOnce",
|
|
1978
|
+
"aws:elasticbeanstalk:command|IgnoreHealthCheck": "false",
|
|
1979
|
+
"aws:elasticbeanstalk:command|Timeout": "600",
|
|
1980
|
+
"aws:elasticbeanstalk:control|DefaultSSHPort": "22",
|
|
1981
|
+
"aws:elasticbeanstalk:control|LaunchTimeout": "0",
|
|
1982
|
+
"aws:elasticbeanstalk:control|LaunchType": "Migration",
|
|
1983
|
+
"aws:elasticbeanstalk:control|RollbackLaunchOnFailure": "false",
|
|
1984
|
+
"aws:elasticbeanstalk:environment:proxy|ProxyServer": "nginx",
|
|
1985
|
+
"aws:elasticbeanstalk:environment|LoadBalancerType": "classic",
|
|
1986
|
+
"aws:elasticbeanstalk:healthreporting:system|EnhancedHealthAuthEnabled": "false",
|
|
1987
|
+
"aws:elasticbeanstalk:healthreporting:system|HealthCheckSuccessThreshold": "Ok",
|
|
1988
|
+
"aws:elasticbeanstalk:healthreporting:system|SystemType": "enhanced",
|
|
1989
|
+
"aws:elasticbeanstalk:hostmanager|LogPublicationControl": "false",
|
|
1990
|
+
"aws:elasticbeanstalk:managedactions:platformupdate|InstanceRefreshEnabled": "false",
|
|
1991
|
+
"aws:elasticbeanstalk:managedactions|ManagedActionsEnabled": "false",
|
|
1992
|
+
"aws:elasticbeanstalk:monitoring|Automatically Terminate Unhealthy Instances": "true",
|
|
1993
|
+
"aws:elasticbeanstalk:sns:topics|Notification Protocol": "email",
|
|
1994
|
+
"aws:elasticbeanstalk:xray|XRayEnabled": "false",
|
|
1995
|
+
"aws:elb:healthcheck|HealthyThreshold": "3",
|
|
1996
|
+
"aws:elb:healthcheck|Interval": "10",
|
|
1997
|
+
"aws:elb:healthcheck|Target": "TCP:80",
|
|
1998
|
+
"aws:elb:healthcheck|Timeout": "5",
|
|
1999
|
+
"aws:elb:healthcheck|UnhealthyThreshold": "5",
|
|
2000
|
+
"aws:elb:listener:80|InstancePort": "80",
|
|
2001
|
+
"aws:elb:listener:80|InstanceProtocol": "HTTP",
|
|
2002
|
+
"aws:elb:listener:80|ListenerEnabled": "true",
|
|
2003
|
+
"aws:elb:listener:80|ListenerProtocol": "HTTP",
|
|
2004
|
+
"aws:elb:loadbalancer|CrossZone": "false",
|
|
2005
|
+
"aws:elb:loadbalancer|LoadBalancerHTTPPort": "80",
|
|
2006
|
+
"aws:elb:loadbalancer|LoadBalancerHTTPSPort": "OFF",
|
|
2007
|
+
"aws:elb:loadbalancer|LoadBalancerPortProtocol": "HTTP",
|
|
2008
|
+
"aws:elb:loadbalancer|LoadBalancerSSLPortProtocol": "HTTPS",
|
|
2009
|
+
"aws:elb:policies|ConnectionDrainingEnabled": "false",
|
|
2010
|
+
"aws:elb:policies|ConnectionDrainingTimeout": "20",
|
|
2011
|
+
"aws:elb:policies|ConnectionSettingIdleTimeout": "60",
|
|
2012
|
+
"aws:rds:dbinstance|HasCoupledDatabase": "false"
|
|
2013
|
+
};
|
|
2014
|
+
const EB_OPTION_DERIVED = {
|
|
2015
|
+
"aws:autoscaling:asg|MaxSize": {
|
|
2016
|
+
SingleInstance: "1",
|
|
2017
|
+
LoadBalanced: "4"
|
|
2018
|
+
},
|
|
2019
|
+
"aws:ec2:instances|SpotFleetOnDemandAboveBasePercentage": {
|
|
2020
|
+
SingleInstance: "0",
|
|
2021
|
+
LoadBalanced: "70"
|
|
2022
|
+
}
|
|
2023
|
+
};
|
|
2024
|
+
const EB_OPTION_VALUE_INDEPENDENT = new Set([
|
|
2025
|
+
"aws:autoscaling:launchconfiguration|ImageId",
|
|
2026
|
+
"aws:autoscaling:launchconfiguration|InstanceType",
|
|
2027
|
+
"aws:cloudformation:template:parameter|AppSource",
|
|
2028
|
+
"aws:cloudformation:template:parameter|HooksPkgUrl",
|
|
2029
|
+
"aws:cloudformation:template:parameter|InstanceTypeFamily",
|
|
2030
|
+
"aws:ec2:instances|InstanceTypes",
|
|
2031
|
+
"aws:ec2:instances|SupportedArchitectures",
|
|
2032
|
+
"aws:elasticbeanstalk:healthreporting:system|ConfigDocument",
|
|
2033
|
+
"aws:elb:loadbalancer|SecurityGroups"
|
|
2034
|
+
]);
|
|
2035
|
+
function ebOptionSettingTier(namespace, optionName, value, envType) {
|
|
2036
|
+
const key = `${String(namespace)}|${String(optionName)}`;
|
|
2037
|
+
if (EB_OPTION_VALUE_INDEPENDENT.has(key)) return "atDefault";
|
|
2038
|
+
const derived = EB_OPTION_DERIVED[key];
|
|
2039
|
+
if (derived) return derived[envType] === value ? "atDefault" : "undeclared";
|
|
2040
|
+
if (key in EB_OPTION_DEFAULTS && EB_OPTION_DEFAULTS[key] === value) return "atDefault";
|
|
2041
|
+
return "undeclared";
|
|
2042
|
+
}
|
|
1935
2043
|
const VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS = {
|
|
1936
2044
|
"AWS::ECS::Service": new Set(["AvailabilityZoneRebalancing", "PlatformVersion"]),
|
|
1937
2045
|
"AWS::KinesisAnalyticsV2::Application": new Set(["ApplicationMaintenanceConfiguration"]),
|
|
1938
2046
|
"AWS::ElasticBeanstalk::ConfigurationTemplate": new Set(["PlatformArn"]),
|
|
1939
2047
|
"AWS::ElasticBeanstalk::Environment": new Set(["PlatformArn"]),
|
|
2048
|
+
"AWS::ElasticLoadBalancing::LoadBalancer": new Set(["AvailabilityZones"]),
|
|
1940
2049
|
"AWS::ApiGateway::Authorizer": new Set(["AuthType"]),
|
|
1941
2050
|
"AWS::RDS::DBCluster": new Set([
|
|
1942
2051
|
"KmsKeyId",
|
|
@@ -2161,7 +2270,8 @@ const CASE_INSENSITIVE_PATHS = {
|
|
|
2161
2270
|
"AWS::RDS::DBInstance": new Set(["DBInstanceIdentifier"]),
|
|
2162
2271
|
"AWS::RDS::DBCluster": new Set(["DBClusterIdentifier"]),
|
|
2163
2272
|
"AWS::DMS::Endpoint": new Set(["EndpointType"]),
|
|
2164
|
-
"AWS::WAFv2::LoggingConfiguration": new Set(["RedactedFields.*.SingleHeader.Name"])
|
|
2273
|
+
"AWS::WAFv2::LoggingConfiguration": new Set(["RedactedFields.*.SingleHeader.Name"]),
|
|
2274
|
+
"AWS::ElasticLoadBalancing::LoadBalancer": new Set(["Listeners.*.Protocol", "Listeners.*.InstanceProtocol"])
|
|
2165
2275
|
};
|
|
2166
2276
|
function isCaseInsensitiveScalarEqual(a, b) {
|
|
2167
2277
|
return typeof a === "string" && typeof b === "string" && a.toLowerCase() === b.toLowerCase();
|
|
@@ -3417,7 +3527,12 @@ const IAM_ATTACHMENT_SUBSET = { "AWS::IAM::ManagedPolicy": new Set([
|
|
|
3417
3527
|
const COMPOSITE_KEY_SUBSET_PATHS = { "AWS::ElasticBeanstalk::ConfigurationTemplate": {
|
|
3418
3528
|
re: /(^|\.)OptionSettings$/,
|
|
3419
3529
|
keyFields: ["Namespace", "OptionName"],
|
|
3420
|
-
ignoreFields: new Set(["ResourceName"])
|
|
3530
|
+
ignoreFields: new Set(["ResourceName"]),
|
|
3531
|
+
entryTier: (entry, liveArray) => {
|
|
3532
|
+
const envEntry = (Array.isArray(liveArray) ? liveArray : []).find((e) => e && e.OptionName === "EnvironmentType");
|
|
3533
|
+
const envType = typeof envEntry?.Value === "string" ? envEntry.Value : "LoadBalanced";
|
|
3534
|
+
return ebOptionSettingTier(entry.Namespace, entry.OptionName, entry.Value, envType);
|
|
3535
|
+
}
|
|
3421
3536
|
} };
|
|
3422
3537
|
function alignCompositeKeySubset(declared, live, spec) {
|
|
3423
3538
|
if (!Array.isArray(declared) || !Array.isArray(live)) return null;
|
|
@@ -3890,7 +4005,7 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
3890
4005
|
const r = lo;
|
|
3891
4006
|
const key = ckSubsetSpec.keyFields.map((f) => String(r[f])).join("|");
|
|
3892
4007
|
findings.push({
|
|
3893
|
-
tier: "undeclared",
|
|
4008
|
+
tier: ckSubsetSpec.entryTier?.(r, d.awsValue) ?? "undeclared",
|
|
3894
4009
|
logicalId,
|
|
3895
4010
|
resourceType,
|
|
3896
4011
|
path: `${d.path}[${key}]`,
|