@go-to-k/cdkd 0.217.0 → 0.219.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/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { a as setAwsClients, i as resetAwsClients, r as getAwsClients, t as AwsClients } from "./aws-clients-DWUnLza1.js";
3
- import { $ as CFN_TEMPLATE_URL_LIMIT, A as DagBuilder, B as getDockerCmd, C as CloudControlProvider, D as IntrinsicFunctionResolver, Dt as withErrorHandling, E as isTerminationProtectionPropagationError, Et as normalizeAwsError, F as AssetPublisher, Ft as generateResourceName, G as getLegacyStateBucketName, H as runDockerStreaming, I as stringifyValue, It as generateResourceNameWithFallback, J as resolveSkipPrefix, K as resolveApp, L as WorkGraph, Lt as withSkipPrefix, M as LockManager, Mt as getLiveRenderer, N as S3StateBackend, Nt as PATTERN_B_NAME_PROPERTIES, O as applyRoleArnIfSet, P as shouldRetainResource, Pt as PATTERN_B_RESOURCE_TYPES, Q as CFN_TEMPLATE_BODY_LIMIT, R as buildDockerImage, Rt as withStackName, S as findActionableSilentDrops, T as disableInstanceApiTermination, U as Synthesizer, V as runDockerForeground, W as getDefaultStateBucketName, X as resolveStateBucketWithDefaultAndSource, Y as resolveStateBucketWithDefault, Z as warnDeprecatedNoPrefixCliFlag, _ as CDK_PATH_TAG, _t as ProvisioningError, a as withRetry, at as resolveBucketRegion, b as resolveExplicitPhysicalId, bt as StackHasActiveImportsError, c as formatResourceLine, d as gray, dt as LocalMigrateError, et as MIGRATE_TMP_PREFIX, f as green, ft as LocalStartServiceError, g as collectInlinePolicyNamesManagedBySiblings, gt as PartialFailureError, h as IAMRoleProvider, ht as NestedStackChildDirectDestroyError, i as withResourceDeadline, j as TemplateParser, jt as runStackBuffered, k as DiffCalculator, kt as getLogger, l as bold, m as yellow, mt as MissingCdkCliError, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as uploadCfnTemplate, o as isRetryableTransientError, p as red, q as resolveCaptureObservedState, r as DeployEngine, rt as AssemblyReader, s as IMPLICIT_DELETE_DEPENDENCIES, st as CdkdError, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as findLargeInlineResources, u as cyan, ut as LocalInvokeBuildError$1, v as matchesCdkPath, vt as ResourceTimeoutError, w as assertRegionMatch, x as ProviderRegistry, xt as StackTerminationProtectionError, y as normalizeAwsTagsToCfn, yt as ResourceUpdateNotSupportedError, z as formatDockerLoginError } from "./deploy-engine-UctzfQ8M.js";
3
+ import { $ as CFN_TEMPLATE_URL_LIMIT, A as DagBuilder, B as getDockerCmd, C as CloudControlProvider, D as IntrinsicFunctionResolver, Dt as withErrorHandling, E as isTerminationProtectionPropagationError, Et as normalizeAwsError, F as AssetPublisher, Ft as generateResourceName, G as getLegacyStateBucketName, H as runDockerStreaming, I as stringifyValue, It as generateResourceNameWithFallback, J as resolveSkipPrefix, K as resolveApp, L as WorkGraph, Lt as withSkipPrefix, M as LockManager, Mt as getLiveRenderer, N as S3StateBackend, Nt as PATTERN_B_NAME_PROPERTIES, O as applyRoleArnIfSet, P as shouldRetainResource, Pt as PATTERN_B_RESOURCE_TYPES, Q as CFN_TEMPLATE_BODY_LIMIT, R as buildDockerImage, Rt as withStackName, S as findActionableSilentDrops, T as disableInstanceApiTermination, U as Synthesizer, V as runDockerForeground, W as getDefaultStateBucketName, X as resolveStateBucketWithDefaultAndSource, Y as resolveStateBucketWithDefault, Z as warnDeprecatedNoPrefixCliFlag, _ as CDK_PATH_TAG, _t as ProvisioningError, a as withRetry, at as resolveBucketRegion, b as resolveExplicitPhysicalId, bt as StackHasActiveImportsError, c as formatResourceLine, d as gray, dt as LocalMigrateError, et as MIGRATE_TMP_PREFIX, f as green, ft as LocalStartServiceError, g as collectInlinePolicyNamesManagedBySiblings, gt as PartialFailureError, h as IAMRoleProvider, ht as NestedStackChildDirectDestroyError, i as withResourceDeadline, j as TemplateParser, jt as runStackBuffered, k as DiffCalculator, kt as getLogger, l as bold, m as yellow, mt as MissingCdkCliError, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as uploadCfnTemplate, o as isRetryableTransientError, p as red, q as resolveCaptureObservedState, r as DeployEngine, rt as AssemblyReader, s as IMPLICIT_DELETE_DEPENDENCIES, st as CdkdError, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as findLargeInlineResources, u as cyan, ut as LocalInvokeBuildError$1, v as matchesCdkPath, vt as ResourceTimeoutError, w as assertRegionMatch, x as ProviderRegistry, xt as StackTerminationProtectionError, y as normalizeAwsTagsToCfn, yt as ResourceUpdateNotSupportedError, z as formatDockerLoginError } from "./deploy-engine-39cTZ1WD.js";
4
4
  import { AsyncLocalStorage } from "node:async_hooks";
