cdk-real-drift 0.2.33 → 0.2.35

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
@@ -1204,7 +1204,8 @@ const KNOWN_DEFAULTS = {
1204
1204
  },
1205
1205
  "AWS::EKS::Cluster": {
1206
1206
  ControlPlaneScalingConfig: { Tier: "standard" },
1207
- UpgradePolicy: { SupportType: "EXTENDED" }
1207
+ UpgradePolicy: { SupportType: "EXTENDED" },
1208
+ AccessConfig: { AuthenticationMode: "CONFIG_MAP" }
1208
1209
  },
1209
1210
  "AWS::EKS::Addon": { NamespaceConfig: { Namespace: "kube-system" } },
1210
1211
  "AWS::WAFv2::WebACL": { OnSourceDDoSProtectionConfig: { ALBLowReputationMode: "ACTIVE_UNDER_DDOS" } },
@@ -1284,6 +1285,7 @@ const KNOWN_DEFAULTS = {
1284
1285
  DisableExecuteApiEndpoint: false
1285
1286
  },
1286
1287
  "AWS::ApiGateway::DomainName": { SecurityPolicy: "TLS_1_2" },
1288
+ "AWS::ApiGateway::GatewayResponse": { ResponseTemplates: { "application/json": "{\"message\":$context.error.messageString}" } },
1287
1289
  "AWS::EC2::VPC": {
1288
1290
  InstanceTenancy: "default",
1289
1291
  EnableDnsSupport: true
@@ -1337,11 +1339,16 @@ const KNOWN_DEFAULTS = {
1337
1339
  EncryptionConfiguration: { EncryptionType: "AES256" },
1338
1340
  ImageTagMutability: "MUTABLE"
1339
1341
  },
1342
+ "AWS::ECR::RepositoryCreationTemplate": {
1343
+ EncryptionConfiguration: { EncryptionType: "AES256" },
1344
+ ImageTagMutability: "MUTABLE"
1345
+ },
1340
1346
  "AWS::Kinesis::Stream": { MaxRecordSizeInKiB: 1024 },
1341
1347
  "AWS::SSM::Parameter": {
1342
1348
  DataType: "text",
1343
1349
  Tier: "Standard"
1344
1350
  },
1351
+ "AWS::SSM::ResourceDataSync": { SyncType: "SyncToDestination" },
1345
1352
  "AWS::StepFunctions::Activity": { EncryptionConfiguration: { Type: "AWS_OWNED_KEY" } },
1346
1353
  "AWS::SNS::Subscription": { FilterPolicyScope: "MessageAttributes" },
1347
1354
  "AWS::Cognito::UserPool": {
@@ -1361,7 +1368,8 @@ const KNOWN_DEFAULTS = {
1361
1368
  SignInPolicy: { AllowedFirstAuthFactors: ["PASSWORD"] }
1362
1369
  },
1363
1370
  KeyConfiguration: { KeyType: "AWS_OWNED_KEY" },
1364
- IssuerConfiguration: { Type: "ORIGINAL" }
1371
+ IssuerConfiguration: { Type: "ORIGINAL" },
1372
+ WebAuthnFactorConfiguration: "SINGLE_FACTOR"
1365
1373
  },
1366
1374
  "AWS::Cognito::IdentityPool": { AllowClassicFlow: false },
1367
1375
  "AWS::Cognito::UserPoolClient": {
@@ -1374,7 +1382,27 @@ const KNOWN_DEFAULTS = {
1374
1382
  SchedulingStrategy: "REPLICA",
1375
1383
  HealthCheckGracePeriodSeconds: 0,
1376
1384
  EnableExecuteCommand: false,
1377
- DeploymentController: { Type: "ECS" }
1385
+ DeploymentController: { Type: "ECS" },
1386
+ DeploymentConfiguration: {
1387
+ BakeTimeInMinutes: 0,
1388
+ Alarms: {
1389
+ AlarmNames: [],
1390
+ Enable: false,
1391
+ Rollback: false
1392
+ },
1393
+ Strategy: "ROLLING",
1394
+ DeploymentCircuitBreaker: {
1395
+ ThresholdConfiguration: {
1396
+ Type: "BOUNDED_PERCENT",
1397
+ Value: 50
1398
+ },
1399
+ Enable: false,
1400
+ ResetOnHealthyTask: true,
1401
+ Rollback: false
1402
+ },
1403
+ MaximumPercent: 200,
1404
+ MinimumHealthyPercent: 100
1405
+ }
1378
1406
  },
1379
1407
  "AWS::AppSync::GraphQLApi": {
1380
1408
  ApiType: "GRAPHQL",
@@ -1519,7 +1547,13 @@ const KNOWN_DEFAULTS = {
1519
1547
  "AWS::Synthetics::Canary": {
1520
1548
  FailureRetentionPeriod: 31,
1521
1549
  SuccessRetentionPeriod: 31,
1522
- ProvisionedResourceCleanup: "AUTOMATIC"
1550
+ ProvisionedResourceCleanup: "AUTOMATIC",
1551
+ RunConfig: {
1552
+ TimeoutInSeconds: 840,
1553
+ MemoryInMB: 1500,
1554
+ EphemeralStorage: 1024,
1555
+ ActiveTracing: false
1556
+ }
1523
1557
  },
1524
1558
  "AWS::MSK::Cluster": {
1525
1559
  EnhancedMonitoring: "DEFAULT",
@@ -1527,8 +1561,34 @@ const KNOWN_DEFAULTS = {
1527
1561
  },
1528
1562
  "AWS::Glue::Job": {
1529
1563
  JobMode: "SCRIPT",
1530
- MaxRetries: 0
1564
+ MaxRetries: 0,
1565
+ Timeout: 2880,
1566
+ ExecutionProperty: { MaxConcurrentRuns: 1 }
1567
+ },
1568
+ "AWS::SES::EmailIdentity": {
1569
+ DkimAttributes: { SigningEnabled: true },
1570
+ DkimSigningAttributes: { NextSigningKeyLength: "RSA_2048_BIT" },
1571
+ FeedbackAttributes: { EmailForwardingEnabled: true }
1531
1572
  },
1573
+ "AWS::SES::ConfigurationSet": {
1574
+ SendingOptions: { SendingEnabled: true },
1575
+ ReputationOptions: { ReputationMetricsEnabled: true }
1576
+ },
1577
+ "AWS::Glue::Schema": { CheckpointVersion: {
1578
+ IsLatest: true,
1579
+ VersionNumber: 1
1580
+ } },
1581
+ "AWS::Signer::SigningProfile": { SignatureValidityPeriod: {
1582
+ Type: "MONTHS",
1583
+ Value: 135
1584
+ } },
1585
+ "AWS::Lambda::CodeSigningConfig": { CodeSigningPolicies: { UntrustedArtifactOnDeployment: "Warn" } },
1586
+ "AWS::EC2::SecurityGroup": { SecurityGroupEgress: [{
1587
+ CidrIp: "0.0.0.0/0",
1588
+ FromPort: -1,
1589
+ ToPort: -1,
1590
+ IpProtocol: "-1"
1591
+ }] },
1532
1592
  "AWS::AutoScaling::AutoScalingGroup": {
1533
1593
  Cooldown: "300",
1534
1594
  HealthCheckType: "EC2",
@@ -1822,8 +1882,22 @@ const KNOWN_DEFAULT_PATHS = {
1822
1882
  "DeploymentConfiguration.DeploymentCircuitBreaker.ThresholdConfiguration": {
1823
1883
  Type: "BOUNDED_PERCENT",
1824
1884
  Value: 50
1885
+ },
1886
+ "DeploymentConfiguration.DeploymentCircuitBreaker": {
1887
+ ThresholdConfiguration: {
1888
+ Type: "BOUNDED_PERCENT",
1889
+ Value: 50
1890
+ },
1891
+ Enable: false,
1892
+ ResetOnHealthyTask: true,
1893
+ Rollback: false
1825
1894
  }
1826
1895
  },
1896
+ "AWS::Bedrock::Guardrail": {
1897
+ "ContentPolicyConfig.ContentFiltersTierConfig": { TierName: "CLASSIC" },
1898
+ "TopicPolicyConfig.TopicsTierConfig": { TierName: "CLASSIC" }
1899
+ },
1900
+ "AWS::Synthetics::Canary": { "Schedule.RetryConfig": { MaxRetries: 0 } },
1827
1901
  "AWS::OpenSearchService::Domain": {
1828
1902
  "EBSOptions.Iops": 3e3,
1829
1903
  "EBSOptions.Throughput": 125
@@ -1943,7 +2017,8 @@ const GENERATED_DEFAULTS = { "AWS::Lambda::Function": { LoggingConfig: {
1943
2017
  } } };
1944
2018
  const GENERATED_PATHS = {
1945
2019
  "AWS::ApiGateway::Method": ["Integration.CacheNamespace"],
1946
- "AWS::XRay::SamplingRule": ["SamplingRule.RuleARN"]
2020
+ "AWS::XRay::SamplingRule": ["SamplingRule.RuleARN"],
2021
+ "AWS::Budgets::Budget": ["Budget.BudgetName"]
1947
2022
  };
1948
2023
  const CONTEXT_DEFAULTS = { "AWS::EC2::VPCEndpointService": { SupportedRegions: "regionList" } };
1949
2024
  const CONTEXT_ARN_DEFAULTS = {
@@ -1962,7 +2037,8 @@ const ENGINE_DEFAULTS = {
1962
2037
  StorageType: (e) => e.startsWith("aurora") ? "aurora" : void 0,
1963
2038
  AllocatedStorage: (e) => e.startsWith("aurora") ? 1 : void 0,
1964
2039
  Port: rdsDefaultPort
1965
- }
2040
+ },
2041
+ "AWS::ElastiCache::CacheCluster": { Port: (e) => /memcached/i.test(e) ? 11211 : /redis|valkey/i.test(e) ? 6379 : void 0 }
1966
2042
  };
1967
2043
  function rdsDefaultPort(engine) {
1968
2044
  if (/mysql|maria/.test(engine)) return 3306;
@@ -2144,6 +2220,7 @@ function ebOptionSettingTier(namespace, optionName, value, envType) {
2144
2220
  return "undeclared";
2145
2221
  }
2146
2222
  const VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS = {
2223
+ "AWS::Batch::JobQueue": new Set(["JobQueueType"]),
2147
2224
  "AWS::ECS::Service": new Set(["AvailabilityZoneRebalancing", "PlatformVersion"]),
2148
2225
  "AWS::KinesisAnalyticsV2::Application": new Set(["ApplicationMaintenanceConfiguration"]),
2149
2226
  "AWS::ElasticBeanstalk::ConfigurationTemplate": new Set(["PlatformArn"]),
@@ -2175,7 +2252,11 @@ const VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS = {
2175
2252
  "AWS::DocDB::DBInstance": new Set(["PreferredMaintenanceWindow"]),
2176
2253
  "AWS::Neptune::DBCluster": new Set(["PreferredMaintenanceWindow", "PreferredBackupWindow"]),
2177
2254
  "AWS::Neptune::DBInstance": new Set(["PreferredMaintenanceWindow", "AvailabilityZone"]),
2178
- "AWS::ElastiCache::CacheCluster": new Set(["PreferredMaintenanceWindow", "SnapshotWindow"]),
2255
+ "AWS::ElastiCache::CacheCluster": new Set([
2256
+ "PreferredMaintenanceWindow",
2257
+ "SnapshotWindow",
2258
+ "PreferredAvailabilityZones"
2259
+ ]),
2179
2260
  "AWS::ElastiCache::ReplicationGroup": new Set(["PreferredMaintenanceWindow", "SnapshotWindow"]),
2180
2261
  "AWS::ElastiCache::ServerlessCache": new Set(["DailySnapshotTime"]),
2181
2262
  "AWS::MemoryDB::Cluster": new Set(["MaintenanceWindow", "SnapshotWindow"]),
@@ -2190,7 +2271,10 @@ const VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS = {
2190
2271
  "AWS::EC2::NetworkInterface": new Set(["PrivateIpAddress"]),
2191
2272
  "AWS::EC2::NatGateway": new Set(["PrivateIpAddress", "VpcId"]),
2192
2273
  "AWS::EFS::MountTarget": new Set(["IpAddress"]),
2193
- "AWS::EC2::EIP": new Set(["NetworkBorderGroup"]),
2274
+ "AWS::EC2::EIP": new Set(["NetworkBorderGroup", "NetworkInterfaceId"]),
2275
+ "AWS::EFS::FileSystem": new Set(["KmsKeyId"]),
2276
+ "AWS::EC2::SecurityGroup": new Set(["VpcId"]),
2277
+ "AWS::GlobalAccelerator::Accelerator": new Set(["IpAddresses"]),
2194
2278
  "AWS::EC2::VPCEndpoint": new Set(["ServiceRegion", "DnsOptions"]),
2195
2279
  "AWS::EC2::VPCPeeringConnection": new Set(["PeerRegion"]),
2196
2280
  "AWS::EC2::VPCCidrBlock": new Set(["Ipv6CidrBlock", "Ipv6CidrBlockNetworkBorderGroup"]),
@@ -2701,6 +2785,7 @@ function alignNameValueSubset(declared, live, spec) {
2701
2785
  return live.filter((e) => !dm.has(e[spec.nameField]));
2702
2786
  }
2703
2787
  const UNORDERED_ARRAY_PROPS = {
2788
+ "AWS::CloudFront::Distribution": new Set(["DistributionConfig.Restrictions.GeoRestriction.Locations"]),
2704
2789
  "AWS::Cognito::UserPoolClient": new Set([
2705
2790
  "AllowedOAuthFlows",
2706
2791
  "AllowedOAuthScopes",
@@ -3821,7 +3906,7 @@ function isPolicySubsetOf(sub, sup) {
3821
3906
  function matchesKnownDefault(live, def) {
3822
3907
  if (deepEqual(live, def)) return true;
3823
3908
  if (!isNestedObject(live) || !isNestedObject(def)) return false;
3824
- return Object.entries(live).every(([k, v]) => k in def ? deepEqual(v, def[k]) : isTrivialEmpty(v));
3909
+ return Object.entries(live).every(([k, v]) => k in def ? matchesKnownDefault(v, def[k]) : isTrivialEmpty(v));
3825
3910
  }
3826
3911
  function collectNestedUndeclared(declaredVal, liveVal, path, emit, nestedArrayIdentity) {
3827
3912
  if (Array.isArray(declaredVal) && Array.isArray(liveVal)) {
@@ -3974,6 +4059,51 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
3974
4059
  ...knownDefPaths,
3975
4060
  "LoggingConfig.LogFormat": "JSON"
3976
4061
  };
4062
+ if (resourceType === "AWS::Glue::Schema") {
4063
+ const arn = declared["Registry"]?.["Arn"];
4064
+ if (typeof arn === "string") {
4065
+ const name = arn.split(/[:/]/).pop();
4066
+ if (name) knownDefPaths = {
4067
+ ...knownDefPaths,
4068
+ "Registry.Name": name
4069
+ };
4070
+ }
4071
+ }
4072
+ if (resourceType === "AWS::ApiGateway::RestApi") {
4073
+ const types = declared["EndpointConfiguration"]?.["Types"];
4074
+ if (Array.isArray(types) && types.includes("PRIVATE")) {
4075
+ knownDef = {
4076
+ ...knownDef,
4077
+ SecurityPolicy: "TLS_1_2"
4078
+ };
4079
+ knownDefPaths = {
4080
+ ...knownDefPaths,
4081
+ "EndpointConfiguration.IpAddressType": "dualstack"
4082
+ };
4083
+ }
4084
+ }
4085
+ if (resourceType === "AWS::Cognito::UserPool") {
4086
+ const tpvd = (declared["Policies"]?.["PasswordPolicy"])?.["TemporaryPasswordValidityDays"];
4087
+ knownDefPaths = {
4088
+ ...knownDefPaths,
4089
+ "AdminCreateUserConfig.UnusedAccountValidityDays": tpvd ?? 7
4090
+ };
4091
+ }
4092
+ if (resourceType === "AWS::SSM::ResourceDataSync") {
4093
+ const s3 = declared["S3Destination"];
4094
+ if (s3 && typeof s3 === "object") {
4095
+ const twins = {};
4096
+ for (const key of [
4097
+ "BucketName",
4098
+ "BucketRegion",
4099
+ "SyncFormat"
4100
+ ]) if (key in s3) twins[key] = s3[key];
4101
+ knownDef = {
4102
+ ...knownDef,
4103
+ ...twins
4104
+ };
4105
+ }
4106
+ }
3977
4107
  const generatedPaths = GENERATED_PATHS[resourceType] ?? [];
3978
4108
  const generatedNestedPaths = GENERATED_NESTED_PATHS[resourceType];
3979
4109
  const freeFormMapPaths = schema.freeFormMapPaths ?? [];
@@ -10699,6 +10829,24 @@ function isManagedPolicyAttachmentMember(f) {
10699
10829
  function isNestedSdkWritable(f) {
10700
10830
  return SDK_NESTED_WRITERS[f.resourceType]?.match(f.path) ?? false;
10701
10831
  }
10832
+ function nullHuskRemovalOps(model) {
10833
+ const ops = [];
10834
+ const walk = (value, pointer) => {
10835
+ if (Array.isArray(value)) {
10836
+ if (value.length > 0 && value.every((v) => v === null || v === void 0)) {
10837
+ if (pointer !== "") ops.push({
10838
+ op: "remove",
10839
+ path: pointer,
10840
+ human: `strip null array husk at ${pointer}`
10841
+ });
10842
+ return;
10843
+ }
10844
+ value.forEach((v, i) => walk(v, `${pointer}/${i}`));
10845
+ } else if (value && typeof value === "object") for (const [k, v] of Object.entries(value)) walk(v, `${pointer}/${k.replace(/~/g, "~0").replace(/\//g, "~1")}`);
10846
+ };
10847
+ walk(model, "");
10848
+ return ops;
10849
+ }
10702
10850
  function toPointer(dotted) {
10703
10851
  return "/" + dotted.split(".").map((s) => s.replace(/~/g, "~0").replace(/\//g, "~1")).join("/");
10704
10852
  }
@@ -10900,6 +11048,13 @@ function buildRevertPlan(findings, baseline, opts = {}) {
10900
11048
  item.ops.push(op);
10901
11049
  itemsByLogical.set(key, item);
10902
11050
  }
11051
+ if (opts.liveByLogical) for (const item of itemsByLogical.values()) {
11052
+ if (item.kind !== "cc") continue;
11053
+ const live = opts.liveByLogical.get(item.logicalId);
11054
+ if (!live) continue;
11055
+ const huskOps = nullHuskRemovalOps(live);
11056
+ if (huskOps.length > 0) item.ops.unshift(...huskOps);
11057
+ }
10903
11058
  const ordered = [...itemsByLogical.values()];
10904
11059
  return {
10905
11060
  items: [...ordered.filter((i) => i.kind !== "delete"), ...ordered.filter((i) => i.kind === "delete")],
@@ -11574,7 +11729,8 @@ async function revertStack(p) {
11574
11729
  removeUnrecorded: includeRemovals,
11575
11730
  schemas: gathered.schemas,
11576
11731
  siblingSgRules: buildSiblingSgRules(gathered.desired),
11577
- stackName
11732
+ stackName,
11733
+ liveByLogical: gathered.liveByLogical
11578
11734
  });
11579
11735
  if (plan.items.length === 0 && plan.notRevertable.length === 0) {
11580
11736
  console.log(style.clean(`${stackName} (${region}): no drift to revert.`));