@fjall/components-infrastructure 0.94.1 → 0.96.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.
Files changed (67) hide show
  1. package/dist/lib/app.d.ts +25 -109
  2. package/dist/lib/app.js +37 -136
  3. package/dist/lib/patterns/aws/account.js +5 -4
  4. package/dist/lib/patterns/aws/computeEcs.d.ts +8 -397
  5. package/dist/lib/patterns/aws/computeEcs.js +13 -9
  6. package/dist/lib/patterns/aws/computeEcsTypes.d.ts +386 -0
  7. package/dist/lib/patterns/aws/computeEcsTypes.js +2 -0
  8. package/dist/lib/patterns/aws/domain.js +4 -5
  9. package/dist/lib/patterns/aws/index.d.ts +2 -0
  10. package/dist/lib/patterns/aws/index.js +2 -0
  11. package/dist/lib/patterns/aws/interfaces/compute.d.ts +6 -0
  12. package/dist/lib/patterns/aws/interfaces/connector.d.ts +1 -1
  13. package/dist/lib/patterns/aws/interfaces/connector.js +1 -1
  14. package/dist/lib/patterns/aws/interfaces/index.d.ts +2 -1
  15. package/dist/lib/patterns/aws/interfaces/index.js +1 -1
  16. package/dist/lib/patterns/aws/interfaces/vpcPeer.d.ts +7 -0
  17. package/dist/lib/patterns/aws/interfaces/vpcPeer.js +1 -0
  18. package/dist/lib/patterns/aws/organisation.js +2 -1
  19. package/dist/lib/patterns/aws/vpcPeer.d.ts +34 -0
  20. package/dist/lib/patterns/aws/vpcPeer.js +36 -0
  21. package/dist/lib/patterns/aws/vpcPeerAccepter.d.ts +29 -0
  22. package/dist/lib/patterns/aws/vpcPeerAccepter.js +196 -0
  23. package/dist/lib/resources/aws/analytics/clickhouse.js +10 -1
  24. package/dist/lib/resources/aws/analytics/clickhouseAlarms.d.ts +34 -0
  25. package/dist/lib/resources/aws/analytics/clickhouseAlarms.js +89 -0
  26. package/dist/lib/resources/aws/analytics/clickhouseConstants.d.ts +1 -1
  27. package/dist/lib/resources/aws/analytics/clickhouseConstants.js +3 -1
  28. package/dist/lib/resources/aws/analytics/clickhouseTypes.d.ts +6 -0
  29. package/dist/lib/resources/aws/analytics/clickhouseUserData.d.ts +1 -0
  30. package/dist/lib/resources/aws/analytics/clickhouseUserData.js +3 -2
  31. package/dist/lib/resources/aws/analytics/index.d.ts +2 -0
  32. package/dist/lib/resources/aws/analytics/index.js +1 -0
  33. package/dist/lib/resources/aws/compute/ecsRemoteConnections.d.ts +38 -0
  34. package/dist/lib/resources/aws/compute/ecsRemoteConnections.js +80 -0
  35. package/dist/lib/resources/aws/compute/ecsTaskDefinition.js +8 -0
  36. package/dist/lib/resources/aws/compute/ecsTypes.d.ts +7 -0
  37. package/dist/lib/resources/aws/iam/delegationRole.js +11 -4
  38. package/dist/lib/resources/aws/networking/crossAccountDelegationRecord.js +2 -1
  39. package/dist/lib/resources/aws/networking/crossAccountReturnRoutes.d.ts +40 -0
  40. package/dist/lib/resources/aws/networking/crossAccountReturnRoutes.js +154 -0
  41. package/dist/lib/resources/aws/networking/dnsRecord/dnsRecordBase.js +2 -1
  42. package/dist/lib/resources/aws/networking/domainCertificate.js +2 -1
  43. package/dist/lib/resources/aws/networking/hostedZone.js +2 -1
  44. package/dist/lib/resources/aws/networking/index.d.ts +3 -0
  45. package/dist/lib/resources/aws/networking/index.js +3 -0
  46. package/dist/lib/resources/aws/networking/vpc.js +6 -2
  47. package/dist/lib/resources/aws/networking/vpcPeeringAccepterRole.d.ts +18 -0
  48. package/dist/lib/resources/aws/networking/vpcPeeringAccepterRole.js +61 -0
  49. package/dist/lib/resources/aws/networking/vpcPeeringConnection.d.ts +49 -0
  50. package/dist/lib/resources/aws/networking/vpcPeeringConnection.js +88 -0
  51. package/dist/lib/utils/bastionFactory.d.ts +10 -0
  52. package/dist/lib/utils/bastionFactory.js +29 -0
  53. package/dist/lib/utils/capitaliseString.d.ts +1 -1
  54. package/dist/lib/utils/capitaliseString.js +1 -1
  55. package/dist/lib/utils/cdkContext.d.ts +8 -0
  56. package/dist/lib/utils/cdkContext.js +11 -0
  57. package/dist/lib/utils/connections.d.ts +7 -1
  58. package/dist/lib/utils/connections.js +15 -0
  59. package/dist/lib/utils/connector.d.ts +18 -2
  60. package/dist/lib/utils/connector.js +6 -1
  61. package/dist/lib/utils/costAllocationTags.d.ts +6 -0
  62. package/dist/lib/utils/costAllocationTags.js +6 -0
  63. package/dist/lib/utils/index.d.ts +3 -0
  64. package/dist/lib/utils/index.js +3 -0
  65. package/dist/lib/utils/vpcPeerInterface.d.ts +22 -0
  66. package/dist/lib/utils/vpcPeerInterface.js +1 -0
  67. package/package.json +4 -3