5
5
  import { randomBytes, randomUUID } from "node:crypto";
6
6
  import { CopyObjectCommand, CreateBucketCommand, DeleteBucketAnalyticsConfigurationCommand, DeleteBucketCommand, DeleteBucketCorsCommand, DeleteBucketIntelligentTieringConfigurationCommand, DeleteBucketInventoryConfigurationCommand, DeleteBucketLifecycleCommand, DeleteBucketMetricsConfigurationCommand, DeleteBucketPolicyCommand, DeleteBucketReplicationCommand, DeleteBucketTaggingCommand, DeleteBucketWebsiteCommand, DeleteObjectsCommand, GetBucketAccelerateConfigurationCommand, GetBucketCorsCommand, GetBucketEncryptionCommand, GetBucketLifecycleConfigurationCommand, GetBucketLocationCommand, GetBucketLoggingCommand, GetBucketNotificationConfigurationCommand, GetBucketPolicyCommand, GetBucketReplicationCommand, GetBucketTaggingCommand, GetBucketVersioningCommand, GetBucketWebsiteCommand, GetObjectCommand, GetObjectLockConfigurationCommand, GetPublicAccessBlockCommand, HeadBucketCommand, ListBucketAnalyticsConfigurationsCommand, ListBucketIntelligentTieringConfigurationsCommand, ListBucketInventoryConfigurationsCommand, ListBucketMetricsConfigurationsCommand, ListBucketsCommand, ListDirectoryBucketsCommand, ListObjectVersionsCommand, ListObjectsV2Command, NoSuchBucket, PutBucketAccelerateConfigurationCommand, PutBucketAnalyticsConfigurationCommand, PutBucketCorsCommand, PutBucketEncryptionCommand, PutBucketIntelligentTieringConfigurationCommand, PutBucketInventoryConfigurationCommand, PutBucketLifecycleConfigurationCommand, PutBucketLoggingCommand, PutBucketMetricsConfigurationCommand, PutBucketNotificationConfigurationCommand, PutBucketOwnershipControlsCommand, PutBucketPolicyCommand, PutBucketReplicationCommand, PutBucketTaggingCommand, PutBucketVersioningCommand, PutBucketWebsiteCommand, PutObjectCommand, PutObjectLockConfigurationCommand, PutPublicAccessBlockCommand, S3Client, S3ServiceException } from "@aws-sdk/client-s3";
