@fjall/components-infrastructure 3.5.2 → 3.6.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.
Files changed (24) hide show
  1. package/dist/lib/patterns/aws/apexDomainPattern.js +12 -24
  2. package/dist/lib/patterns/aws/clickhouseDatabase.js +5 -2
  3. package/dist/lib/patterns/aws/delegatedDomainPattern.d.ts +6 -2
  4. package/dist/lib/patterns/aws/delegatedDomainPattern.js +28 -27
  5. package/dist/lib/patterns/aws/devSubstrate.js +28 -10
  6. package/dist/lib/patterns/aws/domainCertificateComposer.d.ts +48 -0
  7. package/dist/lib/patterns/aws/domainCertificateComposer.js +179 -0
  8. package/dist/lib/patterns/aws/domainValidation.js +95 -7
  9. package/dist/lib/patterns/aws/interfaces/domain.d.ts +33 -0
  10. package/dist/lib/resources/aws/compute/ecs.js +7 -3
  11. package/dist/lib/resources/aws/compute/ecsNetworking.d.ts +24 -2
  12. package/dist/lib/resources/aws/compute/ecsNetworking.js +136 -10
  13. package/dist/lib/resources/aws/compute/ecsServiceFactory.js +7 -1
  14. package/dist/lib/resources/aws/compute/ecsTypes.d.ts +37 -0
  15. package/dist/lib/resources/aws/compute/ecsValidation.js +45 -0
  16. package/dist/lib/resources/aws/compute/listenerRouting.d.ts +10 -1
  17. package/dist/lib/resources/aws/compute/listenerRouting.js +13 -1
  18. package/dist/lib/resources/aws/compute/persistentDataVolume.d.ts +7 -0
  19. package/dist/lib/resources/aws/compute/persistentDataVolume.js +6 -0
  20. package/dist/lib/resources/aws/networking/crossAccountDelegationRecord.d.ts +10 -0
  21. package/dist/lib/resources/aws/networking/crossAccountDelegationRecord.js +27 -1
  22. package/dist/lib/utils/domainTypes.d.ts +5 -11
  23. package/dist/lib/utils/domainTypes.js +7 -4
  24. package/package.json +4 -4
@@ -1,6 +1,7 @@
1
1
  import { type AutoScalingGroup } from "aws-cdk-lib/aws-autoscaling";
2
2
  import { Alarm } from "aws-cdk-lib/aws-cloudwatch";
3
3
  import { EbsDeviceVolumeType, Volume } from "aws-cdk-lib/aws-ec2";
4
+ import type { ITopic } from "aws-cdk-lib/aws-sns";
4
5
  import { Construct } from "constructs";
5
6
  import { LambdaFunction } from "./lambda.js";
6
7
  import { SQSQueue } from "../messaging/sqs.js";
@@ -35,6 +36,12 @@ export interface PersistentDataVolumeProps {
35
36
  iops?: number;
36
37
  /** Throughput in MiB/s (gp3 only). */
37
38
  throughputMbps?: number;
39
+ /**
40
+ * SNS topic `attachFailureAlarm` notifies. Omitted, the alarm still exists
41
+ * but fires no action — pass the stack's alerts topic or the failure is
42
+ * only visible to someone watching the CloudWatch console.
43
+ */
44
+ alarmTopic?: ITopic;
38
45
  }