@@ -23,7 +23,7 @@
23
23
  */
24
24
  import { type IConnectable } from "aws-cdk-lib/aws-ec2";
25
25
  import { type IGrantable } from "aws-cdk-lib/aws-iam";
26
- import { type ConnectionSpec, type ConnectionResult } from "./connector.js";
26
+ import { type ConnectionSpec, type ConnectionResult, type IRemoteConnector } from "./connector.js";
27
27
  /**
28
28
  * Process connections from compute resources to data resources.
29
29
  *
@@ -44,3 +44,9 @@ import { type ConnectionSpec, type ConnectionResult } from "./connector.js";
44
44
  * );
45
45
  */
46
46
  export declare function processConnections(connections: ConnectionSpec[], grantee: IGrantable, connectable?: IConnectable): ConnectionResult[];
47
+ /**
48
+ * Build an env-vars connection result for a remote connector.
49
+ * Used by the cross-app VPC peering path — env vars are surfaced from SSM
50
+ * lookups upstream and merged into the consuming compute's container env.
51
+ */
52
+ export declare function buildEnvVarsResult(connector: IRemoteConnector, envVars: Record<string, string>): ConnectionResult;
@@ -142,6 +142,9 @@ export function processConnections(connections, grantee, connectable) {
142
142
  connectable.connections.allowToDefaultPort(resource);
143
143
  return buildSecurityGroupResult(resource);
144
144
  }
145
+ case "remote": {
146
+ return buildEnvVarsResult(resource, resource.environmentVariables);
147
+ }
145
148
  }
146
149
  }
147
150
  // Legacy IConnectable path
@@ -153,3 +156,15 @@ export function processConnections(connections, grantee, connectable) {
153
156
  throw new Error("Connection resource must be either an IConnector or IConnectable");
154
157
  });
155
158
  }
159
+ /**
160
+ * Build an env-vars connection result for a remote connector.
161
+ * Used by the cross-app VPC peering path — env vars are surfaced from SSM
162
+ * lookups upstream and merged into the consuming compute's container env.
163
+ */
164
+ export function buildEnvVarsResult(connector, envVars) {
165
+ return {
166
+ resource: connector,
167
+ connectionType: CONNECTION_TYPE.ENV_VARS,
168
+ environmentVariables: envVars
169
+ };
170
+ }
@@ -45,8 +45,9 @@ import { type IGrantable, type Grant } from "aws-cdk-lib/aws-iam";
45
45
  * - "queue": SQS queues
46
46
  * - "securityGroup": Resources with security groups (ECS, Lambda with VPC)
47
47
  * - "relational": RDS databases (uses security groups)
48
+ * - "remote": Cross-app resource exposed via VPC peering, surfaced as env vars
48
49
  */
