cdk-real-drift 0.17.3 → 0.18.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
@@ -1181,6 +1181,9 @@ Control cannot sub-path patch it),
1181
1181
  `AWS::Glue::Job` / `Classifier` / `Workflow`),
1182
1182
  `servicediscovery:UpdateHttpNamespace` (reverts an
1183
1183
  `AWS::ServiceDiscovery::HttpNamespace` `Description`),
1184
+ `servicediscovery:UpdateService` (reverts an `AWS::ServiceDiscovery::Service`'s
1185
+ `Description` / `DnsConfig.DnsRecords` / `HealthCheckConfig` — a DNS-namespace
1186
+ service; an API-only (HTTP) namespace service cannot be updated),
1184
1187
  `cognito-sync:SetCognitoEvents` (reverts an `AWS::Cognito::IdentityPool`'s
1185
1188
  writeOnly `CognitoEvents`),
1186
1189
  `kinesisvideo:UpdateDataRetention` / `kinesisvideo:UpdateSignalingChannel` /
package/dist/cli.js CHANGED
@@ -56,7 +56,7 @@ import { BuildBotLocaleCommand, CreateIntentCommand, CreateSlotCommand, CreateSl
56
56
  import { GetScheduleCommand, SchedulerClient } from "@aws-sdk/client-scheduler";
57
57
  import { DescribeReceiptRuleCommand, DescribeReceiptRuleSetCommand, ListReceiptFiltersCommand, SESClient, UpdateReceiptRuleCommand } from "@aws-sdk/client-ses";
58
58
  import { DescribeEndpointConfigCommand, DescribeMonitoringScheduleCommand, ListTagsCommand as ListTagsCommand$1, SageMakerClient } from "@aws-sdk/client-sagemaker";
59
- import { GetNamespaceCommand, GetServiceCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$4, ServiceDiscoveryClient, UpdateHttpNamespaceCommand } from "@aws-sdk/client-servicediscovery";
59
+ import { GetNamespaceCommand, GetServiceCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$4, ServiceDiscoveryClient, UpdateHttpNamespaceCommand, UpdateServiceCommand as UpdateServiceCommand$1 } from "@aws-sdk/client-servicediscovery";
60
60
  import { createHash } from "node:crypto";
61
61
  import { S_BAR, S_BAR_END, S_BAR_START, S_CHECKBOX_INACTIVE, S_CHECKBOX_SELECTED, confirm, isCancel, select, spinner } from "@clack/prompts";
62
62
  import pc from "picocolors";
@@ -16859,6 +16859,54 @@ const writeServiceDiscoveryHttpNamespace = async (ctx, ops) => {
16859
16859
  Namespace: { Description: str(m.Description) ?? "" }
16860
16860
  }));
16861
16861
  };
16862
+ const SD_SERVICE_MUTABLE_TOPS = new Set([
16863
+ "Description",
16864
+ "DnsConfig",
16865
+ "HealthCheckConfig"
16866
+ ]);
16867
+ const writeServiceDiscoveryService = async (ctx, ops) => {
16868
+ const id = str(ctx.physicalId);
16869
+ if (!id) throw new Error("cannot resolve Cloud Map service id for revert");
16870
+ const desired = await desiredModel("AWS::ServiceDiscovery::Service", ctx, ops);
16871
+ if (desired.Type === "HTTP") throw new Error(`ServiceDiscovery Service ${id} lives in an API-only (HTTP) namespace — UpdateService cannot modify it, so its drift is not revertable`);
16872
+ const unExpressible = /* @__PURE__ */ new Set();
16873
+ let anyExpressible = false;
16874
+ for (const op of ops) {
16875
+ const top = opTopSeg(op.path);
16876
+ if (!SD_SERVICE_MUTABLE_TOPS.has(top)) {
16877
+ unExpressible.add(top);
16878
+ continue;
16879
+ }
16880
+ const sub = op.path.replace(/^\//, "").split("/")[1] ?? "";
16881
+ if (top === "DnsConfig" && sub !== "DnsRecords" && sub !== "") {
16882
+ unExpressible.add(`DnsConfig/${sub}`);
16883
+ continue;
16884
+ }
16885
+ anyExpressible = true;
16886
+ }
16887
+ if (anyExpressible) {
16888
+ const service = {};
16889
+ if (str(desired.Description)) service.Description = desired.Description;
16890
+ const dns = desired.DnsConfig;
16891
+ const records = dns && Array.isArray(dns.DnsRecords) ? dns.DnsRecords : void 0;
16892
+ if (records && records.length > 0) service.DnsConfig = { DnsRecords: records.map((r) => {
16893
+ const rec = r;
16894
+ return {
16895
+ Type: rec.Type,
16896
+ TTL: typeof rec.TTL === "number" ? rec.TTL : Number(rec.TTL)
16897
+ };
16898
+ }) };
16899
+ if (desired.HealthCheckConfig !== void 0) service.HealthCheckConfig = desired.HealthCheckConfig;
16900
+ await new ServiceDiscoveryClient({
16901
+ region: ctx.region,
16902
+ ...CLIENT_TIMEOUTS
16903
+ }).send(new UpdateServiceCommand$1({
16904
+ Id: id,
16905
+ Service: service
16906
+ }));
16907
+ }
16908
+ if (unExpressible.size > 0) throw new Error(`ServiceDiscovery Service ${id}: UpdateService cannot express ${[...unExpressible].join(", ")} (create-only / immutable)${anyExpressible ? " — the other drifted values were reverted" : ""}`);
16909
+ };
16862
16910
  const DOCDB_CLUSTER_MODIFY_PARAMS = new Set([
16863
16911
  "BackupRetentionPeriod",
16864
16912
  "PreferredBackupWindow",
@@ -18282,6 +18330,7 @@ const SDK_WRITERS = {
18282
18330
  "AWS::DocDB::DBCluster": writeDocDbCluster,
18283
18331
  "AWS::DocDB::DBInstance": writeDocDbInstance,
18284
18332
  "AWS::ServiceDiscovery::HttpNamespace": writeServiceDiscoveryHttpNamespace,
18333
+ "AWS::ServiceDiscovery::Service": writeServiceDiscoveryService,
18285
18334
  "AWS::S3::BucketPolicy": writeS3BucketPolicy,
18286
18335
  "AWS::SNS::TopicPolicy": writeSnsTopicPolicy,
18287
18336
  "AWS::SQS::QueuePolicy": writeSqsQueuePolicy,