@go-to-k/cdkd 0.57.0 → 0.57.1

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/dist/cli.js CHANGED
@@ -13565,7 +13565,7 @@ var SNSTopicProvider = class {
13565
13565
  if (properties["DeliveryStatusLogging"]) {
13566
13566
  const loggingConfigs = properties["DeliveryStatusLogging"];
13567
13567
  for (const config of loggingConfigs) {
13568
- const protocol = config["Protocol"];
13568
+ const protocol = normalizeDeliveryStatusProtocolOrThrow(config["Protocol"], logicalId);
13569
13569
  if (config["SuccessFeedbackRoleArn"]) {
13570
13570
  await this.snsClient.send(
13571
13571
  new SetTopicAttributesCommand({
@@ -13658,7 +13658,7 @@ var SNSTopicProvider = class {
13658
13658
  if (JSON.stringify(properties["DeliveryStatusLogging"]) !== JSON.stringify(previousProperties["DeliveryStatusLogging"])) {
13659
13659
  const loggingConfigs = properties["DeliveryStatusLogging"] || [];
13660
13660
  for (const config of loggingConfigs) {
13661
- const protocol = config["Protocol"];
13661
+ const protocol = normalizeDeliveryStatusProtocolOrThrow(config["Protocol"], logicalId);
13662
13662
  if (config["SuccessFeedbackRoleArn"]) {
13663
13663
  await this.snsClient.send(
13664
13664
  new SetTopicAttributesCommand({
@@ -13798,16 +13798,22 @@ var SNSTopicProvider = class {
13798
13798
  * FailureFeedbackRoleArn?}]`. Walks the known protocol prefix list
13799
13799
  * (`HTTP` / `HTTPS` / `SQS` / `Lambda` / `Firehose` / `Application`); a
13800
13800
  * protocol is included in the result iff at least one of its three
13801
- * sub-attributes is set on the topic. Entries are sorted by `Protocol`
13802
- * for stable positional compare (AWS does not preserve template order
13803
- * across `GetTopicAttributes` calls).
13801
+ * sub-attributes is set on the topic. Entries are sorted by canonical
13802
+ * PascalCase `Protocol` for stable positional compare (AWS does not
13803
+ * preserve template order across `GetTopicAttributes` calls).
13804
+ *
13805
+ * The emitted `Protocol` value preserves state's case when known
13806
+ * (CDK templates emit lowercase `'lambda'` / `'sqs'` / ...; AWS's
13807
+ * attribute prefix is PascalCase). Without case preservation the
13808
+ * comparator would fire false drift on every clean run for any
13809
+ * lowercase-`Protocol` template.
13804
13810
  *
13805
13811
  * `Subscription` is omitted because CDK manages it via separate
13806
13812
  * `AWS::SNS::Subscription` resources, not as a Topic property.
13807
13813
  *
13808
13814
  * Returns `undefined` when the topic is gone (`NotFoundException`).
13809
13815
  */
13810
- async readCurrentState(physicalId, _logicalId, _resourceType) {
13816
+ async readCurrentState(physicalId, _logicalId, _resourceType, properties) {
13811
13817
  let attrs;
13812
13818
  try {
13813
13819
  const resp = await this.snsClient.send(
@@ -13849,7 +13855,10 @@ var SNSTopicProvider = class {
13849
13855
  }
13850
13856
  }
13851
13857
  }
13852
- result["DeliveryStatusLogging"] = mapDeliveryStatusLogging(attrs);
13858
+ result["DeliveryStatusLogging"] = mapDeliveryStatusLogging(
13859
+ attrs,
13860
+ stateProtocolCaseMap(properties?.["DeliveryStatusLogging"])
13861
+ );
13853
13862
  try {
13854
13863
  const tagsResp = await this.snsClient.send(
13855
13864
  new ListTagsForResourceCommand({ ResourceArn: physicalId })
@@ -13938,7 +13947,55 @@ var SNS_DELIVERY_STATUS_PROTOCOLS = [
13938
13947
  "Lambda",
13939
13948
  "SQS"
13940
13949
  ];
13941
- function mapDeliveryStatusLogging(attrs) {
13950
+ function normalizeDeliveryStatusProtocol(input) {
13951
+ if (typeof input !== "string")
13952
+ return void 0;
13953
+ const lower = input.toLowerCase();
13954
+ switch (lower) {
13955
+ case "application":
13956
+ return "Application";
13957
+ case "firehose":
13958
+ return "Firehose";
13959
+ case "http":
13960
+ return "HTTP";
13961
+ case "https":
13962
+ return "HTTPS";
13963
+ case "lambda":
13964
+ return "Lambda";
13965
+ case "sqs":
13966
+ return "SQS";
13967
+ default:
13968
+ return void 0;
13969
+ }
13970
+ }
13971
+ function normalizeDeliveryStatusProtocolOrThrow(input, logicalId) {
13972
+ const normalized = normalizeDeliveryStatusProtocol(input);
13973
+ if (normalized === void 0) {
13974
+ throw new Error(
13975
+ `SNS topic ${logicalId}: unsupported DeliveryStatusLogging protocol ${JSON.stringify(input)}. Expected one of ${SNS_DELIVERY_STATUS_PROTOCOLS.join(", ")} (case-insensitive).`
13976
+ );
13977
+ }
13978
+ return normalized;
13979
+ }
13980
+ function stateProtocolCaseMap(stateLogging) {
13981
+ const map = /* @__PURE__ */ new Map();
13982
+ if (!Array.isArray(stateLogging))
13983
+ return map;
13984
+ for (const entry of stateLogging) {
13985
+ if (!entry || typeof entry !== "object")
13986
+ continue;
13987
+ const raw = entry["Protocol"];
13988
+ if (typeof raw !== "string")
13989
+ continue;
13990
+ const normalized = normalizeDeliveryStatusProtocol(raw);
13991
+ if (!normalized)
13992
+ continue;
13993
+ if (!map.has(normalized))
13994
+ map.set(normalized, raw);
13995
+ }
13996
+ return map;
13997
+ }
13998
+ function mapDeliveryStatusLogging(attrs, stateCaseMap = /* @__PURE__ */ new Map()) {
13942
13999
  const result = [];
13943
14000
  for (const protocol of SNS_DELIVERY_STATUS_PROTOCOLS) {
13944
14001
  const success = attrs[`${protocol}SuccessFeedbackRoleArn`];
@@ -13946,7 +14003,9 @@ function mapDeliveryStatusLogging(attrs) {
13946
14003
  const failure = attrs[`${protocol}FailureFeedbackRoleArn`];
13947
14004
  if (success === void 0 && sample === void 0 && failure === void 0)
13948
14005
  continue;
13949
- const entry = { Protocol: protocol };
14006
+ const entry = {
14007
+ Protocol: stateCaseMap.get(protocol) ?? protocol
14008
+ };
13950
14009
  if (success !== void 0)
13951
14010
  entry["SuccessFeedbackRoleArn"] = success;
13952
14011
  if (sample !== void 0)
@@ -27595,7 +27654,18 @@ var ECSProvider = class {
27595
27654
  let resp;
27596
27655
  try {
27597
27656
  resp = await this.getClient().send(
27598
- new DescribeClustersCommand({ clusters: [physicalId], include: ["TAGS"] })
27657
+ // AWS DescribeClusters omits `settings` / `configuration` from the
27658
+ // response unless they are explicitly requested via `include`. Without
27659
+ // SETTINGS / CONFIGURATIONS the readCurrentState round-trip silently
27660
+ // surfaces empty `ClusterSettings: []` even when the cluster has
27661
+ // containerInsights enabled — a console-side toggle then can't be
27662
+ // detected as drift because both the deploy-time observedProperties
27663
+ // baseline AND the drift-time AWS read would identically miss the
27664
+ // field. Discovered by the drift-revert integ test (PR #201).
27665
+ new DescribeClustersCommand({
27666
+ clusters: [physicalId],
27667
+ include: ["TAGS", "SETTINGS", "CONFIGURATIONS"]
27668
+ })
27599
27669
  );
27600
27670
  } catch {
27601
27671
  return void 0;
@@ -32342,7 +32412,10 @@ var ServiceDiscoveryProvider = class {
32342
32412
  providerRegion = process.env["AWS_REGION"];
32343
32413
  logger = getLogger().child("ServiceDiscoveryProvider");
32344
32414
  handledProperties = /* @__PURE__ */ new Map([
32345
- ["AWS::ServiceDiscovery::PrivateDnsNamespace", /* @__PURE__ */ new Set(["Name", "Vpc", "Description", "Tags"])],
32415
+ [
32416
+ "AWS::ServiceDiscovery::PrivateDnsNamespace",
32417
+ /* @__PURE__ */ new Set(["Name", "Vpc", "Description", "Tags", "Properties"])
32418
+ ],
32346
32419
  [
32347
32420
  "AWS::ServiceDiscovery::Service",
32348
32421
  /* @__PURE__ */ new Set([
@@ -32444,13 +32517,18 @@ var ServiceDiscoveryProvider = class {
32444
32517
  logicalId
32445
32518
  );
32446
32519
  }
32520
+ const propsBag = properties["Properties"];
32521
+ const dnsProps = propsBag?.["DnsProperties"];
32522
+ const soa = dnsProps?.["SOA"];
32523
+ const inputProperties = soa?.TTL !== void 0 ? { DnsProperties: { SOA: { TTL: Number(soa.TTL) } } } : void 0;
32447
32524
  try {
32448
32525
  const response = await client.send(
32449
32526
  new CreatePrivateDnsNamespaceCommand({
32450
32527
  Name: name,
32451
32528
  Vpc: vpc,
32452
32529
  ...description && { Description: description },
32453
- ...tags && tags.length > 0 && { Tags: tags }
32530
+ ...tags && tags.length > 0 && { Tags: tags },
32531
+ ...inputProperties && { Properties: inputProperties }
32454
32532
  })
32455
32533
  );
32456
32534
  const operationId = response.OperationId;
@@ -32840,6 +32918,12 @@ var ServiceDiscoveryProvider = class {
32840
32918
  if (ns.Name !== void 0)
32841
32919
  result["Name"] = ns.Name;
32842
32920
  result["Description"] = ns.Description ?? "";
32921
+ const soa = ns.Properties?.DnsProperties?.SOA;
32922
+ if (soa?.TTL !== void 0) {
32923
+ result["Properties"] = { DnsProperties: { SOA: { TTL: soa.TTL } } };
32924
+ } else {
32925
+ result["Properties"] = {};
32926
+ }
32843
32927
  if (ns.Arn)
32844
32928
  await this.attachTags(result, ns.Arn);
32845
32929
  return result;
@@ -46250,7 +46334,7 @@ function reorderArgs(argv) {
46250
46334
  }
46251
46335
  async function main() {
46252
46336
  const program = new Command14();
46253
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.57.0");
46337
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.57.1");
46254
46338
  program.addCommand(createBootstrapCommand());
46255
46339
  program.addCommand(createSynthCommand());
46256
46340
  program.addCommand(createListCommand());