@@ -9,7 +9,7 @@ import { CreateQueueCommand, DeleteQueueCommand, GetQueueAttributesCommand, GetQ
9
9
  import { CreateTopicCommand, DeleteTopicCommand, GetSubscriptionAttributesCommand, GetTopicAttributesCommand, ListTagsForResourceCommand, ListTopicsCommand, NotFoundException, SNSClient, SetTopicAttributesCommand, SubscribeCommand, TagResourceCommand, UnsubscribeCommand, UntagResourceCommand } from "@aws-sdk/client-sns";
10
10
  import { AddPermissionCommand, CreateEventSourceMappingCommand, CreateFunctionCommand, CreateFunctionUrlConfigCommand, DeleteEventSourceMappingCommand, DeleteFunctionCommand, DeleteFunctionConcurrencyCommand, DeleteFunctionUrlConfigCommand, DeleteLayerVersionCommand, GetEventSourceMappingCommand, GetFunctionCommand, GetFunctionConcurrencyCommand, GetFunctionRecursionConfigCommand, GetFunctionUrlConfigCommand, GetLayerVersionByArnCommand, GetPolicyCommand as GetPolicyCommand$1, LambdaClient, ListFunctionsCommand, ListLayersCommand, ListTagsCommand, PublishLayerVersionCommand, PutFunctionConcurrencyCommand, PutFunctionRecursionConfigCommand, RemovePermissionCommand, ResourceNotFoundException, TagResourceCommand as TagResourceCommand$1, UntagResourceCommand as UntagResourceCommand$1, UpdateEventSourceMappingCommand, UpdateFunctionCodeCommand, UpdateFunctionConfigurationCommand, UpdateFunctionUrlConfigCommand, waitUntilFunctionUpdatedV2 } from "@aws-sdk/client-lambda";
11
11
  import { AssumeRoleCommand, GetCallerIdentityCommand, STSClient } from "@aws-sdk/client-sts";
12
- import { AssociateRouteTableCommand, AttachInternetGatewayCommand, AuthorizeSecurityGroupEgressCommand, AuthorizeSecurityGroupIngressCommand, CreateInternetGatewayCommand, CreateNatGatewayCommand, CreateNetworkAclCommand, CreateNetworkAclEntryCommand, CreateRouteCommand, CreateRouteTableCommand, CreateSecurityGroupCommand, CreateSubnetCommand, CreateTagsCommand, CreateVpcCommand, DeleteInternetGatewayCommand, DeleteNatGatewayCommand, DeleteNetworkAclCommand, DeleteNetworkAclEntryCommand, DeleteNetworkInterfaceCommand, DeleteRouteCommand, DeleteRouteTableCommand, DeleteSecurityGroupCommand, DeleteSubnetCommand, DeleteTagsCommand, DeleteVpcCommand, DescribeAvailabilityZonesCommand, DescribeInstanceAttributeCommand, DescribeInstancesCommand, DescribeInternetGatewaysCommand, DescribeNatGatewaysCommand, DescribeNetworkAclsCommand, DescribeNetworkInterfacesCommand, DescribeRouteTablesCommand, DescribeSecurityGroupsCommand, DescribeSubnetsCommand, DescribeVolumesCommand, DescribeVpcAttributeCommand, DescribeVpcsCommand, DetachInternetGatewayCommand, DisassociateRouteTableCommand, EC2Client, ModifySubnetAttributeCommand, ModifyVpcAttributeCommand, ReplaceNetworkAclAssociationCommand, RevokeSecurityGroupEgressCommand, RevokeSecurityGroupIngressCommand, RunInstancesCommand, TerminateInstancesCommand, waitUntilInstanceRunning, waitUntilInstanceTerminated, waitUntilNatGatewayAvailable, waitUntilNatGatewayDeleted } from "@aws-sdk/client-ec2";
12
+ import { AssociateRouteTableCommand, AttachInternetGatewayCommand, AuthorizeSecurityGroupEgressCommand, AuthorizeSecurityGroupIngressCommand, CreateInternetGatewayCommand, CreateNatGatewayCommand, CreateNetworkAclCommand, CreateNetworkAclEntryCommand, CreateRouteCommand, CreateRouteTableCommand, CreateSecurityGroupCommand, CreateSubnetCommand, CreateTagsCommand, CreateVpcCommand, DeleteInternetGatewayCommand, DeleteNatGatewayCommand, DeleteNetworkAclCommand, DeleteNetworkAclEntryCommand, DeleteNetworkInterfaceCommand, DeleteRouteCommand, DeleteRouteTableCommand, DeleteSecurityGroupCommand, DeleteSubnetCommand, DeleteTagsCommand, DeleteVpcCommand, DescribeAvailabilityZonesCommand, DescribeInstanceAttributeCommand, DescribeInstanceCreditSpecificationsCommand, DescribeInstancesCommand, DescribeInternetGatewaysCommand, DescribeNatGatewaysCommand, DescribeNetworkAclsCommand, DescribeNetworkInterfacesCommand, DescribeRouteTablesCommand, DescribeSecurityGroupsCommand, DescribeSubnetsCommand, DescribeVolumesCommand, DescribeVpcAttributeCommand, DescribeVpcsCommand, DetachInternetGatewayCommand, DisassociateRouteTableCommand, EC2Client, ModifyInstanceAttributeCommand, ModifyInstanceCreditSpecificationCommand, ModifyInstanceMetadataOptionsCommand, ModifySubnetAttributeCommand, ModifyVpcAttributeCommand, MonitorInstancesCommand, ReplaceNetworkAclAssociationCommand, RevokeSecurityGroupEgressCommand, RevokeSecurityGroupIngressCommand, RunInstancesCommand, TerminateInstancesCommand, UnmonitorInstancesCommand, waitUntilInstanceRunning, waitUntilInstanceTerminated, waitUntilNatGatewayAvailable, waitUntilNatGatewayDeleted } from "@aws-sdk/client-ec2";
13
13
  import { CreateTableCommand, DeleteResourcePolicyCommand, DeleteTableCommand, DescribeContinuousBackupsCommand, DescribeContributorInsightsCommand, DescribeKinesisStreamingDestinationCommand, DescribeTableCommand, DescribeTimeToLiveCommand, DisableKinesisStreamingDestinationCommand, DynamoDBClient, EnableKinesisStreamingDestinationCommand, GetResourcePolicyCommand, ListTablesCommand, ListTagsOfResourceCommand, PutResourcePolicyCommand, ResourceNotFoundException as ResourceNotFoundException$1, TagResourceCommand as TagResourceCommand$2, UntagResourceCommand as UntagResourceCommand$2, UpdateContinuousBackupsCommand, UpdateContributorInsightsCommand, UpdateTableCommand, UpdateTimeToLiveCommand } from "@aws-sdk/client-dynamodb";
14
14
  import { CloudFormationClient, CreateChangeSetCommand, DeleteChangeSetCommand, DeleteStackCommand, DescribeChangeSetCommand, DescribeStackEventsCommand, DescribeStackResourcesCommand, DescribeStacksCommand, DescribeTypeCommand, ExecuteChangeSetCommand, GetTemplateCommand, UpdateStackCommand, waitUntilChangeSetCreateComplete, waitUntilStackDeleteComplete, waitUntilStackImportComplete, waitUntilStackUpdateComplete } from "@aws-sdk/client-cloudformation";
15
15
  import { APIGatewayClient, CreateAuthorizerCommand, CreateDeploymentCommand, CreateResourceCommand, CreateStageCommand, DeleteAuthorizerCommand, DeleteDeploymentCommand, DeleteMethodCommand, DeleteResourceCommand, DeleteStageCommand, GetAccountCommand, GetAuthorizerCommand, GetDeploymentCommand, GetMethodCommand, GetResourceCommand, GetStageCommand, NotFoundException as NotFoundException$1, PutIntegrationCommand, PutIntegrationResponseCommand, PutMethodCommand, PutMethodResponseCommand, TagResourceCommand as TagResourceCommand$3, UntagResourceCommand as UntagResourceCommand$3, UpdateAccountCommand, UpdateAuthorizerCommand, UpdateMethodCommand, UpdateStageCommand } from "@aws-sdk/client-api-gateway";
@@ -13035,7 +13035,12 @@ var EC2Provider = class {
13035
13035
  "IamInstanceProfile",
13036
13036
  "UserData",
13037
13037
  "BlockDeviceMappings",
13038
- "Tags"
13038
+ "Tags",
13039
+ "DisableApiTermination",
13040
+ "MetadataOptions",
13041
+ "Monitoring",
13042
+ "EbsOptimized",
13043
+ "CreditSpecification"
13039
13044
  ])],
