@aws/nx-plugin 0.82.2 → 0.83.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.
- package/LICENSE-THIRD-PARTY +34 -6
- package/package.json +1 -1
- package/src/py/fast-api/__snapshots__/generator.spec.ts.snap +82 -18
- 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 +52 -8
- 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 +98 -18
- 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/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 +366 -20
- 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 +4 -0
- package/src/utils/api-constructs/files/cdk/app/apis/rest/__apiNameKebabCase__.ts.template +4 -0
- 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 +4 -3
- 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 +10 -1
- package/src/utils/versions.d.ts +2 -0
- package/src/utils/versions.js +2 -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,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,
|
|
@@ -270,6 +270,14 @@ resource "aws_cognito_user_pool_client" "web_client" {
|
|
|
270
270
|
# Auth session validity
|
|
271
271
|
auth_session_validity = 3
|
|
272
272
|
|
|
273
|
+
# Callback urls are added via the add-callback-url module and should not be overwritten.
|
|
274
|
+
lifecycle {
|
|
275
|
+
ignore_changes = [
|
|
276
|
+
callback_urls,
|
|
277
|
+
logout_urls
|
|
278
|
+
]
|
|
279
|
+
}
|
|
280
|
+
|
|
273
281
|
}
|
|
274
282
|
|
|
275
283
|
# Identity Pool
|
|
@@ -368,7 +376,8 @@ resource "aws_cognito_managed_login_branding" "managed_login_branding" {
|
|
|
368
376
|
module "add_cognito_to_runtime_config" {
|
|
369
377
|
source = "../../runtime-config/entry"
|
|
370
378
|
|
|
371
|
-
|
|
379
|
+
namespace = "connection"
|
|
380
|
+
key = "cognitoProps"
|
|
372
381
|
value = {
|
|
373
382
|
region = data.aws_region.current.name
|
|
374
383
|
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";
|
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',
|
|
@@ -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;IACnC,qCAAqC,EAAE,SAAS;IAChD,+BAA+B,EAAE,UAAU;IAC3C,kCAAkC,EAAE,QAAQ;IAC5C,uBAAuB,EAAE,SAAS;IAClC,gCAAgC,EAAE,QAAQ;IAC1C,4BAA4B,EAAE,SAAS;IACvC,cAAc,EAAE,SAAS;IACzB,cAAc,EAAE,SAAS;IACzB,aAAa,EAAE,UAAU;IACzB,mBAAmB,EAAE,UAAU;IAC/B,aAAa,EAAE,QAAQ;IACvB,WAAW,EAAE,QAAQ;IACrB,gBAAgB,EAAE,OAAO;IACzB,eAAe,EAAE,QAA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AAG,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,
|
package/src/utils/website-constructs/files/terraform/core/static-website/static-website.tf.template
CHANGED
|
@@ -263,6 +263,13 @@ resource "aws_s3_bucket_ownership_controls" "distribution_logs_ownership" {
|
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
265
|
|
|
266
|
+
resource "aws_s3_bucket_acl" "distribution_logs_acl" {
|
|
267
|
+
#checkov:skip=CKV_AWS_70:ACL required for CloudFront standard logging
|
|
268
|
+
bucket = aws_s3_bucket.distribution_logs.id
|
|
269
|
+
acl = "log-delivery-write"
|
|
270
|
+
|
|
271
|
+
depends_on = [aws_s3_bucket_ownership_controls.distribution_logs_ownership]
|
|
272
|
+
}
|
|
266
273
|
|
|
267
274
|
resource "aws_s3_bucket_logging" "distribution_logs_logging" {
|
|
268
275
|
bucket = aws_s3_bucket.distribution_logs.id
|
|
@@ -495,9 +502,11 @@ resource "aws_s3_bucket_policy" "website_cloudfront_policy" {
|
|
|
495
502
|
depends_on = [aws_cloudfront_distribution.website]
|
|
496
503
|
}
|
|
497
504
|
|
|
498
|
-
# Read runtime config using the reader module
|
|
505
|
+
# Read runtime config using the reader module (connection namespace for website)
|
|
499
506
|
module "runtime_config_reader" {
|
|
500
507
|
source = "../runtime-config/read"
|
|
508
|
+
|
|
509
|
+
namespace = "connection"
|
|
501
510
|
}
|
|
502
511
|
|
|
503
512
|
# Upload website files to S3
|