@fjall/components-infrastructure 0.96.0 → 0.99.3

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.
Files changed (209) hide show
  1. package/dist/lib/app.d.ts +68 -1
  2. package/dist/lib/app.js +113 -4
  3. package/dist/lib/config/aws/__t17fixture.d.ts +1 -0
  4. package/dist/lib/config/aws/__t17fixture.js +3 -0
  5. package/dist/lib/config/aws/__t17fixtureType.d.ts +2 -0
  6. package/dist/lib/config/aws/__t17fixtureType.js +1 -0
  7. package/dist/lib/config/aws/alarmTopic.js +8 -4
  8. package/dist/lib/config/aws/cloudTrail.js +1 -1
  9. package/dist/lib/config/aws/disasterRecovery.js +11 -16
  10. package/dist/lib/config/aws/ecrDefaultImage.d.ts +0 -1
  11. package/dist/lib/config/aws/ecrDefaultImage.js +13 -23
  12. package/dist/lib/config/aws/identityCenter.d.ts +10 -3
  13. package/dist/lib/config/aws/identityCenter.js +101 -37
  14. package/dist/lib/config/aws/identityCenterGroupMembership.js +8 -2
  15. package/dist/lib/config/aws/identityCenterMembership.d.ts +11 -0
  16. package/dist/lib/config/aws/identityCenterMembership.js +61 -0
  17. package/dist/lib/config/aws/index.d.ts +1 -1
  18. package/dist/lib/config/aws/index.js +1 -1
  19. package/dist/lib/config/aws/ipam.js +6 -11
  20. package/dist/lib/config/aws/oidcConnector.js +5 -1
  21. package/dist/lib/config/aws/scpPreset.js +4 -1
  22. package/dist/lib/patterns/aws/_eslint_test_tmp/leak.d.ts +1 -0
  23. package/dist/lib/patterns/aws/_eslint_test_tmp/leak.js +4 -0
  24. package/dist/lib/patterns/aws/account.js +2 -4
  25. package/dist/lib/patterns/aws/apexDomainPattern.js +10 -10
  26. package/dist/lib/patterns/aws/bastionFactory.d.ts +10 -0
  27. package/dist/lib/patterns/aws/bastionFactory.js +29 -0
  28. package/dist/lib/patterns/aws/buildkite.d.ts +2 -2
  29. package/dist/lib/patterns/aws/buildkite.js +51 -97
  30. package/dist/lib/patterns/aws/cdn.js +1 -1
  31. package/dist/lib/patterns/aws/clickhouseDatabase.d.ts +173 -0
  32. package/dist/lib/patterns/aws/clickhouseDatabase.js +601 -0
  33. package/dist/lib/patterns/aws/compute.d.ts +4 -6
  34. package/dist/lib/patterns/aws/compute.js +7 -13
  35. package/dist/lib/patterns/aws/computeEcs.d.ts +93 -5
  36. package/dist/lib/patterns/aws/computeEcs.js +867 -37
  37. package/dist/lib/patterns/aws/computeEcsTypes.d.ts +528 -25
  38. package/dist/lib/patterns/aws/computeEcsTypes.js +10 -0
  39. package/dist/lib/patterns/aws/computeLambda.d.ts +0 -5
  40. package/dist/lib/patterns/aws/computeLambda.js +1 -2
  41. package/dist/lib/patterns/aws/database.d.ts +50 -8
  42. package/dist/lib/patterns/aws/database.js +183 -27
  43. package/dist/lib/patterns/aws/domain.js +6 -4
  44. package/dist/lib/patterns/aws/index.d.ts +1 -0
  45. package/dist/lib/patterns/aws/index.js +1 -0
  46. package/dist/lib/patterns/aws/interfaces/compute.d.ts +7 -1
  47. package/dist/lib/patterns/aws/interfaces/database.d.ts +187 -8
  48. package/dist/lib/patterns/aws/interfaces/database.js +17 -3
  49. package/dist/lib/patterns/aws/interfaces/index.d.ts +2 -1
  50. package/dist/lib/patterns/aws/interfaces/index.js +3 -1
  51. package/dist/lib/patterns/aws/interfaces/messaging.d.ts +7 -0
  52. package/dist/lib/patterns/aws/interfaces/migrationContributor.d.ts +47 -0
  53. package/dist/lib/patterns/aws/interfaces/migrationContributor.js +9 -0
  54. package/dist/lib/patterns/aws/messaging.d.ts +66 -10
  55. package/dist/lib/patterns/aws/messaging.js +115 -20
  56. package/dist/lib/patterns/aws/network.js +16 -7
  57. package/dist/lib/patterns/aws/organisation.d.ts +4 -0
  58. package/dist/lib/patterns/aws/organisation.js +22 -4
  59. package/dist/lib/patterns/aws/storage.d.ts +1 -2
  60. package/dist/lib/patterns/aws/storage.js +3 -2
  61. package/dist/lib/patterns/aws/vpcPeer.js +3 -1
  62. package/dist/lib/resources/aws/analytics/clickhouse.js +18 -9
  63. package/dist/lib/resources/aws/analytics/clickhouseAlarms.d.ts +24 -9
  64. package/dist/lib/resources/aws/analytics/clickhouseAlarms.js +61 -10
  65. package/dist/lib/resources/aws/analytics/clickhouseConstants.d.ts +3 -3
  66. package/dist/lib/resources/aws/analytics/clickhouseConstants.js +3 -3
  67. package/dist/lib/resources/aws/analytics/clickhouseTypes.d.ts +7 -1
  68. package/dist/lib/resources/aws/analytics/clickhouseUserData.d.ts +1 -1
  69. package/dist/lib/resources/aws/analytics/clickhouseUserData.js +53 -3
  70. package/dist/lib/resources/aws/base/awsStack.js +4 -2
  71. package/dist/lib/resources/aws/compute/__tmp__/regression-shape.d.ts +2 -0
  72. package/dist/lib/resources/aws/compute/__tmp__/regression-shape.js +11 -0
  73. package/dist/lib/resources/aws/compute/asgInlineLifecycleHook.d.ts +52 -0
  74. package/dist/lib/resources/aws/compute/asgInlineLifecycleHook.js +60 -0
  75. package/dist/lib/resources/aws/compute/blockDeviceVolume.d.ts +8 -0
  76. package/dist/lib/resources/aws/compute/blockDeviceVolume.js +10 -0
  77. package/dist/lib/resources/aws/compute/ec2.d.ts +132 -12
  78. package/dist/lib/resources/aws/compute/ec2.js +163 -23
  79. package/dist/lib/resources/aws/compute/ec2GracefulTerminationHandler.d.ts +41 -0
  80. package/dist/lib/resources/aws/compute/ec2GracefulTerminationHandler.js +194 -0
  81. package/dist/lib/resources/aws/compute/ec2GracefulTerminationLambda.source.cjs +458 -0
  82. package/dist/lib/resources/aws/compute/ecs.d.ts +27 -1
  83. package/dist/lib/resources/aws/compute/ecs.js +42 -2
  84. package/dist/lib/resources/aws/compute/ecsConstants.d.ts +9 -0
  85. package/dist/lib/resources/aws/compute/ecsConstants.js +16 -0
  86. package/dist/lib/resources/aws/compute/ecsImages.js +32 -20
  87. package/dist/lib/resources/aws/compute/ecsLifecycleHookMigration.d.ts +96 -0
  88. package/dist/lib/resources/aws/compute/ecsLifecycleHookMigration.js +113 -0
  89. package/dist/lib/resources/aws/compute/ecsNetworking.d.ts +2 -1
  90. package/dist/lib/resources/aws/compute/ecsNetworking.js +18 -6
  91. package/dist/lib/resources/aws/compute/ecsServiceFactory.d.ts +13 -4
  92. package/dist/lib/resources/aws/compute/ecsServiceFactory.js +155 -33
  93. package/dist/lib/resources/aws/compute/ecsTaskDefinition.d.ts +31 -1
  94. package/dist/lib/resources/aws/compute/ecsTaskDefinition.js +102 -6
  95. package/dist/lib/resources/aws/compute/ecsTypes.d.ts +173 -13
  96. package/dist/lib/resources/aws/compute/ecsValidation.d.ts +9 -0
  97. package/dist/lib/resources/aws/compute/ecsValidation.js +63 -0
  98. package/dist/lib/resources/aws/compute/index.d.ts +2 -0
  99. package/dist/lib/resources/aws/compute/index.js +2 -0
  100. package/dist/lib/resources/aws/compute/lambda.d.ts +7 -13
  101. package/dist/lib/resources/aws/compute/lambda.js +30 -38
  102. package/dist/lib/resources/aws/compute/lifecycleHookLambda.source.cjs +192 -0
  103. package/dist/lib/resources/aws/compute/persistentDataVolume.d.ts +104 -0
  104. package/dist/lib/resources/aws/compute/persistentDataVolume.js +245 -0
  105. package/dist/lib/resources/aws/compute/persistentDataVolumeLambda.source.cjs +398 -0
  106. package/dist/lib/resources/aws/compute/samApplication.d.ts +15 -0
  107. package/dist/lib/resources/aws/compute/samApplication.js +27 -0
  108. package/dist/lib/resources/aws/database/clickhouseConstants.d.ts +159 -0
  109. package/dist/lib/resources/aws/database/clickhouseConstants.js +181 -0
  110. package/dist/lib/resources/aws/database/clickhouseSchemas.d.ts +71 -0
  111. package/dist/lib/resources/aws/database/clickhouseSchemas.js +160 -0
  112. package/dist/lib/resources/aws/database/clickhouseSecurityGroup.d.ts +14 -0
  113. package/dist/lib/resources/aws/database/clickhouseSecurityGroup.js +23 -0
  114. package/dist/lib/resources/aws/database/clickhouseUserData.d.ts +69 -0
  115. package/dist/lib/resources/aws/database/clickhouseUserData.js +371 -0
  116. package/dist/lib/resources/aws/database/clickhouseXmlRenderer.d.ts +56 -0
  117. package/dist/lib/resources/aws/database/clickhouseXmlRenderer.js +112 -0
  118. package/dist/lib/resources/aws/database/rdsAurora.d.ts +8 -1
  119. package/dist/lib/resources/aws/database/rdsAurora.js +42 -32
  120. package/dist/lib/resources/aws/database/rdsAuroraGlobal.d.ts +15 -2
  121. package/dist/lib/resources/aws/database/rdsAuroraGlobal.js +39 -43
  122. package/dist/lib/resources/aws/database/rdsDefaults.d.ts +6 -0
  123. package/dist/lib/resources/aws/database/rdsDefaults.js +7 -1
  124. package/dist/lib/resources/aws/database/rdsHelpers.d.ts +3 -3
  125. package/dist/lib/resources/aws/database/rdsHelpers.js +1 -0
  126. package/dist/lib/resources/aws/database/rdsInstance.d.ts +8 -1
  127. package/dist/lib/resources/aws/database/rdsInstance.js +51 -34
  128. package/dist/lib/resources/aws/database/rdsProxyOutput.d.ts +1 -1
  129. package/dist/lib/resources/aws/database/rdsProxyOutput.js +1 -1
  130. package/dist/lib/resources/aws/iam/delegationRole.js +1 -1
  131. package/dist/lib/resources/aws/iam/identityCenter/groupMembership.d.ts +9 -0
  132. package/dist/lib/resources/aws/iam/identityCenter/groupMembership.js +12 -0
  133. package/dist/lib/resources/aws/iam/identityCenter/index.d.ts +1 -0
  134. package/dist/lib/resources/aws/iam/identityCenter/index.js +1 -0
  135. package/dist/lib/resources/aws/iam/identityCenter/permissionSet.d.ts +1 -0
  136. package/dist/lib/resources/aws/iam/identityCenter/permissionSet.js +1 -0
  137. package/dist/lib/resources/aws/logging/logGroup.d.ts +0 -8
  138. package/dist/lib/resources/aws/logging/logGroup.js +0 -11
  139. package/dist/lib/resources/aws/messaging/defaultEventBus.d.ts +7 -0
  140. package/dist/lib/resources/aws/messaging/defaultEventBus.js +21 -0
  141. package/dist/lib/resources/aws/messaging/eventBridgeRule.d.ts +96 -0
  142. package/dist/lib/resources/aws/messaging/eventBridgeRule.js +110 -0
  143. package/dist/lib/resources/aws/messaging/eventTargets.d.ts +84 -0
  144. package/dist/lib/resources/aws/messaging/eventTargets.js +152 -0
  145. package/dist/lib/resources/aws/messaging/eventbridge.d.ts +25 -2
  146. package/dist/lib/resources/aws/messaging/eventbridge.js +22 -10
  147. package/dist/lib/resources/aws/messaging/index.d.ts +5 -0
  148. package/dist/lib/resources/aws/messaging/index.js +2 -0
  149. package/dist/lib/resources/aws/messaging/schedule.d.ts +118 -0
  150. package/dist/lib/resources/aws/messaging/schedule.js +64 -0
  151. package/dist/lib/resources/aws/messaging/sns.d.ts +2 -1
  152. package/dist/lib/resources/aws/messaging/sqs.d.ts +2 -1
  153. package/dist/lib/resources/aws/messaging/subscription.d.ts +112 -0
  154. package/dist/lib/resources/aws/messaging/subscription.js +67 -0
  155. package/dist/lib/resources/aws/messaging/utils.d.ts +6 -0
  156. package/dist/lib/resources/aws/messaging/utils.js +10 -0
  157. package/dist/lib/resources/aws/monitoring/clickhouseAlarms.d.ts +60 -0
  158. package/dist/lib/resources/aws/monitoring/clickhouseAlarms.js +139 -0
  159. package/dist/lib/resources/aws/monitoring/index.d.ts +2 -0
  160. package/dist/lib/resources/aws/monitoring/index.js +2 -0
  161. package/dist/lib/resources/aws/monitoring/scheduleAlarms.d.ts +47 -0
  162. package/dist/lib/resources/aws/monitoring/scheduleAlarms.js +106 -0
  163. package/dist/lib/resources/aws/networking/crossAccountDelegationRecord.js +6 -4
  164. package/dist/lib/resources/aws/networking/crossAccountReturnRoutes.js +17 -13
  165. package/dist/lib/resources/aws/networking/dnsRecord/dnsRecordBase.js +7 -5
  166. package/dist/lib/resources/aws/networking/domainCertificate.d.ts +2 -2
  167. package/dist/lib/resources/aws/networking/domainCertificate.js +6 -4
  168. package/dist/lib/resources/aws/networking/hostedZone.js +6 -5
  169. package/dist/lib/resources/aws/networking/serviceDiscovery.d.ts +96 -0
  170. package/dist/lib/resources/aws/networking/serviceDiscovery.js +96 -0
  171. package/dist/lib/resources/aws/networking/vpc.d.ts +4 -1
  172. package/dist/lib/resources/aws/networking/vpc.js +4 -1
  173. package/dist/lib/resources/aws/networking/vpcPeeringConnection.js +21 -3
  174. package/dist/lib/resources/aws/organisation/costAllocationTagActivator.d.ts +16 -5
  175. package/dist/lib/resources/aws/organisation/costAllocationTagActivator.js +17 -3
  176. package/dist/lib/resources/aws/organisation/index.d.ts +1 -1
  177. package/dist/lib/resources/aws/organisation/organisationPolicy.d.ts +2 -0
  178. package/dist/lib/resources/aws/organisation/organisationPolicy.js +3 -2
  179. package/dist/lib/resources/aws/secrets/secret.d.ts +7 -0
  180. package/dist/lib/resources/aws/secrets/secret.js +4 -3
  181. package/dist/lib/resources/aws/storage/bucketDeployment.d.ts +16 -0
  182. package/dist/lib/resources/aws/storage/bucketDeployment.js +17 -0
  183. package/dist/lib/resources/aws/storage/ecr.js +5 -5
  184. package/dist/lib/resources/aws/storage/index.d.ts +1 -0
  185. package/dist/lib/resources/aws/storage/index.js +1 -0
  186. package/dist/lib/resources/aws/storage/s3.js +10 -3
  187. package/dist/lib/resources/aws/utilities/customResource.js +18 -9
  188. package/dist/lib/synth_dump.d.ts +1 -0
  189. package/dist/lib/synth_dump.js +42 -0
  190. package/dist/lib/utils/cdkContext.d.ts +2 -0
  191. package/dist/lib/utils/cdkContext.js +4 -2
  192. package/dist/lib/utils/connections.js +6 -0
  193. package/dist/lib/utils/connector.d.ts +12 -0
  194. package/dist/lib/utils/costAllocationTags.d.ts +9 -0
  195. package/dist/lib/utils/costAllocationTags.js +11 -1
  196. package/dist/lib/utils/databaseTypes.d.ts +14 -0
  197. package/dist/lib/utils/getConfig.d.ts +2 -0
  198. package/dist/lib/utils/getConfig.js +2 -0
  199. package/dist/lib/utils/index.d.ts +1 -0
  200. package/dist/lib/utils/index.js +1 -0
  201. package/dist/lib/utils/manifestWriter.d.ts +6 -89
  202. package/dist/lib/utils/manifestWriter.js +36 -23
  203. package/dist/lib/utils/migrationVersionResolvers.d.ts +2 -0
  204. package/dist/lib/utils/migrationVersionResolvers.js +2 -0
  205. package/dist/lib/utils/orgConfigParser.js +2 -1
  206. package/dist/lib/utils/resolveAlertsTopic.d.ts +14 -0
  207. package/dist/lib/utils/resolveAlertsTopic.js +30 -0
  208. package/dist/lib/utils/validationLogger.js +6 -3
  209. package/package.json +22 -19