13040
13045
  ["AWS::EC2::NetworkAcl", new Set(["VpcId", "Tags"])],
13041
13046
  ["AWS::EC2::NetworkAclEntry", new Set([
@@ -13925,7 +13930,12 @@ var EC2Provider = class {
13925
13930
  Arn: iamInstanceProfile["Arn"],
13926
13931
  Name: iamInstanceProfile["Name"]
13927
13932
  } : void 0,
13928
- BlockDeviceMappings: this.buildBlockDeviceMappings(properties)
13933
+ BlockDeviceMappings: this.buildBlockDeviceMappings(properties),
13934
+ DisableApiTermination: this.coerceBool(properties["DisableApiTermination"]),
13935
+ EbsOptimized: this.coerceBool(properties["EbsOptimized"]),
13936
+ Monitoring: this.buildRunInstancesMonitoring(properties),
13937
+ MetadataOptions: this.buildMetadataOptions(properties),
13938
+ CreditSpecification: this.buildCreditSpecification(properties)
13929
13939
  }))).Instances?.[0];
13930
13940
  if (!instance?.InstanceId) throw new Error("No instance ID returned from RunInstances");
13931
13941
  const instanceId = instance.InstanceId;
@@ -13969,6 +13979,7 @@ var EC2Provider = class {
13969
13979
  this.logger.debug(`Updating EC2 Instance ${logicalId}: ${physicalId}`);
13970
13980
  try {
13971
13981
  await this.applyTagDiff(physicalId, previousProperties["Tags"], properties["Tags"]);
13982
+ await this.updateInstanceSecurityProps(physicalId, properties, previousProperties);
13972
13983
  const instance = (await this.ec2Client.send(new DescribeInstancesCommand({ InstanceIds: [physicalId] }))).Reservations?.[0]?.Instances?.[0];
13973
13984
  return {
13974
13985
  physicalId,
@@ -13987,6 +13998,57 @@ var EC2Provider = class {
13987
13998
  throw new ProvisioningError(`Failed to update EC2 Instance ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
13988
13999
  }
13989
14000
  }
14001
+ /**
14002
+ * Apply in-place modifications for four of the five security-focused
14003
+ * backfill props (#609). Each is diffed against `previousProperties` so a
14004
+ * no-drift round-trip (`update(state, state)`) issues zero mutating calls
14005
+ * (the `cdkd drift --revert` invariant). Each maps to a distinct EC2
14006
+ * modify API:
14007
+ * - DisableApiTermination -> ModifyInstanceAttribute
14008
+ * - Monitoring -> MonitorInstances / UnmonitorInstances
14009
+ * - MetadataOptions -> ModifyInstanceMetadataOptions
14010
+ * - CreditSpecification -> ModifyInstanceCreditSpecification
14011
+ * EbsOptimized is NOT here: it can only be changed on a STOPPED instance, so
14012
+ * an EbsOptimized change is routed to replacement (see ReplacementRules).
14013
+ */
14014
+ async updateInstanceSecurityProps(physicalId, properties, previousProperties) {
14015
+ const newDisableApiTermination = this.coerceBool(properties["DisableApiTermination"]);
14016
+ const oldDisableApiTermination = this.coerceBool(previousProperties["DisableApiTermination"]);
14017
+ if (newDisableApiTermination !== void 0 && newDisableApiTermination !== oldDisableApiTermination) await this.ec2Client.send(new ModifyInstanceAttributeCommand({
14018
+ InstanceId: physicalId,
14019
+ DisableApiTermination: { Value: newDisableApiTermination }
14020
+ }));
14021
+ const newMonitoring = this.coerceBool(properties["Monitoring"]);
14022
+ const oldMonitoring = this.coerceBool(previousProperties["Monitoring"]);
14023
+ if (newMonitoring !== void 0 && newMonitoring !== oldMonitoring) if (newMonitoring) await this.ec2Client.send(new MonitorInstancesCommand({ InstanceIds: [physicalId] }));
14024
+ else await this.ec2Client.send(new UnmonitorInstancesCommand({ InstanceIds: [physicalId] }));
14025
+ const newMetadata = this.buildMetadataOptions(properties);
14026
+ const oldMetadata = this.buildMetadataOptions(previousProperties);
14027
+ if (newMetadata !== void 0 && !this.shallowEqual(newMetadata, oldMetadata)) await this.ec2Client.send(new ModifyInstanceMetadataOptionsCommand({
14028
+ InstanceId: physicalId,
14029
+ ...newMetadata
14030
+ }));
14031
+ const newCpuCredits = this.readCpuCredits(properties["CreditSpecification"]);
14032
+ const oldCpuCredits = this.readCpuCredits(previousProperties["CreditSpecification"]);
14033
+ if (newCpuCredits !== void 0 && newCpuCredits !== oldCpuCredits) await this.ec2Client.send(new ModifyInstanceCreditSpecificationCommand({ InstanceCreditSpecifications: [{
14034
+ InstanceId: physicalId,
14035
+ CpuCredits: newCpuCredits
14036
+ }] }));
14037
+ }
14038
+ /**
14039
+ * Shallow value-equality for the small flat MetadataOptions request shape.
14040
+ * Treats `undefined` and an absent object as equal so the no-drift
14041
+ * round-trip produces zero modify calls.
14042
+ */
14043
+ shallowEqual(a, b) {
14044
+ if (b === void 0) return false;
14045
+ const ra = a;
14046
+ const rb = b;
14047
+ const keysA = Object.keys(ra);
14048
+ const keysB = Object.keys(rb);
14049
+ if (keysA.length !== keysB.length) return false;
14050
+ return keysA.every((k) => ra[k] === rb[k]);
14051
+ }
13990
14052
  async deleteInstance(logicalId, physicalId, resourceType, context) {
13991
14053
  this.logger.debug(`Terminating EC2 Instance ${logicalId}: ${physicalId}`);
13992
14054
  const removeProtection = context?.removeProtection === true;
@@ -14046,6 +14108,73 @@ var EC2Provider = class {
14046
14108
  });
14047
14109
  }
14048
14110
  /**
14111
+ * Coerce a CFn boolean-ish value (`true` | `false` | `"true"` | `"false"`)
14112
+ * into a real boolean, or `undefined` when the property is absent. CFn
14113
+ * templates can carry either the JSON boolean or its string form depending
14114
+ * on how the value was produced (a literal vs an intrinsic-resolved value),
14115
+ * so the wire boundary must normalize both. Returns `undefined` for absent
14116
+ * props so the field is omitted from the SDK input (AWS keeps its default)
14117
+ * rather than being forced to `false`.
14118
+ */
14119
+ coerceBool(value) {
14120
+ if (value === void 0 || value === null) return void 0;
14121
+ if (typeof value === "boolean") return value;
14122
+ if (value === "true") return true;
14123
+ if (value === "false") return false;
14124
+ }
14125
+ /**
14126
+ * Build the RunInstances `Monitoring` shape from the CFn `Monitoring`
14127
+ * boolean. AWS expects `{ Enabled: boolean }`; CFn carries a flat boolean.
14128
+ * Returns `undefined` when the prop is absent so the field is omitted.
14129
+ */
14130
+ buildRunInstancesMonitoring(properties) {
14131
+ const enabled = this.coerceBool(properties["Monitoring"]);
14132
+ if (enabled === void 0) return void 0;
14133
+ return { Enabled: enabled };
14134
+ }
14135
+ /**
14136
+ * Build the RunInstances `MetadataOptions` shape from the CFn
14137
+ * `MetadataOptions` object. CFn and the SDK share field names
14138
+ * (HttpTokens / HttpEndpoint / HttpPutResponseHopLimit / HttpProtocolIpv6 /
14139
+ * InstanceMetadataTags). `HttpPutResponseHopLimit` is numeric — CFn may
14140
+ * carry it as a string, so coerce at the wire boundary. Only emits keys the
14141
+ * template actually set so AWS keeps its defaults for the rest.
14142
+ */
14143
+ buildMetadataOptions(properties) {
14144
+ const opts = properties["MetadataOptions"];
14145
+ if (!opts || typeof opts !== "object") return void 0;
14146
+ const result = {};
14147
+ if (opts["HttpTokens"] !== void 0) result.HttpTokens = opts["HttpTokens"];
14148
+ if (opts["HttpEndpoint"] !== void 0) result.HttpEndpoint = opts["HttpEndpoint"];
14149
+ if (opts["HttpProtocolIpv6"] !== void 0) result.HttpProtocolIpv6 = opts["HttpProtocolIpv6"];
14150
+ if (opts["InstanceMetadataTags"] !== void 0) result.InstanceMetadataTags = opts["InstanceMetadataTags"];
14151
+ const hopLimit = opts["HttpPutResponseHopLimit"];
14152
+ if (hopLimit !== void 0 && hopLimit !== null) result.HttpPutResponseHopLimit = Number(hopLimit);
14153
+ return Object.keys(result).length > 0 ? result : void 0;
14154
+ }
14155
+ /**
14156
+ * Build the RunInstances `CreditSpecification` shape from the CFn
14157
+ * `CreditSpecification` object. CFn uses `CPUCredits` (capital CPU, the
14158
+ * canonical CDK `CfnInstance` emission); accept the SDK-style `CpuCredits`
14159
+ * too for hand-authored templates. Returns `undefined` when absent / empty.
14160
+ */
14161
+ buildCreditSpecification(properties) {
14162
+ const cpuCredits = this.readCpuCredits(properties["CreditSpecification"]);
14163
+ if (cpuCredits === void 0) return void 0;
14164
+ return { CpuCredits: cpuCredits };
14165
+ }
14166
+ /**
14167
+ * Extract the CpuCredits string from a CFn `CreditSpecification` object,
14168
+ * tolerating both the canonical `CPUCredits` key and the SDK-style
14169
+ * `CpuCredits` key. Shared by create() and update().
14170
+ */
14171
+ readCpuCredits(spec) {
14172
+ if (!spec || typeof spec !== "object") return void 0;
14173
+ const obj = spec;
14174
+ const raw = obj["CPUCredits"] ?? obj["CpuCredits"];
14175
+ return typeof raw === "string" ? raw : void 0;
14176
+ }
14177
+ /**
14049
14178
  * Build an IpPermission object from CloudFormation-style properties.
14050
14179
  *
14051
14180
  * The EC2 IpPermission shape is identical for ingress and egress; only the
@@ -14720,6 +14849,17 @@ var EC2Provider = class {
14720
14849
  if (instance.SourceDestCheck !== void 0) result["SourceDestCheck"] = instance.SourceDestCheck;
14721
14850
  const monitoringState = instance.Monitoring?.State;
14722
14851
  result["Monitoring"] = monitoringState === "enabled" || monitoringState === "pending";
14852
+ if (instance.EbsOptimized !== void 0) result["EbsOptimized"] = instance.EbsOptimized;
14853
+ const md = instance.MetadataOptions;
14854
+ if (md !== void 0) {
14855
+ const out = {};
14856
+ if (md.HttpTokens !== void 0) out["HttpTokens"] = md.HttpTokens;
14857
+ if (md.HttpPutResponseHopLimit !== void 0) out["HttpPutResponseHopLimit"] = md.HttpPutResponseHopLimit;
14858
+ if (md.HttpEndpoint !== void 0) out["HttpEndpoint"] = md.HttpEndpoint;
14859
+ if (md.HttpProtocolIpv6 !== void 0) out["HttpProtocolIpv6"] = md.HttpProtocolIpv6;
14860
+ if (md.InstanceMetadataTags !== void 0) out["InstanceMetadataTags"] = md.InstanceMetadataTags;
14861
+ if (Object.keys(out).length > 0) result["MetadataOptions"] = out;
14862
+ }
14723
14863
  if (instance.Placement?.Tenancy !== void 0) result["Tenancy"] = instance.Placement.Tenancy;
14724
14864
  if (instance.IamInstanceProfile?.Arn !== void 0) result["IamInstanceProfile"] = instance.IamInstanceProfile.Arn;
14725
14865
  const volumeIds = (instance.BlockDeviceMappings ?? []).filter((m) => m.Ebs?.VolumeId !== void 0).map((m) => m.Ebs.VolumeId);
@@ -14763,6 +14903,12 @@ var EC2Provider = class {
14763
14903
  } catch (err) {
14764
14904
  this.logger.debug(`DescribeInstanceAttribute(disableApiTermination, ${physicalId}) failed: ${err instanceof Error ? err.message : String(err)}`);
14765
14905
  }
14906
+ try {
14907
+ const cpuCredits = (await this.ec2Client.send(new DescribeInstanceCreditSpecificationsCommand({ InstanceIds: [physicalId] }))).InstanceCreditSpecifications?.[0]?.CpuCredits;
14908
+ if (cpuCredits !== void 0) result["CreditSpecification"] = { CPUCredits: cpuCredits };
14909
+ } catch (err) {
14910
+ this.logger.debug(`DescribeInstanceCreditSpecifications(${physicalId}) failed: ${err instanceof Error ? err.message : String(err)}`);
14911
+ }
14766
14912
  return result;
14767
14913
  }
14768
14914
  async readNetworkAclCurrentState(physicalId) {
@@ -20121,7 +20267,13 @@ var RDSProvider = class {
20121
20267
  "BackupRetentionPeriod",
20122
20268
  "DeletionProtection",
20123
20269
  "ServerlessV2ScalingConfiguration",
20124
- "Tags"
20270
+ "Tags",
20271
+ "ManageMasterUserPassword",
20272
+ "MasterUserSecret",
20273
+ "MonitoringRoleArn",
20274
+ "MonitoringInterval",
20275
+ "EnableIAMDatabaseAuthentication",
20276
+ "PubliclyAccessible"
20125
20277
  ])],
20126
20278
  ["AWS::RDS::DBInstance", new Set([
20127
20279
  "DBInstanceIdentifier",
@@ -20138,7 +20290,13 @@ var RDSProvider = class {
20138
20290
  "MasterUserPassword",
20139
20291
  "Port",
20140
20292
  "StorageEncrypted",
20141
- "VPCSecurityGroups"
20293
+ "VPCSecurityGroups",
20294
+ "KmsKeyId",
20295
+ "MasterUserSecret",
20296
+ "ManageMasterUserPassword",
20297
+ "MonitoringRoleArn",
20298
+ "MonitoringInterval",
20299
+ "EnableIAMDatabaseAuthentication"
20142
20300
  ])]
20143
20301
  ]);
20144
20302
  unhandledByDesign = new Map([["AWS::RDS::DBCluster", new Map([["DeleteAutomatedBackups", "cdkd hardcodes SkipFinalSnapshot=true on destroy; this CFn lifecycle flag has no equivalent on the runtime path"]])], ["AWS::RDS::DBInstance", new Map([
@@ -20246,6 +20404,7 @@ var RDSProvider = class {
20246
20404
  try {
20247
20405
  const tags = this.buildTags(properties);
20248
20406
  const serverlessV2Config = properties["ServerlessV2ScalingConfiguration"];
20407
+ const masterUserSecret = properties["MasterUserSecret"];
20249
20408
  if (!(await this.getClient().send(new CreateDBClusterCommand({
20250
20409
  DBClusterIdentifier: dbClusterIdentifier,
20251
20410
  Engine: properties["Engine"],
@@ -20260,6 +20419,12 @@ var RDSProvider = class {
20260
20419
  KmsKeyId: properties["KmsKeyId"],
20261
20420
  BackupRetentionPeriod: properties["BackupRetentionPeriod"] != null ? Number(properties["BackupRetentionPeriod"]) : void 0,
20262
20421
  DeletionProtection: properties["DeletionProtection"],
20422
+ ...properties["ManageMasterUserPassword"] !== void 0 && { ManageMasterUserPassword: properties["ManageMasterUserPassword"] },
20423
+ ...masterUserSecret?.KmsKeyId !== void 0 && { MasterUserSecretKmsKeyId: masterUserSecret.KmsKeyId },
20424
+ ...properties["MonitoringRoleArn"] !== void 0 && { MonitoringRoleArn: properties["MonitoringRoleArn"] },
20425
+ ...properties["MonitoringInterval"] !== void 0 && { MonitoringInterval: Number(properties["MonitoringInterval"]) },
20426
+ ...properties["EnableIAMDatabaseAuthentication"] !== void 0 && { EnableIAMDatabaseAuthentication: properties["EnableIAMDatabaseAuthentication"] },
20427
+ ...properties["PubliclyAccessible"] !== void 0 && { PubliclyAccessible: properties["PubliclyAccessible"] },
20263
20428
  ...serverlessV2Config && { ServerlessV2ScalingConfiguration: {
20264
20429
  MinCapacity: serverlessV2Config.MinCapacity,
20265
20430
  MaxCapacity: serverlessV2Config.MaxCapacity
@@ -20315,6 +20480,7 @@ var RDSProvider = class {
20315
20480
  const hasServerlessV2 = serverlessV2Config !== void 0 && (serverlessV2Config.MinCapacity !== void 0 || serverlessV2Config.MaxCapacity !== void 0);
20316
20481
  const vpcSgIds = properties["VpcSecurityGroupIds"];
20317
20482
  const sendVpcSgIds = vpcSgIds !== void 0 && vpcSgIds.length > 0;
20483
+ const masterUserSecret = properties["MasterUserSecret"];
20318
20484
  await this.getClient().send(new ModifyDBClusterCommand({
20319
20485
  DBClusterIdentifier: physicalId,
20320
20486
  EngineVersion: properties["EngineVersion"],
@@ -20323,6 +20489,11 @@ var RDSProvider = class {
20323
20489
  ...sendVpcSgIds && { VpcSecurityGroupIds: vpcSgIds },
20324
20490
  MasterUserPassword: properties["MasterUserPassword"],
20325
20491
  Port: properties["Port"] != null ? Number(properties["Port"]) : void 0,
20492
+ ...properties["ManageMasterUserPassword"] !== void 0 && { ManageMasterUserPassword: properties["ManageMasterUserPassword"] },
20493
+ ...masterUserSecret?.KmsKeyId !== void 0 && { MasterUserSecretKmsKeyId: masterUserSecret.KmsKeyId },
20494
+ ...properties["MonitoringRoleArn"] !== void 0 && { MonitoringRoleArn: properties["MonitoringRoleArn"] },
20495
+ ...properties["MonitoringInterval"] !== void 0 && { MonitoringInterval: Number(properties["MonitoringInterval"]) },
20496
+ ...properties["EnableIAMDatabaseAuthentication"] !== void 0 && { EnableIAMDatabaseAuthentication: properties["EnableIAMDatabaseAuthentication"] },
20326
20497
  ...hasServerlessV2 && { ServerlessV2ScalingConfiguration: {
20327
20498
  MinCapacity: serverlessV2Config.MinCapacity,
20328
20499
  MaxCapacity: serverlessV2Config.MaxCapacity
@@ -20385,6 +20556,7 @@ var RDSProvider = class {
20385
20556
  });
20386
20557
  try {
20387
20558
  const tags = this.buildTags(properties);
20559
+ const masterUserSecret = properties["MasterUserSecret"];
20388
20560
  if (!(await this.getClient().send(new CreateDBInstanceCommand({
20389
20561
  DBInstanceIdentifier: dbInstanceIdentifier,
20390
20562
  DBInstanceClass: properties["DBInstanceClass"],
@@ -20400,6 +20572,12 @@ var RDSProvider = class {
20400
20572
  ...properties["MasterUserPassword"] !== void 0 && { MasterUserPassword: properties["MasterUserPassword"] },
20401
20573
  ...properties["StorageEncrypted"] !== void 0 && { StorageEncrypted: properties["StorageEncrypted"] },
20402
20574
  ...properties["VPCSecurityGroups"] !== void 0 && { VpcSecurityGroupIds: properties["VPCSecurityGroups"] },
20575
+ ...properties["KmsKeyId"] !== void 0 && { KmsKeyId: properties["KmsKeyId"] },
20576
+ ...masterUserSecret?.KmsKeyId !== void 0 && { MasterUserSecretKmsKeyId: masterUserSecret.KmsKeyId },
20577
+ ...properties["ManageMasterUserPassword"] !== void 0 && { ManageMasterUserPassword: properties["ManageMasterUserPassword"] },
20578
+ ...properties["MonitoringRoleArn"] !== void 0 && { MonitoringRoleArn: properties["MonitoringRoleArn"] },
20579
+ ...properties["MonitoringInterval"] !== void 0 && { MonitoringInterval: Number(properties["MonitoringInterval"]) },
20580
+ ...properties["EnableIAMDatabaseAuthentication"] !== void 0 && { EnableIAMDatabaseAuthentication: properties["EnableIAMDatabaseAuthentication"] },
20403
20581
  ...tags.length > 0 && { Tags: tags }
20404
20582
  }))).DBInstance) throw new Error("CreateDBInstance did not return DBInstance");
20405
20583
  this.logger.debug(`Successfully created DBInstance ${logicalId}: ${dbInstanceIdentifier}`);
@@ -20425,6 +20603,7 @@ var RDSProvider = class {
20425
20603
  const newEngineVersion = properties["EngineVersion"];
20426
20604
  const prevEngineVersion = previousProperties["EngineVersion"];
20427
20605
  const allowMajorVersionUpgrade = newEngineVersion !== void 0 && newEngineVersion !== prevEngineVersion && prevEngineVersion !== void 0 && newEngineVersion.split(".")[0] !== prevEngineVersion.split(".")[0];
20606
+ const masterUserSecret = properties["MasterUserSecret"];
20428
20607
  await this.getClient().send(new ModifyDBInstanceCommand({
20429
20608
  DBInstanceIdentifier: physicalId,
20430
20609
  DBInstanceClass: properties["DBInstanceClass"],
@@ -20438,7 +20617,12 @@ var RDSProvider = class {
20438
20617
  },
20439
20618
  ...properties["Port"] !== void 0 && { DBPortNumber: Number(properties["Port"]) },
20440
20619
  ...properties["MasterUserPassword"] !== void 0 && { MasterUserPassword: properties["MasterUserPassword"] },
20441
- ...properties["VPCSecurityGroups"] !== void 0 && { VpcSecurityGroupIds: properties["VPCSecurityGroups"] }
20620
+ ...properties["VPCSecurityGroups"] !== void 0 && { VpcSecurityGroupIds: properties["VPCSecurityGroups"] },
20621
+ ...masterUserSecret?.KmsKeyId !== void 0 && { MasterUserSecretKmsKeyId: masterUserSecret.KmsKeyId },
20622
+ ...properties["ManageMasterUserPassword"] !== void 0 && { ManageMasterUserPassword: properties["ManageMasterUserPassword"] },
20623
+ ...properties["MonitoringRoleArn"] !== void 0 && { MonitoringRoleArn: properties["MonitoringRoleArn"] },
20624
+ ...properties["MonitoringInterval"] !== void 0 && { MonitoringInterval: Number(properties["MonitoringInterval"]) },
20625
+ ...properties["EnableIAMDatabaseAuthentication"] !== void 0 && { EnableIAMDatabaseAuthentication: properties["EnableIAMDatabaseAuthentication"] }
20442
20626
  }));
20443
20627
  this.logger.debug(`Successfully updated DBInstance ${logicalId}`);
20444
20628
  const described = await this.describeDBInstance(physicalId);
@@ -20679,6 +20863,11 @@ var RDSProvider = class {
20679
20863
  if (inst.StorageEncrypted !== void 0) result["StorageEncrypted"] = inst.StorageEncrypted;
20680
20864
  const sgIds = (inst.VpcSecurityGroups ?? []).map((sg) => sg.VpcSecurityGroupId).filter((id) => !!id);
20681
20865
  if (sgIds.length > 0) result["VPCSecurityGroups"] = sgIds;
20866
+ if (inst.KmsKeyId !== void 0) result["KmsKeyId"] = inst.KmsKeyId;
20867
+ if (inst.MonitoringRoleArn !== void 0) result["MonitoringRoleArn"] = inst.MonitoringRoleArn;
20868
+ if (inst.MonitoringInterval !== void 0) result["MonitoringInterval"] = inst.MonitoringInterval;
20869
+ if (inst.IAMDatabaseAuthenticationEnabled !== void 0) result["EnableIAMDatabaseAuthentication"] = inst.IAMDatabaseAuthenticationEnabled;
20870
+ if (inst.MasterUserSecret?.KmsKeyId !== void 0) result["MasterUserSecret"] = { KmsKeyId: inst.MasterUserSecret.KmsKeyId };
20682
20871
  if (inst.DBInstanceArn) await this.attachTags(result, inst.DBInstanceArn);
20683
20872
  return result;
20684
20873
  }
@@ -20704,6 +20893,11 @@ var RDSProvider = class {
20704
20893
  if (cluster.KmsKeyId !== void 0) result["KmsKeyId"] = cluster.KmsKeyId;
20705
20894
  if (cluster.BackupRetentionPeriod !== void 0) result["BackupRetentionPeriod"] = cluster.BackupRetentionPeriod;
20706
20895
  if (cluster.DeletionProtection !== void 0) result["DeletionProtection"] = cluster.DeletionProtection;
20896
+ if (cluster.MonitoringRoleArn !== void 0) result["MonitoringRoleArn"] = cluster.MonitoringRoleArn;
20897
+ if (cluster.MonitoringInterval !== void 0) result["MonitoringInterval"] = cluster.MonitoringInterval;
20898
+ if (cluster.IAMDatabaseAuthenticationEnabled !== void 0) result["EnableIAMDatabaseAuthentication"] = cluster.IAMDatabaseAuthenticationEnabled;
20899
+ if (cluster.PubliclyAccessible !== void 0) result["PubliclyAccessible"] = cluster.PubliclyAccessible;
20900
+ if (cluster.MasterUserSecret?.KmsKeyId !== void 0) result["MasterUserSecret"] = { KmsKeyId: cluster.MasterUserSecret.KmsKeyId };
20707
20901
  if (cluster.ServerlessV2ScalingConfiguration?.MinCapacity !== void 0 || cluster.ServerlessV2ScalingConfiguration?.MaxCapacity !== void 0) {
20708
20902
  const sc = {};
20709
20903
  if (cluster.ServerlessV2ScalingConfiguration?.MinCapacity !== void 0) sc["MinCapacity"] = cluster.ServerlessV2ScalingConfiguration.MinCapacity;
@@ -53328,7 +53522,7 @@ function reorderArgs(argv) {
53328
53522
  async function main() {
53329
53523
  installPipeCloseHandler();
53330
53524
  const program = new Command();
53331
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.217.0");
53525
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.219.0");
53332
53526
  program.addCommand(createBootstrapCommand());
53333
53527
  program.addCommand(createSynthCommand());
53334
53528
  program.addCommand(createListCommand());