cdk-real-drift 0.10.3 → 0.11.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 +254 -11
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -892,7 +892,8 @@ covers them. **If you never run `revert`, cdkrd needs no write permissions at al
|
|
|
892
892
|
`lambda:ListVersionsByFunction`
|
|
893
893
|
- `AWS::Events::EventBus`: `events:ListRules`
|
|
894
894
|
- `AWS::Cognito::UserPool`: `cognito-idp:ListUserPoolClients`,
|
|
895
|
-
`cognito-idp:ListGroups`, `cognito-idp:ListResourceServers
|
|
895
|
+
`cognito-idp:ListGroups`, `cognito-idp:ListResourceServers`,
|
|
896
|
+
`cognito-idp:ListIdentityProviders`
|
|
896
897
|
- `AWS::AppSync::GraphQLApi`: `appsync:ListDataSources`, `appsync:ListResolvers`,
|
|
897
898
|
`appsync:ListFunctions`, `appsync:ListTypes`
|
|
898
899
|
- `AWS::Logs::LogGroup`: `logs:DescribeSubscriptionFilters` (plus
|
package/dist/cli.js
CHANGED
|
@@ -9,6 +9,7 @@ import { homedir } from "node:os";
|
|
|
9
9
|
import { BaseCredentials, CdkAppMultiContext, NonInteractiveIoHost, StackSelectionStrategy, Toolkit } from "@aws-cdk/toolkit-lib";
|
|
10
10
|
import { CloudFormationClient, DescribeStackResourcesCommand, DescribeStacksCommand, DescribeTypeCommand, GetTemplateCommand, ListExportsCommand, ListStackResourcesCommand } from "@aws-sdk/client-cloudformation";
|
|
11
11
|
import { DescribeDBClustersCommand, DescribeDBInstancesCommand, DescribeOptionGroupOptionsCommand, RDSClient } from "@aws-sdk/client-rds";
|
|
12
|
+
import { DescribeParametersCommand, GetParametersCommand, SSMClient } from "@aws-sdk/client-ssm";
|
|
12
13
|
import jsonata from "jsonata";
|
|
13
14
|
import { KMSClient, ListAliasesCommand } from "@aws-sdk/client-kms";
|
|
14
15
|
import { createCredentialChain, fromEnv, fromNodeProviderChain } from "@aws-sdk/credential-providers";
|
|
@@ -17,7 +18,7 @@ import { AppConfigClient, ListConfigurationProfilesCommand, ListEnvironmentsComm
|
|
|
17
18
|
import { AppSyncClient, ListApiKeysCommand, ListDataSourcesCommand, ListFunctionsCommand, ListResolversCommand, ListTypesCommand } from "@aws-sdk/client-appsync";
|
|
18
19
|
import { ApiGatewayV2Client, DeleteAccessLogSettingsCommand, DeleteRouteSettingsCommand, GetAuthorizersCommand as GetAuthorizersCommand$1, GetIntegrationsCommand, GetRoutesCommand, GetStagesCommand as GetStagesCommand$1, UpdateStageCommand } from "@aws-sdk/client-apigatewayv2";
|
|
19
20
|
import { CloudWatchLogsClient, DescribeMetricFiltersCommand, DescribeSubscriptionFiltersCommand, PutBearerTokenAuthenticationCommand, PutMetricFilterCommand } from "@aws-sdk/client-cloudwatch-logs";
|
|
20
|
-
import { CognitoIdentityProviderClient, ListGroupsCommand, ListResourceServersCommand, ListUserPoolClientsCommand } from "@aws-sdk/client-cognito-identity-provider";
|
|
21
|
+
import { CognitoIdentityProviderClient, ListGroupsCommand, ListIdentityProvidersCommand, ListResourceServersCommand, ListUserPoolClientsCommand } from "@aws-sdk/client-cognito-identity-provider";
|
|
21
22
|
import { DescribeAddressesCommand, DescribeClientVpnAuthorizationRulesCommand, DescribeClientVpnEndpointsCommand, DescribeClientVpnTargetNetworksCommand, DescribeLaunchTemplateVersionsCommand, DescribeNetworkAclsCommand, DescribeRouteTablesCommand, DescribeSubnetsCommand, DescribeVpcEndpointsCommand, EC2Client, ModifyClientVpnEndpointCommand } from "@aws-sdk/client-ec2";
|
|
22
23
|
import { DescribeServicesCommand, ECSClient, ListServicesCommand, UpdateServiceCommand } from "@aws-sdk/client-ecs";
|
|
23
24
|
import { DescribeMountTargetsCommand, EFSClient } from "@aws-sdk/client-efs";
|
|
@@ -32,22 +33,21 @@ import { DescribeConfigurationSettingsCommand, ElasticBeanstalkClient, UpdateApp
|
|
|
32
33
|
import { CognitoSyncClient, GetCognitoEventsCommand, SetCognitoEventsCommand } from "@aws-sdk/client-cognito-sync";
|
|
33
34
|
import { BatchGetProjectsCommand, BatchGetReportGroupsCommand, CodeBuildClient, UpdateReportGroupCommand } from "@aws-sdk/client-codebuild";
|
|
34
35
|
import { DescribeDBClustersCommand as DescribeDBClustersCommand$1, DescribeDBInstancesCommand as DescribeDBInstancesCommand$1, DocDBClient, ModifyDBClusterCommand, ModifyDBInstanceCommand } from "@aws-sdk/client-docdb";
|
|
35
|
-
import { DAXClient, DescribeClustersCommand, DescribeParameterGroupsCommand, DescribeParametersCommand, DescribeSubnetGroupsCommand, UpdateClusterCommand, UpdateParameterGroupCommand } from "@aws-sdk/client-dax";
|
|
36
|
+
import { DAXClient, DescribeClustersCommand, DescribeParameterGroupsCommand, DescribeParametersCommand as DescribeParametersCommand$1, DescribeSubnetGroupsCommand, UpdateClusterCommand, UpdateParameterGroupCommand } from "@aws-sdk/client-dax";
|
|
36
37
|
import { GetClassifierCommand, GetConnectionCommand, GetJobCommand, GetSecurityConfigurationCommand, GetTableCommand, GetWorkflowCommand, GlueClient, UpdateClassifierCommand, UpdateConnectionCommand, UpdateJobCommand, UpdateTableCommand, UpdateWorkflowCommand } from "@aws-sdk/client-glue";
|
|
37
38
|
import { AttachGroupPolicyCommand, AttachRolePolicyCommand, AttachUserPolicyCommand, CreatePolicyVersionCommand, DeletePolicyVersionCommand, DeleteRolePolicyCommand, DetachGroupPolicyCommand, DetachRolePolicyCommand, DetachUserPolicyCommand, GetGroupPolicyCommand, GetPolicyCommand as GetPolicyCommand$1, GetPolicyVersionCommand, GetRolePolicyCommand, GetUserPolicyCommand, IAMClient, ListAccessKeysCommand, ListEntitiesForPolicyCommand, ListPolicyVersionsCommand, PutGroupPolicyCommand, PutRolePolicyCommand, PutUserPolicyCommand } from "@aws-sdk/client-iam";
|
|
38
39
|
import { DeleteBucketPolicyCommand, GetBucketPolicyCommand, PutBucketPolicyCommand, S3Client } from "@aws-sdk/client-s3";
|
|
39
40
|
import { DescribeCacheClustersCommand, DescribeCacheParameterGroupsCommand, DescribeCacheParametersCommand, DescribeReplicationGroupsCommand, DescribeUsersCommand, ElastiCacheClient, ModifyCacheParameterGroupCommand, ResetCacheParameterGroupCommand } from "@aws-sdk/client-elasticache";
|
|
40
|
-
import { DescribeParameterGroupsCommand as DescribeParameterGroupsCommand$1, DescribeParametersCommand as DescribeParametersCommand$
|
|
41
|
+
import { DescribeParameterGroupsCommand as DescribeParameterGroupsCommand$1, DescribeParametersCommand as DescribeParametersCommand$2, DescribeUsersCommand as DescribeUsersCommand$1, MemoryDBClient, ResetParameterGroupCommand, UpdateParameterGroupCommand as UpdateParameterGroupCommand$1 } from "@aws-sdk/client-memorydb";
|
|
41
42
|
import { CloudWatchClient, DescribeAnomalyDetectorsCommand, PutAnomalyDetectorCommand } from "@aws-sdk/client-cloudwatch";
|
|
42
43
|
import { DLMClient, GetLifecyclePolicyCommand, UpdateLifecyclePolicyCommand } from "@aws-sdk/client-dlm";
|
|
43
|
-
import { DatabaseMigrationServiceClient, DescribeEndpointsCommand, DescribeReplicationSubnetGroupsCommand } from "@aws-sdk/client-database-migration-service";
|
|
44
|
+
import { DatabaseMigrationServiceClient, DescribeEndpointsCommand, DescribeReplicationInstancesCommand, DescribeReplicationSubnetGroupsCommand, DescribeReplicationTasksCommand } from "@aws-sdk/client-database-migration-service";
|
|
44
45
|
import { GetJobTemplateCommand, GetQueueCommand, MediaConvertClient } from "@aws-sdk/client-mediaconvert";
|
|
45
46
|
import { DescribeConfigurationCommand, DescribeConfigurationRevisionCommand, KafkaClient, UpdateConfigurationCommand } from "@aws-sdk/client-kafka";
|
|
46
47
|
import { GetWorkgroupCommand, RedshiftServerlessClient } from "@aws-sdk/client-redshift-serverless";
|
|
47
48
|
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";
|
|
48
49
|
import { GetScheduleCommand, SchedulerClient } from "@aws-sdk/client-scheduler";
|
|
49
50
|
import { DescribeReceiptRuleCommand, DescribeReceiptRuleSetCommand, ListReceiptFiltersCommand, SESClient, UpdateReceiptRuleCommand } from "@aws-sdk/client-ses";
|
|
50
|
-
import { DescribeParametersCommand as DescribeParametersCommand$2, SSMClient } from "@aws-sdk/client-ssm";
|
|
51
51
|
import { DescribeEndpointConfigCommand, SageMakerClient } from "@aws-sdk/client-sagemaker";
|
|
52
52
|
import { GetNamespaceCommand, GetServiceCommand, ServiceDiscoveryClient, UpdateHttpNamespaceCommand } from "@aws-sdk/client-servicediscovery";
|
|
53
53
|
import { GetQueueAttributesCommand, SQSClient, SetQueueAttributesCommand } from "@aws-sdk/client-sqs";
|
|
@@ -1455,6 +1455,11 @@ function resolveGetAtt(v, ctx) {
|
|
|
1455
1455
|
const logicalId = String(v[0]);
|
|
1456
1456
|
const attr = String(v[1]);
|
|
1457
1457
|
const type = ctx.typeOf?.[logicalId];
|
|
1458
|
+
if (attr.startsWith("/cdk/exports/") && (type === void 0 || type === "Custom::CrossRegionExportReader")) {
|
|
1459
|
+
const val = ctx.crossRegionExports?.[attr];
|
|
1460
|
+
if (typeof val === "string") return val;
|
|
1461
|
+
return UNRESOLVED;
|
|
1462
|
+
}
|
|
1458
1463
|
const declaredKey = type ? GETATT_DECLARED_PROPERTY[type]?.[attr] : void 0;
|
|
1459
1464
|
if (declaredKey !== void 0) {
|
|
1460
1465
|
const rawProps = ctx.declaredRawProps?.[logicalId];
|
|
@@ -3133,6 +3138,11 @@ const VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS = {
|
|
|
3133
3138
|
"ConfigParameters",
|
|
3134
3139
|
"SecurityGroupIds",
|
|
3135
3140
|
"SubnetIds"
|
|
3141
|
+
]),
|
|
3142
|
+
"AWS::CloudFormation::Stack": new Set([
|
|
3143
|
+
"TemplateBody",
|
|
3144
|
+
"RoleARN",
|
|
3145
|
+
"Capabilities"
|
|
3136
3146
|
])
|
|
3137
3147
|
};
|
|
3138
3148
|
function isPhysicalIdSegment(value, physicalId) {
|
|
@@ -4309,6 +4319,63 @@ async function listExports(client, accountId, region) {
|
|
|
4309
4319
|
exportsCache.set(cacheKey, exports);
|
|
4310
4320
|
return exports;
|
|
4311
4321
|
}
|
|
4322
|
+
const crossRegionExportsCache = /* @__PURE__ */ new Map();
|
|
4323
|
+
const CROSS_REGION_EXPORT_READER_TYPE = "Custom::CrossRegionExportReader";
|
|
4324
|
+
/**
|
|
4325
|
+
* Scan the parsed template for `Fn::GetAtt` references whose logicalId is a
|
|
4326
|
+
* `Custom::CrossRegionExportReader` resource and whose attribute is an SSM parameter name
|
|
4327
|
+
* (`/cdk/exports/<name>`). Returns the DISTINCT parameter names to prefetch. Pure + exported
|
|
4328
|
+
* for unit tests. Both GetAtt forms are handled: the array form `[LogicalId, AttrName]` and
|
|
4329
|
+
* the long-form string `"LogicalId./cdk/exports/name"` (split on the FIRST dot — the attribute
|
|
4330
|
+
* itself may contain dots).
|
|
4331
|
+
*/
|
|
4332
|
+
function collectCrossRegionExportNames(template) {
|
|
4333
|
+
const resources = template.Resources ?? {};
|
|
4334
|
+
const readerIds = new Set(Object.entries(resources).filter(([, r]) => r?.Type === CROSS_REGION_EXPORT_READER_TYPE).map(([lid]) => lid));
|
|
4335
|
+
if (readerIds.size === 0) return [];
|
|
4336
|
+
const names = /* @__PURE__ */ new Set();
|
|
4337
|
+
const walk = (node) => {
|
|
4338
|
+
if (Array.isArray(node)) {
|
|
4339
|
+
for (const x of node) walk(x);
|
|
4340
|
+
return;
|
|
4341
|
+
}
|
|
4342
|
+
if (node && typeof node === "object") {
|
|
4343
|
+
const obj = node;
|
|
4344
|
+
const g = obj["Fn::GetAtt"];
|
|
4345
|
+
if (g !== void 0) {
|
|
4346
|
+
let logicalId;
|
|
4347
|
+
let attr;
|
|
4348
|
+
if (typeof g === "string") {
|
|
4349
|
+
const dot = g.indexOf(".");
|
|
4350
|
+
if (dot >= 0) {
|
|
4351
|
+
logicalId = g.slice(0, dot);
|
|
4352
|
+
attr = g.slice(dot + 1);
|
|
4353
|
+
}
|
|
4354
|
+
} else if (Array.isArray(g) && g.length >= 2) {
|
|
4355
|
+
logicalId = String(g[0]);
|
|
4356
|
+
attr = String(g[1]);
|
|
4357
|
+
}
|
|
4358
|
+
if (logicalId !== void 0 && readerIds.has(logicalId) && attr !== void 0 && attr.startsWith("/cdk/exports/")) names.add(attr);
|
|
4359
|
+
}
|
|
4360
|
+
for (const v of Object.values(obj)) walk(v);
|
|
4361
|
+
}
|
|
4362
|
+
};
|
|
4363
|
+
walk(template.Resources ?? {});
|
|
4364
|
+
return [...names].sort();
|
|
4365
|
+
}
|
|
4366
|
+
async function getCrossRegionExports(ssm, accountId, region, names) {
|
|
4367
|
+
const cacheKey = `${accountId}:${region}`;
|
|
4368
|
+
const cached = crossRegionExportsCache.get(cacheKey);
|
|
4369
|
+
if (cached) return cached;
|
|
4370
|
+
const out = {};
|
|
4371
|
+
for (let i = 0; i < names.length; i += 10) {
|
|
4372
|
+
const batch = names.slice(i, i + 10);
|
|
4373
|
+
const res = await ssm.send(new GetParametersCommand({ Names: batch }));
|
|
4374
|
+
for (const p of res.Parameters ?? []) if (p.Name && typeof p.Value === "string") out[p.Name] = p.Value;
|
|
4375
|
+
}
|
|
4376
|
+
crossRegionExportsCache.set(cacheKey, out);
|
|
4377
|
+
return out;
|
|
4378
|
+
}
|
|
4312
4379
|
async function listStackResources(client, stackName) {
|
|
4313
4380
|
const physIds = {};
|
|
4314
4381
|
const typeOf = {};
|
|
@@ -4372,6 +4439,17 @@ async function loadDesired(client, stackName, region, templateOverride, recovery
|
|
|
4372
4439
|
const msg = err instanceof Error ? err.message : String(err);
|
|
4373
4440
|
console.error(`warning: ${stackName}: cloudformation:ListExports failed — Fn::ImportValue references will resolve UNRESOLVED (their declared properties are skipped, not compared). Grant cloudformation:ListExports for full coverage. (${msg})`);
|
|
4374
4441
|
}
|
|
4442
|
+
const crossRegionExportNames = collectCrossRegionExportNames(template);
|
|
4443
|
+
if (crossRegionExportNames.length > 0) try {
|
|
4444
|
+
const credentials = client.config?.credentials;
|
|
4445
|
+
ctx.crossRegionExports = await getCrossRegionExports(new SSMClient(credentials ? {
|
|
4446
|
+
region,
|
|
4447
|
+
credentials
|
|
4448
|
+
} : { region }), accountId, region, crossRegionExportNames);
|
|
4449
|
+
} catch (err) {
|
|
4450
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
4451
|
+
console.error(`warning: ${stackName}: ssm:GetParameters failed — crossRegionReferences reader GetAtt references (/cdk/exports/*) will resolve UNRESOLVED (their declared properties are skipped, not compared). Grant ssm:GetParameters for full coverage. (${msg})`);
|
|
4452
|
+
}
|
|
4375
4453
|
const resources = [];
|
|
4376
4454
|
const principalsWithSiblingPolicy = collectPrincipalsWithSiblingPolicies(template.Resources ?? {}, ctx);
|
|
4377
4455
|
const clustersWithSiblingCapacityProviders = collectClustersWithSiblingCapacityProviders(template.Resources ?? {});
|
|
@@ -5135,6 +5213,16 @@ function subtractSiblingUserGroups(live, siblingGroups) {
|
|
|
5135
5213
|
}
|
|
5136
5214
|
if (arr.length === 0) delete live[USER_GROUPS_PROP];
|
|
5137
5215
|
}
|
|
5216
|
+
const LIFECYCLE_HOOK_SPEC_PROP = "LifecycleHookSpecificationList";
|
|
5217
|
+
function subtractSiblingLifecycleHooks(live, siblingHookNames) {
|
|
5218
|
+
const arr = live[LIFECYCLE_HOOK_SPEC_PROP];
|
|
5219
|
+
if (!Array.isArray(arr) || siblingHookNames.length === 0) return;
|
|
5220
|
+
for (const name of siblingHookNames) {
|
|
5221
|
+
const i = arr.findIndex((el) => el !== null && typeof el === "object" && el.LifecycleHookName === name);
|
|
5222
|
+
if (i >= 0) arr.splice(i, 1);
|
|
5223
|
+
}
|
|
5224
|
+
if (arr.length === 0) delete live[LIFECYCLE_HOOK_SPEC_PROP];
|
|
5225
|
+
}
|
|
5138
5226
|
const CC_ALT_REPRESENTATION = {
|
|
5139
5227
|
"AWS::EC2::Subnet": {
|
|
5140
5228
|
AvailabilityZoneId: "AvailabilityZone",
|
|
@@ -5322,6 +5410,7 @@ function cloneDeepWithSymbols(v) {
|
|
|
5322
5410
|
}
|
|
5323
5411
|
const isPolicyStatementArray = (arr) => arr.length > 0 && arr.every((el) => isNestedObject(el) && "Effect" in el);
|
|
5324
5412
|
const isInlinePolicyArray = (arr) => arr.length > 0 && arr.every((el) => isNestedObject(el) && "PolicyDocument" in el);
|
|
5413
|
+
const isKeyValueTagList = (arr) => arr.length > 0 && identityField(arr) === "Key" && arr.every((el) => isNestedObject(el) && "Value" in el);
|
|
5325
5414
|
function isPolicySubsetOf(sub, sup) {
|
|
5326
5415
|
for (const [k, v] of Object.entries(sub)) {
|
|
5327
5416
|
if (!(k in sup)) return false;
|
|
@@ -5536,6 +5625,10 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
5536
5625
|
if (sibGroups) subtractSiblingUserGroups(live, sibGroups);
|
|
5537
5626
|
}
|
|
5538
5627
|
}
|
|
5628
|
+
if (resourceType === "AWS::AutoScaling::AutoScalingGroup") {
|
|
5629
|
+
const sibHooks = physicalId ? opts.siblingLifecycleHooks?.[physicalId] : void 0;
|
|
5630
|
+
if (sibHooks) subtractSiblingLifecycleHooks(live, sibHooks);
|
|
5631
|
+
}
|
|
5539
5632
|
if (resourceType === "AWS::S3::Bucket" && physicalId && opts.bucketNotificationManaged?.has(physicalId) && !("NotificationConfiguration" in declared)) delete live.NotificationConfiguration;
|
|
5540
5633
|
const echoSpec = CLUSTER_ECHO_CHILD[resourceType];
|
|
5541
5634
|
const echoModel = echoSpec && physicalId ? opts.clusterEchoModel?.[physicalId] : void 0;
|
|
@@ -6150,13 +6243,17 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
6150
6243
|
}) ?? false)) continue;
|
|
6151
6244
|
const transformExpr = schema.propertyTransforms?.[d.path] ?? schema.propertyTransforms?.[d.path.replace(/\.\d+(?=\.|$)/g, ".*")];
|
|
6152
6245
|
if (transformExpr !== void 0 && matchesPropertyTransform(transformExpr, d.stateValue, resolveParentObject(declared, d.path), declared, d.awsValue, d.path.split(".").at(-1) ?? d.path)) continue;
|
|
6246
|
+
const tagListWhole = !unorderedObjArray && Array.isArray(v) && isKeyValueTagList(v) && d.path.startsWith(`${k}.`);
|
|
6153
6247
|
const unorderedExtra = unorderedObjArray && Array.isArray(declaredVal) && declaredRemapSource ? {
|
|
6154
6248
|
path: remapSortedIndexToDeclared(d.path, k, declaredVal, declaredRemapSource),
|
|
6155
6249
|
wholeArrayRevert: {
|
|
6156
6250
|
path: k,
|
|
6157
6251
|
value: v
|
|
6158
6252
|
}
|
|
6159
|
-
} : {
|
|
6253
|
+
} : tagListWhole ? { wholeArrayRevert: {
|
|
6254
|
+
path: k,
|
|
6255
|
+
value: v
|
|
6256
|
+
} } : {};
|
|
6160
6257
|
findings.push({
|
|
6161
6258
|
tier: "declared",
|
|
6162
6259
|
logicalId,
|
|
@@ -7277,12 +7374,18 @@ async function enumerateEventBusChildren(ctx) {
|
|
|
7277
7374
|
liveRules
|
|
7278
7375
|
});
|
|
7279
7376
|
}
|
|
7377
|
+
const OPENSEARCH_SERVICE_CLIENT_PREFIXES = ["AWSElasticsearch-", "AmazonOpenSearchService-"];
|
|
7378
|
+
function isOpenSearchServiceClient(name) {
|
|
7379
|
+
if (name === void 0) return false;
|
|
7380
|
+
return OPENSEARCH_SERVICE_CLIENT_PREFIXES.some((p) => name.startsWith(p));
|
|
7381
|
+
}
|
|
7280
7382
|
function diffUserPoolChildren(input) {
|
|
7281
7383
|
const { userPoolId, declaredClientIds, liveClients } = input;
|
|
7282
7384
|
const declared = new Set(declaredClientIds);
|
|
7283
7385
|
const added = [];
|
|
7284
7386
|
for (const c of liveClients) {
|
|
7285
7387
|
if (declared.has(c.id)) continue;
|
|
7388
|
+
if (isOpenSearchServiceClient(c.name ?? c.label)) continue;
|
|
7286
7389
|
added.push({
|
|
7287
7390
|
resourceType: "AWS::Cognito::UserPoolClient",
|
|
7288
7391
|
identifier: `${userPoolId}|${c.id}`,
|
|
@@ -7307,11 +7410,14 @@ async function pageUserPoolClients(client, userPoolId) {
|
|
|
7307
7410
|
return out;
|
|
7308
7411
|
}
|
|
7309
7412
|
function diffUserPoolGroups(input) {
|
|
7310
|
-
const { userPoolId, declaredGroupNames, liveGroups } = input;
|
|
7413
|
+
const { userPoolId, declaredGroupNames, declaredProviderNames, liveGroups } = input;
|
|
7311
7414
|
const declared = new Set(declaredGroupNames);
|
|
7415
|
+
const autoGroupNames = /* @__PURE__ */ new Set();
|
|
7416
|
+
for (const p of declaredProviderNames) if (typeof p === "string" && p.length > 0) autoGroupNames.add(`${userPoolId}_${p}`);
|
|
7312
7417
|
const added = [];
|
|
7313
7418
|
for (const g of liveGroups) {
|
|
7314
7419
|
if (declared.has(g.name)) continue;
|
|
7420
|
+
if (autoGroupNames.has(g.name)) continue;
|
|
7315
7421
|
added.push({
|
|
7316
7422
|
resourceType: "AWS::Cognito::UserPoolGroup",
|
|
7317
7423
|
identifier: `${userPoolId}|${g.name}`,
|
|
@@ -7370,6 +7476,40 @@ async function pageUserPoolResourceServers(client, userPoolId) {
|
|
|
7370
7476
|
} while (next);
|
|
7371
7477
|
return out;
|
|
7372
7478
|
}
|
|
7479
|
+
const BUILTIN_COGNITO_PROVIDER_NAME = "Cognito";
|
|
7480
|
+
function diffUserPoolIdentityProviders(input) {
|
|
7481
|
+
const { userPoolId, declaredProviderNames, liveProviders } = input;
|
|
7482
|
+
const declared = new Set(declaredProviderNames);
|
|
7483
|
+
const added = [];
|
|
7484
|
+
for (const p of liveProviders) {
|
|
7485
|
+
if (p.providerName === BUILTIN_COGNITO_PROVIDER_NAME) continue;
|
|
7486
|
+
if (declared.has(p.providerName)) continue;
|
|
7487
|
+
added.push({
|
|
7488
|
+
resourceType: "AWS::Cognito::UserPoolIdentityProvider",
|
|
7489
|
+
identifier: `${userPoolId}|${p.providerName}`,
|
|
7490
|
+
label: p.label ?? p.providerName,
|
|
7491
|
+
live: {
|
|
7492
|
+
ProviderName: p.providerName,
|
|
7493
|
+
UserPoolId: userPoolId
|
|
7494
|
+
}
|
|
7495
|
+
});
|
|
7496
|
+
}
|
|
7497
|
+
return added;
|
|
7498
|
+
}
|
|
7499
|
+
async function pageUserPoolIdentityProviders(client, userPoolId) {
|
|
7500
|
+
const out = [];
|
|
7501
|
+
let next;
|
|
7502
|
+
do {
|
|
7503
|
+
const res = await client.send(new ListIdentityProvidersCommand({
|
|
7504
|
+
UserPoolId: userPoolId,
|
|
7505
|
+
NextToken: next,
|
|
7506
|
+
MaxResults: 60
|
|
7507
|
+
}));
|
|
7508
|
+
out.push(...res.Providers ?? []);
|
|
7509
|
+
next = res.NextToken;
|
|
7510
|
+
} while (next);
|
|
7511
|
+
return out;
|
|
7512
|
+
}
|
|
7373
7513
|
async function enumerateUserPoolChildren(ctx) {
|
|
7374
7514
|
const { parent, desired, region } = ctx;
|
|
7375
7515
|
const userPoolId = parent.physicalId;
|
|
@@ -7377,6 +7517,7 @@ async function enumerateUserPoolChildren(ctx) {
|
|
|
7377
7517
|
const declaredClientIds = [];
|
|
7378
7518
|
const declaredGroupNames = [];
|
|
7379
7519
|
const declaredResourceServerIdentifiers = [];
|
|
7520
|
+
const declaredProviderNames = [];
|
|
7380
7521
|
for (const r of desired.resources) if (r.resourceType === "AWS::Cognito::UserPoolClient" && parentRefMatches(r.declared.UserPoolId, userPoolId) && r.physicalId) declaredClientIds.push(r.physicalId);
|
|
7381
7522
|
else if (r.resourceType === "AWS::Cognito::UserPoolGroup" && parentRefMatches(r.declared.UserPoolId, userPoolId)) {
|
|
7382
7523
|
const name = typeof r.declared.GroupName === "string" ? r.declared.GroupName : r.physicalId;
|
|
@@ -7384,6 +7525,9 @@ async function enumerateUserPoolChildren(ctx) {
|
|
|
7384
7525
|
} else if (r.resourceType === "AWS::Cognito::UserPoolResourceServer" && parentRefMatches(r.declared.UserPoolId, userPoolId)) {
|
|
7385
7526
|
const identifier = typeof r.declared.Identifier === "string" ? r.declared.Identifier : r.physicalId;
|
|
7386
7527
|
if (identifier) declaredResourceServerIdentifiers.push(identifier);
|
|
7528
|
+
} else if (r.resourceType === "AWS::Cognito::UserPoolIdentityProvider" && parentRefMatches(r.declared.UserPoolId, userPoolId)) {
|
|
7529
|
+
const providerName = typeof r.declared.ProviderName === "string" ? r.declared.ProviderName : r.physicalId;
|
|
7530
|
+
if (providerName) declaredProviderNames.push(providerName);
|
|
7387
7531
|
}
|
|
7388
7532
|
const client = new CognitoIdentityProviderClient({
|
|
7389
7533
|
region,
|
|
@@ -7394,12 +7538,14 @@ async function enumerateUserPoolChildren(ctx) {
|
|
|
7394
7538
|
declaredClientIds,
|
|
7395
7539
|
liveClients: (await pageUserPoolClients(client, userPoolId)).filter((c) => typeof c.ClientId === "string").map((c) => ({
|
|
7396
7540
|
id: c.ClientId,
|
|
7541
|
+
name: c.ClientName,
|
|
7397
7542
|
label: c.ClientName ?? c.ClientId
|
|
7398
7543
|
}))
|
|
7399
7544
|
});
|
|
7400
7545
|
const groupAdded = diffUserPoolGroups({
|
|
7401
7546
|
userPoolId,
|
|
7402
7547
|
declaredGroupNames,
|
|
7548
|
+
declaredProviderNames,
|
|
7403
7549
|
liveGroups: (await pageUserPoolGroups(client, userPoolId)).filter((g) => typeof g.GroupName === "string").map((g) => ({ name: g.GroupName }))
|
|
7404
7550
|
});
|
|
7405
7551
|
const resourceServerAdded = diffUserPoolResourceServers({
|
|
@@ -7410,10 +7556,19 @@ async function enumerateUserPoolChildren(ctx) {
|
|
|
7410
7556
|
label: rs.Name ?? rs.Identifier
|
|
7411
7557
|
}))
|
|
7412
7558
|
});
|
|
7559
|
+
const idpAdded = diffUserPoolIdentityProviders({
|
|
7560
|
+
userPoolId,
|
|
7561
|
+
declaredProviderNames,
|
|
7562
|
+
liveProviders: (await pageUserPoolIdentityProviders(client, userPoolId)).filter((p) => typeof p.ProviderName === "string").map((p) => ({
|
|
7563
|
+
providerName: p.ProviderName,
|
|
7564
|
+
label: p.ProviderName
|
|
7565
|
+
}))
|
|
7566
|
+
});
|
|
7413
7567
|
return [
|
|
7414
7568
|
...clientAdded,
|
|
7415
7569
|
...groupAdded,
|
|
7416
|
-
...resourceServerAdded
|
|
7570
|
+
...resourceServerAdded,
|
|
7571
|
+
...idpAdded
|
|
7417
7572
|
];
|
|
7418
7573
|
}
|
|
7419
7574
|
function diffGraphQLApiChildren(input) {
|
|
@@ -8779,6 +8934,72 @@ const readDmsReplicationSubnetGroup = async ({ physicalId, region }) => {
|
|
|
8779
8934
|
if (subnetIds.length > 0) model.SubnetIds = subnetIds;
|
|
8780
8935
|
return model;
|
|
8781
8936
|
};
|
|
8937
|
+
const readDmsReplicationInstance = async ({ physicalId, region }) => {
|
|
8938
|
+
const id = str$1(physicalId);
|
|
8939
|
+
if (!id) return void 0;
|
|
8940
|
+
const c = new DatabaseMigrationServiceClient({
|
|
8941
|
+
region,
|
|
8942
|
+
...READ_RETRY
|
|
8943
|
+
});
|
|
8944
|
+
const filterName = id.startsWith("arn:") ? "replication-instance-arn" : "replication-instance-id";
|
|
8945
|
+
const i = (await c.send(new DescribeReplicationInstancesCommand({ Filters: [{
|
|
8946
|
+
Name: filterName,
|
|
8947
|
+
Values: [id]
|
|
8948
|
+
}] }))).ReplicationInstances?.[0];
|
|
8949
|
+
if (!i) throw new ResourceGoneError(`DMS ReplicationInstance ${id} absent`);
|
|
8950
|
+
const model = {};
|
|
8951
|
+
if (str$1(i.ReplicationInstanceIdentifier)) model.ReplicationInstanceIdentifier = i.ReplicationInstanceIdentifier;
|
|
8952
|
+
if (str$1(i.ReplicationInstanceClass)) model.ReplicationInstanceClass = i.ReplicationInstanceClass;
|
|
8953
|
+
if (typeof i.AllocatedStorage === "number") model.AllocatedStorage = i.AllocatedStorage;
|
|
8954
|
+
if (typeof i.MultiAZ === "boolean") model.MultiAZ = i.MultiAZ;
|
|
8955
|
+
if (str$1(i.EngineVersion)) model.EngineVersion = i.EngineVersion;
|
|
8956
|
+
if (typeof i.AutoMinorVersionUpgrade === "boolean") model.AutoMinorVersionUpgrade = i.AutoMinorVersionUpgrade;
|
|
8957
|
+
if (typeof i.PubliclyAccessible === "boolean") model.PubliclyAccessible = i.PubliclyAccessible;
|
|
8958
|
+
if (str$1(i.AvailabilityZone)) model.AvailabilityZone = i.AvailabilityZone;
|
|
8959
|
+
if (str$1(i.PreferredMaintenanceWindow)) model.PreferredMaintenanceWindow = i.PreferredMaintenanceWindow;
|
|
8960
|
+
if (str$1(i.KmsKeyId)) model.KmsKeyId = i.KmsKeyId;
|
|
8961
|
+
if (str$1(i.ReplicationSubnetGroup?.ReplicationSubnetGroupIdentifier)) model.ReplicationSubnetGroupIdentifier = i.ReplicationSubnetGroup?.ReplicationSubnetGroupIdentifier;
|
|
8962
|
+
const sgIds = (i.VpcSecurityGroups ?? []).map((g) => str$1(g.VpcSecurityGroupId)).filter((v) => v !== void 0).sort();
|
|
8963
|
+
if (sgIds.length > 0) model.VpcSecurityGroupIds = sgIds;
|
|
8964
|
+
return model;
|
|
8965
|
+
};
|
|
8966
|
+
const readDmsReplicationTask = async ({ physicalId, region }) => {
|
|
8967
|
+
const id = str$1(physicalId);
|
|
8968
|
+
if (!id) return void 0;
|
|
8969
|
+
const c = new DatabaseMigrationServiceClient({
|
|
8970
|
+
region,
|
|
8971
|
+
...READ_RETRY
|
|
8972
|
+
});
|
|
8973
|
+
const filterName = id.startsWith("arn:") ? "replication-task-arn" : "replication-task-id";
|
|
8974
|
+
const t = (await c.send(new DescribeReplicationTasksCommand({ Filters: [{
|
|
8975
|
+
Name: filterName,
|
|
8976
|
+
Values: [id]
|
|
8977
|
+
}] }))).ReplicationTasks?.[0];
|
|
8978
|
+
if (!t) throw new ResourceGoneError(`DMS ReplicationTask ${id} absent`);
|
|
8979
|
+
const parseJsonMaybe = (s) => {
|
|
8980
|
+
const v = str$1(s);
|
|
8981
|
+
if (v === void 0) return void 0;
|
|
8982
|
+
try {
|
|
8983
|
+
return JSON.parse(v);
|
|
8984
|
+
} catch {
|
|
8985
|
+
return v;
|
|
8986
|
+
}
|
|
8987
|
+
};
|
|
8988
|
+
const model = {};
|
|
8989
|
+
if (str$1(t.ReplicationTaskIdentifier)) model.ReplicationTaskIdentifier = t.ReplicationTaskIdentifier;
|
|
8990
|
+
if (str$1(t.SourceEndpointArn)) model.SourceEndpointArn = t.SourceEndpointArn;
|
|
8991
|
+
if (str$1(t.TargetEndpointArn)) model.TargetEndpointArn = t.TargetEndpointArn;
|
|
8992
|
+
if (str$1(t.ReplicationInstanceArn)) model.ReplicationInstanceArn = t.ReplicationInstanceArn;
|
|
8993
|
+
if (str$1(t.MigrationType)) model.MigrationType = t.MigrationType;
|
|
8994
|
+
const tableMappings = parseJsonMaybe(t.TableMappings);
|
|
8995
|
+
if (tableMappings !== void 0) model.TableMappings = tableMappings;
|
|
8996
|
+
const taskSettings = parseJsonMaybe(t.ReplicationTaskSettings);
|
|
8997
|
+
if (taskSettings !== void 0) model.ReplicationTaskSettings = taskSettings;
|
|
8998
|
+
if (str$1(t.CdcStartPosition)) model.CdcStartPosition = t.CdcStartPosition;
|
|
8999
|
+
if (str$1(t.CdcStopPosition)) model.CdcStopPosition = t.CdcStopPosition;
|
|
9000
|
+
if (str$1(t.TaskData)) model.TaskData = t.TaskData;
|
|
9001
|
+
return model;
|
|
9002
|
+
};
|
|
8782
9003
|
const readMediaConvertQueue = async ({ physicalId, region }) => {
|
|
8783
9004
|
const name = str$1(physicalId);
|
|
8784
9005
|
if (!name) return void 0;
|
|
@@ -9019,7 +9240,7 @@ const readDaxParameterGroup = async ({ physicalId, region }) => {
|
|
|
9019
9240
|
const model = {};
|
|
9020
9241
|
if (str$1(g.ParameterGroupName)) model.ParameterGroupName = g.ParameterGroupName;
|
|
9021
9242
|
if (str$1(g.Description)) model.Description = g.Description;
|
|
9022
|
-
const p = await c.send(new DescribeParametersCommand({ ParameterGroupName: name }));
|
|
9243
|
+
const p = await c.send(new DescribeParametersCommand$1({ ParameterGroupName: name }));
|
|
9023
9244
|
const values = {};
|
|
9024
9245
|
for (const param of p.Parameters ?? []) {
|
|
9025
9246
|
if (param.IsModifiable === "FALSE") continue;
|
|
@@ -9781,6 +10002,8 @@ const SDK_OVERRIDES = {
|
|
|
9781
10002
|
"AWS::DLM::LifecyclePolicy": readDlmLifecyclePolicy,
|
|
9782
10003
|
"AWS::DMS::Endpoint": readDmsEndpoint,
|
|
9783
10004
|
"AWS::DMS::ReplicationSubnetGroup": readDmsReplicationSubnetGroup,
|
|
10005
|
+
"AWS::DMS::ReplicationInstance": readDmsReplicationInstance,
|
|
10006
|
+
"AWS::DMS::ReplicationTask": readDmsReplicationTask,
|
|
9784
10007
|
"AWS::MediaConvert::Queue": readMediaConvertQueue,
|
|
9785
10008
|
"AWS::MediaConvert::JobTemplate": readMediaConvertJobTemplate,
|
|
9786
10009
|
"AWS::Route53::RecordSet": readRoute53RecordSet,
|
|
@@ -9799,7 +10022,7 @@ const supplementSsmParameter = async ({ physicalId, declared, region }) => {
|
|
|
9799
10022
|
const p = (await new SSMClient({
|
|
9800
10023
|
region,
|
|
9801
10024
|
...READ_RETRY
|
|
9802
|
-
}).send(new DescribeParametersCommand
|
|
10025
|
+
}).send(new DescribeParametersCommand({ ParameterFilters: [{
|
|
9803
10026
|
Key: "Name",
|
|
9804
10027
|
Option: "Equals",
|
|
9805
10028
|
Values: [name]
|
|
@@ -9900,7 +10123,7 @@ const readMemoryDbParamMap = async (c, groupName) => {
|
|
|
9900
10123
|
const out = {};
|
|
9901
10124
|
let token;
|
|
9902
10125
|
do {
|
|
9903
|
-
const r = await c.send(new DescribeParametersCommand$
|
|
10126
|
+
const r = await c.send(new DescribeParametersCommand$2({
|
|
9904
10127
|
ParameterGroupName: groupName,
|
|
9905
10128
|
NextToken: token
|
|
9906
10129
|
}));
|
|
@@ -10932,6 +11155,24 @@ function buildSiblingUserGroups(desired) {
|
|
|
10932
11155
|
}
|
|
10933
11156
|
return map;
|
|
10934
11157
|
}
|
|
11158
|
+
const LIFECYCLE_HOOK_TYPE = "AWS::AutoScaling::LifecycleHook";
|
|
11159
|
+
function buildSiblingLifecycleHooks(desired) {
|
|
11160
|
+
const byLogicalId = /* @__PURE__ */ new Map();
|
|
11161
|
+
for (const r of desired.resources) if (r.physicalId) byLogicalId.set(r.logicalId, r.physicalId);
|
|
11162
|
+
const map = {};
|
|
11163
|
+
for (const r of desired.resources) {
|
|
11164
|
+
if (r.resourceType !== LIFECYCLE_HOOK_TYPE) continue;
|
|
11165
|
+
const decl = r.declared;
|
|
11166
|
+
if (!decl || typeof decl !== "object") continue;
|
|
11167
|
+
const d = decl;
|
|
11168
|
+
const asgKey = resolvePrincipalKey(d.AutoScalingGroupName, byLogicalId);
|
|
11169
|
+
if (!asgKey) continue;
|
|
11170
|
+
const name = r.physicalId ?? (typeof d.LifecycleHookName === "string" && d.LifecycleHookName ? d.LifecycleHookName : void 0);
|
|
11171
|
+
if (!name) continue;
|
|
11172
|
+
(map[asgKey] ??= []).push(name);
|
|
11173
|
+
}
|
|
11174
|
+
return map;
|
|
11175
|
+
}
|
|
10935
11176
|
function resolvePrincipalKey(ref, byLogicalId) {
|
|
10936
11177
|
if (typeof ref === "string" && ref) return ref;
|
|
10937
11178
|
if (ref && typeof ref === "object" && "Ref" in ref) {
|
|
@@ -11144,6 +11385,7 @@ async function gatherFindings(stackName, region, templateOverride, recoveryTempl
|
|
|
11144
11385
|
siblingEventBusPolicies: buildSiblingEventBusPolicies(desired),
|
|
11145
11386
|
siblingManagedPolicyAttachments: buildSiblingManagedPolicyAttachments(desired),
|
|
11146
11387
|
siblingUserGroups: buildSiblingUserGroups(desired),
|
|
11388
|
+
siblingLifecycleHooks: buildSiblingLifecycleHooks(desired),
|
|
11147
11389
|
bucketNotificationManaged: buildBucketNotificationManaged(desired),
|
|
11148
11390
|
clusterEchoModel: buildClusterEchoModels(desired),
|
|
11149
11391
|
rdsOptionSettingDefaults: await buildRdsOptionSettingDefaults(desired, region)
|
|
@@ -11206,6 +11448,7 @@ async function regatherTouched(gathered, touched, region) {
|
|
|
11206
11448
|
siblingEventBusPolicies: buildSiblingEventBusPolicies(desired),
|
|
11207
11449
|
siblingManagedPolicyAttachments: buildSiblingManagedPolicyAttachments(desired),
|
|
11208
11450
|
siblingUserGroups: buildSiblingUserGroups(desired),
|
|
11451
|
+
siblingLifecycleHooks: buildSiblingLifecycleHooks(desired),
|
|
11209
11452
|
bucketNotificationManaged: buildBucketNotificationManaged(desired),
|
|
11210
11453
|
clusterEchoModel: buildClusterEchoModels(desired),
|
|
11211
11454
|
rdsOptionSettingDefaults: await buildRdsOptionSettingDefaults(desired, region)
|