cdk-real-drift 0.2.11 → 0.2.13
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 +95 -4
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -596,6 +596,11 @@ covers them. **If you never run `revert`, cdkrd needs no write permissions at al
|
|
|
596
596
|
`AWS::ElastiCache::User` / `AWS::MemoryDB::User` with its writeOnly
|
|
597
597
|
`AccessString` — the Redis/Valkey ACL; an out-of-band permission grant is
|
|
598
598
|
otherwise invisible to the Cloud Control read),
|
|
599
|
+
`memorydb:DescribeParameters` + `memorydb:DescribeParameterGroups` (supplement an
|
|
600
|
+
`AWS::MemoryDB::ParameterGroup` with its writeOnly `Parameters` — folding the
|
|
601
|
+
family-default fill by diffing the managed `default.<family>` group; the MemoryDB
|
|
602
|
+
provider does not apply declared parameters on CREATE, so this surfaces the
|
|
603
|
+
never-applied tuning that was otherwise an invisible readGap),
|
|
599
604
|
`redshift-serverless:GetWorkgroup` (supplements an
|
|
600
605
|
`AWS::RedshiftServerless::Workgroup` with its writeOnly `ConfigParameters` /
|
|
601
606
|
`SecurityGroupIds` / `SubnetIds`, which the Cloud Control read returns only
|
|
@@ -643,6 +648,10 @@ is refused, never overwritten, so the un-read credential is never cleared),
|
|
|
643
648
|
`AWS::ElastiCache::ParameterGroup` — a changed declared parameter is modified back
|
|
644
649
|
to its desired value; an out-of-band-added undeclared parameter is reset to the
|
|
645
650
|
family default),
|
|
651
|
+
`memorydb:UpdateParameterGroup` / `ResetParameterGroup` (revert an
|
|
652
|
+
`AWS::MemoryDB::ParameterGroup` — a declared parameter is applied to its desired
|
|
653
|
+
value, which also materializes tuning the provider never applied on CREATE; an
|
|
654
|
+
out-of-band-added undeclared parameter is reset to the family default),
|
|
646
655
|
`ses:UpdateReceiptRule` (reverts an `AWS::SES::ReceiptRule` — the whole rule is
|
|
647
656
|
re-supplied in place, since Cloud Control has no handler for the type),
|
|
648
657
|
`cloudwatch:PutAnomalyDetector` (reverts an `AWS::CloudWatch::AnomalyDetector`
|
package/dist/cli.js
CHANGED
|
@@ -32,7 +32,7 @@ import { ChangeResourceRecordSetsCommand, ListResourceRecordSetsCommand, Route53
|
|
|
32
32
|
import { AttachGroupPolicyCommand, AttachRolePolicyCommand, AttachUserPolicyCommand, CreatePolicyVersionCommand, DeletePolicyVersionCommand, DeleteRolePolicyCommand, DetachGroupPolicyCommand, DetachRolePolicyCommand, DetachUserPolicyCommand, GetGroupPolicyCommand, GetPolicyCommand as GetPolicyCommand$1, GetPolicyVersionCommand, GetRolePolicyCommand, GetUserPolicyCommand, IAMClient, ListEntitiesForPolicyCommand, ListPolicyVersionsCommand, PutGroupPolicyCommand, PutRolePolicyCommand, PutUserPolicyCommand } from "@aws-sdk/client-iam";
|
|
33
33
|
import { DeleteBucketPolicyCommand, GetBucketPolicyCommand, PutBucketPolicyCommand, S3Client } from "@aws-sdk/client-s3";
|
|
34
34
|
import { DescribeCacheClustersCommand, DescribeCacheParameterGroupsCommand, DescribeCacheParametersCommand, DescribeReplicationGroupsCommand, DescribeUsersCommand, ElastiCacheClient, ModifyCacheParameterGroupCommand, ResetCacheParameterGroupCommand } from "@aws-sdk/client-elasticache";
|
|
35
|
-
import { DescribeUsersCommand as DescribeUsersCommand$1, MemoryDBClient } from "@aws-sdk/client-memorydb";
|
|
35
|
+
import { DescribeParameterGroupsCommand as DescribeParameterGroupsCommand$1, DescribeParametersCommand as DescribeParametersCommand$1, DescribeUsersCommand as DescribeUsersCommand$1, MemoryDBClient, ResetParameterGroupCommand, UpdateParameterGroupCommand as UpdateParameterGroupCommand$1 } from "@aws-sdk/client-memorydb";
|
|
36
36
|
import { CloudWatchClient, DescribeAnomalyDetectorsCommand, PutAnomalyDetectorCommand } from "@aws-sdk/client-cloudwatch";
|
|
37
37
|
import { DLMClient, GetLifecyclePolicyCommand, UpdateLifecyclePolicyCommand } from "@aws-sdk/client-dlm";
|
|
38
38
|
import { DatabaseMigrationServiceClient, DescribeEndpointsCommand, DescribeReplicationSubnetGroupsCommand } from "@aws-sdk/client-database-migration-service";
|
|
@@ -42,7 +42,7 @@ import { GetWorkgroupCommand, RedshiftServerlessClient } from "@aws-sdk/client-r
|
|
|
42
42
|
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";
|
|
43
43
|
import { GetScheduleCommand, SchedulerClient } from "@aws-sdk/client-scheduler";
|
|
44
44
|
import { DescribeReceiptRuleCommand, DescribeReceiptRuleSetCommand, ListReceiptFiltersCommand, SESClient, UpdateReceiptRuleCommand } from "@aws-sdk/client-ses";
|
|
45
|
-
import { DescribeParametersCommand as DescribeParametersCommand$
|
|
45
|
+
import { DescribeParametersCommand as DescribeParametersCommand$2, SSMClient } from "@aws-sdk/client-ssm";
|
|
46
46
|
import { GetNamespaceCommand, GetServiceCommand, ServiceDiscoveryClient, UpdateHttpNamespaceCommand } from "@aws-sdk/client-servicediscovery";
|
|
47
47
|
import { GetQueueAttributesCommand, SQSClient, SetQueueAttributesCommand } from "@aws-sdk/client-sqs";
|
|
48
48
|
import { createHash } from "node:crypto";
|
|
@@ -3513,6 +3513,10 @@ const ELB_ATTRIBUTE_BAGS = {
|
|
|
3513
3513
|
"AWS::ElasticLoadBalancingV2::TargetGroup": "TargetGroupAttributes",
|
|
3514
3514
|
"AWS::ElasticLoadBalancingV2::Listener": "ListenerAttributes"
|
|
3515
3515
|
};
|
|
3516
|
+
const MEANINGFUL_WHEN_OFF = {
|
|
3517
|
+
"AWS::KMS::Key": { Enabled: () => true },
|
|
3518
|
+
"AWS::SQS::Queue": { SqsManagedSseEnabled: ({ declared, live }) => declared["KmsMasterKeyId"] === void 0 && live["KmsMasterKeyId"] === void 0 }
|
|
3519
|
+
};
|
|
3516
3520
|
const stripCognitoAttrPrefix = (id) => id.replace(/^(custom|dev):/, "");
|
|
3517
3521
|
const IDENTITY_KEYED_SUBSET_ARRAYS = {
|
|
3518
3522
|
"AWS::Cognito::UserPool": { Schema: {
|
|
@@ -4272,7 +4276,10 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
4272
4276
|
}
|
|
4273
4277
|
if (isAllAwsTags(v)) continue;
|
|
4274
4278
|
if (physicalId !== void 0 && v === physicalId) continue;
|
|
4275
|
-
if (
|
|
4279
|
+
if (!(k in knownDef && !matchesKnownDefault(v, knownDef[k]) && (MEANINGFUL_WHEN_OFF[resourceType]?.[k]?.({
|
|
4280
|
+
declared,
|
|
4281
|
+
live
|
|
4282
|
+
}) ?? false)) && (isTrivialEmpty(v) || isSelfEchoTrivialEmpty(v, physicalId) || isEmptyPolicyShell(v))) continue;
|
|
4276
4283
|
if (isNestedObject(v) && DESCEND_UNDECLARED_OBJECT_PATHS[resourceType]?.has(k)) {
|
|
4277
4284
|
collectNestedUndeclared({}, v, k, emitNested, NESTED_ARRAY_IDENTITY[resourceType]);
|
|
4278
4285
|
continue;
|
|
@@ -7209,7 +7216,7 @@ const supplementSsmParameter = async ({ physicalId, declared, region }) => {
|
|
|
7209
7216
|
const p = (await new SSMClient({
|
|
7210
7217
|
region,
|
|
7211
7218
|
...READ_RETRY
|
|
7212
|
-
}).send(new DescribeParametersCommand$
|
|
7219
|
+
}).send(new DescribeParametersCommand$2({ ParameterFilters: [{
|
|
7213
7220
|
Key: "Name",
|
|
7214
7221
|
Option: "Equals",
|
|
7215
7222
|
Values: [name]
|
|
@@ -7306,6 +7313,56 @@ const supplementMemoryDbUser = async ({ physicalId, declared, region }) => {
|
|
|
7306
7313
|
}).send(new DescribeUsersCommand$1({ UserName: userName }))).Users?.[0]?.AccessString);
|
|
7307
7314
|
return access !== void 0 ? { AccessString: access } : void 0;
|
|
7308
7315
|
};
|
|
7316
|
+
const readMemoryDbParamMap = async (c, groupName) => {
|
|
7317
|
+
const out = {};
|
|
7318
|
+
let token;
|
|
7319
|
+
do {
|
|
7320
|
+
const r = await c.send(new DescribeParametersCommand$1({
|
|
7321
|
+
ParameterGroupName: groupName,
|
|
7322
|
+
NextToken: token
|
|
7323
|
+
}));
|
|
7324
|
+
for (const p of r.Parameters ?? []) {
|
|
7325
|
+
const n = str$1(p.Name);
|
|
7326
|
+
const v = str$1(p.Value);
|
|
7327
|
+
if (n !== void 0 && v !== void 0) out[n] = v;
|
|
7328
|
+
}
|
|
7329
|
+
token = str$1(r.NextToken);
|
|
7330
|
+
} while (token !== void 0);
|
|
7331
|
+
return out;
|
|
7332
|
+
};
|
|
7333
|
+
const readMemoryDbFamilyDefaults = async (c, family) => {
|
|
7334
|
+
let token;
|
|
7335
|
+
do {
|
|
7336
|
+
const r = await c.send(new DescribeParameterGroupsCommand$1({ NextToken: token }));
|
|
7337
|
+
for (const g of r.ParameterGroups ?? []) {
|
|
7338
|
+
const name = str$1(g.Name);
|
|
7339
|
+
if (name?.startsWith("default.") && str$1(g.Family) === family) return readMemoryDbParamMap(c, name);
|
|
7340
|
+
}
|
|
7341
|
+
token = str$1(r.NextToken);
|
|
7342
|
+
} while (token !== void 0);
|
|
7343
|
+
return {};
|
|
7344
|
+
};
|
|
7345
|
+
const supplementMemoryDbParameterGroup = async ({ physicalId, declared, region }) => {
|
|
7346
|
+
const name = str$1(declared.ParameterGroupName) ?? str$1(physicalId);
|
|
7347
|
+
if (!name) return void 0;
|
|
7348
|
+
const c = new MemoryDBClient({
|
|
7349
|
+
region,
|
|
7350
|
+
...READ_RETRY
|
|
7351
|
+
});
|
|
7352
|
+
const live = await readMemoryDbParamMap(c, name);
|
|
7353
|
+
if (Object.keys(live).length === 0) return void 0;
|
|
7354
|
+
const family = str$1(declared.Family);
|
|
7355
|
+
const defaults = family ? await readMemoryDbFamilyDefaults(c, family) : {};
|
|
7356
|
+
const haveDefaults = Object.keys(defaults).length > 0;
|
|
7357
|
+
const declaredParams = typeof declared.Parameters === "object" && declared.Parameters !== null ? declared.Parameters : {};
|
|
7358
|
+
const projected = {};
|
|
7359
|
+
for (const [k, v] of Object.entries(live)) {
|
|
7360
|
+
const isDeclared = Object.prototype.hasOwnProperty.call(declaredParams, k);
|
|
7361
|
+
const isModified = haveDefaults && v !== defaults[k];
|
|
7362
|
+
if (isDeclared || isModified) projected[k] = v;
|
|
7363
|
+
}
|
|
7364
|
+
return Object.keys(projected).length > 0 ? { Parameters: projected } : void 0;
|
|
7365
|
+
};
|
|
7309
7366
|
const supplementRedshiftServerlessWorkgroup = async ({ physicalId, declared, region }) => {
|
|
7310
7367
|
const workgroupName = str$1(declared.WorkgroupName) ?? str$1(physicalId);
|
|
7311
7368
|
if (!workgroupName) return void 0;
|
|
@@ -7552,6 +7609,7 @@ const SDK_SUPPLEMENTS = {
|
|
|
7552
7609
|
"AWS::ECS::Service": supplementEcsService,
|
|
7553
7610
|
"AWS::ElastiCache::User": supplementElastiCacheUser,
|
|
7554
7611
|
"AWS::MemoryDB::User": supplementMemoryDbUser,
|
|
7612
|
+
"AWS::MemoryDB::ParameterGroup": supplementMemoryDbParameterGroup,
|
|
7555
7613
|
"AWS::RedshiftServerless::Workgroup": supplementRedshiftServerlessWorkgroup
|
|
7556
7614
|
};
|
|
7557
7615
|
|
|
@@ -7731,6 +7789,7 @@ const OVERRIDE_READABLE_WRITEONLY = {
|
|
|
7731
7789
|
"AWS::ECS::Service": ["ServiceConnectConfiguration", "VolumeConfigurations"],
|
|
7732
7790
|
"AWS::ElastiCache::User": ["AccessString"],
|
|
7733
7791
|
"AWS::MemoryDB::User": ["AccessString"],
|
|
7792
|
+
"AWS::MemoryDB::ParameterGroup": ["Parameters"],
|
|
7734
7793
|
"AWS::RedshiftServerless::Workgroup": [
|
|
7735
7794
|
"ConfigParameters",
|
|
7736
7795
|
"SecurityGroupIds",
|
|
@@ -9633,6 +9692,37 @@ const writeElastiCacheParameterGroup = async (ctx, ops) => {
|
|
|
9633
9692
|
ParameterNameValues: reset
|
|
9634
9693
|
}));
|
|
9635
9694
|
};
|
|
9695
|
+
const writeMemoryDbParameterGroup = async (ctx, ops) => {
|
|
9696
|
+
const name = str(ctx.physicalId) ?? str(ctx.declared["ParameterGroupName"]);
|
|
9697
|
+
if (!name) throw new Error("cannot resolve MemoryDB parameter-group name for revert");
|
|
9698
|
+
const desiredValues = (await desiredModel("AWS::MemoryDB::ParameterGroup", ctx, ops)).Parameters ?? {};
|
|
9699
|
+
const modifyKeys = /* @__PURE__ */ new Set();
|
|
9700
|
+
const resetKeys = /* @__PURE__ */ new Set();
|
|
9701
|
+
for (const op of ops) {
|
|
9702
|
+
const segs = op.path.replace(/^\//, "").split("/");
|
|
9703
|
+
if (segs[0] !== "Parameters") continue;
|
|
9704
|
+
const key = segs[1]?.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
9705
|
+
if (op.op === "remove") {
|
|
9706
|
+
if (key !== void 0) resetKeys.add(key);
|
|
9707
|
+
} else if (key !== void 0) modifyKeys.add(key);
|
|
9708
|
+
else for (const k of Object.keys(desiredValues)) modifyKeys.add(k);
|
|
9709
|
+
}
|
|
9710
|
+
const c = new MemoryDBClient({ region: ctx.region });
|
|
9711
|
+
const modify = [...modifyKeys].filter((k) => typeof desiredValues[k] === "string").map((k) => ({
|
|
9712
|
+
ParameterName: k,
|
|
9713
|
+
ParameterValue: desiredValues[k]
|
|
9714
|
+
}));
|
|
9715
|
+
if (modify.length > 0) await c.send(new UpdateParameterGroupCommand$1({
|
|
9716
|
+
ParameterGroupName: name,
|
|
9717
|
+
ParameterNameValues: modify
|
|
9718
|
+
}));
|
|
9719
|
+
const reset = [...resetKeys];
|
|
9720
|
+
if (reset.length > 0) await c.send(new ResetParameterGroupCommand({
|
|
9721
|
+
ParameterGroupName: name,
|
|
9722
|
+
AllParameters: false,
|
|
9723
|
+
ParameterNames: reset
|
|
9724
|
+
}));
|
|
9725
|
+
};
|
|
9636
9726
|
const CLIENT_VPN_SCALAR_PARAMS = new Set([
|
|
9637
9727
|
"Description",
|
|
9638
9728
|
"SplitTunnel",
|
|
@@ -10008,6 +10098,7 @@ const SDK_WRITERS = {
|
|
|
10008
10098
|
"AWS::DAX::Cluster": writeDaxCluster,
|
|
10009
10099
|
"AWS::DAX::ParameterGroup": writeDaxParameterGroup,
|
|
10010
10100
|
"AWS::ElastiCache::ParameterGroup": writeElastiCacheParameterGroup,
|
|
10101
|
+
"AWS::MemoryDB::ParameterGroup": writeMemoryDbParameterGroup,
|
|
10011
10102
|
"AWS::EC2::ClientVpnEndpoint": writeEc2ClientVpnEndpoint,
|
|
10012
10103
|
"AWS::OpenSearchService::Domain": writeOpenSearchDomain,
|
|
10013
10104
|
"AWS::CloudFront::Distribution": writeCloudFrontDistribution,
|