cdk-real-drift 0.14.0 → 0.15.0
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 +9 -0
- package/dist/cli.js +81 -5
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -878,6 +878,15 @@ covers them. **If you never run `revert`, cdkrd needs no write permissions at al
|
|
|
878
878
|
resource name, and `ListTagsForResource` reads each resource's tags, which the
|
|
879
879
|
`Get*` responses omit — without it a declared `Tags` false-flagged as drift on
|
|
880
880
|
every tagged MediaConvert resource),
|
|
881
|
+
`config:DescribeConfigurationRecorders` + `config:DescribeDeliveryChannels`
|
|
882
|
+
(read an `AWS::Config::ConfigurationRecorder` /
|
|
883
|
+
`AWS::Config::DeliveryChannel` — the account/region compliance-baseline
|
|
884
|
+
SINGLETONS a large fraction of accounts deploy, NON_PROVISIONABLE with Cloud
|
|
885
|
+
Control `UnsupportedActionException`; the physical id IS the recorder / channel
|
|
886
|
+
name, and the reader projects the CFn-declarable surface — the recorder's
|
|
887
|
+
undeclared `RecordingGroup.RecordingStrategy` mirror and `RecordingMode` default
|
|
888
|
+
fold to atDefault, so a fresh recorder is clean while a recording-scope change
|
|
889
|
+
still surfaces),
|
|
881
890
|
`ssm:DescribeParameters` (supplements the Cloud Control read of an
|
|
882
891
|
`AWS::SSM::Parameter` with its writeOnly `Description` / `AllowedPattern`),
|
|
883
892
|
`elasticache:DescribeReplicationGroups` + `elasticache:DescribeCacheClusters`
|
package/dist/cli.js
CHANGED
|
@@ -49,6 +49,7 @@ import { DLMClient, GetLifecyclePolicyCommand, UpdateLifecyclePolicyCommand } fr
|
|
|
49
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
|
+
import { ConfigServiceClient, DescribeConfigRulesCommand, DescribeConfigurationRecordersCommand, DescribeDeliveryChannelsCommand, PutConfigRuleCommand } from "@aws-sdk/client-config-service";
|
|
52
53
|
import { DescribeConfigurationCommand, DescribeConfigurationRevisionCommand, KafkaClient, UpdateConfigurationCommand } from "@aws-sdk/client-kafka";
|
|
53
54
|
import { GetWorkgroupCommand, RedshiftServerlessClient } from "@aws-sdk/client-redshift-serverless";
|
|
54
55
|
import { BuildBotLocaleCommand, CreateIntentCommand, CreateSlotCommand, CreateSlotTypeCommand, DeleteIntentCommand, DeleteSlotCommand, DeleteSlotTypeCommand, DescribeBotLocaleCommand, DescribeIntentCommand, DescribeSlotCommand, DescribeSlotTypeCommand, LexModelsV2Client, ListBotLocalesCommand, ListIntentsCommand, ListSlotTypesCommand, ListSlotsCommand, UpdateBotLocaleCommand, UpdateIntentCommand, UpdateSlotCommand, UpdateSlotTypeCommand } from "@aws-sdk/client-lex-models-v2";
|
|
@@ -63,7 +64,6 @@ import { MultiSelectPrompt, Prompt, isCancel as isCancel$1 } from "@clack/core";
|
|
|
63
64
|
import { CloudFrontClient, GetDistributionConfigCommand, UpdateDistributionCommand } from "@aws-sdk/client-cloudfront";
|
|
64
65
|
import { DescribeSignalingChannelCommand, DescribeStreamCommand, KinesisVideoClient, UpdateDataRetentionCommand, UpdateSignalingChannelCommand, UpdateStreamStorageConfigurationCommand } from "@aws-sdk/client-kinesis-video";
|
|
65
66
|
import { GetWebACLCommand, UpdateWebACLCommand, WAFV2Client } from "@aws-sdk/client-wafv2";
|
|
66
|
-
import { ConfigServiceClient, DescribeConfigRulesCommand, PutConfigRuleCommand } from "@aws-sdk/client-config-service";
|
|
67
67
|
|
|
68
68
|
//#region src/exit.ts
|
|
69
69
|
function drain(stream) {
|
|
@@ -2066,6 +2066,7 @@ const KNOWN_DEFAULTS = {
|
|
|
2066
2066
|
Description: ""
|
|
2067
2067
|
},
|
|
2068
2068
|
"AWS::SageMaker::DataQualityJobDefinition": { StoppingCondition: { MaxRuntimeInSeconds: 3600 } },
|
|
2069
|
+
"AWS::Config::ConfigurationRecorder": { RecordingMode: { RecordingFrequency: "CONTINUOUS" } },
|
|
2069
2070
|
"AWS::IAM::ServerCertificate": { Path: "/" },
|
|
2070
2071
|
"AWS::CertificateManager::Certificate": { KeyAlgorithm: "RSA_2048" },
|
|
2071
2072
|
"AWS::AppRunner::Service": {
|
|
@@ -6115,6 +6116,16 @@ function dynamoGsiWarmThroughputAtDefault(resourceType, path, value, live, decla
|
|
|
6115
6116
|
const declaredGsi = gsiByName(declared, m[1]);
|
|
6116
6117
|
return liveGsi !== void 0 && deepEqual(value, warmThroughputDefault(liveGsi.ProvisionedThroughput)) || declaredGsi !== void 0 && deepEqual(value, warmThroughputDefault(declaredGsi.ProvisionedThroughput));
|
|
6117
6118
|
}
|
|
6119
|
+
function configRecordingStrategyAtDefault(resourceType, schemaPath, value, live) {
|
|
6120
|
+
if (resourceType !== "AWS::Config::ConfigurationRecorder") return false;
|
|
6121
|
+
if (schemaPath !== "RecordingGroup.RecordingStrategy") return false;
|
|
6122
|
+
const rg = live.RecordingGroup;
|
|
6123
|
+
if (!isNestedObject(rg)) return false;
|
|
6124
|
+
const group = rg;
|
|
6125
|
+
const excl = isNestedObject(group.ExclusionByResourceTypes) ? group.ExclusionByResourceTypes.ResourceTypes : void 0;
|
|
6126
|
+
const useOnly = group.AllSupported === true ? "ALL_SUPPORTED_RESOURCE_TYPES" : Array.isArray(excl) && excl.length > 0 ? "EXCLUSION_BY_RESOURCE_TYPES" : Array.isArray(group.ResourceTypes) && group.ResourceTypes.length > 0 ? "INCLUSION_BY_RESOURCE_TYPES" : void 0;
|
|
6127
|
+
return useOnly !== void 0 && deepEqual(value, { UseOnly: useOnly });
|
|
6128
|
+
}
|
|
6118
6129
|
const CLB_DEFAULT_SSL_POLICY_NAME = "ELBSecurityPolicy-2016-08";
|
|
6119
6130
|
function clbDefaultSslPoliciesAtDefault(resourceType, key, value) {
|
|
6120
6131
|
if (resourceType !== "AWS::ElasticLoadBalancing::LoadBalancer" || key !== "Policies") return false;
|
|
@@ -6994,7 +7005,7 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
6994
7005
|
const parentKey = (path.split(".").pop() ?? "").replace(/\[.*$/, "");
|
|
6995
7006
|
if (!isObjectForm || /tags$/i.test(parentKey)) return;
|
|
6996
7007
|
}
|
|
6997
|
-
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";
|
|
7008
|
+
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"] || configRecordingStrategyAtDefault(resourceType, schemaPath, value, live) ? "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";
|
|
6998
7009
|
const freeFormKey = tier === "undeclared" && underFreeFormMap(schemaPath);
|
|
6999
7010
|
findings.push({
|
|
7000
7011
|
tier,
|
|
@@ -12718,6 +12729,59 @@ const readAcmCertificate = async ({ physicalId, declared, region }) => {
|
|
|
12718
12729
|
}
|
|
12719
12730
|
return model;
|
|
12720
12731
|
};
|
|
12732
|
+
const readConfigConfigurationRecorder = async ({ physicalId, region }) => {
|
|
12733
|
+
const name = str$1(physicalId);
|
|
12734
|
+
if (!name) return void 0;
|
|
12735
|
+
const r = (await new ConfigServiceClient({
|
|
12736
|
+
region,
|
|
12737
|
+
...READ_RETRY
|
|
12738
|
+
}).send(new DescribeConfigurationRecordersCommand({ ConfigurationRecorderNames: [name] }))).ConfigurationRecorders?.[0];
|
|
12739
|
+
if (!r) throw new ResourceGoneError(`Config ConfigurationRecorder ${name} absent`);
|
|
12740
|
+
const model = {};
|
|
12741
|
+
if (str$1(r.name)) model.Name = r.name;
|
|
12742
|
+
if (str$1(r.roleARN)) model.RoleARN = r.roleARN;
|
|
12743
|
+
if (r.recordingGroup) {
|
|
12744
|
+
const g = r.recordingGroup;
|
|
12745
|
+
const rg = {};
|
|
12746
|
+
if (typeof g.allSupported === "boolean") rg.AllSupported = g.allSupported;
|
|
12747
|
+
if (typeof g.includeGlobalResourceTypes === "boolean") rg.IncludeGlobalResourceTypes = g.includeGlobalResourceTypes;
|
|
12748
|
+
if (Array.isArray(g.resourceTypes)) rg.ResourceTypes = g.resourceTypes;
|
|
12749
|
+
const excl = g.exclusionByResourceTypes?.resourceTypes;
|
|
12750
|
+
if (Array.isArray(excl) && excl.length > 0) rg.ExclusionByResourceTypes = { ResourceTypes: excl };
|
|
12751
|
+
if (str$1(g.recordingStrategy?.useOnly)) rg.RecordingStrategy = { UseOnly: g.recordingStrategy?.useOnly };
|
|
12752
|
+
model.RecordingGroup = rg;
|
|
12753
|
+
}
|
|
12754
|
+
if (r.recordingMode) {
|
|
12755
|
+
const m = r.recordingMode;
|
|
12756
|
+
const rm = {};
|
|
12757
|
+
if (str$1(m.recordingFrequency)) rm.RecordingFrequency = m.recordingFrequency;
|
|
12758
|
+
if (Array.isArray(m.recordingModeOverrides) && m.recordingModeOverrides.length > 0) rm.RecordingModeOverrides = m.recordingModeOverrides.map((o) => ({
|
|
12759
|
+
ResourceTypes: o.resourceTypes,
|
|
12760
|
+
RecordingFrequency: o.recordingFrequency,
|
|
12761
|
+
...str$1(o.description) ? { Description: o.description } : {}
|
|
12762
|
+
}));
|
|
12763
|
+
if (Object.keys(rm).length > 0) model.RecordingMode = rm;
|
|
12764
|
+
}
|
|
12765
|
+
return model;
|
|
12766
|
+
};
|
|
12767
|
+
const readConfigDeliveryChannel = async ({ physicalId, region }) => {
|
|
12768
|
+
const name = str$1(physicalId);
|
|
12769
|
+
if (!name) return void 0;
|
|
12770
|
+
const d = (await new ConfigServiceClient({
|
|
12771
|
+
region,
|
|
12772
|
+
...READ_RETRY
|
|
12773
|
+
}).send(new DescribeDeliveryChannelsCommand({ DeliveryChannelNames: [name] }))).DeliveryChannels?.[0];
|
|
12774
|
+
if (!d) throw new ResourceGoneError(`Config DeliveryChannel ${name} absent`);
|
|
12775
|
+
const model = {};
|
|
12776
|
+
if (str$1(d.name)) model.Name = d.name;
|
|
12777
|
+
if (str$1(d.s3BucketName)) model.S3BucketName = d.s3BucketName;
|
|
12778
|
+
if (str$1(d.s3KeyPrefix)) model.S3KeyPrefix = d.s3KeyPrefix;
|
|
12779
|
+
if (str$1(d.s3KmsKeyArn)) model.S3KmsKeyArn = d.s3KmsKeyArn;
|
|
12780
|
+
if (str$1(d.snsTopicARN)) model.SnsTopicARN = d.snsTopicARN;
|
|
12781
|
+
const freq = d.configSnapshotDeliveryProperties?.deliveryFrequency;
|
|
12782
|
+
if (str$1(freq)) model.ConfigSnapshotDeliveryProperties = { DeliveryFrequency: freq };
|
|
12783
|
+
return model;
|
|
12784
|
+
};
|
|
12721
12785
|
const SDK_OVERRIDES = {
|
|
12722
12786
|
"AWS::CertificateManager::Certificate": readAcmCertificate,
|
|
12723
12787
|
"AWS::SES::ReceiptRuleSet": readSesReceiptRuleSet,
|
|
@@ -12769,7 +12833,9 @@ const SDK_OVERRIDES = {
|
|
|
12769
12833
|
"AWS::SageMaker::EndpointConfig": readSageMakerEndpointConfig,
|
|
12770
12834
|
"AWS::SageMaker::MonitoringSchedule": readSageMakerMonitoringSchedule,
|
|
12771
12835
|
"AWS::Logs::MetricFilter": readMetricFilter,
|
|
12772
|
-
"AWS::Scheduler::Schedule": readSchedulerSchedule
|
|
12836
|
+
"AWS::Scheduler::Schedule": readSchedulerSchedule,
|
|
12837
|
+
"AWS::Config::ConfigurationRecorder": readConfigConfigurationRecorder,
|
|
12838
|
+
"AWS::Config::DeliveryChannel": readConfigDeliveryChannel
|
|
12773
12839
|
};
|
|
12774
12840
|
const supplementSsmParameter = async ({ physicalId, declared, region }) => {
|
|
12775
12841
|
const name = str$1(declared.Name) ?? str$1(physicalId);
|
|
@@ -13951,7 +14017,7 @@ const CC_GET_UNSUPPORTED_ADDED_TYPES = new Set([
|
|
|
13951
14017
|
"AWS::SNS::TopicPolicy",
|
|
13952
14018
|
"AWS::KMS::Grant"
|
|
13953
14019
|
]);
|
|
13954
|
-
async function readAddedModel(cc, cfn, c, schemas, oaiCanonicalIds) {
|
|
14020
|
+
async function readAddedModel(cc, cfn, c, schemas, oaiCanonicalIds, region, accountId) {
|
|
13955
14021
|
const normalizeWith = async (raw) => {
|
|
13956
14022
|
let schema = schemas.get(c.resourceType);
|
|
13957
14023
|
if (!schema) {
|
|
@@ -13975,6 +14041,16 @@ async function readAddedModel(cc, cfn, c, schemas, oaiCanonicalIds) {
|
|
|
13975
14041
|
}));
|
|
13976
14042
|
return normalizeWith(JSON.parse(g.ResourceDescription?.Properties ?? "{}"));
|
|
13977
14043
|
} catch {
|
|
14044
|
+
const override = SDK_OVERRIDES[c.resourceType];
|
|
14045
|
+
if (override && region !== void 0 && accountId !== void 0) try {
|
|
14046
|
+
const raw = await override({
|
|
14047
|
+
physicalId: c.identifier,
|
|
14048
|
+
declared: c.live,
|
|
14049
|
+
region,
|
|
14050
|
+
accountId
|
|
14051
|
+
});
|
|
14052
|
+
if (raw !== void 0) return normalizeWith(raw);
|
|
14053
|
+
} catch {}
|
|
13978
14054
|
return {
|
|
13979
14055
|
model: c.live,
|
|
13980
14056
|
ok: false
|
|
@@ -14582,7 +14658,7 @@ async function gatherFindings(stackName, region, templateOverride, recoveryTempl
|
|
|
14582
14658
|
});
|
|
14583
14659
|
continue;
|
|
14584
14660
|
}
|
|
14585
|
-
const read = await readAddedModel(cc, cfn, c, schemas, oaiCanonicalIds);
|
|
14661
|
+
const read = await readAddedModel(cc, cfn, c, schemas, oaiCanonicalIds, region, desired.accountId);
|
|
14586
14662
|
findings.push(addedFinding(r, c, read));
|
|
14587
14663
|
}
|
|
14588
14664
|
} catch (e) {
|