cdk-real-drift 0.22.3 → 0.22.4

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
@@ -870,7 +870,9 @@ covers them. **If you never run `revert`, cdkrd needs no write permissions at al
870
870
  `iam:GetUserPolicy`, `iam:GetGroupPolicy`, `iam:GetPolicy`, `iam:GetPolicyVersion`,
871
871
  `lambda:GetPolicy`, `budgets:ViewBudget`, `ec2:DescribeAddresses`,
872
872
  `ec2:DescribeLaunchTemplateVersions`, `ec2:DescribeNetworkAcls`,
873
- `route53:ListResourceRecordSets`,
873
+ `route53:ListResourceRecordSets`, `route53:ListHostedZonesByName` (resolves a
874
+ RecordSet declared via `HostedZoneName` instead of `HostedZoneId` to its zone
875
+ id),
874
876
  `ses:DescribeReceiptRuleSet`, `ses:DescribeReceiptRule`, `ses:ListReceiptFilters`
875
877
  (the SES inbound receipt-rule family — `ReceiptRuleSet` / `ReceiptRule` /
876
878
  `ReceiptFilter` — has no Cloud Control handlers),
package/dist/cli.js CHANGED
@@ -30,7 +30,7 @@ import { DescribeEventBusCommand, EventBridgeClient, ListRulesCommand, PutPermis
30
30
  import { GetClassifierCommand, GetConnectionCommand, GetJobCommand, GetSecurityConfigurationCommand, GetTableCommand, GetTablesCommand, GetTagsCommand, GetWorkflowCommand, GlueClient, UpdateClassifierCommand, UpdateConnectionCommand, UpdateJobCommand, UpdateTableCommand, UpdateWorkflowCommand } from "@aws-sdk/client-glue";
31
31
  import { GetFunctionCommand, GetPolicyCommand, LambdaClient, ListAliasesCommand as ListAliasesCommand$1, ListEventSourceMappingsCommand, ListFunctionUrlConfigsCommand, ListVersionsByFunctionCommand } from "@aws-sdk/client-lambda";
32
32
  import { DescribeDomainConfigCommand, DescribeDomainsCommand, ListDomainNamesCommand, OpenSearchClient, UpdateDomainConfigCommand } from "@aws-sdk/client-opensearch";
33
- import { ChangeResourceRecordSetsCommand, ListResourceRecordSetsCommand, Route53Client } from "@aws-sdk/client-route-53";
33
+ import { ChangeResourceRecordSetsCommand, ListHostedZonesByNameCommand, ListResourceRecordSetsCommand, Route53Client } from "@aws-sdk/client-route-53";
34
34
  import { DeleteBucketPolicyCommand, GetBucketPolicyCommand, GetObjectCommand, PutBucketPolicyCommand, S3Client } from "@aws-sdk/client-s3";
35
35
  import { DeleteResourcePolicyCommand, GetResourcePolicyCommand, SecretsManagerClient } from "@aws-sdk/client-secrets-manager";
36
36
  import { GetTopicAttributesCommand, ListSubscriptionsByTopicCommand, SNSClient, SetTopicAttributesCommand } from "@aws-sdk/client-sns";
@@ -12279,17 +12279,27 @@ const alignTrailingDot = (live, declared) => {
12279
12279
  if (live === void 0) return void 0;
12280
12280
  return typeof declared === "string" && declared.endsWith(".") ? live.endsWith(".") ? live : `${live}.` : live.replace(/\.$/, "");
12281
12281
  };
12282
+ const canonZone = (s) => unescapeRoute53Name(s).replace(/\.$/, "").toLowerCase();
12283
+ const resolveHostedZoneIdByName = async (c, zoneName) => {
12284
+ const target = canonZone(zoneName);
12285
+ const matches = ((await c.send(new ListHostedZonesByNameCommand({ DNSName: zoneName }))).HostedZones ?? []).filter((z) => !!z.Name && canonZone(z.Name) === target);
12286
+ return (matches.length === 1 ? matches[0] : void 0)?.Id?.replace(/^\/hostedzone\//, "");
12287
+ };
12282
12288
  const readRoute53RecordSet = async ({ physicalId, declared, region }) => {
12283
12289
  const parts = physicalId.split("_");
12284
12290
  const hasIdParts = parts.length >= 3;
12285
- const hostedZoneId = str$1(declared.HostedZoneId) ?? (hasIdParts ? parts[0] : void 0);
12286
- const name = str$1(declared.Name) ?? (hasIdParts ? parts[1] : void 0);
12287
- const type = str$1(declared.Type) ?? (hasIdParts ? parts[parts.length - 1] : void 0);
12288
- if (!hostedZoneId || !name || !type) return void 0;
12289
12291
  const c = new Route53Client({
12290
12292
  region,
12291
12293
  ...READ_RETRY
12292
12294
  });
12295
+ const declaredZoneId = str$1(declared.HostedZoneId);
12296
+ let hostedZoneId = declaredZoneId ?? (hasIdParts ? parts[0] : void 0);
12297
+ const name = str$1(declared.Name) ?? (hasIdParts ? parts[1] : void 0);
12298
+ const type = str$1(declared.Type) ?? (hasIdParts ? parts[parts.length - 1] : void 0);
12299
+ const zoneName = str$1(declared.HostedZoneName);
12300
+ const byName = !declaredZoneId && !!zoneName;
12301
+ if (!hostedZoneId && zoneName) hostedZoneId = await resolveHostedZoneIdByName(c, zoneName);
12302
+ if (!hostedZoneId || !name || !type) return void 0;
12293
12303
  const canon = (s) => unescapeRoute53Name(s).replace(/\.$/, "").toLowerCase();
12294
12304
  const declSetId = str$1(declared.SetIdentifier);
12295
12305
  const isOurNameType = (x) => x.Type === type && !!x.Name && canon(x.Name) === canon(name);
@@ -12320,7 +12330,7 @@ const readRoute53RecordSet = async ({ physicalId, declared, region }) => {
12320
12330
  const model = {
12321
12331
  Name: alignTrailingDot(rec.Name === void 0 ? void 0 : unescapeRoute53Name(rec.Name), declared.Name),
12322
12332
  Type: rec.Type,
12323
- HostedZoneId: hostedZoneId
12333
+ ...byName ? { HostedZoneName: zoneName } : { HostedZoneId: hostedZoneId }
12324
12334
  };
12325
12335
  if (rec.TTL !== void 0) model.TTL = String(rec.TTL);
12326
12336
  const records = rec.ResourceRecords?.map((rr) => rr.Value).filter((v) => !!v);