cdk-real-drift 0.12.72 → 0.12.74

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
@@ -1022,7 +1022,9 @@ covers them. **If you never run `revert`, cdkrd needs no write permissions at al
1022
1022
  `cloudcontrol:UpdateResource` (which resolves to each type's own update
1023
1023
  permissions), `cloudcontrol:DeleteResource` (to delete an out-of-band `added`
1024
1024
  resource; a type Cloud Control cannot delete goes through its own SDK action
1025
- instead — `appsync:DeleteApiKey` for an out-of-band `AWS::AppSync::ApiKey`), and
1025
+ instead — `appsync:DeleteApiKey` for an out-of-band `AWS::AppSync::ApiKey`, or
1026
+ `route53:ChangeResourceRecordSets` (a DELETE change) for an out-of-band
1027
+ `AWS::Route53::RecordSet`), and
1026
1028
  `cloudcontrol:GetResourceRequestStatus` (to poll the async Cloud
1027
1029
  Control request to completion). Plus, for the SDK-written types:
1028
1030
  `s3:PutBucketPolicy` /
package/dist/cli.js CHANGED
@@ -9621,6 +9621,7 @@ async function enumerateRdsClusterChildren(ctx) {
9621
9621
  }
9622
9622
  const canonRoute53Name = (s) => s.replace(/\.$/, "").toLowerCase();
9623
9623
  const route53RecordKey = (name, type, setIdentifier) => `${canonRoute53Name(name)}|${type.toUpperCase()}${setIdentifier !== void 0 ? `|${setIdentifier}` : ""}`;
9624
+ const route53RecordSetIdentifier = (hostedZoneId, name, type, setIdentifier) => `${hostedZoneId}_${name}_${type.toUpperCase()}` + (setIdentifier !== void 0 ? `_${setIdentifier}` : "");
9624
9625
  function diffRoute53HostedZoneChildren(input) {
9625
9626
  const { hostedZoneId, zoneApex, declaredRecords, liveRecords } = input;
9626
9627
  const declared = new Set(declaredRecords.map((r) => route53RecordKey(r.name, r.type, r.setIdentifier)));
@@ -9633,7 +9634,7 @@ function diffRoute53HostedZoneChildren(input) {
9633
9634
  if (type === "SOA") continue;
9634
9635
  if (type === "NS" && apex !== void 0 && name === apex) continue;
9635
9636
  if (declared.has(route53RecordKey(r.name, r.type, r.setIdentifier))) continue;
9636
- const identifier = `${hostedZoneId}_${r.name}_${type}` + (r.setIdentifier !== void 0 ? `_${r.setIdentifier}` : "");
9637
+ const identifier = route53RecordSetIdentifier(hostedZoneId, r.name, type, r.setIdentifier);
9637
9638
  added.push({
9638
9639
  resourceType: "AWS::Route53::RecordSet",
9639
9640
  identifier,
@@ -12520,13 +12521,9 @@ function addedFinding(parent, c, read) {
12520
12521
  ...read.ok ? {} : { modelReadFailed: true }
12521
12522
  };
12522
12523
  }
12524
+ const CC_GET_UNSUPPORTED_ADDED_TYPES = new Set(["AWS::Route53::RecordSet"]);
12523
12525
  async function readAddedModel(cc, cfn, c, schemas, oaiCanonicalIds) {
12524
- try {
12525
- const g = await cc.send(new GetResourceCommand({
12526
- TypeName: c.resourceType,
12527
- Identifier: c.identifier
12528
- }));
12529
- const raw = JSON.parse(g.ResourceDescription?.Properties ?? "{}");
12526
+ const normalizeWith = async (raw) => {
12530
12527
  let schema = schemas.get(c.resourceType);
12531
12528
  if (!schema) {
12532
12529
  const res = await getSchemaInfoResult(cfn, c.resourceType);
@@ -12540,6 +12537,14 @@ async function readAddedModel(cc, cfn, c, schemas, oaiCanonicalIds) {
12540
12537
  }),
12541
12538
  ok: true
12542
12539
  };
12540
+ };
12541
+ if (CC_GET_UNSUPPORTED_ADDED_TYPES.has(c.resourceType)) return normalizeWith(c.live);
12542
+ try {
12543
+ const g = await cc.send(new GetResourceCommand({
12544
+ TypeName: c.resourceType,
12545
+ Identifier: c.identifier
12546
+ }));
12547
+ return normalizeWith(JSON.parse(g.ResourceDescription?.Properties ?? "{}"));
12543
12548
  } catch {
12544
12549
  return {
12545
12550
  model: c.live,
@@ -16557,7 +16562,27 @@ const deleteAppSyncApiKey = async (ctx) => {
16557
16562
  id: ctx.physicalId
16558
16563
  }));
16559
16564
  };
16560
- const SDK_DELETERS = { "AWS::AppSync::ApiKey": deleteAppSyncApiKey };
16565
+ const deleteRoute53RecordSet = async (ctx) => {
16566
+ const zoneId = ctx.parentPhysicalId;
16567
+ if (!zoneId) throw new Error("cannot resolve the parent HostedZone id for the Route53 RecordSet delete");
16568
+ const client = new Route53Client({
16569
+ region: ctx.region,
16570
+ ...CLIENT_TIMEOUTS
16571
+ });
16572
+ const target = (await pageResourceRecordSets(client, zoneId)).find((r) => r.Name !== void 0 && r.Type !== void 0 && route53RecordSetIdentifier(zoneId, r.Name, r.Type, r.SetIdentifier) === ctx.physicalId);
16573
+ if (!target) return;
16574
+ await client.send(new ChangeResourceRecordSetsCommand({
16575
+ HostedZoneId: zoneId,
16576
+ ChangeBatch: { Changes: [{
16577
+ Action: "DELETE",
16578
+ ResourceRecordSet: target
16579
+ }] }
16580
+ }));
16581
+ };
16582
+ const SDK_DELETERS = {
16583
+ "AWS::AppSync::ApiKey": deleteAppSyncApiKey,
16584
+ "AWS::Route53::RecordSet": deleteRoute53RecordSet
16585
+ };
16561
16586
 
16562
16587
  //#endregion
16563
16588
  //#region src/revert/plan.ts
@@ -16822,7 +16847,7 @@ function buildRevertPlan(findings, baseline, opts = {}) {
16822
16847
  });
16823
16848
  continue;
16824
16849
  }
16825
- if (CC_DELETE_UNSUPPORTED_ADDED_TYPES.has(f.resourceType)) {
16850
+ if (CC_DELETE_UNSUPPORTED_ADDED_TYPES.has(f.resourceType) && !SDK_DELETERS[f.resourceType]) {
16826
16851
  notRevertable.push({
16827
16852
  displayId,
16828
16853
  resourceType: f.resourceType,