39
46
  /**
40
47
  * Standalone EBS data volume + ASG `EC2_INSTANCE_LAUNCHING` hook that
@@ -4,6 +4,7 @@ import { fileURLToPath } from "node:url";
4
4
  import { Aws, Duration, RemovalPolicy, Size, Stack, Tags } from "aws-cdk-lib";
5
5
  import { DefaultResult, LifecycleTransition } from "aws-cdk-lib/aws-autoscaling";
6
6
  import { Alarm, ComparisonOperator, Metric, TreatMissingData } from "aws-cdk-lib/aws-cloudwatch";
7
+ import { SnsAction } from "aws-cdk-lib/aws-cloudwatch-actions";
7
8
  import { EbsDeviceVolumeType, Volume } from "aws-cdk-lib/aws-ec2";
8
9
  import { Effect, PolicyStatement } from "aws-cdk-lib/aws-iam";
9
10
  import { Code, Runtime } from "aws-cdk-lib/aws-lambda";
@@ -220,6 +221,11 @@ export class PersistentDataVolume extends Construct {
220
221
  comparisonOperator: ComparisonOperator.GREATER_THAN_OR_EQUAL_TO_THRESHOLD,
221
222
  treatMissingData: TreatMissingData.NOT_BREACHING
222
223
  });
224
+ if (props.alarmTopic !== undefined) {
225
+ const snsAction = new SnsAction(props.alarmTopic);
226
+ this.attachFailureAlarm.addAlarmAction(snsAction);
227
+ this.attachFailureAlarm.addOkAction(snsAction);
228
+ }
223
229
  }
224
230
  }
225
231
  function validatePersistentDataVolumeProps(props) {
@@ -6,6 +6,16 @@ export interface CrossAccountDelegationRecordProps {
6
6
  readonly delegatedZone: IHostedZone;
7
7
  readonly delegatedZoneName: string;
8
8
  readonly parentHostedZoneName: string;
9
+ /**
10
+ * Literal NS hostnames for an ADOPTED (imported) delegated zone. An
11
+ * imported `IHostedZone` exposes no `hostedZoneNameServers` attribute —
12
+ * CDK cannot know a live zone's NS at synth — so the custom resource
13
+ * would UPSERT an empty parent NS row. When set, a facade over the
14
+ * imported zone supplies these literals instead (see
15
+ * `withLiteralNameServers`). Omit for created zones, whose NS arrive as
16
+ * a CloudFormation attribute token.
17
+ */
18
+ readonly adoptedNameServers?: string[];
9
19
  readonly description?: string;
10
20
  readonly costAllocationEnvironment?: string;
11
21
  readonly costAllocationDomain?: string;
@@ -2,6 +2,29 @@ import { Construct } from "constructs";
2
2
  import { Tags } from "aws-cdk-lib";
3
3
  import { CrossAccountZoneDelegationRecord as CdkCrossAccountZoneDelegationRecord } from "aws-cdk-lib/aws-route53";
4
4
  import { applyCostAllocationTags } from "../../../utils/costAllocationTags.js";
5
+ /**
6
+ * CDK facade seam for zone adoption. `CrossAccountZoneDelegationRecord`
7
+ * reads exactly `zoneName` and `hostedZoneNameServers` off its
8
+ * `delegatedZone`; the facade delegates every access to the imported zone
9
+ * and overrides only `hostedZoneNameServers` with the user-declared
10
+ * literals. Methods are bound to the underlying zone so `this`-dependent
11
+ * internals behave identically. Pinned by the adopted-case synth snapshot
12
+ * in crossAccountDelegationRecord.test.ts — a CDK upgrade that starts
13
+ * reading more through this seam trips the pin.
14
+ */
15
+ function withLiteralNameServers(zone, nameServers) {
16
+ return new Proxy(zone, {
17
+ get(target, property) {
18
+ if (property === "hostedZoneNameServers") {
19
+ return [...nameServers];
20
+ }
21
+ const value = Reflect.get(target, property);
22
+ return typeof value === "function"
23
+ ? value.bind(target)
24
+ : value;
25
+ }
26
+ });
27
+ }
5
28
  // CDK's CrossAccountZoneDelegationRecord is a custom-resource Lambda: user-level tags
6
29
  // on the record itself may not reach AWS. We tag the wrapping Fjall Construct for
7
30
  // assertion purposes; create-path tags still propagate to child resources (Lambda,
