cdk-real-drift 0.25.5 → 0.26.1
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/README.md +2 -1
- package/dist/cli.js +205 -16
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -902,7 +902,8 @@ covers them. **If you never run `revert`, cdkrd needs no write permissions at al
|
|
|
902
902
|
`lambda:GetPolicy`, `budgets:ViewBudget`, `ec2:DescribeAddresses`,
|
|
903
903
|
`ec2:DescribeLaunchTemplateVersions`, `ec2:DescribeNetworkAcls`,
|
|
904
904
|
`route53:ListResourceRecordSets`, `route53:ListHostedZonesByName` (resolves a
|
|
905
|
-
RecordSet
|
|
905
|
+
RecordSet — or a RecordSetGroup, which is read member-by-member via the same
|
|
906
|
+
listing — declared via `HostedZoneName` instead of `HostedZoneId` to its zone
|
|
906
907
|
id),
|
|
907
908
|
`ses:DescribeReceiptRuleSet`, `ses:DescribeReceiptRule`, `ses:ListReceiptFilters`
|
|
908
909
|
(the SES inbound receipt-rule family — `ReceiptRuleSet` / `ReceiptRule` /
|
package/dist/cli.js
CHANGED
|
@@ -2546,6 +2546,8 @@ const KNOWN_DEFAULTS = {
|
|
|
2546
2546
|
ResolverCountLimit: 0,
|
|
2547
2547
|
XrayEnabled: false
|
|
2548
2548
|
},
|
|
2549
|
+
"AWS::AppSync::DataSource": { MetricsConfig: "DISABLED" },
|
|
2550
|
+
"AWS::AppSync::SourceApiAssociation": { SourceApiAssociationConfig: { MergeType: "MANUAL_MERGE" } },
|
|
2549
2551
|
"AWS::AppSync::Resolver": { MaxBatchSize: 0 },
|
|
2550
2552
|
"AWS::AppSync::FunctionConfiguration": { MaxBatchSize: 0 },
|
|
2551
2553
|
"AWS::Logs::SubscriptionFilter": { Distribution: "ByLogStream" },
|
|
@@ -2555,6 +2557,8 @@ const KNOWN_DEFAULTS = {
|
|
|
2555
2557
|
KeyUsage: "ENCRYPT_DECRYPT",
|
|
2556
2558
|
Origin: "AWS_KMS"
|
|
2557
2559
|
},
|
|
2560
|
+
"AWS::KMS::ReplicaKey": { Enabled: true },
|
|
2561
|
+
"AWS::EFS::AccessPoint": { RootDirectory: { Path: "/" } },
|
|
2558
2562
|
"AWS::DLM::LifecyclePolicy": {
|
|
2559
2563
|
RetainInterval: 7,
|
|
2560
2564
|
CreateInterval: 1
|
|
@@ -2643,7 +2647,10 @@ const KNOWN_DEFAULTS = {
|
|
|
2643
2647
|
NetworkType: "ipv4",
|
|
2644
2648
|
ReplicasPerNodeGroup: 0
|
|
2645
2649
|
},
|
|
2646
|
-
"AWS::ElastiCache::ServerlessCache": {
|
|
2650
|
+
"AWS::ElastiCache::ServerlessCache": {
|
|
2651
|
+
SnapshotRetentionLimit: 0,
|
|
2652
|
+
Description: " "
|
|
2653
|
+
},
|
|
2647
2654
|
"AWS::OpenSearchService::Domain": {
|
|
2648
2655
|
IPAddressType: "ipv4",
|
|
2649
2656
|
SnapshotOptions: { AutomatedSnapshotStartHour: 0 },
|
|
@@ -2975,6 +2982,9 @@ const KNOWN_DEFAULTS = {
|
|
|
2975
2982
|
},
|
|
2976
2983
|
"AWS::Transfer::Server": {
|
|
2977
2984
|
IpAddressType: "IPV4",
|
|
2985
|
+
Protocols: ["SFTP"],
|
|
2986
|
+
EndpointType: "PUBLIC",
|
|
2987
|
+
IdentityProviderType: "SERVICE_MANAGED",
|
|
2978
2988
|
ProtocolDetails: {
|
|
2979
2989
|
PassiveIp: "AUTO",
|
|
2980
2990
|
SetStatOption: "DEFAULT",
|
|
@@ -3728,7 +3738,7 @@ const VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS = {
|
|
|
3728
3738
|
"PreferredBackupWindow",
|
|
3729
3739
|
"EngineLifecycleSupport"
|
|
3730
3740
|
]),
|
|
3731
|
-
"AWS::RDS::GlobalCluster": new Set(["EngineLifecycleSupport"]),
|
|
3741
|
+
"AWS::RDS::GlobalCluster": new Set(["EngineLifecycleSupport", "EngineVersion"]),
|
|
3732
3742
|
"AWS::EKS::Cluster": new Set(["Version"]),
|
|
3733
3743
|
"AWS::EKS::Addon": new Set(["AddonVersion"]),
|
|
3734
3744
|
"AWS::Glue::Job": new Set([
|
|
@@ -3765,7 +3775,7 @@ const VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS = {
|
|
|
3765
3775
|
"SnapshotWindow",
|
|
3766
3776
|
"EngineVersion"
|
|
3767
3777
|
]),
|
|
3768
|
-
"AWS::ElastiCache::ServerlessCache": new Set(["DailySnapshotTime"]),
|
|
3778
|
+
"AWS::ElastiCache::ServerlessCache": new Set(["DailySnapshotTime", "MajorEngineVersion"]),
|
|
3769
3779
|
"AWS::MemoryDB::Cluster": new Set([
|
|
3770
3780
|
"MaintenanceWindow",
|
|
3771
3781
|
"SnapshotWindow",
|
|
@@ -3818,6 +3828,11 @@ const VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS = {
|
|
|
3818
3828
|
};
|
|
3819
3829
|
const VALUE_INDEPENDENT_DEFAULT_NESTED_PATHS = {
|
|
3820
3830
|
"AWS::Batch::ComputeEnvironment": new Set(["ComputeResources.DesiredvCpus"]),
|
|
3831
|
+
"AWS::Cognito::UserPoolIdentityProvider": new Set([
|
|
3832
|
+
"ProviderDetails.SSORedirectBindingURI",
|
|
3833
|
+
"ProviderDetails.SLORedirectBindingURI",
|
|
3834
|
+
"ProviderDetails.ActiveEncryptionCertificate"
|
|
3835
|
+
]),
|
|
3821
3836
|
"AWS::DLM::LifecyclePolicy": new Set(["PolicyDetails.Schedules.*.CreateRule.Times"]),
|
|
3822
3837
|
"AWS::AutoScaling::AutoScalingGroup": new Set(["Tags.*.ResourceId", "Tags.*.ResourceType"])
|
|
3823
3838
|
};
|
|
@@ -4073,6 +4088,7 @@ const JSON_STRING_PROPS = { "AWS::Config::ConfigRule": new Set(["InputParameters
|
|
|
4073
4088
|
const JSON_STRING_DEFAULT_FILLS = { "AWS::CE::CostCategory": { Rules: { Type: "REGULAR" } } };
|
|
4074
4089
|
const CASE_INSENSITIVE_PATHS = {
|
|
4075
4090
|
"AWS::Route53::RecordSet": new Set(["Name", "AliasTarget.DNSName"]),
|
|
4091
|
+
"AWS::Route53::RecordSetGroup": new Set(["RecordSets.*.Name", "RecordSets.*.AliasTarget.DNSName"]),
|
|
4076
4092
|
"AWS::Batch::ComputeEnvironment": new Set(["Type"]),
|
|
4077
4093
|
"AWS::Batch::JobDefinition": new Set(["Type"]),
|
|
4078
4094
|
"AWS::EMRServerless::Application": new Set(["Type"]),
|
|
@@ -4088,8 +4104,10 @@ const CASE_INSENSITIVE_PATHS = {
|
|
|
4088
4104
|
"DBClusterIdentifier",
|
|
4089
4105
|
"DBClusterParameterGroupName",
|
|
4090
4106
|
"DBSubnetGroupName",
|
|
4091
|
-
"Engine"
|
|
4107
|
+
"Engine",
|
|
4108
|
+
"GlobalClusterIdentifier"
|
|
4092
4109
|
]),
|
|
4110
|
+
"AWS::RDS::GlobalCluster": new Set(["GlobalClusterIdentifier", "Engine"]),
|
|
4093
4111
|
"AWS::ElastiCache::SubnetGroup": new Set(["CacheSubnetGroupName"]),
|
|
4094
4112
|
"AWS::ElastiCache::ReplicationGroup": new Set([
|
|
4095
4113
|
"ReplicationGroupId",
|
|
@@ -4636,6 +4654,7 @@ const UNORDERED_ARRAY_PROPS = {
|
|
|
4636
4654
|
"AWS::CloudFront::Distribution": new Set(["DistributionConfig.Restrictions.GeoRestriction.Locations"]),
|
|
4637
4655
|
"AWS::Cognito::UserPool": new Set(["EnabledMfas"]),
|
|
4638
4656
|
"AWS::ECS::Cluster": new Set(["CapacityProviders"]),
|
|
4657
|
+
"AWS::ECS::ClusterCapacityProviderAssociations": new Set(["CapacityProviders"]),
|
|
4639
4658
|
"AWS::Cognito::UserPoolClient": new Set([
|
|
4640
4659
|
"AllowedOAuthFlows",
|
|
4641
4660
|
"AllowedOAuthScopes",
|
|
@@ -4648,6 +4667,7 @@ const UNORDERED_ARRAY_PROPS = {
|
|
|
4648
4667
|
]),
|
|
4649
4668
|
"AWS::WAFv2::IPSet": new Set(["Addresses"]),
|
|
4650
4669
|
"AWS::Route53::RecordSet": new Set(["ResourceRecords"]),
|
|
4670
|
+
"AWS::Route53::RecordSetGroup": new Set(["RecordSets.*.ResourceRecords"]),
|
|
4651
4671
|
"AWS::CodeDeploy::DeploymentGroup": new Set(["AutoRollbackConfiguration.Events"]),
|
|
4652
4672
|
"AWS::RDS::DBInstance": new Set(["EnableCloudwatchLogsExports"]),
|
|
4653
4673
|
"AWS::RDS::DBCluster": new Set(["EnableCloudwatchLogsExports"]),
|
|
@@ -6131,6 +6151,7 @@ const ELB_ATTRIBUTE_BAGS = {
|
|
|
6131
6151
|
const notRestored = (...restoreSourceKeys) => ({ declared }) => restoreSourceKeys.every((k) => declared[k] === void 0);
|
|
6132
6152
|
const MEANINGFUL_WHEN_OFF = {
|
|
6133
6153
|
"AWS::KMS::Key": { Enabled: () => true },
|
|
6154
|
+
"AWS::KMS::ReplicaKey": { Enabled: () => true },
|
|
6134
6155
|
"AWS::ServiceCatalog::TagOption": { Active: () => true },
|
|
6135
6156
|
"AWS::VpcLattice::ResourceConfiguration": { AllowAssociationToSharableServiceNetwork: () => true },
|
|
6136
6157
|
"AWS::SQS::Queue": { SqsManagedSseEnabled: ({ declared, live }) => declared["KmsMasterKeyId"] === void 0 && live["KmsMasterKeyId"] === void 0 },
|
|
@@ -6240,7 +6261,8 @@ const DEFAULT_SG_LIST_PATHS = {
|
|
|
6240
6261
|
"AWS::DMS::ReplicationInstance": "VpcSecurityGroupIds",
|
|
6241
6262
|
"AWS::EC2::ClientVpnEndpoint": "SecurityGroupIds",
|
|
6242
6263
|
"AWS::VpcLattice::ResourceGateway": "SecurityGroupIds",
|
|
6243
|
-
"AWS::EC2::VPCEndpoint": "SecurityGroupIds"
|
|
6264
|
+
"AWS::EC2::VPCEndpoint": "SecurityGroupIds",
|
|
6265
|
+
"AWS::ElastiCache::ServerlessCache": "SecurityGroupIds"
|
|
6244
6266
|
};
|
|
6245
6267
|
/** #1269 fold decision for an UNDECLARED default-SUBNET list (RedshiftServerless Workgroup
|
|
6246
6268
|
* SubnetIds). Unlike the SG gate (which folds only a SINGLE default SG), a workgroup placed into
|
|
@@ -6258,7 +6280,10 @@ function shouldFoldDefaultSubnetList(resourceType, key, liveValue, defaultSubnet
|
|
|
6258
6280
|
if (!Array.isArray(liveValue)) return true;
|
|
6259
6281
|
return liveValue.every((s) => typeof s === "string" && defaultSubnetIds.has(s));
|
|
6260
6282
|
}
|
|
6261
|
-
const DEFAULT_SUBNET_LIST_PATHS = {
|
|
6283
|
+
const DEFAULT_SUBNET_LIST_PATHS = {
|
|
6284
|
+
"AWS::RedshiftServerless::Workgroup": "SubnetIds",
|
|
6285
|
+
"AWS::ElastiCache::ServerlessCache": "SubnetIds"
|
|
6286
|
+
};
|
|
6262
6287
|
const RS_WORKGROUP_CONFIG_PARAM_DEFAULTS = {
|
|
6263
6288
|
auto_mv: "true",
|
|
6264
6289
|
datestyle: "ISO, MDY",
|
|
@@ -9229,9 +9254,12 @@ async function enumerateHttpApiChildren(ctx) {
|
|
|
9229
9254
|
const CHATBOT_SUBSCRIPTION_ENDPOINT = "https://global.sns-api.chatbot.amazonaws.com";
|
|
9230
9255
|
function diffSnsTopicChildren(input) {
|
|
9231
9256
|
const declared = new Set(input.declaredSubscriptionArns);
|
|
9257
|
+
const inline = input.declaredInlineSubscriptions ?? [];
|
|
9258
|
+
const matchesInline = (s) => inline.some((d) => (d.protocol === void 0 || d.protocol.toLowerCase() === (s.protocol ?? "").toLowerCase()) && (d.endpointUnresolved || d.endpoint === s.endpoint));
|
|
9232
9259
|
const added = [];
|
|
9233
9260
|
for (const s of input.liveSubscriptions) {
|
|
9234
9261
|
if (declared.has(s.arn)) continue;
|
|
9262
|
+
if (matchesInline(s)) continue;
|
|
9235
9263
|
if (s.endpoint === CHATBOT_SUBSCRIPTION_ENDPOINT) continue;
|
|
9236
9264
|
added.push({
|
|
9237
9265
|
resourceType: "AWS::SNS::Subscription",
|
|
@@ -9263,6 +9291,17 @@ async function enumerateSnsTopicChildren(ctx) {
|
|
|
9263
9291
|
if (!topicArn) return [];
|
|
9264
9292
|
const declaredSubscriptionArns = [];
|
|
9265
9293
|
for (const r of desired.resources) if (r.resourceType === "AWS::SNS::Subscription" && parentRefMatches(r.declared.TopicArn, topicArn) && r.physicalId) declaredSubscriptionArns.push(r.physicalId);
|
|
9294
|
+
const declaredInlineSubscriptions = [];
|
|
9295
|
+
const inlineDecl = parent.declared?.Subscription;
|
|
9296
|
+
if (Array.isArray(inlineDecl)) for (const e of inlineDecl) {
|
|
9297
|
+
if (!e || typeof e !== "object") continue;
|
|
9298
|
+
const { Protocol, Endpoint } = e;
|
|
9299
|
+
declaredInlineSubscriptions.push({
|
|
9300
|
+
protocol: typeof Protocol === "string" ? Protocol : void 0,
|
|
9301
|
+
endpoint: typeof Endpoint === "string" ? Endpoint : void 0,
|
|
9302
|
+
endpointUnresolved: Endpoint !== void 0 && hasUnresolved(Endpoint)
|
|
9303
|
+
});
|
|
9304
|
+
}
|
|
9266
9305
|
let hasDeclaredPolicy = false;
|
|
9267
9306
|
for (const r of desired.resources) {
|
|
9268
9307
|
if (r.resourceType === "AWS::SNS::TopicInlinePolicy") {
|
|
@@ -9284,12 +9323,14 @@ async function enumerateSnsTopicChildren(ctx) {
|
|
|
9284
9323
|
const liveSubscriptions = (await pageSubscriptions(client, topicArn)).filter((s) => typeof s.SubscriptionArn === "string" && s.SubscriptionArn.startsWith("arn:")).map((s) => ({
|
|
9285
9324
|
arn: s.SubscriptionArn,
|
|
9286
9325
|
label: s.Protocol ? `${s.Protocol} ${s.Endpoint ?? ""}`.trim() : s.SubscriptionArn,
|
|
9326
|
+
protocol: s.Protocol,
|
|
9287
9327
|
endpoint: s.Endpoint,
|
|
9288
9328
|
owner: s.Owner
|
|
9289
9329
|
}));
|
|
9290
9330
|
const livePolicy = await readSnsTopicPolicyDocument(client, topicArn);
|
|
9291
9331
|
return diffSnsTopicChildren({
|
|
9292
9332
|
declaredSubscriptionArns,
|
|
9333
|
+
declaredInlineSubscriptions,
|
|
9293
9334
|
liveSubscriptions
|
|
9294
9335
|
}).concat(diffSnsTopicPolicy({
|
|
9295
9336
|
topicArn,
|
|
@@ -11609,6 +11650,7 @@ function diffGlueDatabaseChildren(input) {
|
|
|
11609
11650
|
const added = [];
|
|
11610
11651
|
for (const t of liveTables) {
|
|
11611
11652
|
if (declared.has(t.name)) continue;
|
|
11653
|
+
if (t.sourceDatabaseName !== void 0 && t.sourceDatabaseName !== databaseName) continue;
|
|
11612
11654
|
added.push({
|
|
11613
11655
|
resourceType: "AWS::Glue::Table",
|
|
11614
11656
|
identifier: `${databaseName}|${t.name}`,
|
|
@@ -11639,6 +11681,8 @@ async function enumerateGlueDatabaseChildren(ctx) {
|
|
|
11639
11681
|
const { parent, desired, region } = ctx;
|
|
11640
11682
|
const databaseName = parent.physicalId;
|
|
11641
11683
|
if (!databaseName) return [];
|
|
11684
|
+
const dbInput = parent.declared.DatabaseInput;
|
|
11685
|
+
if (dbInput?.TargetDatabase !== void 0 || dbInput?.FederatedDatabase !== void 0) return [];
|
|
11642
11686
|
const declaredTableNames = [];
|
|
11643
11687
|
for (const r of desired.resources) {
|
|
11644
11688
|
if (r.resourceType !== "AWS::Glue::Table" || !parentRefMatches(r.declared.DatabaseName, databaseName)) continue;
|
|
@@ -11655,7 +11699,8 @@ async function enumerateGlueDatabaseChildren(ctx) {
|
|
|
11655
11699
|
...READ_RETRY
|
|
11656
11700
|
}), databaseName, catalogId)).filter((t) => typeof t.Name === "string").map((t) => ({
|
|
11657
11701
|
name: t.Name,
|
|
11658
|
-
label: t.TableType ? `${t.Name} (${t.TableType})` : t.Name
|
|
11702
|
+
label: t.TableType ? `${t.Name} (${t.TableType})` : t.Name,
|
|
11703
|
+
sourceDatabaseName: t.DatabaseName
|
|
11659
11704
|
}))
|
|
11660
11705
|
});
|
|
11661
11706
|
}
|
|
@@ -13164,10 +13209,13 @@ const readRoute53RecordSet = async ({ physicalId, declared, region }) => {
|
|
|
13164
13209
|
startId = r.NextRecordIdentifier;
|
|
13165
13210
|
}
|
|
13166
13211
|
if (!rec) throw new ResourceGoneError(`Route53 RecordSet ${name} ${type} absent from zone ${hostedZoneId}`);
|
|
13212
|
+
return projectRoute53RecordModel(rec, declared, byName ? { HostedZoneName: zoneName } : { HostedZoneId: hostedZoneId });
|
|
13213
|
+
};
|
|
13214
|
+
function projectRoute53RecordModel(rec, declared, zoneField) {
|
|
13167
13215
|
const model = {
|
|
13168
13216
|
Name: alignTrailingDot(rec.Name === void 0 ? void 0 : unescapeRoute53Name(rec.Name), declared.Name),
|
|
13169
13217
|
Type: rec.Type,
|
|
13170
|
-
...
|
|
13218
|
+
...zoneField
|
|
13171
13219
|
};
|
|
13172
13220
|
if (rec.TTL !== void 0) model.TTL = String(rec.TTL);
|
|
13173
13221
|
const records = rec.ResourceRecords?.map((rr) => rr.Value).filter((v) => !!v);
|
|
@@ -13208,6 +13256,39 @@ const readRoute53RecordSet = async ({ physicalId, declared, region }) => {
|
|
|
13208
13256
|
...cidr.LocationName !== void 0 && { LocationName: cidr.LocationName }
|
|
13209
13257
|
};
|
|
13210
13258
|
return model;
|
|
13259
|
+
}
|
|
13260
|
+
const readRoute53RecordSetGroup = async ({ declared, region }) => {
|
|
13261
|
+
const c = new Route53Client({
|
|
13262
|
+
region,
|
|
13263
|
+
...READ_RETRY
|
|
13264
|
+
});
|
|
13265
|
+
const declaredZoneId = str$1(declared.HostedZoneId);
|
|
13266
|
+
const zoneName = str$1(declared.HostedZoneName);
|
|
13267
|
+
const byName = !declaredZoneId && !!zoneName;
|
|
13268
|
+
const hostedZoneId = declaredZoneId ?? (zoneName ? await resolveHostedZoneIdByName(c, zoneName) : void 0);
|
|
13269
|
+
const declSets = Array.isArray(declared.RecordSets) ? declared.RecordSets : void 0;
|
|
13270
|
+
if (!hostedZoneId || !declSets) return void 0;
|
|
13271
|
+
const live = await pageResourceRecordSets(c, hostedZoneId);
|
|
13272
|
+
const canon = (s) => unescapeRoute53Name(s).replace(/\.$/, "").toLowerCase();
|
|
13273
|
+
const projected = [];
|
|
13274
|
+
for (const d of declSets) {
|
|
13275
|
+
if (!d || typeof d !== "object") continue;
|
|
13276
|
+
const name = str$1(d.Name);
|
|
13277
|
+
const type = str$1(d.Type);
|
|
13278
|
+
if (!name || !type) continue;
|
|
13279
|
+
const declSetId = str$1(d.SetIdentifier);
|
|
13280
|
+
const rec = live.find((x) => x.Type === type && !!x.Name && canon(x.Name) === canon(name) && (x.SetIdentifier ?? void 0) === declSetId);
|
|
13281
|
+
if (!rec) continue;
|
|
13282
|
+
projected.push(projectRoute53RecordModel(rec, d, {
|
|
13283
|
+
...str$1(d.HostedZoneId) !== void 0 && { HostedZoneId: d.HostedZoneId },
|
|
13284
|
+
...str$1(d.HostedZoneName) !== void 0 && { HostedZoneName: d.HostedZoneName }
|
|
13285
|
+
}));
|
|
13286
|
+
}
|
|
13287
|
+
return {
|
|
13288
|
+
...declaredZoneId !== void 0 && { HostedZoneId: declaredZoneId },
|
|
13289
|
+
...byName && { HostedZoneName: zoneName },
|
|
13290
|
+
RecordSets: projected
|
|
13291
|
+
};
|
|
13211
13292
|
};
|
|
13212
13293
|
const readGlueTable = async ({ physicalId, declared, region }) => {
|
|
13213
13294
|
const idParts = physicalId.split("|");
|
|
@@ -14113,6 +14194,7 @@ const SDK_OVERRIDES = {
|
|
|
14113
14194
|
"AWS::MediaConvert::Queue": readMediaConvertQueue,
|
|
14114
14195
|
"AWS::MediaConvert::JobTemplate": readMediaConvertJobTemplate,
|
|
14115
14196
|
"AWS::Route53::RecordSet": readRoute53RecordSet,
|
|
14197
|
+
"AWS::Route53::RecordSetGroup": readRoute53RecordSetGroup,
|
|
14116
14198
|
"AWS::Glue::Table": readGlueTable,
|
|
14117
14199
|
"AWS::Glue::Classifier": readGlueClassifier,
|
|
14118
14200
|
"AWS::Glue::Workflow": readGlueWorkflow,
|
|
@@ -15119,9 +15201,10 @@ const DEFAULT_SG_LIST_TYPES = new Set([
|
|
|
15119
15201
|
"AWS::DMS::ReplicationInstance",
|
|
15120
15202
|
"AWS::EC2::ClientVpnEndpoint",
|
|
15121
15203
|
"AWS::VpcLattice::ResourceGateway",
|
|
15122
|
-
"AWS::EC2::VPCEndpoint"
|
|
15204
|
+
"AWS::EC2::VPCEndpoint",
|
|
15205
|
+
"AWS::ElastiCache::ServerlessCache"
|
|
15123
15206
|
]);
|
|
15124
|
-
const DEFAULT_SUBNET_LIST_TYPES = new Set(["AWS::RedshiftServerless::Workgroup"]);
|
|
15207
|
+
const DEFAULT_SUBNET_LIST_TYPES = new Set(["AWS::RedshiftServerless::Workgroup", "AWS::ElastiCache::ServerlessCache"]);
|
|
15125
15208
|
const EB_SG_OPTION_KEYS = new Set(["aws:elb:loadbalancer|SecurityGroups", "aws:autoscaling:launchconfiguration|SecurityGroups"]);
|
|
15126
15209
|
function collectEbSecurityGroupIds(resources, liveById) {
|
|
15127
15210
|
const ids = /* @__PURE__ */ new Set();
|
|
@@ -18979,12 +19062,10 @@ const RR_ROUTING_FIELDS = [
|
|
|
18979
19062
|
"GeoProximityLocation",
|
|
18980
19063
|
"CidrRoutingConfig"
|
|
18981
19064
|
];
|
|
18982
|
-
|
|
18983
|
-
const
|
|
18984
|
-
const
|
|
18985
|
-
|
|
18986
|
-
const type = str(m.Type) ?? str(ctx.declared["Type"]);
|
|
18987
|
-
if (!zone || !name || !type) throw new Error("cannot resolve Route53 record target for revert");
|
|
19065
|
+
function buildRoute53RrSet(m) {
|
|
19066
|
+
const name = str(m.Name);
|
|
19067
|
+
const type = str(m.Type);
|
|
19068
|
+
if (!name || !type) return void 0;
|
|
18988
19069
|
const rrset = {
|
|
18989
19070
|
Name: name,
|
|
18990
19071
|
Type: type
|
|
@@ -18993,6 +19074,17 @@ const writeRoute53RecordSet = async (ctx, ops) => {
|
|
|
18993
19074
|
if (Array.isArray(m.ResourceRecords)) rrset.ResourceRecords = m.ResourceRecords.map((v) => ({ Value: v }));
|
|
18994
19075
|
if (m.AliasTarget !== void 0) rrset.AliasTarget = m.AliasTarget;
|
|
18995
19076
|
for (const k of RR_ROUTING_FIELDS) if (m[k] !== void 0) rrset[k] = m[k];
|
|
19077
|
+
return rrset;
|
|
19078
|
+
}
|
|
19079
|
+
const writeRoute53RecordSet = async (ctx, ops) => {
|
|
19080
|
+
const m = await desiredModel("AWS::Route53::RecordSet", ctx, ops);
|
|
19081
|
+
const zone = str(m.HostedZoneId) ?? str(ctx.declared["HostedZoneId"]);
|
|
19082
|
+
const rrset = buildRoute53RrSet({
|
|
19083
|
+
...m,
|
|
19084
|
+
Name: str(m.Name) ?? str(ctx.declared["Name"]),
|
|
19085
|
+
Type: str(m.Type) ?? str(ctx.declared["Type"])
|
|
19086
|
+
});
|
|
19087
|
+
if (!zone || !rrset) throw new Error("cannot resolve Route53 record target for revert");
|
|
18996
19088
|
await new Route53Client({
|
|
18997
19089
|
region: ctx.region,
|
|
18998
19090
|
...CLIENT_TIMEOUTS
|
|
@@ -19004,6 +19096,37 @@ const writeRoute53RecordSet = async (ctx, ops) => {
|
|
|
19004
19096
|
}] }
|
|
19005
19097
|
}));
|
|
19006
19098
|
};
|
|
19099
|
+
const writeRoute53RecordSetGroup = async (ctx, ops) => {
|
|
19100
|
+
const m = await desiredModel("AWS::Route53::RecordSetGroup", ctx, ops);
|
|
19101
|
+
let zone = str(m.HostedZoneId) ?? str(ctx.declared["HostedZoneId"]);
|
|
19102
|
+
if (!zone) {
|
|
19103
|
+
const zoneName = str(m.HostedZoneName) ?? str(ctx.declared["HostedZoneName"]);
|
|
19104
|
+
if (zoneName) zone = await resolveHostedZoneIdByName(new Route53Client({
|
|
19105
|
+
region: ctx.region,
|
|
19106
|
+
...CLIENT_TIMEOUTS
|
|
19107
|
+
}), zoneName);
|
|
19108
|
+
}
|
|
19109
|
+
const sets = Array.isArray(m.RecordSets) ? m.RecordSets : [];
|
|
19110
|
+
if (!zone || sets.length === 0) throw new Error("cannot resolve Route53 record-set-group target for revert");
|
|
19111
|
+
const wholeArray = ops.some((o) => o.path === "/RecordSets");
|
|
19112
|
+
const touched = /* @__PURE__ */ new Set();
|
|
19113
|
+
for (const o of ops) {
|
|
19114
|
+
const i = /^\/RecordSets\/(\d+)(\/|$)/.exec(o.path)?.[1];
|
|
19115
|
+
if (i !== void 0) touched.add(Number(i));
|
|
19116
|
+
}
|
|
19117
|
+
const changes = (wholeArray ? sets : [...touched].map((i) => sets[i]).filter((s) => !!s)).map((member) => buildRoute53RrSet(member)).filter((r) => r !== void 0).map((rrset) => ({
|
|
19118
|
+
Action: "UPSERT",
|
|
19119
|
+
ResourceRecordSet: rrset
|
|
19120
|
+
}));
|
|
19121
|
+
if (changes.length === 0) throw new Error("Route53 record-set-group revert: no member resolved from the revert ops");
|
|
19122
|
+
await new Route53Client({
|
|
19123
|
+
region: ctx.region,
|
|
19124
|
+
...CLIENT_TIMEOUTS
|
|
19125
|
+
}).send(new ChangeResourceRecordSetsCommand({
|
|
19126
|
+
HostedZoneId: zone,
|
|
19127
|
+
ChangeBatch: { Changes: changes }
|
|
19128
|
+
}));
|
|
19129
|
+
};
|
|
19007
19130
|
const configInputParametersString = (v) => {
|
|
19008
19131
|
let model = v;
|
|
19009
19132
|
if (typeof v === "string") try {
|
|
@@ -20214,6 +20337,7 @@ const SDK_WRITERS = {
|
|
|
20214
20337
|
"AWS::DLM::LifecyclePolicy": writeDlmLifecyclePolicy,
|
|
20215
20338
|
"AWS::Logs::MetricFilter": writeMetricFilter,
|
|
20216
20339
|
"AWS::Route53::RecordSet": writeRoute53RecordSet,
|
|
20340
|
+
"AWS::Route53::RecordSetGroup": writeRoute53RecordSetGroup,
|
|
20217
20341
|
"AWS::DocDB::DBCluster": writeDocDbCluster,
|
|
20218
20342
|
"AWS::DocDB::DBInstance": writeDocDbInstance,
|
|
20219
20343
|
"AWS::ServiceDiscovery::HttpNamespace": writeServiceDiscoveryHttpNamespace,
|
|
@@ -20508,6 +20632,7 @@ const CC_REVERTABLE_DESPITE_READ_OVERRIDE = new Set([
|
|
|
20508
20632
|
"AWS::EC2::EIP"
|
|
20509
20633
|
]);
|
|
20510
20634
|
const REVERT_SET_DEFAULT_PATHS = new Set([
|
|
20635
|
+
"AWS::ElastiCache::ServerlessCache\0Description",
|
|
20511
20636
|
"AWS::EC2::CapacityReservation\0InstanceMatchCriteria",
|
|
20512
20637
|
"AWS::EC2::CapacityReservation\0EndDateType",
|
|
20513
20638
|
"AWS::CodeDeploy::DeploymentGroup\0DeploymentConfigName",
|
|
@@ -20716,6 +20841,69 @@ function nullHuskRemovalOps(model) {
|
|
|
20716
20841
|
ops.sort((a, b) => compareDocOrderDescending(a.path, b.path));
|
|
20717
20842
|
return ops;
|
|
20718
20843
|
}
|
|
20844
|
+
const GUARDDUTY_DS_FEATURE_BLOCKS = [
|
|
20845
|
+
{
|
|
20846
|
+
block: "S3Logs",
|
|
20847
|
+
feature: "S3_DATA_EVENTS"
|
|
20848
|
+
},
|
|
20849
|
+
{
|
|
20850
|
+
block: "Kubernetes",
|
|
20851
|
+
feature: "EKS_AUDIT_LOGS"
|
|
20852
|
+
},
|
|
20853
|
+
{
|
|
20854
|
+
block: "MalwareProtection",
|
|
20855
|
+
feature: "EBS_MALWARE_PROTECTION"
|
|
20856
|
+
}
|
|
20857
|
+
];
|
|
20858
|
+
function firstBooleanLeaf(v) {
|
|
20859
|
+
if (typeof v === "boolean") return v;
|
|
20860
|
+
if (v && typeof v === "object" && !Array.isArray(v)) for (const x of Object.values(v)) {
|
|
20861
|
+
const b = firstBooleanLeaf(x);
|
|
20862
|
+
if (b !== void 0) return b;
|
|
20863
|
+
}
|
|
20864
|
+
}
|
|
20865
|
+
function applyGuardDutyDetectorPatchShape(item, live) {
|
|
20866
|
+
const features = Array.isArray(live.Features) ? live.Features : [];
|
|
20867
|
+
const featureIdx = (name) => features.findIndex((f) => f && f.Name === name);
|
|
20868
|
+
const ops = [];
|
|
20869
|
+
for (const op of item.ops) {
|
|
20870
|
+
if (!op.path.startsWith("/DataSources")) {
|
|
20871
|
+
ops.push(op);
|
|
20872
|
+
continue;
|
|
20873
|
+
}
|
|
20874
|
+
const seg = op.path.split("/")[2];
|
|
20875
|
+
const blocks = seg ? GUARDDUTY_DS_FEATURE_BLOCKS.filter((b) => b.block === seg) : GUARDDUTY_DS_FEATURE_BLOCKS;
|
|
20876
|
+
const translated = [];
|
|
20877
|
+
for (const b of blocks) {
|
|
20878
|
+
const sub = seg ? op.value : op.value?.[b.block];
|
|
20879
|
+
const enabled = op.op === "remove" ? true : firstBooleanLeaf(sub);
|
|
20880
|
+
const idx = featureIdx(b.feature);
|
|
20881
|
+
if (enabled === void 0 || idx < 0) continue;
|
|
20882
|
+
translated.push({
|
|
20883
|
+
op: "add",
|
|
20884
|
+
path: `/Features/${idx}/Status`,
|
|
20885
|
+
value: enabled ? "ENABLED" : "DISABLED",
|
|
20886
|
+
prior: op.prior,
|
|
20887
|
+
human: `${b.feature} -> ${enabled ? "ENABLED" : "DISABLED"} (translated from ${op.path}, #1752)`
|
|
20888
|
+
});
|
|
20889
|
+
}
|
|
20890
|
+
ops.push(...translated.length > 0 ? translated : [op]);
|
|
20891
|
+
}
|
|
20892
|
+
if (live.DataSources !== void 0 && !ops.some((o) => o.path === "/DataSources")) ops.push({
|
|
20893
|
+
op: "remove",
|
|
20894
|
+
path: "/DataSources",
|
|
20895
|
+
contract: true,
|
|
20896
|
+
human: "DataSources -> remove from the write model (Features projection, #1752)"
|
|
20897
|
+
});
|
|
20898
|
+
const eksIdx = featureIdx("EKS_RUNTIME_MONITORING");
|
|
20899
|
+
if (eksIdx >= 0 && featureIdx("RUNTIME_MONITORING") >= 0) ops.push({
|
|
20900
|
+
op: "remove",
|
|
20901
|
+
path: `/Features/${eksIdx}`,
|
|
20902
|
+
contract: true,
|
|
20903
|
+
human: "EKS_RUNTIME_MONITORING -> remove (deprecated alias of RUNTIME_MONITORING, #1752)"
|
|
20904
|
+
});
|
|
20905
|
+
item.ops = ops;
|
|
20906
|
+
}
|
|
20719
20907
|
function compareDocOrderDescending(a, b) {
|
|
20720
20908
|
const as = a.split("/").slice(1);
|
|
20721
20909
|
const bs = b.split("/").slice(1);
|
|
@@ -21048,6 +21236,7 @@ function buildRevertPlan(findings, baseline, opts = {}) {
|
|
|
21048
21236
|
item.liveRaw = live;
|
|
21049
21237
|
const huskOps = nullHuskRemovalOps(live);
|
|
21050
21238
|
if (huskOps.length > 0) item.ops.unshift(...huskOps);
|
|
21239
|
+
if (item.resourceType === "AWS::GuardDuty::Detector") applyGuardDutyDetectorPatchShape(item, live);
|
|
21051
21240
|
}
|
|
21052
21241
|
const ordered = [...itemsByLogical.values()];
|
|
21053
21242
|
return {
|