49
- export type ConnectorType = "storage" | "dynamodb" | "queue" | "securityGroup" | "relational";
50
+ export type ConnectorType = "storage" | "dynamodb" | "queue" | "securityGroup" | "relational" | "remote";
50
51
  /**
51
52
  * Access level for storage and DynamoDB connectors.
52
53
  */
@@ -115,10 +116,20 @@ export interface ISecurityGroupConnector extends IConnector {
115
116
  /** The security group connections for this resource. */
116
117
  readonly connections: IConnectable["connections"];
117
118
  }
119
+ /**
120
+ * Remote connector interface.
121
+ * Represents a resource exposed by a peered app via VPC peering.
122
+ * Carries the env vars that should be injected into the consuming compute.
123
+ */
124
+ export interface IRemoteConnector extends IConnector {
125
+ readonly connectorType: "remote";
126
+ /** Env vars to inject (e.g. `{PREFIX}_HOST`, `{PREFIX}_PORT`). */
127
+ readonly environmentVariables: Record<string, string>;
128
+ }
118
129
  /**
119
130
  * Union type representing any connector interface.
120
131
  */
121
- export type AnyConnector = IStorageConnector | IDynamoDBConnector | IQueueConnector | ISecurityGroupConnector;
132
+ export type AnyConnector = IStorageConnector | IDynamoDBConnector | IQueueConnector | ISecurityGroupConnector | IRemoteConnector;
122
133
  /**
123
134
  * Connection configuration with explicit access level.
124
135
  * Use this to specify non-default access levels.
@@ -141,6 +152,7 @@ export type ConnectionSpec = IConnectable | AnyConnector | ConnectionConfig;
141
152
  export declare const CONNECTION_TYPE: {
142
153
  readonly SECURITY_GROUP: "securityGroup";
143
154
  readonly IAM: "iam";
155
+ readonly ENV_VARS: "envVars";
144
156
  };
145
157
  export type ConnectionType = (typeof CONNECTION_TYPE)[keyof typeof CONNECTION_TYPE];
146
158
  /**
@@ -154,6 +166,8 @@ export interface ConnectionResult {
154
166
  grant?: Grant;
155
167
  /** The type of connection that was made. */
156
168
  connectionType: ConnectionType;
169
+ /** Env vars to inject when connectionType is "envVars". */
170
+ environmentVariables?: Record<string, string>;
157
171
  }
158
172
  /** Check if a value is a valid ConnectionAccess. */
159
173
  export declare function isConnectionAccess(value: unknown): value is ConnectionAccess;
@@ -181,3 +195,5 @@ export declare function isDynamoDBConnector(connector: IConnector): connector is
181
195
  export declare function isQueueConnector(connector: IConnector): connector is IQueueConnector;
182
196
  /** Type guard for security group connectors (RDS, ECS). */
183
197
  export declare function isSecurityGroupConnector(connector: IConnector): connector is ISecurityGroupConnector;
198
+ /** Type guard for remote connectors (cross-app exposed resources). */
199
+ export declare function isRemoteConnector(connector: IConnector): connector is IRemoteConnector;
@@ -39,7 +39,8 @@
39
39
  /** Connection result types. */
40
40
  export const CONNECTION_TYPE = {
41
41
  SECURITY_GROUP: "securityGroup",
42
- IAM: "iam"
42
+ IAM: "iam",
43
+ ENV_VARS: "envVars"
43
44
  };
