cdk-real-drift 0.12.53 → 0.12.54

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
@@ -267,8 +267,10 @@ of an undeclared property, and is reconciled the same way against your baseline:
267
267
  `cdk drift` / CFn drift detection compare only template-declared resources, so an
268
268
  out-of-band addition is invisible to them. Decide it like any finding: `record`
269
269
  snapshots its full live model and watches it, `ignore` accepts it, or `revert`
270
- **deletes** it (Cloud Control `DeleteResource`, behind the usual confirm /
271
- `--dry-run` / picker; an unrecorded one needs `--remove-unrecorded`).
270
+ **deletes** it (Cloud Control `DeleteResource` — or a type-specific SDK delete
271
+ where Cloud Control does not support the type's DELETE action, e.g. an AppSync
272
+ api key — behind the usual confirm / `--dry-run` / picker; an unrecorded one
273
+ needs `--remove-unrecorded`).
272
274
 
273
275
  <details>
274
276
  <summary>Covered parent types (the <code>CHILD_ENUMERATORS</code> registry, growing per type)</summary>
@@ -974,7 +976,7 @@ covers them. **If you never run `revert`, cdkrd needs no write permissions at al
974
976
  `es:ListDomainNames`, `es:DescribeDomains` — a caller lacking these degrades
975
977
  fail-safe (the service client is treated as corroborated, never falsely flagged)
976
978
  - `AWS::AppSync::GraphQLApi`: `appsync:ListDataSources`, `appsync:ListResolvers`,
977
- `appsync:ListFunctions`, `appsync:ListTypes`
979
+ `appsync:ListFunctions`, `appsync:ListTypes`, `appsync:ListApiKeys`
978
980
  - `AWS::Logs::LogGroup`: `logs:DescribeSubscriptionFilters` (plus
979
981
  `logs:DescribeMetricFilters`, already listed above)
980
982
  - `AWS::ElasticLoadBalancingV2::LoadBalancer` + `::Listener`:
@@ -1008,7 +1010,9 @@ covers them. **If you never run `revert`, cdkrd needs no write permissions at al
1008
1010
 
1009
1011
  `cloudcontrol:UpdateResource` (which resolves to each type's own update
1010
1012
  permissions), `cloudcontrol:DeleteResource` (to delete an out-of-band `added`
1011
- resource), and `cloudcontrol:GetResourceRequestStatus` (to poll the async Cloud
1013
+ resource; a type Cloud Control cannot delete goes through its own SDK action
1014
+ instead — `appsync:DeleteApiKey` for an out-of-band `AWS::AppSync::ApiKey`), and
1015
+ `cloudcontrol:GetResourceRequestStatus` (to poll the async Cloud
1012
1016
  Control request to completion). Plus, for the SDK-written types:
1013
1017
  `s3:PutBucketPolicy` /
1014
1018
  `s3:DeleteBucketPolicy`, `sns:SetTopicAttributes`, `sqs:SetQueueAttributes`,
package/dist/cli.js CHANGED
@@ -16,7 +16,7 @@ import jsonata from "jsonata";
16
16
  import { KMSClient, ListAliasesCommand } from "@aws-sdk/client-kms";
17
17
  import { APIGatewayClient, GetAuthorizersCommand, GetGatewayResponsesCommand, GetModelsCommand, GetRequestValidatorsCommand, GetResourcesCommand, GetStagesCommand, UpdateIntegrationCommand, UpdateIntegrationResponseCommand, UpdateMethodResponseCommand, UpdateRestApiCommand } from "@aws-sdk/client-api-gateway";
18
18
  import { AppConfigClient, ListConfigurationProfilesCommand, ListEnvironmentsCommand } from "@aws-sdk/client-appconfig";
19
- import { AppSyncClient, ListApiKeysCommand, ListDataSourcesCommand, ListFunctionsCommand, ListResolversCommand, ListTypesCommand } from "@aws-sdk/client-appsync";
19
+ import { AppSyncClient, DeleteApiKeyCommand, ListApiKeysCommand, ListDataSourcesCommand, ListFunctionsCommand, ListResolversCommand, ListTypesCommand } from "@aws-sdk/client-appsync";
20
20
  import { ApiGatewayV2Client, DeleteAccessLogSettingsCommand, DeleteRouteSettingsCommand, GetAuthorizersCommand as GetAuthorizersCommand$1, GetIntegrationsCommand, GetRoutesCommand, GetStagesCommand as GetStagesCommand$1, UpdateStageCommand } from "@aws-sdk/client-apigatewayv2";
