@go-to-k/cdkd 0.50.9 → 0.50.10

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
@@ -19412,7 +19412,11 @@ var EC2Provider = class {
19412
19412
  case "AWS::EC2::NetworkAcl":
19413
19413
  case "AWS::EC2::NetworkAclEntry":
19414
19414
  case "AWS::EC2::SubnetNetworkAclAssociation":
19415
- return { physicalId, wasReplaced: false };
19415
+ throw new ResourceUpdateNotSupportedError(
19416
+ resourceType,
19417
+ logicalId,
19418
+ "destroy + redeploy. The property surface for this resource type is effectively immutable in cdkd today."
19419
+ );
19416
19420
  default:
19417
19421
  throw new ProvisioningError(
19418
19422
  `Unsupported resource type: ${resourceType}`,
@@ -19557,21 +19561,28 @@ var EC2Provider = class {
19557
19561
  async updateVpc(logicalId, physicalId, resourceType, properties, previousProperties) {
19558
19562
  this.logger.debug(`Updating VPC ${logicalId}: ${physicalId}`);
19559
19563
  try {
19560
- if (properties["EnableDnsHostnames"] !== void 0) {
19561
- const value = properties["EnableDnsHostnames"] === true || properties["EnableDnsHostnames"] === "true";
19564
+ const asBool = (v) => {
19565
+ if (v === void 0)
19566
+ return void 0;
19567
+ return v === true || v === "true";
19568
+ };
19569
+ const newDnsHostnames = asBool(properties["EnableDnsHostnames"]);
19570
+ const oldDnsHostnames = asBool(previousProperties["EnableDnsHostnames"]);
19571
+ if (newDnsHostnames !== void 0 && newDnsHostnames !== oldDnsHostnames) {
19562
19572
  await this.ec2Client.send(
19563
19573
  new ModifyVpcAttributeCommand({
19564
19574
  VpcId: physicalId,
19565
- EnableDnsHostnames: { Value: value }
19575
+ EnableDnsHostnames: { Value: newDnsHostnames }
19566
19576
  })
19567
19577
  );
19568
19578
  }
19569
- if (properties["EnableDnsSupport"] !== void 0) {
19570
- const value = properties["EnableDnsSupport"] === true || properties["EnableDnsSupport"] === "true";
19579
+ const newDnsSupport = asBool(properties["EnableDnsSupport"]);
19580
+ const oldDnsSupport = asBool(previousProperties["EnableDnsSupport"]);
19581
+ if (newDnsSupport !== void 0 && newDnsSupport !== oldDnsSupport) {
19571
19582
  await this.ec2Client.send(
19572
19583
  new ModifyVpcAttributeCommand({
19573
19584
  VpcId: physicalId,
19574
- EnableDnsSupport: { Value: value }
19585
+ EnableDnsSupport: { Value: newDnsSupport }
19575
19586
  })
19576
19587
  );
19577
19588
  }
@@ -19754,8 +19765,13 @@ var EC2Provider = class {
19754
19765
  }
19755
19766
  }
19756
19767
  updateSubnet(logicalId, physicalId) {
19757
- this.logger.debug(`Updating Subnet ${logicalId}: ${physicalId} (no-op, immutable properties)`);
19758
- return Promise.resolve({ physicalId, wasReplaced: false });
19768
+ return Promise.reject(
19769
+ new ResourceUpdateNotSupportedError(
19770
+ "AWS::EC2::Subnet",
19771
+ logicalId,
19772
+ "destroy + redeploy the Subnet (and the resources that depend on it). Subnet properties are immutable in AWS."
19773
+ )
19774
+ );
19759
19775
  }
19760
19776
  async deleteSubnet(logicalId, physicalId, resourceType, context) {
19761
19777
  this.logger.debug(`Deleting Subnet ${logicalId}: ${physicalId}`);
@@ -19890,8 +19906,13 @@ var EC2Provider = class {
19890
19906
  }
19891
19907
  }
19892
19908
  updateInternetGateway(logicalId, physicalId) {
19893
- this.logger.debug(`Updating InternetGateway ${logicalId}: ${physicalId} (no-op)`);
19894
- return Promise.resolve({ physicalId, wasReplaced: false });
19909
+ return Promise.reject(
19910
+ new ResourceUpdateNotSupportedError(
19911
+ "AWS::EC2::InternetGateway",
19912
+ logicalId,
19913
+ "destroy + redeploy the InternetGateway. IGW properties are immutable in AWS."
19914
+ )
19915
+ );
19895
19916
  }
19896
19917
  async deleteInternetGateway(logicalId, physicalId, resourceType, context) {
19897
19918
  this.logger.debug(`Deleting InternetGateway ${logicalId}: ${physicalId}`);
@@ -19960,8 +19981,13 @@ var EC2Provider = class {
19960
19981
  }
19961
19982
  }
19962
19983
  updateVpcGatewayAttachment(logicalId, physicalId) {
19963
- this.logger.debug(`Updating VPCGatewayAttachment ${logicalId}: ${physicalId} (no-op)`);
19964
- return Promise.resolve({ physicalId, wasReplaced: false });
19984
+ return Promise.reject(
19985
+ new ResourceUpdateNotSupportedError(
19986
+ "AWS::EC2::VPCGatewayAttachment",
19987
+ logicalId,
19988
+ "destroy + redeploy the VPCGatewayAttachment. The (VpcId, InternetGatewayId) pair is immutable."
19989
+ )
19990
+ );
19965
19991
  }
19966
19992
  async deleteVpcGatewayAttachment(logicalId, physicalId, resourceType, context) {
19967
19993
  this.logger.debug(`Deleting VPCGatewayAttachment ${logicalId}: ${physicalId}`);
@@ -20076,8 +20102,13 @@ var EC2Provider = class {
20076
20102
  }
20077
20103
  }
20078
20104
  updateNatGateway(logicalId, physicalId) {
20079
- this.logger.debug(`Updating NatGateway ${logicalId}: ${physicalId} (no-op)`);
20080
- return Promise.resolve({ physicalId, wasReplaced: false });
20105
+ return Promise.reject(
20106
+ new ResourceUpdateNotSupportedError(
20107
+ "AWS::EC2::NatGateway",
20108
+ logicalId,
20109
+ "destroy + redeploy the NatGateway (and the dependent Routes). NAT Gateway properties are immutable in AWS."
20110
+ )
20111
+ );
20081
20112
  }
20082
20113
  async deleteNatGateway(logicalId, physicalId, resourceType, context) {
20083
20114
  this.logger.debug(`Deleting NatGateway ${logicalId}: ${physicalId}`);
@@ -20152,8 +20183,13 @@ var EC2Provider = class {
20152
20183
  }
20153
20184
  }
20154
20185
  updateRouteTable(logicalId, physicalId) {
20155
- this.logger.debug(`Updating RouteTable ${logicalId}: ${physicalId} (no-op)`);
20156
- return Promise.resolve({ physicalId, wasReplaced: false });
20186
+ return Promise.reject(
20187
+ new ResourceUpdateNotSupportedError(
20188
+ "AWS::EC2::RouteTable",
20189
+ logicalId,
20190
+ "destroy + redeploy the RouteTable (and its associated Routes / SubnetRouteTableAssociations). VpcId is immutable."
20191
+ )
20192
+ );
20157
20193
  }
20158
20194
  async deleteRouteTable(logicalId, physicalId, resourceType, context) {
20159
20195
  this.logger.debug(`Deleting RouteTable ${logicalId}: ${physicalId}`);
@@ -20228,8 +20264,11 @@ var EC2Provider = class {
20228
20264
  );
20229
20265
  }
20230
20266
  }
20231
- async updateRoute(logicalId, physicalId, resourceType, properties, _previousProperties) {
20267
+ async updateRoute(logicalId, physicalId, resourceType, properties, previousProperties) {
20232
20268
  this.logger.debug(`Updating Route ${logicalId}: ${physicalId}`);
20269
+ if (JSON.stringify(properties) === JSON.stringify(previousProperties)) {
20270
+ return { physicalId, wasReplaced: false };
20271
+ }
20233
20272
  try {
20234
20273
  await this.deleteRoute(logicalId, physicalId, resourceType);
20235
20274
  const createResult = await this.createRoute(logicalId, resourceType, properties);
@@ -20332,10 +20371,13 @@ var EC2Provider = class {
20332
20371
  }
20333
20372
  }
20334
20373
  updateSubnetRouteTableAssociation(logicalId, physicalId) {
20335
- this.logger.debug(
20336
- `Updating SubnetRouteTableAssociation ${logicalId}: ${physicalId} (no-op, requires replacement)`
20374
+ return Promise.reject(
20375
+ new ResourceUpdateNotSupportedError(
20376
+ "AWS::EC2::SubnetRouteTableAssociation",
20377
+ logicalId,
20378
+ "destroy + redeploy the association. (SubnetId, RouteTableId) is immutable."
20379
+ )
20337
20380
  );
20338
- return Promise.resolve({ physicalId, wasReplaced: false });
20339
20381
  }
20340
20382
  async deleteSubnetRouteTableAssociation(logicalId, physicalId, resourceType, context) {
20341
20383
  this.logger.debug(`Deleting SubnetRouteTableAssociation ${logicalId}: ${physicalId}`);
@@ -20633,6 +20675,9 @@ var EC2Provider = class {
20633
20675
  }
20634
20676
  async updateSecurityGroupIngress(logicalId, physicalId, resourceType, properties, previousProperties) {
20635
20677
  this.logger.debug(`Updating SecurityGroupIngress ${logicalId}: ${physicalId}`);
20678
+ if (JSON.stringify(properties) === JSON.stringify(previousProperties)) {
20679
+ return { physicalId, wasReplaced: false };
20680
+ }
20636
20681
  try {
20637
20682
  await this.deleteSecurityGroupIngress(
20638
20683
  logicalId,
@@ -23906,6 +23951,24 @@ var CloudFrontOAIProvider = class {
23906
23951
  throw err;
23907
23952
  }
23908
23953
  }
23954
+ /**
23955
+ * State property paths the comparator must skip during drift detection.
23956
+ *
23957
+ * `CloudFrontOriginAccessIdentityConfig.CallerReference` is set by cdkd
23958
+ * to `logicalId` at create time regardless of what the CDK template
23959
+ * specified, so it ends up in `state.properties` (from the resolved
23960
+ * template) but is intentionally not surfaced by `readCurrentState`. A
23961
+ * keys-from-state walk would otherwise compare `state.CallerReference`
23962
+ * against `aws=undefined` and fire a guaranteed false positive on every
23963
+ * clean run for any stack whose template templated CallerReference.
23964
+ *
23965
+ * The field is also immutable in AWS — the OAI's CallerReference cannot
23966
+ * change post-create — so omitting it from drift is also semantically
23967
+ * correct.
23968
+ */
23969
+ getDriftUnknownPaths() {
23970
+ return ["CloudFrontOriginAccessIdentityConfig.CallerReference"];
23971
+ }
23909
23972
  /**
23910
23973
  * Adopt an existing CloudFront Origin Access Identity into cdkd state.
23911
23974
  *
@@ -26549,7 +26612,8 @@ var ELBv2Provider = class {
26549
26612
  async updateTargetGroup(logicalId, physicalId, resourceType, properties, previousProperties) {
26550
26613
  this.logger.debug(`Updating TargetGroup ${logicalId}: ${physicalId}`);
26551
26614
  try {
26552
- const matcher = properties["Matcher"];
26615
+ const rawMatcher = properties["Matcher"];
26616
+ const matcher = rawMatcher && (rawMatcher.HttpCode !== void 0 || rawMatcher.GrpcCode !== void 0) ? rawMatcher : void 0;
26553
26617
  await this.getClient().send(
26554
26618
  new ModifyTargetGroupCommand({
26555
26619
  TargetGroupArn: physicalId,
@@ -28527,7 +28591,7 @@ var Route53Provider = class {
28527
28591
  }
28528
28592
  }
28529
28593
  const setIdentifier = properties["SetIdentifier"];
28530
- if (setIdentifier) {
28594
+ if (setIdentifier !== void 0) {
28531
28595
  recordSet.SetIdentifier = setIdentifier;
28532
28596
  }
28533
28597
  const weight = properties["Weight"];
@@ -28535,11 +28599,11 @@ var Route53Provider = class {
28535
28599
  recordSet.Weight = Number(weight);
28536
28600
  }
28537
28601
  const region = properties["Region"];
28538
- if (region) {
28602
+ if (region !== void 0) {
28539
28603
  recordSet.Region = region;
28540
28604
  }
28541
28605
  const failover = properties["Failover"];
28542
- if (failover) {
28606
+ if (failover !== void 0) {
28543
28607
  recordSet.Failover = failover;
28544
28608
  }
28545
28609
  const multiValueAnswer = properties["MultiValueAnswer"];
@@ -28547,15 +28611,15 @@ var Route53Provider = class {
28547
28611
  recordSet.MultiValueAnswer = typeof multiValueAnswer === "string" ? multiValueAnswer.toLowerCase() === "true" : multiValueAnswer;
28548
28612
  }
28549
28613
  const healthCheckId = properties["HealthCheckId"];
28550
- if (healthCheckId) {
28614
+ if (healthCheckId !== void 0) {
28551
28615
  recordSet.HealthCheckId = healthCheckId;
28552
28616
  }
28553
28617
  const geoLocation = properties["GeoLocation"];
28554
28618
  if (geoLocation) {
28555
28619
  recordSet.GeoLocation = {
28556
- ...geoLocation["ContinentCode"] ? { ContinentCode: geoLocation["ContinentCode"] } : {},
28557
- ...geoLocation["CountryCode"] ? { CountryCode: geoLocation["CountryCode"] } : {},
28558
- ...geoLocation["SubdivisionCode"] ? { SubdivisionCode: geoLocation["SubdivisionCode"] } : {}
28620
+ ...geoLocation["ContinentCode"] !== void 0 ? { ContinentCode: geoLocation["ContinentCode"] } : {},
28621
+ ...geoLocation["CountryCode"] !== void 0 ? { CountryCode: geoLocation["CountryCode"] } : {},
28622
+ ...geoLocation["SubdivisionCode"] !== void 0 ? { SubdivisionCode: geoLocation["SubdivisionCode"] } : {}
28559
28623
  };
28560
28624
  }
28561
28625
  return recordSet;
@@ -28785,14 +28849,16 @@ var Route53Provider = class {
28785
28849
  }
28786
28850
  result["HostedZoneConfig"] = cfg;
28787
28851
  }
28788
- result["VPCs"] = (resp.VPCs ?? []).map((v) => {
28789
- const out = {};
28790
- if (v.VPCId !== void 0)
28791
- out["VPCId"] = v.VPCId;
28792
- if (v.VPCRegion !== void 0)
28793
- out["VPCRegion"] = v.VPCRegion;
28794
- return out;
28795
- });
28852
+ if (resp.HostedZone.Config?.PrivateZone === true) {
28853
+ result["VPCs"] = (resp.VPCs ?? []).map((v) => {
28854
+ const out = {};
28855
+ if (v.VPCId !== void 0)
28856
+ out["VPCId"] = v.VPCId;
28857
+ if (v.VPCRegion !== void 0)
28858
+ out["VPCRegion"] = v.VPCRegion;
28859
+ return out;
28860
+ });
28861
+ }
28796
28862
  const idTail = physicalId.replace(/^\/hostedzone\//, "");
28797
28863
  try {
28798
28864
  const tagsResp = await this.getClient().send(
@@ -28837,9 +28903,11 @@ var Route53Provider = class {
28837
28903
  Name: name,
28838
28904
  Type: type
28839
28905
  };
28840
- if (recordSet.TTL !== void 0)
28841
- result["TTL"] = recordSet.TTL;
28842
- result["ResourceRecords"] = (recordSet.ResourceRecords ?? []).map((r) => r.Value).filter((v) => typeof v === "string");
28906
+ if (!recordSet.AliasTarget) {
28907
+ if (recordSet.TTL !== void 0)
28908
+ result["TTL"] = recordSet.TTL;
28909
+ result["ResourceRecords"] = (recordSet.ResourceRecords ?? []).map((r) => r.Value).filter((v) => typeof v === "string");
28910
+ }
28843
28911
  if (recordSet.AliasTarget) {
28844
28912
  const at = {};
28845
28913
  if (recordSet.AliasTarget.HostedZoneId !== void 0) {
@@ -43669,7 +43737,7 @@ function reorderArgs(argv) {
43669
43737
  }
43670
43738
  async function main() {
43671
43739
  const program = new Command14();
43672
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.50.9");
43740
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.50.10");
43673
43741
  program.addCommand(createBootstrapCommand());
43674
43742
  program.addCommand(createSynthCommand());
43675
43743
  program.addCommand(createListCommand());