cdk-real-drift 0.12.73 → 0.12.75

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
@@ -5530,7 +5530,8 @@ const DEFAULT_SG_LIST_PATHS = {
5530
5530
  "AWS::EC2::NetworkInterface": "GroupSet",
5531
5531
  "AWS::Neptune::DBCluster": "VpcSecurityGroupIds",
5532
5532
  "AWS::AmazonMQ::Broker": "SecurityGroups",
5533
- "AWS::RedshiftServerless::Workgroup": "SecurityGroupIds"
5533
+ "AWS::RedshiftServerless::Workgroup": "SecurityGroupIds",
5534
+ "AWS::EC2::Instance": "SecurityGroupIds"
5534
5535
  };
5535
5536
  /** #1269 fold decision for an UNDECLARED default-SUBNET list (RedshiftServerless Workgroup
5536
5537
  * SubnetIds). Unlike the SG gate (which folds only a SINGLE default SG), a workgroup placed into
@@ -9621,6 +9622,7 @@ async function enumerateRdsClusterChildren(ctx) {
9621
9622
  }
9622
9623
  const canonRoute53Name = (s) => s.replace(/\.$/, "").toLowerCase();
9623
9624
  const route53RecordKey = (name, type, setIdentifier) => `${canonRoute53Name(name)}|${type.toUpperCase()}${setIdentifier !== void 0 ? `|${setIdentifier}` : ""}`;
9625
+ const route53RecordSetIdentifier = (hostedZoneId, name, type, setIdentifier) => `${hostedZoneId}_${name}_${type.toUpperCase()}` + (setIdentifier !== void 0 ? `_${setIdentifier}` : "");
9624
9626
  function diffRoute53HostedZoneChildren(input) {
9625
9627
  const { hostedZoneId, zoneApex, declaredRecords, liveRecords } = input;
9626
9628
  const declared = new Set(declaredRecords.map((r) => route53RecordKey(r.name, r.type, r.setIdentifier)));
@@ -9633,7 +9635,7 @@ function diffRoute53HostedZoneChildren(input) {
9633
9635
  if (type === "SOA") continue;
9634
9636
  if (type === "NS" && apex !== void 0 && name === apex) continue;
9635
9637
  if (declared.has(route53RecordKey(r.name, r.type, r.setIdentifier))) continue;
9636
- const identifier = `${hostedZoneId}_${r.name}_${type}` + (r.setIdentifier !== void 0 ? `_${r.setIdentifier}` : "");
9638
+ const identifier = route53RecordSetIdentifier(hostedZoneId, r.name, type, r.setIdentifier);
9637
9639
  added.push({
9638
9640
  resourceType: "AWS::Route53::RecordSet",
9639
9641
  identifier,
@@ -12520,13 +12522,9 @@ function addedFinding(parent, c, read) {
12520
12522
  ...read.ok ? {} : { modelReadFailed: true }
12521
12523
  };
12522
12524
  }
12525
+ const CC_GET_UNSUPPORTED_ADDED_TYPES = new Set(["AWS::Route53::RecordSet"]);
12523
12526
  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 ?? "{}");
12527
+ const normalizeWith = async (raw) => {
12530
12528
  let schema = schemas.get(c.resourceType);
12531
12529
  if (!schema) {
12532
12530
  const res = await getSchemaInfoResult(cfn, c.resourceType);
@@ -12540,6 +12538,14 @@ async function readAddedModel(cc, cfn, c, schemas, oaiCanonicalIds) {
12540
12538
  }),
12541
12539
  ok: true
12542
12540
  };
12541
+ };
12542
+ if (CC_GET_UNSUPPORTED_ADDED_TYPES.has(c.resourceType)) return normalizeWith(c.live);
12543
+ try {
12544
+ const g = await cc.send(new GetResourceCommand({
12545
+ TypeName: c.resourceType,
12546
+ Identifier: c.identifier
12547
+ }));
12548
+ return normalizeWith(JSON.parse(g.ResourceDescription?.Properties ?? "{}"));
12543
12549
  } catch {
12544
12550
  return {
12545
12551
  model: c.live,
@@ -16557,7 +16563,27 @@ const deleteAppSyncApiKey = async (ctx) => {
16557
16563
  id: ctx.physicalId
16558
16564
  }));
16559
16565
  };
16560
- const SDK_DELETERS = { "AWS::AppSync::ApiKey": deleteAppSyncApiKey };
16566
+ const deleteRoute53RecordSet = async (ctx) => {
16567
+ const zoneId = ctx.parentPhysicalId;
16568
+ if (!zoneId) throw new Error("cannot resolve the parent HostedZone id for the Route53 RecordSet delete");
16569
+ const client = new Route53Client({
16570
+ region: ctx.region,
16571
+ ...CLIENT_TIMEOUTS
16572
+ });
16573
+ 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);
16574
+ if (!target) return;
16575
+ await client.send(new ChangeResourceRecordSetsCommand({
16576
+ HostedZoneId: zoneId,
16577
+ ChangeBatch: { Changes: [{
16578
+ Action: "DELETE",
16579
+ ResourceRecordSet: target
16580
+ }] }
16581
+ }));
16582
+ };
16583
+ const SDK_DELETERS = {
16584
+ "AWS::AppSync::ApiKey": deleteAppSyncApiKey,
16585
+ "AWS::Route53::RecordSet": deleteRoute53RecordSet
16586
+ };
16561
16587
 
16562
16588
  //#endregion
16563
16589
  //#region src/revert/plan.ts
@@ -16822,7 +16848,7 @@ function buildRevertPlan(findings, baseline, opts = {}) {
16822
16848
  });
16823
16849
  continue;
16824
16850
  }
16825
- if (CC_DELETE_UNSUPPORTED_ADDED_TYPES.has(f.resourceType)) {
16851
+ if (CC_DELETE_UNSUPPORTED_ADDED_TYPES.has(f.resourceType) && !SDK_DELETERS[f.resourceType]) {
16826
16852
  notRevertable.push({
16827
16853
  displayId,
16828
16854
  resourceType: f.resourceType,