cdk-real-drift 0.16.0 → 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 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$1, ModifyCacheParameterGroupCommand, ResetCacheParameterGroupCommand } from "@aws-sdk/client-elasticache";
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);
@@ -2065,6 +2068,7 @@ const KNOWN_DEFAULTS = {
2065
2068
  Path: "/",
2066
2069
  Description: ""
2067
2070
  },
2071
+ "AWS::KinesisFirehose::DeliveryStream": { DeliveryStreamType: "DirectPut" },
2068
2072
  "AWS::SageMaker::DataQualityJobDefinition": { StoppingCondition: { MaxRuntimeInSeconds: 3600 } },
2069
2073
  "AWS::Config::ConfigurationRecorder": { RecordingMode: { RecordingFrequency: "CONTINUOUS" } },
2070
2074
  "AWS::IAM::ServerCertificate": { Path: "/" },
@@ -2095,6 +2099,11 @@ const KNOWN_DEFAULTS = {
2095
2099
  "AWS::KinesisAnalyticsV2::Application": { ApplicationMode: "STREAMING" },
2096
2100
  "AWS::Events::ApiDestination": { InvocationRateLimitPerSecond: 300 },
2097
2101
  "AWS::DMS::Endpoint": { SslMode: "none" },
2102
+ "AWS::DMS::ReplicationInstance": {
2103
+ AutoMinorVersionUpgrade: true,
2104
+ PubliclyAccessible: true,
2105
+ NetworkType: "IPV4"
2106
+ },
2098
2107
  "AWS::MediaConvert::Queue": {
2099
2108
  PricingPlan: "ON_DEMAND",
2100
2109
  Status: "ACTIVE"
@@ -3067,7 +3076,11 @@ const KNOWN_DEFAULT_PATHS = {
3067
3076
  "AWS::KinesisFirehose::DeliveryStream": {
3068
3077
  "ExtendedS3DestinationConfiguration.S3BackupMode": "Disabled",
3069
3078
  "ExtendedS3DestinationConfiguration.CompressionFormat": "UNCOMPRESSED",
3070
- "ExtendedS3DestinationConfiguration.EncryptionConfiguration": { NoEncryptionConfig: "NoEncryption" }
3079
+ "ExtendedS3DestinationConfiguration.EncryptionConfiguration": { NoEncryptionConfig: "NoEncryption" },
3080
+ "ExtendedS3DestinationConfiguration.BufferingHints": {
3081
+ IntervalInSeconds: 300,
3082
+ SizeInMBs: 5
3083
+ }
3071
3084
  },
3072
3085
  "AWS::Athena::WorkGroup": {
3073
3086
  "WorkGroupConfiguration.EnforceWorkGroupConfiguration": true,
@@ -3276,6 +3289,9 @@ const GENERATED_TOPLEVEL_PATHS = {
3276
3289
  "AWS::EC2::SecurityGroupIngress": new Set(["SourceSecurityGroupOwnerId", "GroupName"]),
3277
3290
  "AWS::ECS::Service": new Set(["Role"]),
3278
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"]),
3279
3295
  "AWS::ElasticLoadBalancingV2::TargetGroup": new Set(["Name"]),
3280
3296
  "AWS::ApplicationAutoScaling::ScalingPolicy": new Set([
3281
3297
  "ResourceId",
@@ -3480,6 +3496,13 @@ const VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS = {
3480
3496
  ]),
3481
3497
  "AWS::ApiGateway::Authorizer": new Set(["AuthType"]),
3482
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"]),
3483
3506
  "AWS::DAX::Cluster": new Set(["PreferredMaintenanceWindow"]),
3484
3507
  "AWS::Lightsail::Instance": new Set(["AvailabilityZone"]),
3485
3508
  "AWS::RDS::DBCluster": new Set([
@@ -5723,6 +5746,10 @@ const MEANINGFUL_WHEN_OFF = {
5723
5746
  "AWS::ApplicationInsights::Application": { CWEMonitorEnabled: () => true },
5724
5747
  "AWS::GuardDuty::Detector": { DataSources: () => true },
5725
5748
  "AWS::Lambda::EventSourceMapping": { Enabled: () => true },
5749
+ "AWS::DMS::ReplicationInstance": {
5750
+ AutoMinorVersionUpgrade: () => true,
5751
+ PubliclyAccessible: () => true
5752
+ },
5726
5753
  "AWS::ElasticLoadBalancingV2::TargetGroup": { HealthCheckEnabled: ({ declared }) => declared["TargetType"] !== "lambda" },
5727
5754
  "AWS::MemoryDB::Cluster": {
5728
5755
  TLSEnabled: () => true,
@@ -5785,7 +5812,8 @@ const DEFAULT_SG_LIST_PATHS = {
5785
5812
  "AWS::AmazonMQ::Broker": "SecurityGroups",
5786
5813
  "AWS::RedshiftServerless::Workgroup": "SecurityGroupIds",
5787
5814
  "AWS::EC2::Instance": "SecurityGroupIds",
5788
- "AWS::DAX::Cluster": "SecurityGroupIds"
5815
+ "AWS::DAX::Cluster": "SecurityGroupIds",
5816
+ "AWS::DMS::ReplicationInstance": "VpcSecurityGroupIds"
5789
5817
  };
5790
5818
  /** #1269 fold decision for an UNDECLARED default-SUBNET list (RedshiftServerless Workgroup
5791
5819
  * SubnetIds). Unlike the SG gate (which folds only a SINGLE default SG), a workgroup placed into
@@ -7501,6 +7529,20 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
7501
7529
  continue;
7502
7530
  }
7503
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
+ }
7504
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)) {
7505
7547
  findings.push({
7506
7548
  tier: "atDefault",
@@ -11435,7 +11477,7 @@ const readDlmLifecyclePolicy = async ({ physicalId, declared, region }) => {
11435
11477
  };
11436
11478
  async function attachDmsTags(c, arn, declared, model, label) {
11437
11479
  try {
11438
- const tags = projectTagList((await c.send(new ListTagsForResourceCommand$2({ ResourceArn: arn }))).TagList);
11480
+ const tags = projectTagList((await c.send(new ListTagsForResourceCommand({ ResourceArn: arn }))).TagList);
11439
11481
  if (tags) model.Tags = tags;
11440
11482
  } catch (err) {
11441
11483
  const mirrored = mirrorDeclaredTags(declared.Tags);
@@ -11903,7 +11945,7 @@ const readElastiCacheParameterGroup = async ({ physicalId, declared, region, acc
11903
11945
  if (accountId) {
11904
11946
  const arn = `arn:${partitionForRegion(region).partition}:elasticache:${region}:${accountId}:parametergroup:${name}`;
11905
11947
  try {
11906
- const tags = projectTagList((await c.send(new ListTagsForResourceCommand$1({ ResourceName: arn }))).TagList);
11948
+ const tags = projectTagList((await c.send(new ListTagsForResourceCommand$2({ ResourceName: arn }))).TagList);
11907
11949
  if (tags) model.Tags = tags;
11908
11950
  } catch (err) {
11909
11951
  const mirrored = mirrorDeclaredTags(declared.Tags);
@@ -12492,7 +12534,7 @@ const readServiceDiscoveryService = async ({ physicalId, declared, region }) =>
12492
12534
  };
12493
12535
  async function attachDocDbTags(c, arn, declared, model, label) {
12494
12536
  try {
12495
- const tags = projectTagList((await c.send(new ListTagsForResourceCommand({ ResourceName: arn }))).TagList);
12537
+ const tags = projectTagList((await c.send(new ListTagsForResourceCommand$1({ ResourceName: arn }))).TagList);
12496
12538
  if (tags) model.Tags = tags;
12497
12539
  } catch (err) {
12498
12540
  const mirrored = mirrorDeclaredTags(declared.Tags);
@@ -13827,7 +13869,8 @@ const DEFAULT_SG_LIST_TYPES = new Set([
13827
13869
  "AWS::RDS::DBInstance",
13828
13870
  "AWS::DocDB::DBCluster",
13829
13871
  "AWS::EC2::Instance",
13830
- "AWS::DAX::Cluster"
13872
+ "AWS::DAX::Cluster",
13873
+ "AWS::DMS::ReplicationInstance"
13831
13874
  ]);
13832
13875
  const DEFAULT_SUBNET_LIST_TYPES = new Set(["AWS::RedshiftServerless::Workgroup"]);
13833
13876
  const defaultSgIdsCache = /* @__PURE__ */ new Map();
@@ -13962,6 +14005,29 @@ async function fetchRdsDefaultCaIdentifier(region) {
13962
14005
  return;
13963
14006
  }
13964
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
+ }
13965
14031
  const instanceMetadataDefaultsCache = /* @__PURE__ */ new Map();
13966
14032
  async function fetchInstanceMetadataDefaults(region) {
13967
14033
  if (instanceMetadataDefaultsCache.has(region)) return instanceMetadataDefaultsCache.get(region);
@@ -14720,6 +14786,10 @@ async function gatherFindings(stackName, region, templateOverride, recoveryTempl
14720
14786
  const v = await fetchRdsDefaultCaIdentifier(region);
14721
14787
  if (v !== void 0) accountDefaults.rdsDefaultCaIdentifier = v;
14722
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
+ }
14723
14793
  const classifyOpts = {
14724
14794
  accountId: desired.accountId,
14725
14795
  region,