@aws/nx-plugin 0.82.1 → 0.83.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/LICENSE-THIRD-PARTY +34 -6
- package/package.json +1 -1
- package/src/infra/app/__snapshots__/generator.spec.ts.snap +4 -4
- package/src/py/fast-api/__snapshots__/generator.spec.ts.snap +148 -56
- package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +53 -3
- package/src/py/mcp-server/generator.js +1 -0
- package/src/py/mcp-server/generator.js.map +1 -1
- package/src/py/strands-agent/__snapshots__/generator.spec.ts.snap +53 -3
- package/src/py/strands-agent/generator.js +1 -0
- package/src/py/strands-agent/generator.js.map +1 -1
- package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +108 -50
- package/src/smithy/ts/api/generator.js +2 -0
- package/src/smithy/ts/api/generator.js.map +1 -1
- package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +256 -128
- package/src/trpc/backend/generator.js +2 -0
- package/src/trpc/backend/generator.js.map +1 -1
- package/src/ts/lambda-function/generator.js +2 -0
- package/src/ts/lambda-function/generator.js.map +1 -1
- package/src/ts/lib/vitest.js +2 -0
- package/src/ts/lib/vitest.js.map +1 -1
- package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +54 -3
- package/src/ts/mcp-server/generator.js +7 -1
- package/src/ts/mcp-server/generator.js.map +1 -1
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +372 -26
- package/src/ts/react-website/app/generator.js +5 -1
- package/src/ts/react-website/app/generator.js.map +1 -1
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +2 -0
- package/src/ts/strands-agent/__snapshots__/generator.spec.ts.snap +52 -3
- package/src/ts/strands-agent/generator.js +3 -1
- package/src/ts/strands-agent/generator.js.map +1 -1
- package/src/utils/__snapshots__/shared-constructs.spec.ts.snap +157 -5
- package/src/utils/agent-core-constructs/files/cdk/app/agent-core/__nameKebabCase__/__nameKebabCase__.ts.template +14 -0
- package/src/utils/agent-core-constructs/files/terraform/app/agent-core/__nameKebabCase__/__nameKebabCase__.tf.template +37 -2
- package/src/utils/agent-core-constructs/files/terraform/core/agent-core/runtime.tf.template +1 -1
- package/src/utils/api-constructs/files/cdk/app/apis/http/__apiNameKebabCase__.ts.template +19 -17
- package/src/utils/api-constructs/files/cdk/app/apis/rest/__apiNameKebabCase__.ts.template +28 -21
- package/src/utils/api-constructs/files/cdk/core/api/http/http-api.ts.template +4 -3
- package/src/utils/api-constructs/files/cdk/core/api/rest/rest-api.ts.template +24 -5
- package/src/utils/api-constructs/files/cdk/core/api/utils/utils.ts.template +4 -1
- package/src/utils/api-constructs/files/terraform/app/apis/http/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +11 -2
- package/src/utils/api-constructs/files/terraform/app/apis/rest/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +11 -2
- package/src/utils/files/common/constructs/src/core/runtime-config.ts.template +157 -5
- package/src/utils/files/terraform/src/core/runtime-config/appconfig/appconfig.tf.template +100 -0
- package/src/utils/files/terraform/src/core/runtime-config/entry/entry.tf.template +19 -17
- package/src/utils/files/terraform/src/core/runtime-config/read/read.tf.template +12 -5
- package/src/utils/identity-constructs/files/cdk/core/user-identity.ts.template +2 -2
- package/src/utils/identity-constructs/files/terraform/core/user-identity/add-callback-url/add-callback-url.tf.template +2 -0
- package/src/utils/identity-constructs/files/terraform/core/user-identity/identity/identity.tf.template +2 -1
- package/src/utils/versions.d.ts +6 -1
- package/src/utils/versions.js +5 -0
- package/src/utils/versions.js.map +1 -1
- package/src/utils/website-constructs/files/cdk/core/static-website.ts.template +8 -3
- package/src/utils/website-constructs/files/terraform/core/static-website/static-website.tf.template +10 -1
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { Construct } from 'constructs';
|
|
1
|
+
import { Construct, IConstruct } from 'constructs';
|
|
2
2
|
import {
|
|
3
|
+
Cors,
|
|
4
|
+
Resource,
|
|
3
5
|
RestApi as _RestApi,
|
|
4
6
|
RestApiProps as _RestApiProps,
|
|
5
7
|
IResource,
|
|
6
8
|
Stage,
|
|
7
9
|
} from 'aws-cdk-lib/aws-apigateway';
|
|
10
|
+
import { IAspect } from 'aws-cdk-lib';
|
|
8
11
|
import { RuntimeConfig } from '../runtime-config.js';
|
|
9
12
|
import {
|
|
10
13
|
ApiIntegrations,
|
|
@@ -103,7 +106,7 @@ export class RestApi<
|
|
|
103
106
|
};
|
|
104
107
|
|
|
105
108
|
// Create API resources and methods for each operation
|
|
106
|
-
(Object.entries(operations) as [TOperation, OperationDetails][]).
|
|
109
|
+
(Object.entries(operations) as [TOperation, OperationDetails][]).forEach(
|
|
107
110
|
([op, details]) => {
|
|
108
111
|
const integration = resolveIntegration(op);
|
|
109
112
|
const resource = this.getOrCreateResource(
|
|
@@ -122,10 +125,11 @@ export class RestApi<
|
|
|
122
125
|
);
|
|
123
126
|
|
|
124
127
|
// Register the API URL in runtime configuration for client discovery
|
|
125
|
-
RuntimeConfig.ensure(this)
|
|
126
|
-
|
|
128
|
+
const rc = RuntimeConfig.ensure(this);
|
|
129
|
+
rc.set('connection', 'apis', {
|
|
130
|
+
...rc.get('connection').apis,
|
|
127
131
|
[apiName]: this.api.url!,
|
|
128
|
-
};
|
|
132
|
+
});
|
|
129
133
|
}
|
|
130
134
|
|
|
131
135
|
/**
|
|
@@ -147,3 +151,18 @@ export class RestApi<
|
|
|
147
151
|
return this.getOrCreateResource(childResource, pathParts);
|
|
148
152
|
}
|
|
149
153
|
}
|
|
154
|
+
|
|
155
|
+
export class AddCorsPreflightAspect implements IAspect {
|
|
156
|
+
private getAllowedOrigins: () => readonly string[];
|
|
157
|
+
constructor(getAllowedOrigins: () => readonly string[]) {
|
|
158
|
+
this.getAllowedOrigins = getAllowedOrigins;
|
|
159
|
+
}
|
|
160
|
+
public visit(node: IConstruct): void {
|
|
161
|
+
if (node instanceof Resource) {
|
|
162
|
+
node.addCorsPreflight({
|
|
163
|
+
allowOrigins: [...this.getAllowedOrigins()],
|
|
164
|
+
allowMethods: Cors.ALL_METHODS,
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
@@ -297,12 +297,21 @@ resource "aws_apigatewayv2_route" "proxy_routes" {
|
|
|
297
297
|
module "add_url_to_runtime_config" {
|
|
298
298
|
source = "../../../core/runtime-config/entry"
|
|
299
299
|
|
|
300
|
-
|
|
301
|
-
|
|
300
|
+
namespace = "connection"
|
|
301
|
+
key = "apis"
|
|
302
|
+
value = { "<%- apiNameClassName %>" = module.http_api.stage_invoke_url }
|
|
302
303
|
|
|
303
304
|
depends_on = [module.http_api]
|
|
304
305
|
}
|
|
305
306
|
|
|
307
|
+
module "appconfig" {
|
|
308
|
+
source = "../../../core/runtime-config/appconfig"
|
|
309
|
+
|
|
310
|
+
application_name = "<%- apiNameClassName %>-runtime-config"
|
|
311
|
+
|
|
312
|
+
depends_on = [module.add_url_to_runtime_config]
|
|
313
|
+
}
|
|
314
|
+
|
|
306
315
|
# Lambda permission for API Gateway to invoke the function<% if (backend.type === 'fastapi') { %> via alias<% } %>
|
|
307
316
|
resource "aws_lambda_permission" "api_gateway_invoke" {
|
|
308
317
|
statement_id = "AllowExecutionFromAPIGateway"
|
|
@@ -454,12 +454,21 @@ resource "aws_lambda_permission" "api_gateway_invoke_streaming" {
|
|
|
454
454
|
module "add_url_to_runtime_config" {
|
|
455
455
|
source = "../../../core/runtime-config/entry"
|
|
456
456
|
|
|
457
|
-
|
|
458
|
-
|
|
457
|
+
namespace = "connection"
|
|
458
|
+
key = "apis"
|
|
459
|
+
value = { "<%- apiNameClassName %>" = aws_api_gateway_stage.api_stage.invoke_url }
|
|
459
460
|
|
|
460
461
|
depends_on = [aws_api_gateway_stage.api_stage]
|
|
461
462
|
}
|
|
462
463
|
|
|
464
|
+
module "appconfig" {
|
|
465
|
+
source = "../../../core/runtime-config/appconfig"
|
|
466
|
+
|
|
467
|
+
application_name = "<%- apiNameClassName %>-runtime-config"
|
|
468
|
+
|
|
469
|
+
depends_on = [module.add_url_to_runtime_config]
|
|
470
|
+
}
|
|
471
|
+
|
|
463
472
|
# Outputs
|
|
464
473
|
|
|
465
474
|
# API Gateway Outputs (from core module)
|
|
@@ -1,10 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
ArnFormat,
|
|
3
|
+
Aspects,
|
|
4
|
+
CfnOutput,
|
|
5
|
+
Lazy,
|
|
6
|
+
Names,
|
|
7
|
+
Stack,
|
|
8
|
+
Stage,
|
|
9
|
+
} from 'aws-cdk-lib';
|
|
10
|
+
import {
|
|
11
|
+
CfnApplication,
|
|
12
|
+
CfnConfigurationProfile,
|
|
13
|
+
CfnDeployment,
|
|
14
|
+
CfnDeploymentStrategy,
|
|
15
|
+
CfnEnvironment,
|
|
16
|
+
CfnHostedConfigurationVersion,
|
|
17
|
+
} from 'aws-cdk-lib/aws-appconfig';
|
|
18
|
+
import { Grant, IGrantable } from 'aws-cdk-lib/aws-iam';
|
|
19
|
+
import { Construct, IConstruct } from 'constructs';
|
|
3
20
|
|
|
4
21
|
const RuntimeConfigKey = '__RuntimeConfig__';
|
|
5
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Stage-scoped singleton that collects runtime configuration from CDK constructs
|
|
25
|
+
* and delivers it to server-side (AppConfig) and client-side (S3) consumers.
|
|
26
|
+
*
|
|
27
|
+
* Configuration is organised into namespaces (mapped to AppConfig Configuration Profiles):
|
|
28
|
+
* ```ts
|
|
29
|
+
* const rc = RuntimeConfig.ensure(this);
|
|
30
|
+
* rc.set('connection', 'cognitoProps', { region: '...', userPoolId: '...' });
|
|
31
|
+
* rc.set('tables', 'users', { tableName: '...', arn: '...' });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
6
34
|
export class RuntimeConfig extends Construct {
|
|
7
|
-
private readonly
|
|
35
|
+
private readonly _namespaces = new Map<string, Record<string, any>>();
|
|
36
|
+
private _appConfigApplicationId?: string;
|
|
37
|
+
private _appConfigApplicationArn?: string;
|
|
38
|
+
private _aspectRegistered = false;
|
|
8
39
|
|
|
9
40
|
static ensure(scope: Construct): RuntimeConfig {
|
|
10
41
|
const parent = Stage.of(scope) ?? Stack.of(scope);
|
|
@@ -24,7 +55,128 @@ export class RuntimeConfig extends Construct {
|
|
|
24
55
|
super(scope, id);
|
|
25
56
|
}
|
|
26
57
|
|
|
27
|
-
|
|
28
|
-
|
|
58
|
+
/** Sets a key in the given namespace. Creates the namespace if it doesn't exist. */
|
|
59
|
+
set(namespace: string, key: string, value: any): void {
|
|
60
|
+
let data = this._namespaces.get(namespace);
|
|
61
|
+
if (!data) {
|
|
62
|
+
data = {};
|
|
63
|
+
this._namespaces.set(namespace, data);
|
|
64
|
+
}
|
|
65
|
+
data[key] = value;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Returns the config data for a namespace. Creates it if it doesn't exist. */
|
|
69
|
+
get(namespace: string): Record<string, any> {
|
|
70
|
+
let data = this._namespaces.get(namespace);
|
|
71
|
+
if (!data) {
|
|
72
|
+
data = {};
|
|
73
|
+
this._namespaces.set(namespace, data);
|
|
74
|
+
}
|
|
75
|
+
return data;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** Returns a lazy token resolving to the AppConfig Application ID. */
|
|
79
|
+
get appConfigApplicationId(): string {
|
|
80
|
+
this.ensureAspect();
|
|
81
|
+
return Lazy.string({
|
|
82
|
+
produce: () => {
|
|
83
|
+
if (!this._appConfigApplicationId) {
|
|
84
|
+
throw new Error(
|
|
85
|
+
'RuntimeConfig AppConfig resources were not created.',
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
return this._appConfigApplicationId;
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Grants a server-side consumer permission to read from AppConfig. */
|
|
94
|
+
grantReadAppConfig(grantee: IGrantable): Grant {
|
|
95
|
+
this.ensureAspect();
|
|
96
|
+
return Grant.addToPrincipal({
|
|
97
|
+
grantee,
|
|
98
|
+
actions: [
|
|
99
|
+
'appconfig:StartConfigurationSession',
|
|
100
|
+
'appconfig:GetLatestConfiguration',
|
|
101
|
+
],
|
|
102
|
+
resourceArns: [
|
|
103
|
+
Lazy.string({ produce: () => this._appConfigApplicationArn }),
|
|
104
|
+
],
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
private ensureAspect(): void {
|
|
109
|
+
if (this._aspectRegistered) return;
|
|
110
|
+
this._aspectRegistered = true;
|
|
111
|
+
let created = false;
|
|
112
|
+
|
|
113
|
+
Aspects.of(this.node.scope!).add({
|
|
114
|
+
visit: (node: IConstruct) => {
|
|
115
|
+
if (created || !(node instanceof Stack)) return;
|
|
116
|
+
created = true;
|
|
117
|
+
|
|
118
|
+
const stack = node;
|
|
119
|
+
const name = Names.uniqueResourceName(this, {
|
|
120
|
+
maxLength: 64,
|
|
121
|
+
separator: '-',
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
const app = new CfnApplication(stack, 'RcAppConfigApp', { name });
|
|
125
|
+
const strategy = new CfnDeploymentStrategy(
|
|
126
|
+
stack,
|
|
127
|
+
'RcAppConfigStrategy',
|
|
128
|
+
{
|
|
129
|
+
name,
|
|
130
|
+
deploymentDurationInMinutes: 0,
|
|
131
|
+
growthFactor: 100,
|
|
132
|
+
replicateTo: 'NONE',
|
|
133
|
+
finalBakeTimeInMinutes: 0,
|
|
134
|
+
},
|
|
135
|
+
);
|
|
136
|
+
const env = new CfnEnvironment(stack, 'RcAppConfigEnv', {
|
|
137
|
+
applicationId: app.ref,
|
|
138
|
+
name: 'default',
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
for (const [ns, data] of this._namespaces.entries()) {
|
|
142
|
+
const profile = new CfnConfigurationProfile(
|
|
143
|
+
stack,
|
|
144
|
+
`RcAppConfigProfile${ns}`,
|
|
145
|
+
{
|
|
146
|
+
applicationId: app.ref,
|
|
147
|
+
name: ns,
|
|
148
|
+
locationUri: 'hosted',
|
|
149
|
+
type: 'AWS.Freeform',
|
|
150
|
+
},
|
|
151
|
+
);
|
|
152
|
+
const version = new CfnHostedConfigurationVersion(
|
|
153
|
+
stack,
|
|
154
|
+
`RcAppConfigVersion${ns}`,
|
|
155
|
+
{
|
|
156
|
+
applicationId: app.ref,
|
|
157
|
+
configurationProfileId: profile.ref,
|
|
158
|
+
contentType: 'application/json',
|
|
159
|
+
content: Lazy.string({ produce: () => stack.toJsonString(data) }),
|
|
160
|
+
},
|
|
161
|
+
);
|
|
162
|
+
new CfnDeployment(stack, `RcAppConfigDeploy${ns}`, {
|
|
163
|
+
applicationId: app.ref,
|
|
164
|
+
environmentId: env.ref,
|
|
165
|
+
configurationProfileId: profile.ref,
|
|
166
|
+
configurationVersion: version.ref,
|
|
167
|
+
deploymentStrategyId: strategy.ref,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
new CfnOutput(stack, 'RuntimeConfigApplicationId', { value: app.ref });
|
|
172
|
+
this._appConfigApplicationId = app.ref;
|
|
173
|
+
this._appConfigApplicationArn = stack.formatArn({
|
|
174
|
+
service: 'appconfig',
|
|
175
|
+
resource: 'application',
|
|
176
|
+
resourceName: `${app.ref}/*`,
|
|
177
|
+
arnFormat: ArnFormat.SLASH_RESOURCE_NAME,
|
|
178
|
+
});
|
|
179
|
+
},
|
|
180
|
+
});
|
|
29
181
|
}
|
|
30
182
|
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
terraform {
|
|
2
|
+
required_version = ">= 1.0"
|
|
3
|
+
|
|
4
|
+
required_providers {
|
|
5
|
+
aws = {
|
|
6
|
+
source = "hashicorp/aws"
|
|
7
|
+
version = ">= 5.0"
|
|
8
|
+
}
|
|
9
|
+
local = {
|
|
10
|
+
source = "hashicorp/local"
|
|
11
|
+
version = "~> 2.0"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
variable "application_name" {
|
|
17
|
+
description = "Name of the AppConfig application"
|
|
18
|
+
type = string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
locals {
|
|
22
|
+
config_dir = "${path.module}/../../../../../../../dist/packages/common/terraform/runtime-config"
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
# AppConfig Application
|
|
26
|
+
resource "aws_appconfig_application" "runtime_config" {
|
|
27
|
+
name = var.application_name
|
|
28
|
+
description = "Runtime configuration for ${var.application_name}"
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
# AppConfig Environment
|
|
32
|
+
resource "aws_appconfig_environment" "default" {
|
|
33
|
+
name = "default"
|
|
34
|
+
application_id = aws_appconfig_application.runtime_config.id
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
# Instant deployment strategy (zero wait)
|
|
38
|
+
resource "aws_appconfig_deployment_strategy" "instant" {
|
|
39
|
+
name = "${var.application_name}-instant"
|
|
40
|
+
deployment_duration_in_minutes = 0
|
|
41
|
+
growth_factor = 100
|
|
42
|
+
replicate_to = "NONE"
|
|
43
|
+
final_bake_time_in_minutes = 0
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
# Read all namespace JSON files from the config directory
|
|
47
|
+
locals {
|
|
48
|
+
namespace_files = fileset(local.config_dir, "*.json")
|
|
49
|
+
namespaces = {
|
|
50
|
+
for f in local.namespace_files :
|
|
51
|
+
trimsuffix(f, ".json") => jsondecode(file("${local.config_dir}/${f}"))
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
# Configuration Profile per namespace
|
|
56
|
+
resource "aws_appconfig_configuration_profile" "namespace" {
|
|
57
|
+
for_each = local.namespaces
|
|
58
|
+
|
|
59
|
+
application_id = aws_appconfig_application.runtime_config.id
|
|
60
|
+
name = each.key
|
|
61
|
+
location_uri = "hosted"
|
|
62
|
+
type = "AWS.Freeform"
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
# Hosted Configuration Version per namespace
|
|
66
|
+
resource "aws_appconfig_hosted_configuration_version" "namespace" {
|
|
67
|
+
for_each = local.namespaces
|
|
68
|
+
|
|
69
|
+
application_id = aws_appconfig_application.runtime_config.id
|
|
70
|
+
configuration_profile_id = aws_appconfig_configuration_profile.namespace[each.key].configuration_profile_id
|
|
71
|
+
content_type = "application/json"
|
|
72
|
+
content = jsonencode(each.value)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
# Deployment per namespace
|
|
76
|
+
resource "aws_appconfig_deployment" "namespace" {
|
|
77
|
+
for_each = local.namespaces
|
|
78
|
+
|
|
79
|
+
application_id = aws_appconfig_application.runtime_config.id
|
|
80
|
+
environment_id = aws_appconfig_environment.default.environment_id
|
|
81
|
+
configuration_profile_id = aws_appconfig_configuration_profile.namespace[each.key].configuration_profile_id
|
|
82
|
+
configuration_version = aws_appconfig_hosted_configuration_version.namespace[each.key].version_number
|
|
83
|
+
deployment_strategy_id = aws_appconfig_deployment_strategy.instant.id
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
# Outputs
|
|
87
|
+
output "application_id" {
|
|
88
|
+
description = "AppConfig Application ID"
|
|
89
|
+
value = aws_appconfig_application.runtime_config.id
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
output "application_arn" {
|
|
93
|
+
description = "AppConfig Application ARN"
|
|
94
|
+
value = aws_appconfig_application.runtime_config.arn
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
output "environment_id" {
|
|
98
|
+
description = "AppConfig Environment ID"
|
|
99
|
+
value = aws_appconfig_environment.default.environment_id
|
|
100
|
+
}
|
|
@@ -8,22 +8,30 @@ terraform {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
# Variables
|
|
11
|
-
variable "
|
|
12
|
-
description = "
|
|
11
|
+
variable "namespace" {
|
|
12
|
+
description = "Namespace for the configuration entry (e.g., 'connection', 'tables')"
|
|
13
|
+
type = string
|
|
14
|
+
default = "connection"
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
variable "key" {
|
|
18
|
+
description = "Key name within the namespace (e.g., 'apis', 'cognitoProps')"
|
|
13
19
|
type = string
|
|
14
20
|
}
|
|
15
21
|
|
|
16
22
|
variable "value" {
|
|
17
|
-
description = "Value to set at the key
|
|
23
|
+
description = "Value to set at the key"
|
|
18
24
|
type = any
|
|
19
25
|
}
|
|
20
26
|
|
|
21
27
|
locals {
|
|
22
|
-
|
|
28
|
+
config_dir = "${path.module}/../../../../../../../dist/packages/common/terraform/runtime-config"
|
|
29
|
+
config_file_path = "${local.config_dir}/${var.namespace}.json"
|
|
23
30
|
}
|
|
24
31
|
|
|
25
|
-
# This module writes an entry to
|
|
26
|
-
#
|
|
32
|
+
# This module writes an entry to a namespaced runtime config JSON file.
|
|
33
|
+
# Each namespace maps to a separate file (e.g., connection.json, tables.json)
|
|
34
|
+
# which is then used by the AppConfig module and static website module.
|
|
27
35
|
|
|
28
36
|
data "external" "updated_config" {
|
|
29
37
|
program = ["uv", "run", "python", "-c", <<-EOT
|
|
@@ -37,7 +45,7 @@ from pathlib import Path
|
|
|
37
45
|
# Read input from Terraform
|
|
38
46
|
input_data = json.load(sys.stdin)
|
|
39
47
|
config_file = input_data['config_file']
|
|
40
|
-
|
|
48
|
+
key = input_data['key']
|
|
41
49
|
value = json.loads(input_data['value'])
|
|
42
50
|
|
|
43
51
|
# Create lock file path
|
|
@@ -69,14 +77,8 @@ for attempt in range(max_retries):
|
|
|
69
77
|
with open(config_file, 'r') as f:
|
|
70
78
|
config = json.load(f)
|
|
71
79
|
|
|
72
|
-
# Set the
|
|
73
|
-
|
|
74
|
-
current = config
|
|
75
|
-
for key in keys[:-1]:
|
|
76
|
-
if key not in current:
|
|
77
|
-
current[key] = {}
|
|
78
|
-
current = current[key]
|
|
79
|
-
current[keys[-1]] = value
|
|
80
|
+
# Set the key directly in the namespace file
|
|
81
|
+
config[key] = value
|
|
80
82
|
|
|
81
83
|
# Write updated config back to file atomically
|
|
82
84
|
temp_file = config_file + '.tmp'
|
|
@@ -113,7 +115,7 @@ EOT
|
|
|
113
115
|
|
|
114
116
|
query = {
|
|
115
117
|
config_file = local.config_file_path
|
|
116
|
-
|
|
118
|
+
key = var.key
|
|
117
119
|
value = jsonencode(var.value)
|
|
118
120
|
}
|
|
119
|
-
}
|
|
121
|
+
}
|
|
@@ -7,22 +7,29 @@ terraform {
|
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
variable "namespace" {
|
|
11
|
+
description = "Namespace to read (e.g., 'connection'). If not set, reads all namespaces."
|
|
12
|
+
type = string
|
|
13
|
+
default = "connection"
|
|
14
|
+
}
|
|
15
|
+
|
|
10
16
|
locals {
|
|
11
|
-
|
|
17
|
+
config_dir = "${path.module}/../../../../../../../dist/packages/common/terraform/runtime-config"
|
|
18
|
+
config_file_path = "${local.config_dir}/${var.namespace}.json"
|
|
12
19
|
}
|
|
13
20
|
|
|
14
|
-
# Read the runtime config file
|
|
21
|
+
# Read the namespaced runtime config file
|
|
15
22
|
data "local_file" "runtime_config" {
|
|
16
23
|
filename = local.config_file_path
|
|
17
24
|
}
|
|
18
25
|
|
|
19
26
|
# Outputs
|
|
20
27
|
output "config" {
|
|
21
|
-
description = "Runtime configuration object"
|
|
28
|
+
description = "Runtime configuration object for the namespace"
|
|
22
29
|
value = jsondecode(data.local_file.runtime_config.content)
|
|
23
30
|
}
|
|
24
31
|
|
|
25
32
|
output "config_json" {
|
|
26
|
-
description = "Runtime configuration as JSON string"
|
|
33
|
+
description = "Runtime configuration as JSON string for the namespace"
|
|
27
34
|
value = data.local_file.runtime_config.content
|
|
28
|
-
}
|
|
35
|
+
}
|
|
@@ -46,12 +46,12 @@ export class UserIdentity extends Construct {
|
|
|
46
46
|
this.userPoolDomain
|
|
47
47
|
);
|
|
48
48
|
|
|
49
|
-
RuntimeConfig.ensure(this).
|
|
49
|
+
RuntimeConfig.ensure(this).set('connection', 'cognitoProps', {
|
|
50
50
|
region: Stack.of(this).region,
|
|
51
51
|
identityPoolId: this.identityPool.identityPoolId,
|
|
52
52
|
userPoolId: this.userPool.userPoolId,
|
|
53
53
|
userPoolWebClientId: this.userPoolClient.userPoolClientId,
|
|
54
|
-
};
|
|
54
|
+
});
|
|
55
55
|
|
|
56
56
|
suppressRules(
|
|
57
57
|
this.userPool,
|
|
@@ -368,7 +368,8 @@ resource "aws_cognito_managed_login_branding" "managed_login_branding" {
|
|
|
368
368
|
module "add_cognito_to_runtime_config" {
|
|
369
369
|
source = "../../runtime-config/entry"
|
|
370
370
|
|
|
371
|
-
|
|
371
|
+
namespace = "connection"
|
|
372
|
+
key = "cognitoProps"
|
|
372
373
|
value = {
|
|
373
374
|
region = data.aws_region.current.name
|
|
374
375
|
identityPoolId = aws_cognito_identity_pool.identity_pool.id
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -13,8 +13,10 @@ export declare const TS_VERSIONS: {
|
|
|
13
13
|
readonly '@aws-smithy/server-node': "1.0.0-alpha.10";
|
|
14
14
|
readonly '@aws-lambda-powertools/logger': "2.31.0";
|
|
15
15
|
readonly '@aws-lambda-powertools/metrics': "2.31.0";
|
|
16
|
+
readonly '@aws-lambda-powertools/parameters': "2.31.0";
|
|
16
17
|
readonly '@aws-lambda-powertools/tracer': "2.31.0";
|
|
17
18
|
readonly '@aws-lambda-powertools/parser': "2.31.0";
|
|
19
|
+
readonly '@aws-sdk/client-appconfigdata': "3.1004.0";
|
|
18
20
|
readonly '@middy/core': "6.4.5";
|
|
19
21
|
readonly '@nxlv/python': "22.1.1";
|
|
20
22
|
readonly '@nx-extend/terraform': "9.0.1";
|
|
@@ -43,6 +45,8 @@ export declare const TS_VERSIONS: {
|
|
|
43
45
|
readonly '@types/ws': "8.18.1";
|
|
44
46
|
readonly '@types/express': "5.0.6";
|
|
45
47
|
readonly '@smithy/types': "4.13.0";
|
|
48
|
+
readonly '@vitest/coverage-v8': "4.0.18";
|
|
49
|
+
readonly '@vitest/ui': "4.0.18";
|
|
46
50
|
readonly aws4fetch: "1.0.20";
|
|
47
51
|
readonly 'aws-cdk': "2.1108.0";
|
|
48
52
|
readonly 'aws-cdk-lib': "2.241.0";
|
|
@@ -78,6 +82,7 @@ export declare const TS_VERSIONS: {
|
|
|
78
82
|
readonly shadcn: "3.8.5";
|
|
79
83
|
readonly 'tw-animate-css': "1.4.0";
|
|
80
84
|
readonly 'tailwind-merge': "3.5.0";
|
|
85
|
+
readonly vitest: "4.0.18";
|
|
81
86
|
readonly 'vite-tsconfig-paths': "5.1.4";
|
|
82
87
|
readonly zod: "4.3.6";
|
|
83
88
|
readonly ws: "8.19.0";
|
|
@@ -87,7 +92,7 @@ export type ITsDepVersion = keyof typeof TS_VERSIONS;
|
|
|
87
92
|
* Add versions to the given dependencies
|
|
88
93
|
*/
|
|
89
94
|
export declare const withVersions: (deps: ITsDepVersion[]) => {
|
|
90
|
-
[k: string]: "22.5.3" | "3.8.1" | "1.27.1" | "22.1.1" | "4.3.6" | "3.1004.0" | "1.0.0-alpha.10" | "2.31.0" | "6.4.5" | "9.0.1" | "0.19.0" | "0.4.0" | "1.163.3" | "1.164.0" | "1.161.4" | "3.0.150" | "3.0.1217" | "1.0.51" | "5.90.21" | "5.91.3" | "11.11.0" | "22.19.13" | "8.10.161" | "2.8.19" | "8.18.1" | "5.0.6" | "4.13.0" | "1.0.20" | "2.1108.0" | "2.241.0" | "2.241.0-alpha.0" | "3.12.0" | "10.5.1" | "2.8.6" | "0.7.1" | "2.1.1" | "3.7.0" | "0.27.3" | "1.0.31" | "1.0.5" | "5.5.5" | "5.2.1" | "2.4.2" | "4.0.0" | "2.0.0" | "19.6.3" | "3.4.1" | "3.3.0" | "19.2.4" | "6.1.3" | "1.0.0-rc.1" | "0.5.21" | "4.2.1" | "4.21.0" | "0.576.0" | "1.4.3" | "3.8.5" | "1.4.0" | "3.5.0" | "5.1.4" | "8.19.0";
|
|
95
|
+
[k: string]: "22.5.3" | "3.8.1" | "1.27.1" | "22.1.1" | "4.0.18" | "4.3.6" | "3.1004.0" | "1.0.0-alpha.10" | "2.31.0" | "6.4.5" | "9.0.1" | "0.19.0" | "0.4.0" | "1.163.3" | "1.164.0" | "1.161.4" | "3.0.150" | "3.0.1217" | "1.0.51" | "5.90.21" | "5.91.3" | "11.11.0" | "22.19.13" | "8.10.161" | "2.8.19" | "8.18.1" | "5.0.6" | "4.13.0" | "1.0.20" | "2.1108.0" | "2.241.0" | "2.241.0-alpha.0" | "3.12.0" | "10.5.1" | "2.8.6" | "0.7.1" | "2.1.1" | "3.7.0" | "0.27.3" | "1.0.31" | "1.0.5" | "5.5.5" | "5.2.1" | "2.4.2" | "4.0.0" | "2.0.0" | "19.6.3" | "3.4.1" | "3.3.0" | "19.2.4" | "6.1.3" | "1.0.0-rc.1" | "0.5.21" | "4.2.1" | "4.21.0" | "0.576.0" | "1.4.3" | "3.8.5" | "1.4.0" | "3.5.0" | "5.1.4" | "8.19.0";
|
|
91
96
|
};
|
|
92
97
|
/**
|
|
93
98
|
* Versions for Python dependencies added by generators
|
package/src/utils/versions.js
CHANGED
|
@@ -16,8 +16,10 @@ exports.TS_VERSIONS = {
|
|
|
16
16
|
'@aws-smithy/server-node': '1.0.0-alpha.10',
|
|
17
17
|
'@aws-lambda-powertools/logger': '2.31.0',
|
|
18
18
|
'@aws-lambda-powertools/metrics': '2.31.0',
|
|
19
|
+
'@aws-lambda-powertools/parameters': '2.31.0',
|
|
19
20
|
'@aws-lambda-powertools/tracer': '2.31.0',
|
|
20
21
|
'@aws-lambda-powertools/parser': '2.31.0',
|
|
22
|
+
'@aws-sdk/client-appconfigdata': '3.1004.0',
|
|
21
23
|
'@middy/core': '6.4.5',
|
|
22
24
|
'@nxlv/python': '22.1.1',
|
|
23
25
|
'@nx-extend/terraform': '9.0.1',
|
|
@@ -46,6 +48,8 @@ exports.TS_VERSIONS = {
|
|
|
46
48
|
'@types/ws': '8.18.1',
|
|
47
49
|
'@types/express': '5.0.6',
|
|
48
50
|
'@smithy/types': '4.13.0',
|
|
51
|
+
'@vitest/coverage-v8': '4.0.18',
|
|
52
|
+
'@vitest/ui': '4.0.18',
|
|
49
53
|
aws4fetch: '1.0.20',
|
|
50
54
|
'aws-cdk': '2.1108.0',
|
|
51
55
|
'aws-cdk-lib': '2.241.0',
|
|
@@ -81,6 +85,7 @@ exports.TS_VERSIONS = {
|
|
|
81
85
|
shadcn: '3.8.5',
|
|
82
86
|
'tw-animate-css': '1.4.0',
|
|
83
87
|
'tailwind-merge': '3.5.0',
|
|
88
|
+
vitest: '4.0.18',
|
|
84
89
|
'vite-tsconfig-paths': '5.1.4',
|
|
85
90
|
zod: '4.3.6',
|
|
86
91
|
ws: '8.19.0',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../../../packages/nx-plugin/src/utils/versions.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AACU,QAAA,WAAW,GAAG;IACzB,0BAA0B,EAAE,UAAU;IACtC,qBAAqB,EAAE,UAAU;IACjC,+BAA+B,EAAE,UAAU;IAC3C,+BAA+B,EAAE,gBAAgB;IACjD,yBAAyB,EAAE,gBAAgB;IAC3C,+BAA+B,EAAE,QAAQ;IACzC,gCAAgC,EAAE,QAAQ;IAC1C,+BAA+B,EAAE,QAAQ;IACzC,+BAA+B,EAAE,QAAQ;IACzC,aAAa,EAAE,OAAO;IACtB,cAAc,EAAE,QAAQ;IACxB,sBAAsB,EAAE,OAAO;IAC/B,YAAY,EAAE,QAAQ;IACtB,WAAW,EAAE,QAAQ;IACrB,qBAAqB,EAAE,QAAQ;IAC/B,2BAA2B,EAAE,QAAQ;IACrC,iCAAiC,EAAE,QAAQ;IAC3C,qBAAqB,EAAE,OAAO;IAC9B,wBAAwB,EAAE,SAAS;IACnC,yBAAyB,EAAE,SAAS;IACpC,4BAA4B,EAAE,SAAS;IACvC,+BAA+B,EAAE,SAAS;IAC1C,wBAAwB,EAAE,SAAS;IACn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AO,EAAE,WAAW;IACpB,mBAAmB,EAAE,WAAW;IAChC,GAAG,EAAE,UAAU;IACf,mBAAmB,EAAE,UAAU;IAC/B,gBAAgB,EAAE,UAAU;IAC5B,sBAAsB,EAAE,UAAU;IAClC,OAAO,EAAE,UAAU;CACX,CAAC;AAGX;;GAEG;AACI,MAAM,cAAc,GAAG,CAAC,IAAqB,EAAE,EAAE,CACtD,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,GAAG,mBAAW,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AADpC,QAAA,cAAc,kBACsB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CfnOutput, CfnResource, RemovalPolicy, Stack } from 'aws-cdk-lib';
|
|
1
|
+
import { CfnOutput, CfnResource, Lazy, RemovalPolicy, Stack } from 'aws-cdk-lib';
|
|
2
2
|
import { Distribution, ViewerProtocolPolicy } from 'aws-cdk-lib/aws-cloudfront';
|
|
3
3
|
import { S3BucketOrigin } from 'aws-cdk-lib/aws-cloudfront-origins';
|
|
4
4
|
import {
|
|
@@ -145,9 +145,14 @@ export class StaticWebsite extends Construct {
|
|
|
145
145
|
this.bucketDeployment = new BucketDeployment(this, 'WebsiteDeployment', {
|
|
146
146
|
sources: [
|
|
147
147
|
Source.asset(websiteFilePath),
|
|
148
|
-
Source.
|
|
148
|
+
Source.data(
|
|
149
149
|
DEFAULT_RUNTIME_CONFIG_FILENAME,
|
|
150
|
-
|
|
150
|
+
Lazy.string({
|
|
151
|
+
produce: () =>
|
|
152
|
+
Stack.of(this).toJsonString(
|
|
153
|
+
RuntimeConfig.ensure(this).get('connection'),
|
|
154
|
+
),
|
|
155
|
+
}),
|
|
151
156
|
),
|
|
152
157
|
],
|
|
153
158
|
destinationBucket: this.websiteBucket,
|