@@ -14,9 +37,12 @@ export class CrossAccountDelegationRecord extends Construct {
14
37
  this.description =
15
38
  props.description ??
16
39
  `Fjall-managed cross-account delegation for ${props.delegatedZoneName} in parent ${props.parentHostedZoneName}`;
40
+ const delegatedZone = props.adoptedNameServers !== undefined
41
+ ? withLiteralNameServers(props.delegatedZone, props.adoptedNameServers)
42
+ : props.delegatedZone;
17
43
  this.record = new CdkCrossAccountZoneDelegationRecord(this, "Record", {
18
44
  delegationRole: props.delegationRole,
19
- delegatedZone: props.delegatedZone,
45
+ delegatedZone,
20
46
  parentHostedZoneName: props.parentHostedZoneName
21
47
  });
22
48
  Tags.of(this).add("fjall:description", this.description);
@@ -29,15 +29,9 @@ export declare function resolveRecordFqdn(recordName: string, zoneName: string):
29
29
  /**
30
30
  * Two-step deploy phase for constructs whose certificates must not be issued
31
31
  * before their zone's NS delegation has propagated (design R2 cert-hang
32
- * guard). `"zone"` synthesises the hosted zone (+ delegation record) only;
33
- * `"full"` additionally issues certificates. Shared by the delegated `Domain`
34
- * topology and `DevSubstrate` lowest common layer per generator-standards
35
- * § Infrastructure Layer Boundaries.
32
+ * guard) plus its omitted-phase default homed in `@fjall/util`
33
+ * (`infra/domainExports.ts`, the lowest common layer) and re-exported here
34
+ * so construct-side consumers keep their import path. deploy-core's
35
+ * `orchestration/domain/types.ts` re-exports the same declaration.
36
36
  */
37
- export type DomainDeployPhase = "zone" | "full";
38
- /**
39
- * Default deploy phase when `phase` is omitted — the complete build. The
40
- * two-step guard (R2) sets `"zone"` explicitly for step 1, so the safe
41
- * default for a single-shot deploy is everything.
42
- */
43
- export declare const DOMAIN_DEPLOY_DEFAULT_PHASE: DomainDeployPhase;
37
+ export { DOMAIN_DEPLOY_DEFAULT_PHASE, type DomainDeployPhase } from "@fjall/util";
@@ -58,8 +58,11 @@ export function resolveRecordFqdn(recordName, zoneName) {
58
58
  return `${recordName}.${zoneName}`;
59
59
  }
60
60
  /**
61
- * Default deploy phase when `phase` is omitted the complete build. The
62
- * two-step guard (R2) sets `"zone"` explicitly for step 1, so the safe
63
- * default for a single-shot deploy is everything.
61
+ * Two-step deploy phase for constructs whose certificates must not be issued
62
+ * before their zone's NS delegation has propagated (design R2 cert-hang
63
+ * guard) plus its omitted-phase default homed in `@fjall/util`
64
+ * (`infra/domainExports.ts`, the lowest common layer) and re-exported here
65
+ * so construct-side consumers keep their import path. deploy-core's
66
+ * `orchestration/domain/types.ts` re-exports the same declaration.
64
67
  */
65
- export const DOMAIN_DEPLOY_DEFAULT_PHASE = "full";
68
+ export { DOMAIN_DEPLOY_DEFAULT_PHASE } from "@fjall/util";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fjall/components-infrastructure",
3
- "version": "3.5.2",
3
+ "version": "3.6.1",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "type": "module",
6
6
  "bin": {
@@ -67,8 +67,8 @@
67
67
  },
68
68
  "dependencies": {
69
69
  "@aws-sdk/client-organizations": "^3.1038.0",
70
- "@fjall/generator": "^3.5.2",
71
- "@fjall/util": "^3.5.2",
70
+ "@fjall/generator": "^3.6.1",
71
+ "@fjall/util": "^3.6.1",
72
72
  "constructs": "^10.6.0"
73
73
  },
74
74
  "overrides": {
@@ -82,5 +82,5 @@
82
82
  "engines": {
83
83
  "node": ">=18.0.0"
84
84
  },
85
- "gitHead": "f59755647b2fd81ff692a3545e8e199d93c3bdf8"
85
+ "gitHead": "4bf3b77f9ef1472ca7afc6da552a225062ad602c"
86
86
  }