44
45
  const VALID_CONNECTION_ACCESS = [
45
46
  "read",
@@ -102,3 +103,7 @@ export function isSecurityGroupConnector(connector) {
102
103
  return (connector.connectorType === "securityGroup" ||
103
104
  connector.connectorType === "relational");
104
105
  }
106
+ /** Type guard for remote connectors (cross-app exposed resources). */
107
+ export function isRemoteConnector(connector) {
108
+ return connector.connectorType === "remote";
109
+ }
@@ -0,0 +1,6 @@
1
+ export declare const COST_ALLOCATION_TAGS: {
2
+ readonly ENVIRONMENT: "fjall:costAllocation:environment";
3
+ readonly SERVICE: "fjall:costAllocation:service";
4
+ readonly DOMAIN: "fjall:costAllocation:domain";
5
+ };
6
+ export declare const DEFAULT_COST_ALLOCATION_ENVIRONMENT: "management";
@@ -0,0 +1,6 @@
1
+ export const COST_ALLOCATION_TAGS = {
2
+ ENVIRONMENT: "fjall:costAllocation:environment",
3
+ SERVICE: "fjall:costAllocation:service",
4
+ DOMAIN: "fjall:costAllocation:domain"
5
+ };
6
+ export const DEFAULT_COST_ALLOCATION_ENVIRONMENT = "management";
@@ -1,6 +1,8 @@
1
1
  export * from "./backupTierMapping.js";
2
2
  export * from "./capitaliseString.js";
3
+ export * from "./cdkContext.js";
3
4
  export * from "./connections.js";
5
+ export * from "./connector.js";
4
6
  export * from "./databaseTypes.js";
5
7
  export * from "./getConfig.js";
6
8
  export * from "./removalPolicy.js";
@@ -8,5 +10,6 @@ export * from "./resourceNaming.js";
8
10
  export * from "./standardTagsAspect.js";
9
11
  export * from "./validationLogger.js";
10
12
  export * from "./env.js";
13
+ export * from "./vpcPeerInterface.js";
11
14
  export * from "./vpcUtils.js";
12
15
  export * from "./domainTypes.js";
@@ -1,6 +1,8 @@
1
1
  export * from "./backupTierMapping.js";
2
2
  export * from "./capitaliseString.js";
3
+ export * from "./cdkContext.js";
3
4
  export * from "./connections.js";
5
+ export * from "./connector.js";
4
6
  export * from "./databaseTypes.js";
5
7
  export * from "./getConfig.js";
6
8
  export * from "./removalPolicy.js";
@@ -8,5 +10,6 @@ export * from "./resourceNaming.js";
8
10
  export * from "./standardTagsAspect.js";
9
11
  export * from "./validationLogger.js";
10
12
  export * from "./env.js";
13
+ export * from "./vpcPeerInterface.js";
11
14
  export * from "./vpcUtils.js";
12
15
  export * from "./domainTypes.js";
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Canonical home for the `IVpcPeer` interface — placed in `utils/` so both
3
+ * `resources/` (the synth-time `resolveRemoteConnections` helper) and
4
+ * `patterns/` (the consumer-facing `RemoteConnectionSpec`) can import it
5
+ * without crossing the resources -> patterns layer boundary.
6
+ *
7
+ * `peerAppName` is typed as `string | undefined` to match the underlying
8
+ * `VpcPeeringConnection` construct, which accepts the prop optionally. The
9
+ * `VpcPeerFactory` always populates it, but consumers must still guard
10
+ * against `undefined` and CFN-token contamination at synth time (see
11
+ * `resolveRemoteConnections()` for the canonical guard).
12
+ */
13
+ export interface IVpcPeer {
14
+ /** Name of the remote Fjall app this peering targets. */
15
+ readonly peerAppName: string | undefined;
16
+ /**
17
+ * Organisation ID of the remote app, when known. Falls back to `"default"`
18
+ * during SSM path construction when undefined — mirroring the `VpcPeer`
19
+ * factory's existing behaviour.
20
+ */
21
+ readonly peerOrgId: string | undefined;
22
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fjall/components-infrastructure",
3
- "version": "0.94.1",
3
+ "version": "0.96.0",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "type": "module",
6
6
  "bin": {
@@ -54,7 +54,8 @@
54
54
  },
55
55
  "dependencies": {
56
56
  "@aws-sdk/client-organizations": "^3.997.0",
57
- "@fjall/util": "^0.94.1",
57
+ "@fjall/generator": "^0.96.0",
58
+ "@fjall/util": "^0.96.0",
58
59
  "cdk-time-sleep": "^1.0.0",
59
60
  "constructs": "^10.0.0",
60
61
  "uuid": "^10.0.0"
@@ -62,7 +63,7 @@
62
63
  "overrides": {
63
64
  "@smithy/core": "2.5.5"
64
65
  },
65
- "gitHead": "65d778bc6370a5becd761b367a482ca51e890f58",
66
+ "gitHead": "bfbd3625ab029ba77a6571630e0edb85f9d53380",
66
67
  "peerDependencies": {
67
68
  "aws-cdk": "^2.239.0",
68
69
  "aws-cdk-lib": "^2.239.0",