21
21
  import { CloudWatchLogsClient, DescribeMetricFiltersCommand, DescribeSubscriptionFiltersCommand, PutBearerTokenAuthenticationCommand, PutMetricFilterCommand } from "@aws-sdk/client-cloudwatch-logs";
22
22
  import { CognitoIdentityProviderClient, ListGroupsCommand, ListIdentityProvidersCommand, ListResourceServersCommand, ListUserPoolClientsCommand } from "@aws-sdk/client-cognito-identity-provider";
@@ -16018,6 +16018,19 @@ function resolveSdkWriter(resourceType, ops) {
16018
16018
  const nested = SDK_NESTED_WRITERS[resourceType];
16019
16019
  if (nested && ops[0] && nested.match(pointerToDotted(ops[0].path))) return nested.writer;
16020
16020
  }
16021
+ const deleteAppSyncApiKey = async (ctx) => {
16022
+ const parent = ctx.parentPhysicalId;
16023
+ if (!parent) throw new Error("cannot resolve the parent GraphQLApi id for the AppSync ApiKey delete");
16024
+ const apiId = parent.includes("/") ? parent.slice(parent.lastIndexOf("/") + 1) : parent;
16025
+ await new AppSyncClient({
16026
+ region: ctx.region,
16027
+ ...CLIENT_TIMEOUTS
16028
+ }).send(new DeleteApiKeyCommand({
16029
+ apiId,
16030
+ id: ctx.physicalId
16031
+ }));
16032
+ };
16033
+ const SDK_DELETERS = { "AWS::AppSync::ApiKey": deleteAppSyncApiKey };
16021
16034
 
16022
16035
  //#endregion
16023
16036
  //#region src/revert/plan.ts
@@ -16832,6 +16845,9 @@ async function applyRevertDelete(cc, item, identifier = item.physicalId, retry =
16832
16845
  };
16833
16846
  }
16834
16847
  };
16848
+ return retryDeleteDeferringDependencies(oneDelete, retry);
16849
+ }
16850
+ async function retryDeleteDeferringDependencies(oneDelete, retry) {
16835
16851
  let deferredDepError;
16836
16852
  const guardedDelete = async () => {
16837
16853
  const r = await oneDelete();
@@ -16851,6 +16867,21 @@ async function applyRevertDelete(cc, item, identifier = item.physicalId, retry =
16851
16867
  };
16852
16868
  return r;
16853
16869
  }
16870
+ async function applyRevertDeleteSdk(doDelete, retry = {}) {
16871
+ const oneDelete = async () => {
16872
+ try {
16873
+ await doDelete();
16874
+ return { ok: true };
16875
+ } catch (e) {
16876
+ if (isAlreadyGone(e)) return { ok: true };
16877
+ return {
16878
+ ok: false,
16879
+ error: errorText(e)
16880
+ };
16881
+ }
16882
+ };
16883
+ return retryDeleteDeferringDependencies(oneDelete, retry);
16884
+ }
16854
16885
 
16855
16886
  //#endregion
16856
16887
  //#region src/commands/stack-actions.ts
@@ -17655,7 +17686,19 @@ async function revertStack(p) {
17655
17686
  streamResultLine(item.logicalId);
17656
17687
  }
17657
17688
  const deleteDeadlineMs = waitMs !== void 0 ? clock() + waitMs : void 0;
17658
- const deleteOutcomes = await applyRevertDeletes(deleteItems, (item) => applyRevertDelete(cc, item, item.physicalId, buildRetryOpts(item.displayId, deleteDeadlineMs)));
17689
+ const deleteOutcomes = await applyRevertDeletes(deleteItems, (item) => {
17690
+ const sdkDeleter = SDK_DELETERS[item.resourceType];
17691
+ if (sdkDeleter) {
17692
+ const parentLogicalId = item.logicalId.split("/", 1)[0] ?? item.logicalId;
17693
+ const parentPhysicalId = resByLogical.get(parentLogicalId)?.physicalId;
17694
+ return applyRevertDeleteSdk(() => sdkDeleter({
17695
+ physicalId: item.physicalId,
17696
+ parentPhysicalId,
17697
+ region
17698
+ }), buildRetryOpts(item.displayId, deleteDeadlineMs));
17699
+ }
17700
+ return applyRevertDelete(cc, item, item.physicalId, buildRetryOpts(item.displayId, deleteDeadlineMs));
17701
+ });
17659
17702
  for (const { item, result: r } of deleteOutcomes) {
17660
17703
  if (!r.ok) failedDeleteIds.add(item.logicalId);
17661
17704
  applied.push({