cdk-real-drift 0.13.11 → 0.13.12

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
@@ -3209,6 +3209,7 @@ const CONTEXT_ARN_DEFAULTS = {
3209
3209
  "AWS::Batch::ComputeEnvironment": { ServiceRole: "arn:{partition}:iam::{accountId}:role/aws-service-role/batch.amazonaws.com/AWSServiceRoleForBatch" },
3210
3210
  "AWS::CodeBuild::Project": { EncryptionKey: "arn:{partition}:kms:{region}:{accountId}:alias/aws/s3" },
3211
3211
  "AWS::SSM::MaintenanceWindowTask": { ServiceRoleArn: "arn:{partition}:iam::{accountId}:role/aws-service-role/ssm.amazonaws.com/AWSServiceRoleForAmazonSSM" },
3212
+ "AWS::LakeFormation::Resource": { RoleArn: "arn:{partition}:iam::{accountId}:role/aws-service-role/lakeformation.amazonaws.com/AWSServiceRoleForLakeFormationDataAccess" },
3212
3213
  "AWS::LakeFormation::Tag": { CatalogId: "{accountId}" },
3213
3214
  "AWS::LakeFormation::PrincipalPermissions": { Catalog: "{accountId}" },
3214
3215
  "AWS::S3::AccessPoint": { BucketAccountId: "{accountId}" },
@@ -3772,6 +3773,7 @@ const JSON_STRING_DEFAULT_FILLS = { "AWS::CE::CostCategory": { Rules: { Type: "R
3772
3773
  const CASE_INSENSITIVE_PATHS = {
3773
3774
  "AWS::Route53::RecordSet": new Set(["Name", "AliasTarget.DNSName"]),
3774
3775
  "AWS::Batch::ComputeEnvironment": new Set(["Type"]),
3776
+ "AWS::Batch::JobDefinition": new Set(["Type"]),
3775
3777
  "AWS::EMRServerless::Application": new Set(["Type"]),
3776
3778
  "AWS::RDS::DBInstance": new Set(["DBInstanceIdentifier"]),
3777
3779
  "AWS::RDS::DBCluster": new Set(["DBClusterIdentifier"]),
@@ -3791,6 +3793,7 @@ const CASE_INSENSITIVE_PATHS = {
3791
3793
  "AWS::Neptune::DBParameterGroup": new Set(["Name"]),
3792
3794
  "AWS::Neptune::DBClusterParameterGroup": new Set(["Name"]),
3793
3795
  "AWS::DocDB::DBClusterParameterGroup": new Set(["Name"]),
3796
+ "AWS::Redshift::ClusterParameterGroup": new Set(["ParameterGroupName"]),
3794
3797
  "AWS::DMS::ReplicationInstance": new Set(["ReplicationInstanceIdentifier"]),
3795
3798
  "AWS::DMS::ReplicationSubnetGroup": new Set(["ReplicationSubnetGroupIdentifier"]),
3796
3799
  "AWS::DMS::Endpoint": new Set(["EndpointType", "EndpointIdentifier"]),
@@ -6003,23 +6006,36 @@ function alignCompositeKeySubset(declared, live, spec) {
6003
6006
  }
6004
6007
  const isNestedObject = (x) => x !== null && typeof x === "object" && !Array.isArray(x);
6005
6008
  const DDB_TABLE_TYPES = new Set(["AWS::DynamoDB::Table", "AWS::DynamoDB::GlobalTable"]);
6009
+ function capacityUnit(x) {
6010
+ if (typeof x === "number") return x;
6011
+ if (typeof x === "string" && x.trim() !== "" && !Number.isNaN(Number(x))) return Number(x);
6012
+ }
6006
6013
  function warmThroughputDefault(provisionedThroughput) {
6007
- if (isNestedObject(provisionedThroughput) && typeof provisionedThroughput.ReadCapacityUnits === "number" && typeof provisionedThroughput.WriteCapacityUnits === "number") return {
6008
- ReadUnitsPerSecond: provisionedThroughput.ReadCapacityUnits,
6009
- WriteUnitsPerSecond: provisionedThroughput.WriteCapacityUnits
6010
- };
6014
+ if (isNestedObject(provisionedThroughput)) {
6015
+ const read = capacityUnit(provisionedThroughput.ReadCapacityUnits);
6016
+ const write = capacityUnit(provisionedThroughput.WriteCapacityUnits);
6017
+ if (read !== void 0 && write !== void 0) return {
6018
+ ReadUnitsPerSecond: read,
6019
+ WriteUnitsPerSecond: write
6020
+ };
6021
+ }
6011
6022
  return {
6012
6023
  ReadUnitsPerSecond: 12e3,
6013
6024
  WriteUnitsPerSecond: 4e3
6014
6025
  };
6015
6026
  }
6016
- function dynamoGsiWarmThroughputAtDefault(resourceType, path, value, live) {
6027
+ function gsiByName(model, indexName) {
6028
+ if (!isNestedObject(model) || !Array.isArray(model.GlobalSecondaryIndexes)) return void 0;
6029
+ const gsi = model.GlobalSecondaryIndexes.find((g) => isNestedObject(g) && g.IndexName === indexName);
6030
+ return isNestedObject(gsi) ? gsi : void 0;
6031
+ }
6032
+ function dynamoGsiWarmThroughputAtDefault(resourceType, path, value, live, declared) {
6017
6033
  if (!DDB_TABLE_TYPES.has(resourceType)) return false;
6018
6034
  const m = /^GlobalSecondaryIndexes\[(.*)\]\.WarmThroughput$/.exec(path);
6019
- if (m === null || !Array.isArray(live.GlobalSecondaryIndexes)) return false;
6020
- const gsi = live.GlobalSecondaryIndexes.find((g) => isNestedObject(g) && g.IndexName === m[1]);
6021
- if (!isNestedObject(gsi)) return false;
6022
- return deepEqual(value, warmThroughputDefault(gsi.ProvisionedThroughput));
6035
+ if (m === null) return false;
6036
+ const liveGsi = gsiByName(live, m[1]);
6037
+ const declaredGsi = gsiByName(declared, m[1]);
6038
+ return liveGsi !== void 0 && deepEqual(value, warmThroughputDefault(liveGsi.ProvisionedThroughput)) || declaredGsi !== void 0 && deepEqual(value, warmThroughputDefault(declaredGsi.ProvisionedThroughput));
6023
6039
  }
6024
6040
  const CLB_DEFAULT_SSL_POLICY_NAME = "ELBSecurityPolicy-2016-08";
6025
6041
  function clbDefaultSslPoliciesAtDefault(resourceType, key, value) {
@@ -6895,7 +6911,7 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
6895
6911
  const parentKey = (path.split(".").pop() ?? "").replace(/\[.*$/, "");
6896
6912
  if (!isObjectForm || /tags$/i.test(parentKey)) return;
6897
6913
  }
6898
- 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) || resourceType === "AWS::Events::EventBusPolicy" && schemaPath === "Statement.*.Sid" && typeof value === "string" && value === declared["StatementId"] ? "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";
6914
+ 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"] ? "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";
6899
6915
  const freeFormKey = tier === "undeclared" && underFreeFormMap(schemaPath);
6900
6916
  findings.push({
6901
6917
  tier,
@@ -7464,7 +7480,17 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
7464
7480
  continue;
7465
7481
  }
7466
7482
  }
7467
- if (DDB_TABLE_TYPES.has(resourceType) && k === "WarmThroughput" && deepEqual(v, warmThroughputDefault(live.ProvisionedThroughput))) {
7483
+ if (DDB_TABLE_TYPES.has(resourceType) && k === "WarmThroughput" && (deepEqual(v, warmThroughputDefault(live.ProvisionedThroughput)) || deepEqual(v, warmThroughputDefault(declared.ProvisionedThroughput)))) {
7484
+ findings.push({
7485
+ tier: "atDefault",
7486
+ logicalId,
7487
+ resourceType,
7488
+ path: k,
7489
+ actual: v
7490
+ });
7491
+ continue;
7492
+ }
7493
+ if (resourceType === "AWS::ServiceDiscovery::Service" && k === "Type" && v === (declared.DnsConfig !== void 0 ? "DNS_HTTP" : "HTTP")) {
7468
7494
  findings.push({
7469
7495
  tier: "atDefault",
7470
7496
  logicalId,
@@ -11068,8 +11094,10 @@ const readDmsReplicationTask = async ({ physicalId, declared, region }) => {
11068
11094
  return model;
11069
11095
  };
11070
11096
  const readLakeFormationResource = async ({ physicalId, region }) => {
11071
- const arn = str$1(physicalId);
11072
- if (!arn) return void 0;
11097
+ const raw = str$1(physicalId);
11098
+ if (!raw) return void 0;
11099
+ const arnStart = raw.indexOf("arn:");
11100
+ const arn = arnStart >= 0 ? raw.slice(arnStart) : raw;
11073
11101
  const c = new LakeFormationClient({
11074
11102
  region,
11075
11103
  ...READ_RETRY
@@ -11965,13 +11993,17 @@ const readServiceDiscoveryService = async ({ physicalId, declared, region }) =>
11965
11993
  if (s.Description !== void 0) model.Description = s.Description;
11966
11994
  if (s.NamespaceId !== void 0) model.NamespaceId = s.NamespaceId;
11967
11995
  if (s.Type !== void 0) model.Type = s.Type;
11968
- if (s.DnsConfig) model.DnsConfig = {
11969
- ...s.DnsConfig.RoutingPolicy !== void 0 && { RoutingPolicy: s.DnsConfig.RoutingPolicy },
11970
- ...s.DnsConfig.DnsRecords !== void 0 && { DnsRecords: s.DnsConfig.DnsRecords.map((d) => ({
11971
- Type: d.Type,
11972
- TTL: d.TTL
11973
- })) }
11974
- };
11996
+ if (s.DnsConfig) {
11997
+ const declaredDnsConfig = declared?.DnsConfig;
11998
+ model.DnsConfig = {
11999
+ ...declaredDnsConfig !== null && typeof declaredDnsConfig === "object" && declaredDnsConfig.NamespaceId !== void 0 && s.NamespaceId !== void 0 && { NamespaceId: s.NamespaceId },
12000
+ ...s.DnsConfig.RoutingPolicy !== void 0 && { RoutingPolicy: s.DnsConfig.RoutingPolicy },
12001
+ ...s.DnsConfig.DnsRecords !== void 0 && { DnsRecords: s.DnsConfig.DnsRecords.map((d) => ({
12002
+ Type: d.Type,
12003
+ TTL: d.TTL
12004
+ })) }
12005
+ };
12006
+ }
11975
12007
  if (s.HealthCheckConfig) model.HealthCheckConfig = {
11976
12008
  ...s.HealthCheckConfig.Type !== void 0 && { Type: s.HealthCheckConfig.Type },
11977
12009
  ...s.HealthCheckConfig.ResourcePath !== void 0 && { ResourcePath: s.HealthCheckConfig.ResourcePath },
@@ -17808,6 +17840,7 @@ const REVERT_SET_DEFAULT_PATHS = new Set([
17808
17840
  "AWS::OpenSearchService::Domain\0DeploymentStrategyOptions",
17809
17841
  "AWS::EKS::Cluster\0ResourcesVpcConfig.EndpointPrivateAccess",
17810
17842
  "AWS::RDS::DBInstance\0AutoMinorVersionUpgrade",
17843
+ "AWS::RDS::DBInstance\0BackupRetentionPeriod",
17811
17844
  "AWS::RDS::DBCluster\0AutoMinorVersionUpgrade",
17812
17845
  "AWS::Neptune::DBInstance\0AutoMinorVersionUpgrade",
17813
17846
  "AWS::ElastiCache::CacheCluster\0AutoMinorVersionUpgrade",