@@ -1,14 +1,15 @@
1
1
  import { Runtime } from "aws-cdk-lib/aws-lambda";
2
2
  import { isCompute, isEcsCompute, isLambdaCompute, isEc2Compute } from "./interfaces/compute.js";
3
3
  import { warnIfPropertiesIgnored } from "../../utils/validationLogger.js";
4
+ import { DEFAULT_ECS_FALLBACK_IMAGE, DEFAULT_EC2_INSTANCE_TYPE } from "../../resources/aws/compute/ecsConstants.js";
4
5
  // Import and re-export from per-pattern files
5
- import { EcsCompute, ECS_CAPACITY_PROVIDER_CONFIG, getEcsCapacityProviderConfig, ScalingType, validateEcsProps, buildContainerConfigs, resolveScalingConfig } from "./computeEcs.js";
6
+ import { EcsCompute, ECS_CAPACITY_PROVIDER_CONFIG, getEcsCapacityProviderConfig, ScalingType, validateEcsProps, buildContainerConfigs, expandMigrationsSugar, resolveScalingConfig } from "./computeEcs.js";
6
7
  import { LambdaCompute, resolveLambdaDeployment, Architecture, HttpMethod, InvokeMode } from "./computeLambda.js";
7
8
  import { Ec2Compute } from "./computeEc2.js";
