cdk-real-drift 0.10.2 → 0.11.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 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$1, DescribeUsersCommand as DescribeUsersCommand$1, MemoryDBClient, ResetParameterGroupCommand, UpdateParameterGroupCommand as UpdateParameterGroupCommand$1 } from "@aws-sdk/client-memorydb";
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) {
@@ -3637,6 +3647,90 @@ function canonicalizeIdArraysDeep(v) {
3637
3647
  }
3638
3648
  return v;
3639
3649
  }
3650
+ function parseIpv6Groups(addr) {
3651
+ if (addr.includes(".")) return void 0;
3652
+ const dc = addr.indexOf("::");
3653
+ if (dc !== addr.lastIndexOf("::")) return void 0;
3654
+ const hextet = (part) => {
3655
+ if (!/^[0-9a-fA-F]{1,4}$/.test(part)) return void 0;
3656
+ return Number.parseInt(part, 16);
3657
+ };
3658
+ if (dc === -1) {
3659
+ const parts = addr.split(":");
3660
+ if (parts.length !== 8) return void 0;
3661
+ const groups = [];
3662
+ for (const p of parts) {
3663
+ const g = hextet(p);
3664
+ if (g === void 0) return void 0;
3665
+ groups.push(g);
3666
+ }
3667
+ return groups;
3668
+ }
3669
+ const head = addr.slice(0, dc);
3670
+ const tail = addr.slice(dc + 2);
3671
+ const headParts = head === "" ? [] : head.split(":");
3672
+ const tailParts = tail === "" ? [] : tail.split(":");
3673
+ const headGroups = [];
3674
+ for (const p of headParts) {
3675
+ const g = hextet(p);
3676
+ if (g === void 0) return void 0;
3677
+ headGroups.push(g);
3678
+ }
3679
+ const tailGroups = [];
3680
+ for (const p of tailParts) {
3681
+ const g = hextet(p);
3682
+ if (g === void 0) return void 0;
3683
+ tailGroups.push(g);
3684
+ }
3685
+ const missing = 8 - headGroups.length - tailGroups.length;
3686
+ if (missing < 1) return void 0;
3687
+ return [
3688
+ ...headGroups,
3689
+ ...new Array(missing).fill(0),
3690
+ ...tailGroups
3691
+ ];
3692
+ }
3693
+ function canonicalIpv6Cidr(s) {
3694
+ const slash = s.indexOf("/");
3695
+ if (slash === -1) return void 0;
3696
+ const addr = s.slice(0, slash);
3697
+ const prefixStr = s.slice(slash + 1);
3698
+ if (!/^\d{1,3}$/.test(prefixStr)) return void 0;
3699
+ const prefix = Number.parseInt(prefixStr, 10);
3700
+ if (prefix < 0 || prefix > 128) return void 0;
3701
+ const groups = parseIpv6Groups(addr);
3702
+ if (!groups) return void 0;
3703
+ let bestStart = -1;
3704
+ let bestLen = 0;
3705
+ let curStart = -1;
3706
+ let curLen = 0;
3707
+ for (let i = 0; i < 8; i++) if (groups[i] === 0) {
3708
+ if (curStart === -1) curStart = i;
3709
+ curLen++;
3710
+ if (curLen > bestLen) {
3711
+ bestLen = curLen;
3712
+ bestStart = curStart;
3713
+ }
3714
+ } else {
3715
+ curStart = -1;
3716
+ curLen = 0;
3717
+ }
3718
+ const hex = groups.map((g) => g.toString(16));
3719
+ let addrOut;
3720
+ if (bestLen >= 2) addrOut = `${hex.slice(0, bestStart).join(":")}::${hex.slice(bestStart + bestLen).join(":")}`;
3721
+ else addrOut = hex.join(":");
3722
+ return `${addrOut}/${prefix}`;
3723
+ }
3724
+ function canonicalizeIpv6CidrsDeep(v) {
3725
+ if (typeof v === "string") return canonicalIpv6Cidr(v) ?? v;
3726
+ if (Array.isArray(v)) return v.map(canonicalizeIpv6CidrsDeep);
3727
+ if (v && typeof v === "object") {
3728
+ const out = {};
3729
+ for (const [k, val] of Object.entries(v)) out[k] = canonicalizeIpv6CidrsDeep(val);
3730
+ return out;
3731
+ }
3732
+ return v;
3733
+ }
3640
3734
  const NAME_VALUE_SUBSET_PATHS = {
3641
3735
  "AWS::KinesisFirehose::DeliveryStream": {
3642
3736
  re: /(^|\.)Processors\.\d+\.Parameters$/,
@@ -4225,6 +4319,63 @@ async function listExports(client, accountId, region) {
4225
4319
  exportsCache.set(cacheKey, exports);
4226
4320
  return exports;
4227
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
+ }
4228
4379
  async function listStackResources(client, stackName) {
4229
4380
  const physIds = {};
4230
4381
  const typeOf = {};
@@ -4288,6 +4439,17 @@ async function loadDesired(client, stackName, region, templateOverride, recovery
4288
4439
  const msg = err instanceof Error ? err.message : String(err);
4289
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})`);
4290
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
+ }
4291
4453
  const resources = [];
4292
4454
  const principalsWithSiblingPolicy = collectPrincipalsWithSiblingPolicies(template.Resources ?? {}, ctx);
4293
4455
  const clustersWithSiblingCapacityProviders = collectClustersWithSiblingCapacityProviders(template.Resources ?? {});
@@ -4800,7 +4962,7 @@ function normWalk(v, freeForm) {
4800
4962
  //#region src/normalize/pipeline.ts
4801
4963
  function canonicalizeForCompare(v, resourceType) {
4802
4964
  const orderSig = resourceType ? ORDER_SIGNIFICANT_ARRAY_KEYS[resourceType] : void 0;
4803
- const base = canonicalizeIdArraysDeep(canonicalizeTagListsDeep(normalizePoliciesDeep(v), orderSig));
4965
+ const base = canonicalizeIpv6CidrsDeep(canonicalizeIdArraysDeep(canonicalizeTagListsDeep(normalizePoliciesDeep(v), orderSig)));
4804
4966
  return resourceType === "AWS::WAFv2::WebACL" || resourceType === "AWS::WAFv2::RuleGroup" ? normalizeWafByteMatchDeep(base) : base;
4805
4967
  }
4806
4968
  function sortObjectArraysDeep(v) {
@@ -5051,6 +5213,16 @@ function subtractSiblingUserGroups(live, siblingGroups) {
5051
5213
  }
5052
5214
  if (arr.length === 0) delete live[USER_GROUPS_PROP];
5053
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
+ }
5054
5226
  const CC_ALT_REPRESENTATION = {
5055
5227
  "AWS::EC2::Subnet": {
5056
5228
  AvailabilityZoneId: "AvailabilityZone",
@@ -5452,6 +5624,10 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
5452
5624
  if (sibGroups) subtractSiblingUserGroups(live, sibGroups);
5453
5625
  }
5454
5626
  }
5627
+ if (resourceType === "AWS::AutoScaling::AutoScalingGroup") {
5628
+ const sibHooks = physicalId ? opts.siblingLifecycleHooks?.[physicalId] : void 0;
5629
+ if (sibHooks) subtractSiblingLifecycleHooks(live, sibHooks);
5630
+ }
5455
5631
  if (resourceType === "AWS::S3::Bucket" && physicalId && opts.bucketNotificationManaged?.has(physicalId) && !("NotificationConfiguration" in declared)) delete live.NotificationConfiguration;
5456
5632
  const echoSpec = CLUSTER_ECHO_CHILD[resourceType];
5457
5633
  const echoModel = echoSpec && physicalId ? opts.clusterEchoModel?.[physicalId] : void 0;
@@ -7223,11 +7399,14 @@ async function pageUserPoolClients(client, userPoolId) {
7223
7399
  return out;
7224
7400
  }
7225
7401
  function diffUserPoolGroups(input) {
7226
- const { userPoolId, declaredGroupNames, liveGroups } = input;
7402
+ const { userPoolId, declaredGroupNames, declaredProviderNames, liveGroups } = input;
7227
7403
  const declared = new Set(declaredGroupNames);
7404
+ const autoGroupNames = /* @__PURE__ */ new Set();
7405
+ for (const p of declaredProviderNames) if (typeof p === "string" && p.length > 0) autoGroupNames.add(`${userPoolId}_${p}`);
7228
7406
  const added = [];
7229
7407
  for (const g of liveGroups) {
7230
7408
  if (declared.has(g.name)) continue;
7409
+ if (autoGroupNames.has(g.name)) continue;
7231
7410
  added.push({
7232
7411
  resourceType: "AWS::Cognito::UserPoolGroup",
7233
7412
  identifier: `${userPoolId}|${g.name}`,
@@ -7286,6 +7465,40 @@ async function pageUserPoolResourceServers(client, userPoolId) {
7286
7465
  } while (next);
7287
7466
  return out;
7288
7467
  }
7468
+ const BUILTIN_COGNITO_PROVIDER_NAME = "Cognito";
7469
+ function diffUserPoolIdentityProviders(input) {
7470
+ const { userPoolId, declaredProviderNames, liveProviders } = input;
7471
+ const declared = new Set(declaredProviderNames);
7472
+ const added = [];
7473
+ for (const p of liveProviders) {
7474
+ if (p.providerName === BUILTIN_COGNITO_PROVIDER_NAME) continue;
7475
+ if (declared.has(p.providerName)) continue;
7476
+ added.push({
7477
+ resourceType: "AWS::Cognito::UserPoolIdentityProvider",
7478
+ identifier: `${userPoolId}|${p.providerName}`,
7479
+ label: p.label ?? p.providerName,
7480
+ live: {
7481
+ ProviderName: p.providerName,
7482
+ UserPoolId: userPoolId
7483
+ }
7484
+ });
7485
+ }
7486
+ return added;
7487
+ }
7488
+ async function pageUserPoolIdentityProviders(client, userPoolId) {
7489
+ const out = [];
7490
+ let next;
7491
+ do {
7492
+ const res = await client.send(new ListIdentityProvidersCommand({
7493
+ UserPoolId: userPoolId,
7494
+ NextToken: next,
7495
+ MaxResults: 60
7496
+ }));
7497
+ out.push(...res.Providers ?? []);
7498
+ next = res.NextToken;
7499
+ } while (next);
7500
+ return out;
7501
+ }
7289
7502
  async function enumerateUserPoolChildren(ctx) {
7290
7503
  const { parent, desired, region } = ctx;
7291
7504
  const userPoolId = parent.physicalId;
@@ -7293,6 +7506,7 @@ async function enumerateUserPoolChildren(ctx) {
7293
7506
  const declaredClientIds = [];
7294
7507
  const declaredGroupNames = [];
7295
7508
  const declaredResourceServerIdentifiers = [];
7509
+ const declaredProviderNames = [];
7296
7510
  for (const r of desired.resources) if (r.resourceType === "AWS::Cognito::UserPoolClient" && parentRefMatches(r.declared.UserPoolId, userPoolId) && r.physicalId) declaredClientIds.push(r.physicalId);
7297
7511
  else if (r.resourceType === "AWS::Cognito::UserPoolGroup" && parentRefMatches(r.declared.UserPoolId, userPoolId)) {
7298
7512
  const name = typeof r.declared.GroupName === "string" ? r.declared.GroupName : r.physicalId;
@@ -7300,6 +7514,9 @@ async function enumerateUserPoolChildren(ctx) {
7300
7514
  } else if (r.resourceType === "AWS::Cognito::UserPoolResourceServer" && parentRefMatches(r.declared.UserPoolId, userPoolId)) {
7301
7515
  const identifier = typeof r.declared.Identifier === "string" ? r.declared.Identifier : r.physicalId;
7302
7516
  if (identifier) declaredResourceServerIdentifiers.push(identifier);
7517
+ } else if (r.resourceType === "AWS::Cognito::UserPoolIdentityProvider" && parentRefMatches(r.declared.UserPoolId, userPoolId)) {
7518
+ const providerName = typeof r.declared.ProviderName === "string" ? r.declared.ProviderName : r.physicalId;
7519
+ if (providerName) declaredProviderNames.push(providerName);
7303
7520
  }
7304
7521
  const client = new CognitoIdentityProviderClient({
7305
7522
  region,
@@ -7316,6 +7533,7 @@ async function enumerateUserPoolChildren(ctx) {
7316
7533
  const groupAdded = diffUserPoolGroups({
7317
7534
  userPoolId,
7318
7535
  declaredGroupNames,
7536
+ declaredProviderNames,
7319
7537
  liveGroups: (await pageUserPoolGroups(client, userPoolId)).filter((g) => typeof g.GroupName === "string").map((g) => ({ name: g.GroupName }))
7320
7538
  });
7321
7539
  const resourceServerAdded = diffUserPoolResourceServers({
@@ -7326,10 +7544,19 @@ async function enumerateUserPoolChildren(ctx) {
7326
7544
  label: rs.Name ?? rs.Identifier
7327
7545
  }))
7328
7546
  });
7547
+ const idpAdded = diffUserPoolIdentityProviders({
7548
+ userPoolId,
7549
+ declaredProviderNames,
7550
+ liveProviders: (await pageUserPoolIdentityProviders(client, userPoolId)).filter((p) => typeof p.ProviderName === "string").map((p) => ({
7551
+ providerName: p.ProviderName,
7552
+ label: p.ProviderName
7553
+ }))
7554
+ });
7329
7555
  return [
7330
7556
  ...clientAdded,
7331
7557
  ...groupAdded,
7332
- ...resourceServerAdded
7558
+ ...resourceServerAdded,
7559
+ ...idpAdded
7333
7560
  ];
7334
7561
  }
7335
7562
  function diffGraphQLApiChildren(input) {
@@ -8695,6 +8922,72 @@ const readDmsReplicationSubnetGroup = async ({ physicalId, region }) => {
8695
8922
  if (subnetIds.length > 0) model.SubnetIds = subnetIds;
8696
8923
  return model;
8697
8924
  };
8925
+ const readDmsReplicationInstance = async ({ physicalId, region }) => {
8926
+ const id = str$1(physicalId);
8927
+ if (!id) return void 0;
8928
+ const c = new DatabaseMigrationServiceClient({
8929
+ region,
8930
+ ...READ_RETRY
8931
+ });
8932
+ const filterName = id.startsWith("arn:") ? "replication-instance-arn" : "replication-instance-id";
8933
+ const i = (await c.send(new DescribeReplicationInstancesCommand({ Filters: [{
8934
+ Name: filterName,
8935
+ Values: [id]
8936
+ }] }))).ReplicationInstances?.[0];
8937
+ if (!i) throw new ResourceGoneError(`DMS ReplicationInstance ${id} absent`);
8938
+ const model = {};
8939
+ if (str$1(i.ReplicationInstanceIdentifier)) model.ReplicationInstanceIdentifier = i.ReplicationInstanceIdentifier;
8940
+ if (str$1(i.ReplicationInstanceClass)) model.ReplicationInstanceClass = i.ReplicationInstanceClass;
8941
+ if (typeof i.AllocatedStorage === "number") model.AllocatedStorage = i.AllocatedStorage;
8942
+ if (typeof i.MultiAZ === "boolean") model.MultiAZ = i.MultiAZ;
8943
+ if (str$1(i.EngineVersion)) model.EngineVersion = i.EngineVersion;
8944
+ if (typeof i.AutoMinorVersionUpgrade === "boolean") model.AutoMinorVersionUpgrade = i.AutoMinorVersionUpgrade;
8945
+ if (typeof i.PubliclyAccessible === "boolean") model.PubliclyAccessible = i.PubliclyAccessible;
8946
+ if (str$1(i.AvailabilityZone)) model.AvailabilityZone = i.AvailabilityZone;
8947
+ if (str$1(i.PreferredMaintenanceWindow)) model.PreferredMaintenanceWindow = i.PreferredMaintenanceWindow;
8948
+ if (str$1(i.KmsKeyId)) model.KmsKeyId = i.KmsKeyId;
8949
+ if (str$1(i.ReplicationSubnetGroup?.ReplicationSubnetGroupIdentifier)) model.ReplicationSubnetGroupIdentifier = i.ReplicationSubnetGroup?.ReplicationSubnetGroupIdentifier;
8950
+ const sgIds = (i.VpcSecurityGroups ?? []).map((g) => str$1(g.VpcSecurityGroupId)).filter((v) => v !== void 0).sort();
8951
+ if (sgIds.length > 0) model.VpcSecurityGroupIds = sgIds;
8952
+ return model;
8953
+ };
8954
+ const readDmsReplicationTask = async ({ physicalId, region }) => {
8955
+ const id = str$1(physicalId);
8956
+ if (!id) return void 0;
8957
+ const c = new DatabaseMigrationServiceClient({
8958
+ region,
8959
+ ...READ_RETRY
8960
+ });
8961
+ const filterName = id.startsWith("arn:") ? "replication-task-arn" : "replication-task-id";
8962
+ const t = (await c.send(new DescribeReplicationTasksCommand({ Filters: [{
8963
+ Name: filterName,
8964
+ Values: [id]
8965
+ }] }))).ReplicationTasks?.[0];
8966
+ if (!t) throw new ResourceGoneError(`DMS ReplicationTask ${id} absent`);
8967
+ const parseJsonMaybe = (s) => {
8968
+ const v = str$1(s);
8969
+ if (v === void 0) return void 0;
8970
+ try {
8971
+ return JSON.parse(v);
8972
+ } catch {
8973
+ return v;
8974
+ }
8975
+ };
8976
+ const model = {};
8977
+ if (str$1(t.ReplicationTaskIdentifier)) model.ReplicationTaskIdentifier = t.ReplicationTaskIdentifier;
8978
+ if (str$1(t.SourceEndpointArn)) model.SourceEndpointArn = t.SourceEndpointArn;
8979
+ if (str$1(t.TargetEndpointArn)) model.TargetEndpointArn = t.TargetEndpointArn;
8980
+ if (str$1(t.ReplicationInstanceArn)) model.ReplicationInstanceArn = t.ReplicationInstanceArn;
8981
+ if (str$1(t.MigrationType)) model.MigrationType = t.MigrationType;
8982
+ const tableMappings = parseJsonMaybe(t.TableMappings);
8983
+ if (tableMappings !== void 0) model.TableMappings = tableMappings;
8984
+ const taskSettings = parseJsonMaybe(t.ReplicationTaskSettings);
8985
+ if (taskSettings !== void 0) model.ReplicationTaskSettings = taskSettings;
8986
+ if (str$1(t.CdcStartPosition)) model.CdcStartPosition = t.CdcStartPosition;
8987
+ if (str$1(t.CdcStopPosition)) model.CdcStopPosition = t.CdcStopPosition;
8988
+ if (str$1(t.TaskData)) model.TaskData = t.TaskData;
8989
+ return model;
8990
+ };
8698
8991
  const readMediaConvertQueue = async ({ physicalId, region }) => {
8699
8992
  const name = str$1(physicalId);
8700
8993
  if (!name) return void 0;
@@ -8935,7 +9228,7 @@ const readDaxParameterGroup = async ({ physicalId, region }) => {
8935
9228
  const model = {};
8936
9229
  if (str$1(g.ParameterGroupName)) model.ParameterGroupName = g.ParameterGroupName;
8937
9230
  if (str$1(g.Description)) model.Description = g.Description;
8938
- const p = await c.send(new DescribeParametersCommand({ ParameterGroupName: name }));
9231
+ const p = await c.send(new DescribeParametersCommand$1({ ParameterGroupName: name }));
8939
9232
  const values = {};
8940
9233
  for (const param of p.Parameters ?? []) {
8941
9234
  if (param.IsModifiable === "FALSE") continue;
@@ -9697,6 +9990,8 @@ const SDK_OVERRIDES = {
9697
9990
  "AWS::DLM::LifecyclePolicy": readDlmLifecyclePolicy,
9698
9991
  "AWS::DMS::Endpoint": readDmsEndpoint,
9699
9992
  "AWS::DMS::ReplicationSubnetGroup": readDmsReplicationSubnetGroup,
9993
+ "AWS::DMS::ReplicationInstance": readDmsReplicationInstance,
9994
+ "AWS::DMS::ReplicationTask": readDmsReplicationTask,
9700
9995
  "AWS::MediaConvert::Queue": readMediaConvertQueue,
9701
9996
  "AWS::MediaConvert::JobTemplate": readMediaConvertJobTemplate,
9702
9997
  "AWS::Route53::RecordSet": readRoute53RecordSet,
@@ -9715,7 +10010,7 @@ const supplementSsmParameter = async ({ physicalId, declared, region }) => {
9715
10010
  const p = (await new SSMClient({
9716
10011
  region,
9717
10012
  ...READ_RETRY
9718
- }).send(new DescribeParametersCommand$2({ ParameterFilters: [{
10013
+ }).send(new DescribeParametersCommand({ ParameterFilters: [{
9719
10014
  Key: "Name",
9720
10015
  Option: "Equals",
9721
10016
  Values: [name]
@@ -9816,7 +10111,7 @@ const readMemoryDbParamMap = async (c, groupName) => {
9816
10111
  const out = {};
9817
10112
  let token;
9818
10113
  do {
9819
- const r = await c.send(new DescribeParametersCommand$1({
10114
+ const r = await c.send(new DescribeParametersCommand$2({
9820
10115
  ParameterGroupName: groupName,
9821
10116
  NextToken: token
9822
10117
  }));
@@ -10848,6 +11143,24 @@ function buildSiblingUserGroups(desired) {
10848
11143
  }
10849
11144
  return map;
10850
11145
  }
11146
+ const LIFECYCLE_HOOK_TYPE = "AWS::AutoScaling::LifecycleHook";
11147
+ function buildSiblingLifecycleHooks(desired) {
11148
+ const byLogicalId = /* @__PURE__ */ new Map();
11149
+ for (const r of desired.resources) if (r.physicalId) byLogicalId.set(r.logicalId, r.physicalId);
11150
+ const map = {};
11151
+ for (const r of desired.resources) {
11152
+ if (r.resourceType !== LIFECYCLE_HOOK_TYPE) continue;
11153
+ const decl = r.declared;
11154
+ if (!decl || typeof decl !== "object") continue;
11155
+ const d = decl;
11156
+ const asgKey = resolvePrincipalKey(d.AutoScalingGroupName, byLogicalId);
11157
+ if (!asgKey) continue;
11158
+ const name = r.physicalId ?? (typeof d.LifecycleHookName === "string" && d.LifecycleHookName ? d.LifecycleHookName : void 0);
11159
+ if (!name) continue;
11160
+ (map[asgKey] ??= []).push(name);
11161
+ }
11162
+ return map;
11163
+ }
10851
11164
  function resolvePrincipalKey(ref, byLogicalId) {
10852
11165
  if (typeof ref === "string" && ref) return ref;
10853
11166
  if (ref && typeof ref === "object" && "Ref" in ref) {
@@ -11060,6 +11373,7 @@ async function gatherFindings(stackName, region, templateOverride, recoveryTempl
11060
11373
  siblingEventBusPolicies: buildSiblingEventBusPolicies(desired),
11061
11374
  siblingManagedPolicyAttachments: buildSiblingManagedPolicyAttachments(desired),
11062
11375
  siblingUserGroups: buildSiblingUserGroups(desired),
11376
+ siblingLifecycleHooks: buildSiblingLifecycleHooks(desired),
11063
11377
  bucketNotificationManaged: buildBucketNotificationManaged(desired),
11064
11378
  clusterEchoModel: buildClusterEchoModels(desired),
11065
11379
  rdsOptionSettingDefaults: await buildRdsOptionSettingDefaults(desired, region)
@@ -11122,6 +11436,7 @@ async function regatherTouched(gathered, touched, region) {
11122
11436
  siblingEventBusPolicies: buildSiblingEventBusPolicies(desired),
11123
11437
  siblingManagedPolicyAttachments: buildSiblingManagedPolicyAttachments(desired),
11124
11438
  siblingUserGroups: buildSiblingUserGroups(desired),
11439
+ siblingLifecycleHooks: buildSiblingLifecycleHooks(desired),
11125
11440
  bucketNotificationManaged: buildBucketNotificationManaged(desired),
11126
11441
  clusterEchoModel: buildClusterEchoModels(desired),
11127
11442
  rdsOptionSettingDefaults: await buildRdsOptionSettingDefaults(desired, region)