cdk-real-drift 0.16.1 → 0.16.2
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 +74 -9
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -13,6 +13,7 @@ import { CloudFormationClient, DescribeStackResourcesCommand, DescribeStacksComm
|
|
|
13
13
|
import { DescribeAddressesCommand, DescribeClientVpnAuthorizationRulesCommand, DescribeClientVpnEndpointsCommand, DescribeClientVpnTargetNetworksCommand, DescribeFlowLogsCommand, DescribeInternetGatewaysCommand, DescribeLaunchTemplateVersionsCommand, DescribeNatGatewaysCommand, DescribeNetworkAclsCommand, DescribeRouteTablesCommand, DescribeSecurityGroupsCommand, DescribeSubnetsCommand, DescribeTransitGatewayAttachmentsCommand, DescribeTransitGatewayRouteTablesCommand, DescribeVpcEndpointsCommand, DescribeVpcsCommand, EC2Client, GetDefaultCreditSpecificationCommand, GetEbsEncryptionByDefaultCommand, GetInstanceMetadataDefaultsCommand, ModifyClientVpnEndpointCommand } from "@aws-sdk/client-ec2";
|
|
14
14
|
import { DescribeServicesCommand, ECSClient, ListAccountSettingsCommand, ListServicesCommand, UpdateServiceCommand } from "@aws-sdk/client-ecs";
|
|
15
15
|
import { DescribeCertificatesCommand, DescribeDBClustersCommand, DescribeDBInstancesCommand, DescribeOptionGroupOptionsCommand, RDSClient } from "@aws-sdk/client-rds";
|
|
16
|
+
import { DatabaseMigrationServiceClient, DescribeEndpointsCommand, DescribeOrderableReplicationInstancesCommand, DescribeReplicationInstancesCommand, DescribeReplicationSubnetGroupsCommand, DescribeReplicationTasksCommand, ListTagsForResourceCommand } from "@aws-sdk/client-database-migration-service";
|
|
16
17
|
import { DescribeParametersCommand, GetParametersCommand, GetServiceSettingCommand, SSMClient } from "@aws-sdk/client-ssm";
|
|
17
18
|
import jsonata from "jsonata";
|
|
18
19
|
import { KMSClient, ListAliasesCommand, ListGrantsCommand, RevokeGrantCommand } from "@aws-sdk/client-kms";
|
|
@@ -39,14 +40,13 @@ import { BudgetsClient, DescribeBudgetCommand } from "@aws-sdk/client-budgets";
|
|
|
39
40
|
import { DescribeConfigurationSettingsCommand, ElasticBeanstalkClient, UpdateApplicationCommand, UpdateApplicationResourceLifecycleCommand, UpdateEnvironmentCommand } from "@aws-sdk/client-elastic-beanstalk";
|
|
40
41
|
import { CognitoSyncClient, GetCognitoEventsCommand, SetCognitoEventsCommand } from "@aws-sdk/client-cognito-sync";
|
|
41
42
|
import { BatchGetProjectsCommand, BatchGetReportGroupsCommand, CodeBuildClient, UpdateReportGroupCommand } from "@aws-sdk/client-codebuild";
|
|
42
|
-
import { DescribeDBClustersCommand as DescribeDBClustersCommand$1, DescribeDBInstancesCommand as DescribeDBInstancesCommand$1, DocDBClient, ListTagsForResourceCommand, ModifyDBClusterCommand, ModifyDBInstanceCommand } from "@aws-sdk/client-docdb";
|
|
43
|
+
import { DescribeDBClustersCommand as DescribeDBClustersCommand$1, DescribeDBInstancesCommand as DescribeDBInstancesCommand$1, DocDBClient, ListTagsForResourceCommand as ListTagsForResourceCommand$1, ModifyDBClusterCommand, ModifyDBInstanceCommand } from "@aws-sdk/client-docdb";
|
|
43
44
|
import { DAXClient, DescribeClustersCommand, DescribeParameterGroupsCommand, DescribeParametersCommand as DescribeParametersCommand$1, DescribeSubnetGroupsCommand, ListTagsCommand, UpdateClusterCommand, UpdateParameterGroupCommand } from "@aws-sdk/client-dax";
|
|
44
45
|
import { AttachGroupPolicyCommand, AttachRolePolicyCommand, AttachUserPolicyCommand, CreatePolicyVersionCommand, DeletePolicyVersionCommand, DeleteRolePolicyCommand, DetachGroupPolicyCommand, DetachRolePolicyCommand, DetachUserPolicyCommand, GetGroupPolicyCommand, GetPolicyCommand as GetPolicyCommand$1, GetPolicyVersionCommand, GetRolePolicyCommand, GetUserPolicyCommand, IAMClient, ListAccessKeysCommand, ListEntitiesForPolicyCommand, ListPolicyVersionsCommand, PutGroupPolicyCommand, PutRolePolicyCommand, PutUserPolicyCommand } from "@aws-sdk/client-iam";
|
|
45
|
-
import { DescribeCacheClustersCommand, DescribeCacheParameterGroupsCommand, DescribeCacheParametersCommand, DescribeReplicationGroupsCommand, DescribeUsersCommand, ElastiCacheClient, ListTagsForResourceCommand as ListTagsForResourceCommand$
|
|
46
|
+
import { DescribeCacheClustersCommand, DescribeCacheParameterGroupsCommand, DescribeCacheParametersCommand, DescribeReplicationGroupsCommand, DescribeUsersCommand, ElastiCacheClient, ListTagsForResourceCommand as ListTagsForResourceCommand$2, ModifyCacheParameterGroupCommand, ResetCacheParameterGroupCommand } from "@aws-sdk/client-elasticache";
|
|
46
47
|
import { DescribeParameterGroupsCommand as DescribeParameterGroupsCommand$1, DescribeParametersCommand as DescribeParametersCommand$2, DescribeUsersCommand as DescribeUsersCommand$1, MemoryDBClient, ResetParameterGroupCommand, UpdateParameterGroupCommand as UpdateParameterGroupCommand$1 } from "@aws-sdk/client-memorydb";
|
|
47
48
|
import { CloudWatchClient, DescribeAnomalyDetectorsCommand, PutAnomalyDetectorCommand } from "@aws-sdk/client-cloudwatch";
|
|
48
49
|
import { DLMClient, GetLifecyclePolicyCommand, UpdateLifecyclePolicyCommand } from "@aws-sdk/client-dlm";
|
|
49
|
-
import { DatabaseMigrationServiceClient, DescribeEndpointsCommand, DescribeReplicationInstancesCommand, DescribeReplicationSubnetGroupsCommand, DescribeReplicationTasksCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$2 } from "@aws-sdk/client-database-migration-service";
|
|
50
50
|
import { DescribeResourceCommand, EntityNotFoundException, LakeFormationClient } from "@aws-sdk/client-lakeformation";
|
|
51
51
|
import { GetJobTemplateCommand, GetQueueCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$3, MediaConvertClient } from "@aws-sdk/client-mediaconvert";
|
|
52
52
|
import { ConfigServiceClient, DescribeConfigRulesCommand, DescribeConfigurationRecordersCommand, DescribeDeliveryChannelsCommand, PutConfigRuleCommand, PutConfigurationRecorderCommand } from "@aws-sdk/client-config-service";
|
|
@@ -1920,6 +1920,8 @@ function buildCorpusCase(resource, liveRaw, schema, opts, findings) {
|
|
|
1920
1920
|
const rdsOptCatalog = resource.physicalId && opts.rdsOptionSettingDefaults?.[resource.physicalId] ? opts.rdsOptionSettingDefaults[resource.physicalId] : void 0;
|
|
1921
1921
|
const listenerArn = resource.resourceType === "AWS::GlobalAccelerator::EndpointGroup" ? resource.declared?.ListenerArn : void 0;
|
|
1922
1922
|
const gaListenerPort = typeof listenerArn === "string" && opts.siblingListenerPorts?.[listenerArn] !== void 0 ? { [listenerArn]: opts.siblingListenerPorts[listenerArn] } : void 0;
|
|
1923
|
+
const dmsClass = resource.resourceType === "AWS::DMS::ReplicationInstance" ? resource.declared?.ReplicationInstanceClass : void 0;
|
|
1924
|
+
const dmsStorageDefault = typeof dmsClass === "string" && opts.accountDefaults?.dmsAllocatedStorageDefaults?.[dmsClass] !== void 0 ? { dmsAllocatedStorageDefaults: { [dmsClass]: opts.accountDefaults.dmsAllocatedStorageDefaults[dmsClass] } } : void 0;
|
|
1923
1925
|
return sanitizeAccountId({
|
|
1924
1926
|
corpusVersion: 1,
|
|
1925
1927
|
resource: {
|
|
@@ -1956,7 +1958,8 @@ function buildCorpusCase(resource, liveRaw, schema, opts, findings) {
|
|
|
1956
1958
|
...tgRegistrarId ? { siblingTargetGroupRegistrars: [tgRegistrarId] } : {},
|
|
1957
1959
|
...echoModel && resource.physicalId ? { clusterEchoModel: { [resource.physicalId]: echoModel } } : {},
|
|
1958
1960
|
...rdsOptCatalog && resource.physicalId ? { rdsOptionSettingDefaults: { [resource.physicalId]: rdsOptCatalog } } : {},
|
|
1959
|
-
...gaListenerPort ? { siblingListenerPorts: gaListenerPort } : {}
|
|
1961
|
+
...gaListenerPort ? { siblingListenerPorts: gaListenerPort } : {},
|
|
1962
|
+
...dmsStorageDefault ? { accountDefaults: dmsStorageDefault } : {}
|
|
1960
1963
|
},
|
|
1961
1964
|
expected: findings
|
|
1962
1965
|
}, opts.accountId);
|
|
@@ -2096,6 +2099,11 @@ const KNOWN_DEFAULTS = {
|
|
|
2096
2099
|
"AWS::KinesisAnalyticsV2::Application": { ApplicationMode: "STREAMING" },
|
|
2097
2100
|
"AWS::Events::ApiDestination": { InvocationRateLimitPerSecond: 300 },
|
|
2098
2101
|
"AWS::DMS::Endpoint": { SslMode: "none" },
|
|
2102
|
+
"AWS::DMS::ReplicationInstance": {
|
|
2103
|
+
AutoMinorVersionUpgrade: true,
|
|
2104
|
+
PubliclyAccessible: true,
|
|
2105
|
+
NetworkType: "IPV4"
|
|
2106
|
+
},
|
|
2099
2107
|
"AWS::MediaConvert::Queue": {
|
|
2100
2108
|
PricingPlan: "ON_DEMAND",
|
|
2101
2109
|
Status: "ACTIVE"
|
|
@@ -3281,6 +3289,9 @@ const GENERATED_TOPLEVEL_PATHS = {
|
|
|
3281
3289
|
"AWS::EC2::SecurityGroupIngress": new Set(["SourceSecurityGroupOwnerId", "GroupName"]),
|
|
3282
3290
|
"AWS::ECS::Service": new Set(["Role"]),
|
|
3283
3291
|
"AWS::SecretsManager::Secret": new Set(["Name"]),
|
|
3292
|
+
"AWS::DMS::ReplicationInstance": new Set(["ReplicationInstanceIdentifier"]),
|
|
3293
|
+
"AWS::DMS::Endpoint": new Set(["EndpointIdentifier"]),
|
|
3294
|
+
"AWS::DMS::ReplicationTask": new Set(["ReplicationTaskIdentifier"]),
|
|
3284
3295
|
"AWS::ElasticLoadBalancingV2::TargetGroup": new Set(["Name"]),
|
|
3285
3296
|
"AWS::ApplicationAutoScaling::ScalingPolicy": new Set([
|
|
3286
3297
|
"ResourceId",
|
|
@@ -3485,6 +3496,13 @@ const VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS = {
|
|
|
3485
3496
|
]),
|
|
3486
3497
|
"AWS::ApiGateway::Authorizer": new Set(["AuthType"]),
|
|
3487
3498
|
"AWS::DMS::Endpoint": new Set(["KmsKeyId"]),
|
|
3499
|
+
"AWS::DMS::ReplicationInstance": new Set([
|
|
3500
|
+
"EngineVersion",
|
|
3501
|
+
"AvailabilityZone",
|
|
3502
|
+
"PreferredMaintenanceWindow",
|
|
3503
|
+
"KmsKeyId"
|
|
3504
|
+
]),
|
|
3505
|
+
"AWS::DMS::ReplicationTask": new Set(["ReplicationTaskSettings"]),
|
|
3488
3506
|
"AWS::DAX::Cluster": new Set(["PreferredMaintenanceWindow"]),
|
|
3489
3507
|
"AWS::Lightsail::Instance": new Set(["AvailabilityZone"]),
|
|
3490
3508
|
"AWS::RDS::DBCluster": new Set([
|
|
@@ -5728,6 +5746,10 @@ const MEANINGFUL_WHEN_OFF = {
|
|
|
5728
5746
|
"AWS::ApplicationInsights::Application": { CWEMonitorEnabled: () => true },
|
|
5729
5747
|
"AWS::GuardDuty::Detector": { DataSources: () => true },
|
|
5730
5748
|
"AWS::Lambda::EventSourceMapping": { Enabled: () => true },
|
|
5749
|
+
"AWS::DMS::ReplicationInstance": {
|
|
5750
|
+
AutoMinorVersionUpgrade: () => true,
|
|
5751
|
+
PubliclyAccessible: () => true
|
|
5752
|
+
},
|
|
5731
5753
|
"AWS::ElasticLoadBalancingV2::TargetGroup": { HealthCheckEnabled: ({ declared }) => declared["TargetType"] !== "lambda" },
|
|
5732
5754
|
"AWS::MemoryDB::Cluster": {
|
|
5733
5755
|
TLSEnabled: () => true,
|
|
@@ -5790,7 +5812,8 @@ const DEFAULT_SG_LIST_PATHS = {
|
|
|
5790
5812
|
"AWS::AmazonMQ::Broker": "SecurityGroups",
|
|
5791
5813
|
"AWS::RedshiftServerless::Workgroup": "SecurityGroupIds",
|
|
5792
5814
|
"AWS::EC2::Instance": "SecurityGroupIds",
|
|
5793
|
-
"AWS::DAX::Cluster": "SecurityGroupIds"
|
|
5815
|
+
"AWS::DAX::Cluster": "SecurityGroupIds",
|
|
5816
|
+
"AWS::DMS::ReplicationInstance": "VpcSecurityGroupIds"
|
|
5794
5817
|
};
|
|
5795
5818
|
/** #1269 fold decision for an UNDECLARED default-SUBNET list (RedshiftServerless Workgroup
|
|
5796
5819
|
* SubnetIds). Unlike the SG gate (which folds only a SINGLE default SG), a workgroup placed into
|
|
@@ -7506,6 +7529,20 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
7506
7529
|
continue;
|
|
7507
7530
|
}
|
|
7508
7531
|
}
|
|
7532
|
+
if (resourceType === "AWS::DMS::ReplicationInstance" && k === "AllocatedStorage") {
|
|
7533
|
+
const cls = declared["ReplicationInstanceClass"];
|
|
7534
|
+
const derived = typeof cls === "string" ? opts.accountDefaults?.dmsAllocatedStorageDefaults?.[cls] : void 0;
|
|
7535
|
+
if (derived !== void 0) {
|
|
7536
|
+
findings.push({
|
|
7537
|
+
tier: matchesKnownDefault(v, derived) ? "atDefault" : "undeclared",
|
|
7538
|
+
logicalId,
|
|
7539
|
+
resourceType,
|
|
7540
|
+
path: k,
|
|
7541
|
+
actual: v
|
|
7542
|
+
});
|
|
7543
|
+
continue;
|
|
7544
|
+
}
|
|
7545
|
+
}
|
|
7509
7546
|
if (k in schema.defaults && matchesKnownDefault(v, schema.defaults[k]) || k in schema.defaultPaths && matchesKnownDefault(v, schema.defaultPaths[k]) || k in knownDef && matchesKnownDefault(v, knownDef[k]) || KNOWN_DEFAULT_ONE_OF[resourceType]?.[k]?.some((d) => matchesKnownDefault(v, d)) || VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS[resourceType]?.has(k) && !isTrivialEmpty(v) && !(k in knownDef) || clbDefaultSslPoliciesAtDefault(resourceType, k, v)) {
|
|
7510
7547
|
findings.push({
|
|
7511
7548
|
tier: "atDefault",
|
|
@@ -11440,7 +11477,7 @@ const readDlmLifecyclePolicy = async ({ physicalId, declared, region }) => {
|
|
|
11440
11477
|
};
|
|
11441
11478
|
async function attachDmsTags(c, arn, declared, model, label) {
|
|
11442
11479
|
try {
|
|
11443
|
-
const tags = projectTagList((await c.send(new ListTagsForResourceCommand
|
|
11480
|
+
const tags = projectTagList((await c.send(new ListTagsForResourceCommand({ ResourceArn: arn }))).TagList);
|
|
11444
11481
|
if (tags) model.Tags = tags;
|
|
11445
11482
|
} catch (err) {
|
|
11446
11483
|
const mirrored = mirrorDeclaredTags(declared.Tags);
|
|
@@ -11908,7 +11945,7 @@ const readElastiCacheParameterGroup = async ({ physicalId, declared, region, acc
|
|
|
11908
11945
|
if (accountId) {
|
|
11909
11946
|
const arn = `arn:${partitionForRegion(region).partition}:elasticache:${region}:${accountId}:parametergroup:${name}`;
|
|
11910
11947
|
try {
|
|
11911
|
-
const tags = projectTagList((await c.send(new ListTagsForResourceCommand$
|
|
11948
|
+
const tags = projectTagList((await c.send(new ListTagsForResourceCommand$2({ ResourceName: arn }))).TagList);
|
|
11912
11949
|
if (tags) model.Tags = tags;
|
|
11913
11950
|
} catch (err) {
|
|
11914
11951
|
const mirrored = mirrorDeclaredTags(declared.Tags);
|
|
@@ -12497,7 +12534,7 @@ const readServiceDiscoveryService = async ({ physicalId, declared, region }) =>
|
|
|
12497
12534
|
};
|
|
12498
12535
|
async function attachDocDbTags(c, arn, declared, model, label) {
|
|
12499
12536
|
try {
|
|
12500
|
-
const tags = projectTagList((await c.send(new ListTagsForResourceCommand({ ResourceName: arn }))).TagList);
|
|
12537
|
+
const tags = projectTagList((await c.send(new ListTagsForResourceCommand$1({ ResourceName: arn }))).TagList);
|
|
12501
12538
|
if (tags) model.Tags = tags;
|
|
12502
12539
|
} catch (err) {
|
|
12503
12540
|
const mirrored = mirrorDeclaredTags(declared.Tags);
|
|
@@ -13832,7 +13869,8 @@ const DEFAULT_SG_LIST_TYPES = new Set([
|
|
|
13832
13869
|
"AWS::RDS::DBInstance",
|
|
13833
13870
|
"AWS::DocDB::DBCluster",
|
|
13834
13871
|
"AWS::EC2::Instance",
|
|
13835
|
-
"AWS::DAX::Cluster"
|
|
13872
|
+
"AWS::DAX::Cluster",
|
|
13873
|
+
"AWS::DMS::ReplicationInstance"
|
|
13836
13874
|
]);
|
|
13837
13875
|
const DEFAULT_SUBNET_LIST_TYPES = new Set(["AWS::RedshiftServerless::Workgroup"]);
|
|
13838
13876
|
const defaultSgIdsCache = /* @__PURE__ */ new Map();
|
|
@@ -13967,6 +14005,29 @@ async function fetchRdsDefaultCaIdentifier(region) {
|
|
|
13967
14005
|
return;
|
|
13968
14006
|
}
|
|
13969
14007
|
}
|
|
14008
|
+
const dmsAllocatedStorageDefaultsCache = /* @__PURE__ */ new Map();
|
|
14009
|
+
async function fetchDmsAllocatedStorageDefaults(region) {
|
|
14010
|
+
const cached = dmsAllocatedStorageDefaultsCache.get(region);
|
|
14011
|
+
if (cached) return cached;
|
|
14012
|
+
const map = {};
|
|
14013
|
+
try {
|
|
14014
|
+
const c = new DatabaseMigrationServiceClient({
|
|
14015
|
+
region,
|
|
14016
|
+
...READ_RETRY
|
|
14017
|
+
});
|
|
14018
|
+
let marker;
|
|
14019
|
+
do {
|
|
14020
|
+
const r = await c.send(new DescribeOrderableReplicationInstancesCommand({
|
|
14021
|
+
Marker: marker,
|
|
14022
|
+
MaxRecords: 100
|
|
14023
|
+
}));
|
|
14024
|
+
for (const o of r.OrderableReplicationInstances ?? []) if (typeof o.ReplicationInstanceClass === "string" && typeof o.DefaultAllocatedStorage === "number") map[o.ReplicationInstanceClass] = o.DefaultAllocatedStorage;
|
|
14025
|
+
marker = r.Marker;
|
|
14026
|
+
} while (marker);
|
|
14027
|
+
} catch {}
|
|
14028
|
+
dmsAllocatedStorageDefaultsCache.set(region, map);
|
|
14029
|
+
return map;
|
|
14030
|
+
}
|
|
13970
14031
|
const instanceMetadataDefaultsCache = /* @__PURE__ */ new Map();
|
|
13971
14032
|
async function fetchInstanceMetadataDefaults(region) {
|
|
13972
14033
|
if (instanceMetadataDefaultsCache.has(region)) return instanceMetadataDefaultsCache.get(region);
|
|
@@ -14725,6 +14786,10 @@ async function gatherFindings(stackName, region, templateOverride, recoveryTempl
|
|
|
14725
14786
|
const v = await fetchRdsDefaultCaIdentifier(region);
|
|
14726
14787
|
if (v !== void 0) accountDefaults.rdsDefaultCaIdentifier = v;
|
|
14727
14788
|
}
|
|
14789
|
+
if (desired.resources.some((r) => r.resourceType === "AWS::DMS::ReplicationInstance")) {
|
|
14790
|
+
const m = await fetchDmsAllocatedStorageDefaults(region);
|
|
14791
|
+
if (Object.keys(m).length > 0) accountDefaults.dmsAllocatedStorageDefaults = m;
|
|
14792
|
+
}
|
|
14728
14793
|
const classifyOpts = {
|
|
14729
14794
|
accountId: desired.accountId,
|
|
14730
14795
|
region,
|