8
9
  // Re-export everything from per-pattern files
9
10
  export {
10
11
  // ECS
11
- EcsCompute, ECS_CAPACITY_PROVIDER_CONFIG, getEcsCapacityProviderConfig, ScalingType, validateEcsProps, buildContainerConfigs, resolveScalingConfig,
12
+ EcsCompute, ECS_CAPACITY_PROVIDER_CONFIG, getEcsCapacityProviderConfig, ScalingType, validateEcsProps, buildContainerConfigs, expandMigrationsSugar, resolveScalingConfig,
12
13
  // Lambda
13
14
  LambdaCompute, resolveLambdaDeployment, Architecture, HttpMethod, InvokeMode,
14
15
  // EC2
@@ -36,14 +37,12 @@ export const COMPUTE_TYPE_CONFIG = {
36
37
  */
37
38
  export const COMPUTE_DEFAULTS = {
38
39
  EC2: {
39
- INSTANCE_TYPE: "t4g.micro",
40
+ INSTANCE_TYPE: DEFAULT_EC2_INSTANCE_TYPE,
40
41
  MIN_CAPACITY: 1,
41
42
  MAX_CAPACITY: 1
42
43
  },
43
44
  ECS: {
44
- /** AWS sample image used when no ECR repository is provided */
45
- FALLBACK_IMAGE: "amazon/amazon-ecs-sample",
46
- /** Default tag for ECR images */
45
+ FALLBACK_IMAGE: DEFAULT_ECS_FALLBACK_IMAGE,
47
46
  IMAGE_TAG: "latest"
48
47
  },
49
48
  LAMBDA: {
@@ -140,13 +139,8 @@ export class ComputeFactory {
140
139
  name: service.name,
141
140
  clusterName
142
141
  };
143
- // Include dockerfilePath if specified (metadata for CLI)
144
- if (service.dockerfilePath) {
145
- manifestService.dockerfilePath = service.dockerfilePath;
146
- }
147
- // Include dockerTarget if specified (metadata for CLI)
148
- if (service.dockerTarget) {
149
- manifestService.dockerTarget = service.dockerTarget;
142
+ if (service.docker !== undefined) {
143
+ manifestService.docker = service.docker;
150
144
  }
151
145
  // Find container port from first container with a port
152
146
  const containerWithPort = service.containers?.find((c) => c.port !== undefined);
@@ -1,13 +1,13 @@
1
- import { type ICluster, type IBaseService } from "aws-cdk-lib/aws-ecs";
1
+ import { type ICluster, type IBaseService, type TaskDefinition, type FargateTaskDefinition } from "aws-cdk-lib/aws-ecs";
2
2
  import { type Connections, type ISecurityGroup } from "aws-cdk-lib/aws-ec2";
3
- import { type IGrantable, Grant } from "aws-cdk-lib/aws-iam";
3
+ import { type IGrantable, type IRole, Grant } from "aws-cdk-lib/aws-iam";
4
4
  import { type IApplicationLoadBalancer, type ApplicationListener } from "aws-cdk-lib/aws-elasticloadbalancingv2";
5
5
  import { Construct } from "constructs";
6
6
  import { type IEcsCompute } from "./interfaces/compute.js";
7
7
  import EcsCluster, { type EcsClusterProps } from "../../resources/aws/compute/ecs.js";
8
8
  export { ScalingType } from "./computeEcsTypes.js";
9
- export type { EcsCapacityProvider, Ec2CapacityConfig, RemoteConnectionSpec, EcsCapacityProviderConfig, EcsContainerConfig, EcsScalingConfig, EcsClusterConfig, EcsRoutingConfig, EcsServiceConfig, EcsComputeProps } from "./computeEcsTypes.js";
10
- import { ScalingType, type EcsCapacityProviderConfig, type EcsCapacityProvider, type EcsScalingConfig, type EcsServiceConfig, type EcsComputeProps } from "./computeEcsTypes.js";
9
+ export type { EcsCapacityProvider, Ec2CapacityConfig, RemoteConnectionSpec, EcsCapacityProviderConfig, EcsContainerConfig, ContainerDependency, ContainerVolume, EcsScheduledTaskConfig, EcsLifecycleHookMigrationsConfig, EcsPostDeployMigrationsConfig, EcsHookMigrationsConfig, EcsMigrationsConfig, EcsMigrationsMode, EcsCircuitBreakerConfig, EcsScalingConfig, EcsClusterConfig, EcsRoutingConfig, EcsServiceConfig, EcsComputeProps } from "./computeEcsTypes.js";
10
+ import { ScalingType, type EcsCapacityProviderConfig, type EcsCapacityProvider, type EcsContainerConfig, type EcsScalingConfig, type EcsServiceConfig, type EcsComputeProps } from "./computeEcsTypes.js";
11
11
  export declare const ECS_CAPACITY_PROVIDER_CONFIG: Record<EcsCapacityProvider, EcsCapacityProviderConfig>;
12
12
  export declare function getEcsCapacityProviderConfig(provider: EcsCapacityProvider): EcsCapacityProviderConfig;
13
13
  /**
@@ -15,12 +15,40 @@ export declare function getEcsCapacityProviderConfig(provider: EcsCapacityProvid
15
15
  * Extracted for clarity and detail parity with database/network patterns.
16
16
  */
17
17
  export declare function validateEcsProps(props: EcsComputeProps): void;
18
+ /**
19
+ * Expand a service's `migrations` sugar into a synthetic init container plus
20
+ * auto-injected `dependsOn` entries on every other container.
21
+ *
22
+ * - Synthesises a non-essential container that runs the migration command and exits.
23
+ * - Inherits image / environment / secrets / secretsImport from the primary container
24
+ * (first container with a port, or first container if none have a port).
25
+ * - Auto-wires every other container to wait on the migrate container's `SUCCESS`,
26
+ * skipping containers that already declare the dependency to keep user overrides intact.
27
+ * - Throws on name collision when a user-defined container shares the migrate name.
28
+ *
29
+ * When `migrations.mode` is a lambda-hook variant (`"lifecycle-hook"` /
30
+ * `"post-deploy"`), this helper is a no-op: the task
31
+ * definition stays unmodified and the migration is run by a deployment lifecycle
32
+ * hook synthesised separately at the pattern layer.
33
+ *
34
+ * @internal Exported for testing only
35
+ */
36
+ export declare function expandMigrationsSugar(service: EcsServiceConfig, userContainers: EcsContainerConfig[] | undefined): EcsContainerConfig[];
18
37
  /**
19
38
  * Build container configurations for an ECS service.
20
39
  * Converts user-facing EcsContainerConfig to internal EcsClusterProps format.
40
+ *
41
+ * @param service Service config from EcsComputeProps.
42
+ * @param schemaVersionEnv Pre-resolved `{ EXPECTED_SCHEMA_VERSION: <ver> }`
43
+ * from a connected database's `migrations:` config, or
44
+ * `undefined` when the service has no migrated DB or
45
+ * opted out via `schemaGate: false`.
46
+ * @param annotationsScope Construct used as the source for synth-time
47
+ * warnings when the author has set `EXPECTED_SCHEMA_VERSION`
48
+ * themselves and the resolved value differs.
21
49
  * @internal Exported for testing only
22
50
  */
23
- export declare function buildContainerConfigs(service: EcsServiceConfig): EcsClusterProps["services"][number]["containers"];
51
+ export declare function buildContainerConfigs(service: EcsServiceConfig, schemaVersionEnv?: Record<string, string>, annotationsScope?: Construct): EcsClusterProps["services"][number]["containers"];
24
52
  /**
25
53
  * Resolved scaling configuration for an ECS service.
26
54
  * @internal Exported for testing only
@@ -44,7 +72,46 @@ export declare class EcsCompute extends Construct implements IEcsCompute {
44
72
  readonly computeType: "ecs";
45
73
  readonly connections: Connections;
46
74
  private readonly ecsCluster;
75
+ private readonly clusterId;
76
+ private readonly appName;
77
+ private readonly migrationTaskDefinitions;
47
78
  constructor(scope: Construct, id: string, props: EcsComputeProps);
79
+ /**
80
+ * Walks a service's `connections:` for a relational database carrying a
81
+ * `migrations:` config. Returns the schema-version gate env entries to
82
+ * thread into the service's containers, or `undefined` when the service is
83
+ * not gated.
84
+ *
85
+ * - `schemaGate: false` → returns `undefined` (auditable opt-out)
86
+ * - No migrated DB in connections → returns `undefined`
87
+ * - Exactly one migrated DB → returns `{ EXPECTED_SCHEMA_VERSION, EXPECTED_SCHEMA_VERSION_TOOL }`
88
+ * - Two or more migrated DBs → throws via `resolveMigrationDatabaseForService`
89
+ *
90
+ * Both envs always emit together. The tool sibling lets the runtime gate
91
+ * dispatch to the matching resolver (or refuse on unknown tool) instead of
92
+ * hardcoding one.
93
+ */
94
+ private resolveSchemaVersionEnv;
95
+ private materialiseScheduledTasks;
96
+ private buildScheduledTaskDefinition;
97
+ /**
98
+ * For each service whose `migrations.mode` is a lambda-hook variant
99
+ * (`"lifecycle-hook"` for PRE_SCALE_UP, `"post-deploy"` for POST_SCALE_UP),
100
+ * synthesise the Lambda + IAM role + log group that backs the deployment
101
+ * lifecycle hook. The init-container path is unaffected — services without
102
+ * `mode` (or with `mode: "init-container"`) still get the synthetic
103
+ * migrate container injected by `expandMigrationsSugar`.
104
+ */
105
+ private wireLifecycleHookMigrations;
106
+ /**
107
+ * Synthesise a dedicated migration task definition for a lifecycle-hook
108
+ * migration when `separateTaskDef` is set. Creates the migration's own
109
+ * execution + task roles, log group, security group (when `egressTo` is
110
+ * present, else reuses the service's SGs), and the Fargate task definition
111
+ * with the migration container baked in.
112
+ */
113
+ private synthesiseMigrationTaskDef;
114
+ private resolveMigrationSecrets;
48
115
  /** Get the ECS cluster. */
49
116
  getCluster(): ICluster;
50
117
  /** Get the Application Load Balancer if one was created. */
@@ -53,6 +120,14 @@ export declare class EcsCompute extends Construct implements IEcsCompute {
53
120
  getService(name: string): IBaseService | undefined;
54
121
  /** Get all services in the cluster. */
55
122
  getAllServices(): IBaseService[];
123
+ getTaskDefinition(serviceName: string): TaskDefinition | undefined;
124
+ /**
125
+ * Get the migration task definition for a service. Returns `undefined` when
126
+ * the service has no `migrations: { mode: "lifecycle-hook", separateTaskDef }`
127
+ * configured — escape hatch for callers that need to attach grants (e.g.
128
+ * `bucket.grantReadWrite(td.taskRole)`) to the migration task role.
129
+ */
130
+ getMigrationTaskDefinition(serviceName: string): FargateTaskDefinition | undefined;
56
131
  /** Get the security group for the cluster. */
57
132
  getSecurityGroup(): ISecurityGroup;
58
133
  /**
@@ -70,4 +145,17 @@ export declare class EcsCompute extends Construct implements IEcsCompute {
70
145
  * which are not known until runtime (tasks are ephemeral).
71
146
  */
72
147
  grantExecuteCommand(grantee: IGrantable): Grant;
148
+ /**
149
+ * Get the EC2 instance role for the cluster's underlying ASG. EC2-mode
150
+ * clusters return the ASG instance role; Fargate-only clusters return
151
+ * `undefined`. Use to attach S3 grants etc. that must reach the host
152
+ * process (D10 — single accessor; no separate `getAutoScalingGroup()`).
153
+ */
154
+ getInstanceRole(): IRole | undefined;
155
+ /**
156
+ * Get the underlying ASG's `autoScalingGroupName` token. String-only —
157
+ * D10 forbids exposing the ASG construct itself. Used by alarm helpers
158
+ * that need a CloudWatch dimension value.
159
+ */
160
+ getAutoScalingGroupName(): string | undefined;
73
161
  }