@aws/nx-plugin 1.0.0-rc.82 → 1.0.0-rc.84
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/migrations.json +41 -1
- package/package.json +1 -1
- package/src/agentcore-gateway/__snapshots__/generator.spec.ts.snap +51 -2
- package/src/agentcore-gateway/generator.d.ts +7 -6
- package/src/agentcore-gateway/generator.js +2 -12
- package/src/agentcore-gateway/generator.js.map +1 -1
- package/src/agentcore-harness/__snapshots__/generator.spec.ts.snap +4 -5
- package/src/agentcore-harness/files/project/README.md.template +4 -5
- package/src/migrations/latest/agentcore-harness-no-tools-by-default/__snapshots__/migration.spec.ts.snap +79 -0
- package/src/migrations/latest/agentcore-harness-no-tools-by-default/metadata.json +3 -0
- package/src/migrations/latest/agentcore-harness-no-tools-by-default/migration.d.ts +6 -0
- package/src/migrations/latest/agentcore-harness-no-tools-by-default/migration.js +87 -0
- package/src/migrations/latest/agentcore-harness-no-tools-by-default/migration.js.map +1 -0
- package/src/migrations/latest/dynamodb-terraform-app-module-outputs/metadata.json +3 -0
- package/src/migrations/latest/dynamodb-terraform-app-module-outputs/migration.d.ts +6 -0
- package/src/migrations/latest/dynamodb-terraform-app-module-outputs/migration.js +69 -0
- package/src/migrations/latest/dynamodb-terraform-app-module-outputs/migration.js.map +1 -0
- package/src/migrations/latest/rdb-terraform-aurora-app-module-defaults/__snapshots__/migration.spec.ts.snap +54 -0
- package/src/migrations/latest/rdb-terraform-aurora-app-module-defaults/metadata.json +3 -0
- package/src/migrations/latest/rdb-terraform-aurora-app-module-defaults/migration.d.ts +6 -0
- package/src/migrations/latest/rdb-terraform-aurora-app-module-defaults/migration.js +86 -0
- package/src/migrations/latest/rdb-terraform-aurora-app-module-defaults/migration.js.map +1 -0
- package/src/migrations/latest/terraform-data-resource-destroy-protection/__snapshots__/migration.spec.ts.snap +75 -0
- package/src/migrations/latest/terraform-data-resource-destroy-protection/metadata.json +3 -0
- package/src/migrations/latest/terraform-data-resource-destroy-protection/migration.d.ts +6 -0
- package/src/migrations/latest/terraform-data-resource-destroy-protection/migration.js +78 -0
- package/src/migrations/latest/terraform-data-resource-destroy-protection/migration.js.map +1 -0
- package/src/migrations/latest/terraform-declare-used-providers/metadata.json +3 -0
- package/src/migrations/latest/terraform-declare-used-providers/migration.d.ts +6 -0
- package/src/migrations/latest/terraform-declare-used-providers/migration.js +147 -0
- package/src/migrations/latest/terraform-declare-used-providers/migration.js.map +1 -0
- package/src/migrations/latest/terraform-gateway-cedar-render-root-ejs/metadata.json +3 -0
- package/src/migrations/latest/terraform-gateway-cedar-render-root-ejs/migration.d.ts +6 -0
- package/src/migrations/latest/terraform-gateway-cedar-render-root-ejs/migration.js +38 -0
- package/src/migrations/latest/terraform-gateway-cedar-render-root-ejs/migration.js.map +1 -0
- package/src/migrations/latest/terraform-harness-vpc-role-and-memory-grant/__snapshots__/migration.spec.ts.snap +521 -0
- package/src/migrations/latest/terraform-harness-vpc-role-and-memory-grant/metadata.json +3 -0
- package/src/migrations/latest/terraform-harness-vpc-role-and-memory-grant/migration.d.ts +6 -0
- package/src/migrations/latest/terraform-harness-vpc-role-and-memory-grant/migration.js +504 -0
- package/src/migrations/latest/terraform-harness-vpc-role-and-memory-grant/migration.js.map +1 -0
- package/src/migrations/latest/waf-log-group-cmk-encryption/__snapshots__/migration.spec.ts.snap +286 -0
- package/src/migrations/latest/waf-log-group-cmk-encryption/metadata.json +3 -0
- package/src/migrations/latest/waf-log-group-cmk-encryption/migration.d.ts +6 -0
- package/src/migrations/latest/waf-log-group-cmk-encryption/migration.js +238 -0
- package/src/migrations/latest/waf-log-group-cmk-encryption/migration.js.map +1 -0
- package/src/py/agent/__snapshots__/generator.protocols.spec.ts.snap +12 -0
- package/src/py/dynamodb/__snapshots__/generator.spec.ts.snap +21 -0
- package/src/py/fast-api/__snapshots__/generator.terraform.spec.ts.snap +231 -24
- package/src/py/lambda-function/__snapshots__/generator.spec.ts.snap +8 -0
- package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +4 -0
- package/src/py/rdb/__snapshots__/generator.spec.ts.snap +31 -2
- package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +216 -25
- package/src/terraform/project/files/application/bootstrap/providers.tf.template +9 -0
- package/src/terraform/project/files/application/src/providers.tf.template +4 -0
- package/src/terraform/project/files/library/src/main.tf.template +9 -0
- package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +231 -24
- package/src/ts/agent/__snapshots__/generator.spec.ts.snap +8 -0
- package/src/ts/dcr-proxy/__snapshots__/generator.spec.ts.snap +4 -0
- package/src/ts/dynamodb/__snapshots__/generator.spec.ts.snap +21 -0
- package/src/ts/lambda-function/__snapshots__/generator.spec.ts.snap +8 -0
- package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +4 -0
- package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +74 -4
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +4 -0
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.spec.ts.snap +35 -8
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +4 -0
- package/src/utils/agent-core-constructs/agent-core-constructs.d.ts +9 -2
- package/src/utils/agent-core-constructs/agent-core-constructs.js +22 -8
- package/src/utils/agent-core-constructs/agent-core-constructs.js.map +1 -1
- package/src/utils/agent-core-constructs/files/cdk/app/agentcore-harness/__nameKebabCase__/__nameKebabCase__.ts.template +39 -1
- package/src/utils/agent-core-constructs/files/terraform/app/agent-core/__nameKebabCase__/__nameKebabCase__.tf.template +8 -1
- package/src/utils/agent-core-constructs/files/terraform/app/agentcore-gateway/__nameKebabCase__/__nameKebabCase__.tf.template +57 -2
- package/src/utils/agent-core-constructs/files/terraform/app/agentcore-harness/__nameKebabCase__/__nameKebabCase__.tf.template +258 -24
- package/src/utils/agent-core-constructs/files/terraform/core/agent-core/runtime.tf.template +4 -0
- package/src/utils/api-constructs/files/terraform/app/apis/http/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +8 -0
- package/src/utils/api-constructs/files/terraform/app/apis/rest/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +9 -1
- package/src/utils/api-constructs/files/terraform/core/api/rest/rest-api/rest-api.tf.template +60 -7
- package/src/utils/dcr-proxy-constructs/files/terraform/app/dcr-proxies/__nameKebabCase__/__nameKebabCase__.tf.template +4 -0
- package/src/utils/dynamodb-constructs/files/terraform/app/dynamodb/__nameKebabCase__/__nameKebabCase__.tf.template +15 -0
- package/src/utils/dynamodb-constructs/files/terraform/core/dynamodb/dynamodb.tf.template +6 -0
- package/src/utils/files/terraform/src/metrics/providers.tf.template +12 -0
- package/src/utils/function-constructs/files/terraform/app/lambda-functions/__nameKebabCase__/__nameKebabCase__.tf.template +4 -0
- package/src/utils/identity-constructs/files/cdk/core/user-identity.ts.template +33 -8
- package/src/utils/identity-constructs/files/terraform/core/user-identity/add-callback-url/add-callback-url.tf.template +4 -0
- package/src/utils/identity-constructs/files/terraform/core/user-identity/identity/identity.tf.template +51 -2
- package/src/utils/rdb-constructs/files/cdk/core/rdb/aurora.ts.template +18 -0
- package/src/utils/rdb-constructs/files/terraform/app/dbs/__nameKebabCase__/__nameKebabCase__.tf.template +15 -4
- package/src/utils/rdb-constructs/files/terraform/core/rdb/aurora/aurora.tf.template +8 -2
- package/src/utils/rdb-constructs/rdb-constructs.d.ts +12 -0
- package/src/utils/rdb-constructs/rdb-constructs.js +24 -3
- package/src/utils/rdb-constructs/rdb-constructs.js.map +1 -1
- package/src/utils/shared-constructs-constants.d.ts +5 -0
- package/src/utils/shared-constructs-constants.js +4 -0
- package/src/utils/shared-constructs-constants.js.map +1 -1
- package/src/utils/website-constructs/files/terraform/core/static-website/static-website.tf.template +4 -0
|
@@ -73,6 +73,8 @@ locals {
|
|
|
73
73
|
"http://localhost:4200",
|
|
74
74
|
"http://localhost:4300"
|
|
75
75
|
]
|
|
76
|
+
|
|
77
|
+
user_pool_waf_log_group_name = var.enable_waf ? "aws-waf-logs-UserPool-${random_id.unique_suffix.hex}" : null
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
# Random suffix for resource names
|
|
@@ -368,14 +370,61 @@ resource "aws_wafv2_web_acl_association" "user_pool_waf_association" {
|
|
|
368
370
|
web_acl_arn = aws_wafv2_web_acl.user_pool_waf[0].arn
|
|
369
371
|
}
|
|
370
372
|
|
|
373
|
+
# KMS key for encrypting WAF request logs at rest
|
|
374
|
+
resource "aws_kms_key" "user_pool_waf_logs" {
|
|
375
|
+
count = var.enable_waf ? 1 : 0
|
|
376
|
+
|
|
377
|
+
description = "User pool WAF log encryption"
|
|
378
|
+
deletion_window_in_days = 7
|
|
379
|
+
enable_key_rotation = true
|
|
380
|
+
|
|
381
|
+
policy = jsonencode({
|
|
382
|
+
Version = "2012-10-17"
|
|
383
|
+
Statement = [
|
|
384
|
+
{
|
|
385
|
+
Sid = "Enable IAM User Permissions"
|
|
386
|
+
Effect = "Allow"
|
|
387
|
+
Principal = { AWS = "arn:aws:iam::${data.aws_caller_identity.current.account_id}:root" }
|
|
388
|
+
Action = "kms:*"
|
|
389
|
+
Resource = "*"
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
Sid = "Allow CloudWatch Logs"
|
|
393
|
+
Effect = "Allow"
|
|
394
|
+
Principal = { Service = "logs.${data.aws_region.current.region}.amazonaws.com" }
|
|
395
|
+
Action = [
|
|
396
|
+
"kms:Encrypt",
|
|
397
|
+
"kms:Decrypt",
|
|
398
|
+
"kms:ReEncrypt*",
|
|
399
|
+
"kms:GenerateDataKey*",
|
|
400
|
+
"kms:DescribeKey"
|
|
401
|
+
]
|
|
402
|
+
Resource = "*"
|
|
403
|
+
Condition = {
|
|
404
|
+
ArnEquals = {
|
|
405
|
+
"kms:EncryptionContext:aws:logs:arn" = "arn:aws:logs:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:log-group:${local.user_pool_waf_log_group_name}"
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
]
|
|
410
|
+
})
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
resource "aws_kms_alias" "user_pool_waf_logs" {
|
|
414
|
+
count = var.enable_waf ? 1 : 0
|
|
415
|
+
|
|
416
|
+
name = "alias/user-pool-${random_id.unique_suffix.hex}-waf-logs"
|
|
417
|
+
target_key_id = aws_kms_key.user_pool_waf_logs[0].key_id
|
|
418
|
+
}
|
|
419
|
+
|
|
371
420
|
# CloudWatch Log Group for WAF request logs. Name must start with `aws-waf-logs-`.
|
|
372
421
|
resource "aws_cloudwatch_log_group" "user_pool_waf_logs" {
|
|
373
|
-
#checkov:skip=CKV_AWS_158:Using default CloudWatch log encryption
|
|
374
422
|
#checkov:skip=CKV_AWS_338:Log retention set to one month which is sufficient for WAF logs
|
|
375
423
|
count = var.enable_waf ? 1 : 0
|
|
376
424
|
|
|
377
|
-
name =
|
|
425
|
+
name = local.user_pool_waf_log_group_name
|
|
378
426
|
retention_in_days = 30
|
|
427
|
+
kms_key_id = aws_kms_key.user_pool_waf_logs[0].arn
|
|
379
428
|
}
|
|
380
429
|
|
|
381
430
|
resource "aws_wafv2_web_acl_logging_configuration" "user_pool_waf_logging" {
|
|
@@ -180,6 +180,20 @@ export interface AuroraDatabaseProps extends _AuroraDatabaseProps {
|
|
|
180
180
|
* @default true
|
|
181
181
|
*/
|
|
182
182
|
readonly enablePerformanceInsights?: boolean;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Minimum Aurora Serverless v2 ACUs.
|
|
186
|
+
*
|
|
187
|
+
* @default <%= serverlessMinCapacity %>
|
|
188
|
+
*/
|
|
189
|
+
readonly serverlessV2MinCapacity?: number;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Maximum Aurora Serverless v2 ACUs.
|
|
193
|
+
*
|
|
194
|
+
* @default <%= serverlessMaxCapacity %>
|
|
195
|
+
*/
|
|
196
|
+
readonly serverlessV2MaxCapacity?: number;
|
|
183
197
|
}
|
|
184
198
|
|
|
185
199
|
/**
|
|
@@ -209,6 +223,8 @@ export abstract class AuroraDatabase extends Construct {
|
|
|
209
223
|
enableKeyRotation = true,
|
|
210
224
|
enableCloudwatchLogs = true,
|
|
211
225
|
enablePerformanceInsights = true,
|
|
226
|
+
serverlessV2MinCapacity = <%= serverlessMinCapacity %>,
|
|
227
|
+
serverlessV2MaxCapacity = <%= serverlessMaxCapacity %>,
|
|
212
228
|
engine,
|
|
213
229
|
engineVersion,
|
|
214
230
|
...clusterProps
|
|
@@ -224,6 +240,8 @@ export abstract class AuroraDatabase extends Construct {
|
|
|
224
240
|
vpc,
|
|
225
241
|
vpcSubnets,
|
|
226
242
|
engine: engine.clusterEngine(engineVersion ?? engine.defaultVersion),
|
|
243
|
+
serverlessV2MinCapacity,
|
|
244
|
+
serverlessV2MaxCapacity,
|
|
227
245
|
writer:
|
|
228
246
|
writer ??
|
|
229
247
|
ClusterInstance.serverlessV2("writer", {
|
|
@@ -10,6 +10,10 @@ terraform {
|
|
|
10
10
|
source = "hashicorp/aws"
|
|
11
11
|
version = "<%- awsProviderVersion %>"
|
|
12
12
|
}
|
|
13
|
+
external = {
|
|
14
|
+
source = "hashicorp/external"
|
|
15
|
+
version = "<%- externalProviderVersion %>"
|
|
16
|
+
}
|
|
13
17
|
null = {
|
|
14
18
|
source = "hashicorp/null"
|
|
15
19
|
version = "<%- nullProviderVersion %>"
|
|
@@ -51,13 +55,13 @@ variable "port" {
|
|
|
51
55
|
variable "serverless_min_capacity" {
|
|
52
56
|
description = "Minimum Aurora Serverless v2 ACUs."
|
|
53
57
|
type = number
|
|
54
|
-
default =
|
|
58
|
+
default = <%= serverlessMinCapacity %>
|
|
55
59
|
}
|
|
56
60
|
|
|
57
61
|
variable "serverless_max_capacity" {
|
|
58
62
|
description = "Maximum Aurora Serverless v2 ACUs."
|
|
59
63
|
type = number
|
|
60
|
-
default =
|
|
64
|
+
default = <%= serverlessMaxCapacity %>
|
|
61
65
|
}
|
|
62
66
|
|
|
63
67
|
variable "instance_count" {
|
|
@@ -91,9 +95,9 @@ variable "enable_credential_rotation" {
|
|
|
91
95
|
}
|
|
92
96
|
|
|
93
97
|
variable "enable_cloudwatch_logs" {
|
|
94
|
-
description = "Whether to export Aurora engine logs to CloudWatch. PostgreSQL
|
|
98
|
+
description = "Whether to export Aurora engine logs to CloudWatch. PostgreSQL logs DDL statements only (log_statement=ddl); MySQL enables Advanced Auditing scoped to connections and DDL (server_audit_events=CONNECT,QUERY_DDL). Neither logs statement parameter values, to avoid leaking PII into log data."
|
|
95
99
|
type = bool
|
|
96
|
-
default =
|
|
100
|
+
default = true
|
|
97
101
|
}
|
|
98
102
|
|
|
99
103
|
variable "enable_performance_insights" {
|
|
@@ -114,6 +118,12 @@ variable "enable_backup" {
|
|
|
114
118
|
default = false
|
|
115
119
|
}
|
|
116
120
|
|
|
121
|
+
variable "enable_key_rotation" {
|
|
122
|
+
description = "Whether to enable automatic key rotation on the KMS key used to encrypt the Aurora cluster and its credentials secret."
|
|
123
|
+
type = bool
|
|
124
|
+
default = true
|
|
125
|
+
}
|
|
126
|
+
|
|
117
127
|
variable "tags" {
|
|
118
128
|
description = "Tags to apply to all resources."
|
|
119
129
|
type = map(string)
|
|
@@ -184,6 +194,7 @@ module "aurora" {
|
|
|
184
194
|
enable_performance_insights = var.enable_performance_insights
|
|
185
195
|
performance_insights_retention_period = var.performance_insights_retention_period
|
|
186
196
|
enable_backup = var.enable_backup
|
|
197
|
+
enable_key_rotation = var.enable_key_rotation
|
|
187
198
|
tags = var.tags
|
|
188
199
|
}
|
|
189
200
|
|
|
@@ -84,13 +84,13 @@ variable "port" {
|
|
|
84
84
|
variable "serverless_min_capacity" {
|
|
85
85
|
description = "Minimum Aurora Serverless v2 ACUs."
|
|
86
86
|
type = number
|
|
87
|
-
default =
|
|
87
|
+
default = <%= serverlessMinCapacity %>
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
variable "serverless_max_capacity" {
|
|
91
91
|
description = "Maximum Aurora Serverless v2 ACUs."
|
|
92
92
|
type = number
|
|
93
|
-
default =
|
|
93
|
+
default = <%= serverlessMaxCapacity %>
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
variable "instance_count" {
|
|
@@ -215,6 +215,8 @@ resource "aws_kms_key" "database" {
|
|
|
215
215
|
description = "KMS key for Aurora cluster ${var.name}"
|
|
216
216
|
enable_key_rotation = var.enable_key_rotation
|
|
217
217
|
|
|
218
|
+
deletion_window_in_days = 30
|
|
219
|
+
|
|
218
220
|
policy = jsonencode({
|
|
219
221
|
Version = "2012-10-17"
|
|
220
222
|
Statement = [
|
|
@@ -357,6 +359,10 @@ resource "aws_rds_cluster" "database" {
|
|
|
357
359
|
tags = merge(var.tags, {
|
|
358
360
|
Name = "${var.name}-aurora"
|
|
359
361
|
})
|
|
362
|
+
|
|
363
|
+
lifecycle {
|
|
364
|
+
prevent_destroy = true
|
|
365
|
+
}
|
|
360
366
|
}
|
|
361
367
|
|
|
362
368
|
resource "aws_rds_cluster_instance" "database" {
|
|
@@ -5,6 +5,18 @@
|
|
|
5
5
|
import { type Tree } from '@nx/devkit';
|
|
6
6
|
import type { Containers } from '../containers.js';
|
|
7
7
|
import type { Iac } from '../iac.js';
|
|
8
|
+
/**
|
|
9
|
+
* Aurora Serverless v2 scaling bounds, in ACUs, that both IaC providers derive
|
|
10
|
+
* from so the same generator options vend the same ceiling regardless of `--iac`.
|
|
11
|
+
*
|
|
12
|
+
* Set explicitly on CDK rather than inheriting `DatabaseClusterProps`, whose
|
|
13
|
+
* default moves with `aws-cdk-lib`. Serverless v2 bills on ACUs consumed, not on
|
|
14
|
+
* the ceiling, so the maximum is headroom rather than a cost commitment.
|
|
15
|
+
*/
|
|
16
|
+
export declare const AURORA_SERVERLESS_V2_CAPACITY: {
|
|
17
|
+
readonly min: 0.5;
|
|
18
|
+
readonly max: 4;
|
|
19
|
+
};
|
|
8
20
|
export interface AddRdbConstructOptions {
|
|
9
21
|
projectName: string;
|
|
10
22
|
projectRoot: string;
|
|
@@ -7,6 +7,24 @@ import { esmVars } from "../module-format.js";
|
|
|
7
7
|
import { addDependencyToTargetIfNotPresent } from "../nx.js";
|
|
8
8
|
import { PACKAGES_DIR, SHARED_CONSTRUCTS_DIR, SHARED_TERRAFORM_DIR } from "../shared-constructs-constants.js";
|
|
9
9
|
import { terraformProviderVersions } from "../versions.js";
|
|
10
|
+
/**
|
|
11
|
+
* Aurora Serverless v2 scaling bounds, in ACUs, that both IaC providers derive
|
|
12
|
+
* from so the same generator options vend the same ceiling regardless of `--iac`.
|
|
13
|
+
*
|
|
14
|
+
* Set explicitly on CDK rather than inheriting `DatabaseClusterProps`, whose
|
|
15
|
+
* default moves with `aws-cdk-lib`. Serverless v2 bills on ACUs consumed, not on
|
|
16
|
+
* the ceiling, so the maximum is headroom rather than a cost commitment.
|
|
17
|
+
*/ export const AURORA_SERVERLESS_V2_CAPACITY = {
|
|
18
|
+
min: 0.5,
|
|
19
|
+
max: 4
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Substitution variables exposing the Aurora Serverless v2 scaling bounds to
|
|
23
|
+
* generated CDK and Terraform templates.
|
|
24
|
+
*/ const auroraServerlessV2Capacity = ()=>({
|
|
25
|
+
serverlessMinCapacity: AURORA_SERVERLESS_V2_CAPACITY.min,
|
|
26
|
+
serverlessMaxCapacity: AURORA_SERVERLESS_V2_CAPACITY.max
|
|
27
|
+
});
|
|
10
28
|
export const addRdbInfra = async (tree, options)=>{
|
|
11
29
|
if (options.iac === 'cdk') {
|
|
12
30
|
await addRdbCdkConstructs(tree, options);
|
|
@@ -23,7 +41,8 @@ export const addRdbInfra = async (tree, options)=>{
|
|
|
23
41
|
export const addRdbCdkConstructs = async (tree, options)=>{
|
|
24
42
|
generateFiles(tree, joinPathFragments(import.meta.dirname, 'files', 'cdk', 'core', 'rdb'), joinPathFragments(PACKAGES_DIR, SHARED_CONSTRUCTS_DIR, 'src', 'core', 'rdb'), {
|
|
25
43
|
...options,
|
|
26
|
-
...esmVars(tree)
|
|
44
|
+
...esmVars(tree),
|
|
45
|
+
...auroraServerlessV2Capacity()
|
|
27
46
|
}, {
|
|
28
47
|
overwriteStrategy: OverwriteStrategy.KeepExisting
|
|
29
48
|
});
|
|
@@ -39,13 +58,15 @@ export const addRdbCdkConstructs = async (tree, options)=>{
|
|
|
39
58
|
};
|
|
40
59
|
export const addRdbTerraformModules = (tree, options)=>{
|
|
41
60
|
generateFiles(tree, joinPathFragments(import.meta.dirname, 'files', 'terraform', 'core', 'rdb'), joinPathFragments(PACKAGES_DIR, SHARED_TERRAFORM_DIR, 'src', 'core', 'rdb'), {
|
|
42
|
-
...terraformProviderVersions()
|
|
61
|
+
...terraformProviderVersions(),
|
|
62
|
+
...auroraServerlessV2Capacity()
|
|
43
63
|
}, {
|
|
44
64
|
overwriteStrategy: OverwriteStrategy.KeepExisting
|
|
45
65
|
});
|
|
46
66
|
generateFiles(tree, joinPathFragments(import.meta.dirname, 'files', 'terraform', 'app', 'dbs'), joinPathFragments(PACKAGES_DIR, SHARED_TERRAFORM_DIR, 'src', 'app', 'dbs'), {
|
|
47
67
|
...options,
|
|
48
|
-
...terraformProviderVersions()
|
|
68
|
+
...terraformProviderVersions(),
|
|
69
|
+
...auroraServerlessV2Capacity()
|
|
49
70
|
}, {
|
|
50
71
|
overwriteStrategy: OverwriteStrategy.KeepExisting
|
|
51
72
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/utils/rdb-constructs/rdb-constructs.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n type ProjectConfiguration,\n type Tree,\n updateJson,\n} from '@nx/devkit';\nimport { addStarExport } from '../ast.js';\nimport type { Containers } from '../containers.js';\nimport type { Iac } from '../iac.js';\nimport { esmVars } from '../module-format.js';\nimport { addDependencyToTargetIfNotPresent } from '../nx.js';\nimport {\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n SHARED_TERRAFORM_DIR,\n} from '../shared-constructs-constants.js';\nimport { terraformProviderVersions } from '../versions.js';\n\nexport interface AddRdbConstructOptions {\n projectName: string;\n projectRoot: string;\n nameClassName: string;\n nameKebabCase: string;\n databasePackageAlias: string;\n databaseName: string;\n adminUser: string;\n engine: 'postgres' | 'mysql';\n migrationBundleDir: string;\n /**\n * Node.js zip bundle directory for the create-db-user Lambda (ts#rdb).\n * When absent the migration Docker image is reused with the\n * `create_db_user_handler.handler` command (py#rdb).\n */\n createDbUserBundleDir: string;\n /** ORM framework used by the create-db-user Lambda. */\n framework: 'prisma' | 'sqlmodel';\n /** Local Docker tag for the Python create-db-user Lambda image. */\n createDbUserDockerImageTag?: string;\n /** Local Docker tag for the migration Lambda image. */\n migrationDockerImageTag: string;\n containerEngine: Containers;\n}\n\nexport const addRdbInfra = async (\n tree: Tree,\n options: AddRdbConstructOptions & { iac: Iac },\n) => {\n if (options.iac === 'cdk') {\n await addRdbCdkConstructs(tree, options);\n } else if (options.iac === 'terraform') {\n addRdbTerraformModules(tree, options);\n } else {\n throw new Error(`Unsupported iac ${options.iac}`);\n }\n\n updateJson(\n tree,\n joinPathFragments(\n PACKAGES_DIR,\n options.iac === 'cdk' ? SHARED_CONSTRUCTS_DIR : SHARED_TERRAFORM_DIR,\n 'project.json',\n ),\n (config: ProjectConfiguration) => {\n addDependencyToTargetIfNotPresent(\n config,\n 'build',\n `${options.projectName}:build`,\n );\n return config;\n },\n );\n};\n\nexport const addRdbCdkConstructs = async (\n tree: Tree,\n options: AddRdbConstructOptions,\n) => {\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'cdk', 'core', 'rdb'),\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'core',\n 'rdb',\n ),\n { ...options, ...esmVars(tree) },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'cdk', 'app', 'dbs'),\n joinPathFragments(PACKAGES_DIR, SHARED_CONSTRUCTS_DIR, 'src', 'app', 'dbs'),\n { ...options, ...esmVars(tree) },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n await addStarExport(\n tree,\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'core',\n 'index.ts',\n ),\n './rdb/aurora.js',\n );\n await addStarExport(\n tree,\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'app',\n 'dbs',\n 'index.ts',\n ),\n `./${options.nameKebabCase}.js`,\n );\n await addStarExport(\n tree,\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'app',\n 'index.ts',\n ),\n './dbs/index.js',\n );\n};\n\nexport const addRdbTerraformModules = (\n tree: Tree,\n options: AddRdbConstructOptions,\n) => {\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'terraform', 'core', 'rdb'),\n joinPathFragments(PACKAGES_DIR, SHARED_TERRAFORM_DIR, 'src', 'core', 'rdb'),\n { ...terraformProviderVersions() },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'terraform', 'app', 'dbs'),\n joinPathFragments(PACKAGES_DIR, SHARED_TERRAFORM_DIR, 'src', 'app', 'dbs'),\n {
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/utils/rdb-constructs/rdb-constructs.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n type ProjectConfiguration,\n type Tree,\n updateJson,\n} from '@nx/devkit';\nimport { addStarExport } from '../ast.js';\nimport type { Containers } from '../containers.js';\nimport type { Iac } from '../iac.js';\nimport { esmVars } from '../module-format.js';\nimport { addDependencyToTargetIfNotPresent } from '../nx.js';\nimport {\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n SHARED_TERRAFORM_DIR,\n} from '../shared-constructs-constants.js';\nimport { terraformProviderVersions } from '../versions.js';\n\n/**\n * Aurora Serverless v2 scaling bounds, in ACUs, that both IaC providers derive\n * from so the same generator options vend the same ceiling regardless of `--iac`.\n *\n * Set explicitly on CDK rather than inheriting `DatabaseClusterProps`, whose\n * default moves with `aws-cdk-lib`. Serverless v2 bills on ACUs consumed, not on\n * the ceiling, so the maximum is headroom rather than a cost commitment.\n */\nexport const AURORA_SERVERLESS_V2_CAPACITY = {\n min: 0.5,\n max: 4,\n} as const;\n\n/**\n * Substitution variables exposing the Aurora Serverless v2 scaling bounds to\n * generated CDK and Terraform templates.\n */\nconst auroraServerlessV2Capacity = () => ({\n serverlessMinCapacity: AURORA_SERVERLESS_V2_CAPACITY.min,\n serverlessMaxCapacity: AURORA_SERVERLESS_V2_CAPACITY.max,\n});\n\nexport interface AddRdbConstructOptions {\n projectName: string;\n projectRoot: string;\n nameClassName: string;\n nameKebabCase: string;\n databasePackageAlias: string;\n databaseName: string;\n adminUser: string;\n engine: 'postgres' | 'mysql';\n migrationBundleDir: string;\n /**\n * Node.js zip bundle directory for the create-db-user Lambda (ts#rdb).\n * When absent the migration Docker image is reused with the\n * `create_db_user_handler.handler` command (py#rdb).\n */\n createDbUserBundleDir: string;\n /** ORM framework used by the create-db-user Lambda. */\n framework: 'prisma' | 'sqlmodel';\n /** Local Docker tag for the Python create-db-user Lambda image. */\n createDbUserDockerImageTag?: string;\n /** Local Docker tag for the migration Lambda image. */\n migrationDockerImageTag: string;\n containerEngine: Containers;\n}\n\nexport const addRdbInfra = async (\n tree: Tree,\n options: AddRdbConstructOptions & { iac: Iac },\n) => {\n if (options.iac === 'cdk') {\n await addRdbCdkConstructs(tree, options);\n } else if (options.iac === 'terraform') {\n addRdbTerraformModules(tree, options);\n } else {\n throw new Error(`Unsupported iac ${options.iac}`);\n }\n\n updateJson(\n tree,\n joinPathFragments(\n PACKAGES_DIR,\n options.iac === 'cdk' ? SHARED_CONSTRUCTS_DIR : SHARED_TERRAFORM_DIR,\n 'project.json',\n ),\n (config: ProjectConfiguration) => {\n addDependencyToTargetIfNotPresent(\n config,\n 'build',\n `${options.projectName}:build`,\n );\n return config;\n },\n );\n};\n\nexport const addRdbCdkConstructs = async (\n tree: Tree,\n options: AddRdbConstructOptions,\n) => {\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'cdk', 'core', 'rdb'),\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'core',\n 'rdb',\n ),\n { ...options, ...esmVars(tree), ...auroraServerlessV2Capacity() },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'cdk', 'app', 'dbs'),\n joinPathFragments(PACKAGES_DIR, SHARED_CONSTRUCTS_DIR, 'src', 'app', 'dbs'),\n { ...options, ...esmVars(tree) },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n await addStarExport(\n tree,\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'core',\n 'index.ts',\n ),\n './rdb/aurora.js',\n );\n await addStarExport(\n tree,\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'app',\n 'dbs',\n 'index.ts',\n ),\n `./${options.nameKebabCase}.js`,\n );\n await addStarExport(\n tree,\n joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'app',\n 'index.ts',\n ),\n './dbs/index.js',\n );\n};\n\nexport const addRdbTerraformModules = (\n tree: Tree,\n options: AddRdbConstructOptions,\n) => {\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'terraform', 'core', 'rdb'),\n joinPathFragments(PACKAGES_DIR, SHARED_TERRAFORM_DIR, 'src', 'core', 'rdb'),\n { ...terraformProviderVersions(), ...auroraServerlessV2Capacity() },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'terraform', 'app', 'dbs'),\n joinPathFragments(PACKAGES_DIR, SHARED_TERRAFORM_DIR, 'src', 'app', 'dbs'),\n {\n ...options,\n ...terraformProviderVersions(),\n ...auroraServerlessV2Capacity(),\n },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n};\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","updateJson","addStarExport","esmVars","addDependencyToTargetIfNotPresent","PACKAGES_DIR","SHARED_CONSTRUCTS_DIR","SHARED_TERRAFORM_DIR","terraformProviderVersions","AURORA_SERVERLESS_V2_CAPACITY","min","max","auroraServerlessV2Capacity","serverlessMinCapacity","serverlessMaxCapacity","addRdbInfra","tree","options","iac","addRdbCdkConstructs","addRdbTerraformModules","Error","config","projectName","dirname","overwriteStrategy","KeepExisting","nameKebabCase"],"mappings":"AAAA;;;CAGC,GACD,SACEA,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EAGjBC,UAAU,QACL,aAAa;AACpB,SAASC,aAAa,QAAQ,YAAY;AAG1C,SAASC,OAAO,QAAQ,sBAAsB;AAC9C,SAASC,iCAAiC,QAAQ,WAAW;AAC7D,SACEC,YAAY,EACZC,qBAAqB,EACrBC,oBAAoB,QACf,oCAAoC;AAC3C,SAASC,yBAAyB,QAAQ,iBAAiB;AAE3D;;;;;;;CAOC,GACD,OAAO,MAAMC,gCAAgC;IAC3CC,KAAK;IACLC,KAAK;AACP,EAAW;AAEX;;;CAGC,GACD,MAAMC,6BAA6B,IAAO,CAAA;QACxCC,uBAAuBJ,8BAA8BC,GAAG;QACxDI,uBAAuBL,8BAA8BE,GAAG;IAC1D,CAAA;AA2BA,OAAO,MAAMI,cAAc,OACzBC,MACAC;IAEA,IAAIA,QAAQC,GAAG,KAAK,OAAO;QACzB,MAAMC,oBAAoBH,MAAMC;IAClC,OAAO,IAAIA,QAAQC,GAAG,KAAK,aAAa;QACtCE,uBAAuBJ,MAAMC;IAC/B,OAAO;QACL,MAAM,IAAII,MAAM,CAAC,gBAAgB,EAAEJ,QAAQC,GAAG,EAAE;IAClD;IAEAjB,WACEe,MACAjB,kBACEM,cACAY,QAAQC,GAAG,KAAK,QAAQZ,wBAAwBC,sBAChD,iBAEF,CAACe;QACClB,kCACEkB,QACA,SACA,GAAGL,QAAQM,WAAW,CAAC,MAAM,CAAC;QAEhC,OAAOD;IACT;AAEJ,EAAE;AAEF,OAAO,MAAMH,sBAAsB,OACjCH,MACAC;IAEAnB,cACEkB,MACAjB,kBAAkB,YAAYyB,OAAO,EAAE,SAAS,OAAO,QAAQ,QAC/DzB,kBACEM,cACAC,uBACA,OACA,QACA,QAEF;QAAE,GAAGW,OAAO;QAAE,GAAGd,QAAQa,KAAK;QAAE,GAAGJ,4BAA4B;IAAC,GAChE;QACEa,mBAAmBzB,kBAAkB0B,YAAY;IACnD;IAGF5B,cACEkB,MACAjB,kBAAkB,YAAYyB,OAAO,EAAE,SAAS,OAAO,OAAO,QAC9DzB,kBAAkBM,cAAcC,uBAAuB,OAAO,OAAO,QACrE;QAAE,GAAGW,OAAO;QAAE,GAAGd,QAAQa,KAAK;IAAC,GAC/B;QACES,mBAAmBzB,kBAAkB0B,YAAY;IACnD;IAGF,MAAMxB,cACJc,MACAjB,kBACEM,cACAC,uBACA,OACA,QACA,aAEF;IAEF,MAAMJ,cACJc,MACAjB,kBACEM,cACAC,uBACA,OACA,OACA,OACA,aAEF,CAAC,EAAE,EAAEW,QAAQU,aAAa,CAAC,GAAG,CAAC;IAEjC,MAAMzB,cACJc,MACAjB,kBACEM,cACAC,uBACA,OACA,OACA,aAEF;AAEJ,EAAE;AAEF,OAAO,MAAMc,yBAAyB,CACpCJ,MACAC;IAEAnB,cACEkB,MACAjB,kBAAkB,YAAYyB,OAAO,EAAE,SAAS,aAAa,QAAQ,QACrEzB,kBAAkBM,cAAcE,sBAAsB,OAAO,QAAQ,QACrE;QAAE,GAAGC,2BAA2B;QAAE,GAAGI,4BAA4B;IAAC,GAClE;QACEa,mBAAmBzB,kBAAkB0B,YAAY;IACnD;IAGF5B,cACEkB,MACAjB,kBAAkB,YAAYyB,OAAO,EAAE,SAAS,aAAa,OAAO,QACpEzB,kBAAkBM,cAAcE,sBAAsB,OAAO,OAAO,QACpE;QACE,GAAGU,OAAO;QACV,GAAGT,2BAA2B;QAC9B,GAAGI,4BAA4B;IACjC,GACA;QACEa,mBAAmBzB,kBAAkB0B,YAAY;IACnD;AAEJ,EAAE"}
|
|
@@ -54,6 +54,11 @@ export declare const generatedInfrastructure: (m: IacMetadata) => boolean;
|
|
|
54
54
|
* branch never writes.
|
|
55
55
|
*/
|
|
56
56
|
export declare const generatedTerraform: (m: IacMetadata) => boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Whether CDK infrastructure was generated, for the packages only a construct
|
|
59
|
+
* imports.
|
|
60
|
+
*/
|
|
61
|
+
export declare const generatedCdk: (m: IacMetadata) => boolean;
|
|
57
62
|
/**
|
|
58
63
|
* Dependencies a caller must declare to use the shared constructs project.
|
|
59
64
|
* Lives here so generators can spread it without importing the generator.
|
|
@@ -43,6 +43,10 @@ export const DYNAMODB_GENERATOR_IDS = [
|
|
|
43
43
|
* module pins — a Terraform inline script's `uv run --with` pins, which the CDK
|
|
44
44
|
* branch never writes.
|
|
45
45
|
*/ export const generatedTerraform = (m)=>m.iac === 'terraform';
|
|
46
|
+
/**
|
|
47
|
+
* Whether CDK infrastructure was generated, for the packages only a construct
|
|
48
|
+
* imports.
|
|
49
|
+
*/ export const generatedCdk = (m)=>m.iac === 'cdk';
|
|
46
50
|
/**
|
|
47
51
|
* Dependencies a caller must declare to use the shared constructs project.
|
|
48
52
|
* Lives here so generators can spread it without importing the generator.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../packages/nx-plugin/src/utils/shared-constructs-constants.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { DeclaredTsDependency } from './declared-dependencies.js';\nimport type { ITsDepVersion } from './versions.js';\n\nexport const PACKAGES_DIR = 'packages';\nexport const SHARED_CONSTRUCTS_NAME = 'common-constructs';\nexport const SHARED_CONSTRUCTS_DIR = 'common/constructs';\nexport const SHARED_TERRAFORM_NAME = 'terraform';\nexport const SHARED_TERRAFORM_DIR = 'common/terraform';\nexport const SHARED_SHADCN_NAME = 'common-shadcn';\nexport const SHARED_SHADCN_DIR = 'common/shadcn';\nexport const SHARED_INFRA_CONFIG_NAME = 'common-infra-config';\nexport const SHARED_INFRA_CONFIG_DIR = 'common/infra-config';\nexport const SHARED_SCRIPTS_NAME = 'common-scripts';\nexport const SHARED_SCRIPTS_DIR = 'common/scripts';\n\nexport const DYNAMODB_GENERATOR_IDS = ['ts#dynamodb', 'py#dynamodb'];\n\n/**\n * Directory the vended Terraform runtime-config modules aggregate into at apply\n * time, relative to the workspace root. The `entry` module writes leaf files\n * under `entries/<namespace>/`, and the `read` / `appconfig-deployment` modules\n * merge those into one `<namespace>.json` here.\n */\nexport const TERRAFORM_RUNTIME_CONFIG_DIR = `dist/${PACKAGES_DIR}/${SHARED_TERRAFORM_DIR}/runtime-config`;\n\n/**\n * Runtime-config namespace the static website publishes to and reads back, as\n * passed to the `read` module by the vended static-website Terraform module.\n */\nexport const WEBSITE_RUNTIME_CONFIG_NAMESPACE = 'connection';\n\n/**\n * File the Terraform aggregation writes the website's runtime config to,\n * relative to the workspace root.\n */\nexport const TERRAFORM_WEBSITE_RUNTIME_CONFIG_FILE = `${TERRAFORM_RUNTIME_CONFIG_DIR}/${WEBSITE_RUNTIME_CONFIG_NAMESPACE}.json`;\n\n/**\n * What a generator records about the infrastructure it generated.\n *\n * Every generator that creates infrastructure records the `iac` it used, so a\n * predicate can tell a CDK project from a Terraform one at upgrade time. Absent\n * when the generator was run with no infrastructure, so its presence doubles as\n * \"infrastructure was generated\" — which is what gates the packages an infra\n * helper adds.\n */\nexport interface IacMetadata {\n readonly iac?: string;\n}\n\n/**\n * Whether infrastructure was generated at all, so the packages an infra helper\n * adds are only claimed where that helper ran.\n *\n * Reads `iac` rather than the generator's own `infra` option: every generator\n * resolves `iac` only on the infra branch, so one recorded field answers both\n * questions and no generator needs a second one.\n */\nexport const generatedInfrastructure = (m: IacMetadata): boolean =>\n m.iac !== undefined;\n\n/**\n * Whether Terraform infrastructure was generated, for the versions only a `.tf`\n * module pins — a Terraform inline script's `uv run --with` pins, which the CDK\n * branch never writes.\n */\nexport const generatedTerraform = (m: IacMetadata): boolean =>\n m.iac === 'terraform';\n\n/**\n * Dependencies a caller must declare to use the shared constructs project.\n * Lives here so generators can spread it without importing the generator.\n *\n * `constructs` and `aws-cdk-lib` are gated on CDK because\n * `sharedConstructsGenerator` creates the TypeScript constructs project on that\n * branch alone — a Terraform workspace gets the shared Terraform project and\n * never receives them.\n */\nexport const SHARED_CONSTRUCTS_DEPENDENCIES = [\n { name: 'constructs', when: (m: IacMetadata) => m.iac === 'cdk' },\n { name: 'aws-cdk-lib', when: (m: IacMetadata) => m.iac === 'cdk' },\n { name: '@types/node' },\n] as const satisfies readonly DeclaredTsDependency<\n ITsDepVersion,\n IacMetadata\n>[];\n"],"names":["PACKAGES_DIR","SHARED_CONSTRUCTS_NAME","SHARED_CONSTRUCTS_DIR","SHARED_TERRAFORM_NAME","SHARED_TERRAFORM_DIR","SHARED_SHADCN_NAME","SHARED_SHADCN_DIR","SHARED_INFRA_CONFIG_NAME","SHARED_INFRA_CONFIG_DIR","SHARED_SCRIPTS_NAME","SHARED_SCRIPTS_DIR","DYNAMODB_GENERATOR_IDS","TERRAFORM_RUNTIME_CONFIG_DIR","WEBSITE_RUNTIME_CONFIG_NAMESPACE","TERRAFORM_WEBSITE_RUNTIME_CONFIG_FILE","generatedInfrastructure","m","iac","undefined","generatedTerraform","SHARED_CONSTRUCTS_DEPENDENCIES","name","when"],"mappings":"AAAA;;;CAGC,GAID,OAAO,MAAMA,eAAe,WAAW;AACvC,OAAO,MAAMC,yBAAyB,oBAAoB;AAC1D,OAAO,MAAMC,wBAAwB,oBAAoB;AACzD,OAAO,MAAMC,wBAAwB,YAAY;AACjD,OAAO,MAAMC,uBAAuB,mBAAmB;AACvD,OAAO,MAAMC,qBAAqB,gBAAgB;AAClD,OAAO,MAAMC,oBAAoB,gBAAgB;AACjD,OAAO,MAAMC,2BAA2B,sBAAsB;AAC9D,OAAO,MAAMC,0BAA0B,sBAAsB;AAC7D,OAAO,MAAMC,sBAAsB,iBAAiB;AACpD,OAAO,MAAMC,qBAAqB,iBAAiB;AAEnD,OAAO,MAAMC,yBAAyB;IAAC;IAAe;CAAc,CAAC;AAErE;;;;;CAKC,GACD,OAAO,MAAMC,+BAA+B,CAAC,KAAK,EAAEZ,aAAa,CAAC,EAAEI,qBAAqB,eAAe,CAAC,CAAC;AAE1G;;;CAGC,GACD,OAAO,MAAMS,mCAAmC,aAAa;AAE7D;;;CAGC,GACD,OAAO,MAAMC,wCAAwC,GAAGF,6BAA6B,CAAC,EAAEC,iCAAiC,KAAK,CAAC,CAAC;AAehI;;;;;;;CAOC,GACD,OAAO,MAAME,0BAA0B,CAACC,IACtCA,EAAEC,GAAG,KAAKC,UAAU;AAEtB;;;;CAIC,GACD,OAAO,MAAMC,qBAAqB,CAACH,IACjCA,EAAEC,GAAG,KAAK,YAAY;AAExB;;;;;;;;CAQC,GACD,OAAO,
|
|
1
|
+
{"version":3,"sources":["../../../../../packages/nx-plugin/src/utils/shared-constructs-constants.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { DeclaredTsDependency } from './declared-dependencies.js';\nimport type { ITsDepVersion } from './versions.js';\n\nexport const PACKAGES_DIR = 'packages';\nexport const SHARED_CONSTRUCTS_NAME = 'common-constructs';\nexport const SHARED_CONSTRUCTS_DIR = 'common/constructs';\nexport const SHARED_TERRAFORM_NAME = 'terraform';\nexport const SHARED_TERRAFORM_DIR = 'common/terraform';\nexport const SHARED_SHADCN_NAME = 'common-shadcn';\nexport const SHARED_SHADCN_DIR = 'common/shadcn';\nexport const SHARED_INFRA_CONFIG_NAME = 'common-infra-config';\nexport const SHARED_INFRA_CONFIG_DIR = 'common/infra-config';\nexport const SHARED_SCRIPTS_NAME = 'common-scripts';\nexport const SHARED_SCRIPTS_DIR = 'common/scripts';\n\nexport const DYNAMODB_GENERATOR_IDS = ['ts#dynamodb', 'py#dynamodb'];\n\n/**\n * Directory the vended Terraform runtime-config modules aggregate into at apply\n * time, relative to the workspace root. The `entry` module writes leaf files\n * under `entries/<namespace>/`, and the `read` / `appconfig-deployment` modules\n * merge those into one `<namespace>.json` here.\n */\nexport const TERRAFORM_RUNTIME_CONFIG_DIR = `dist/${PACKAGES_DIR}/${SHARED_TERRAFORM_DIR}/runtime-config`;\n\n/**\n * Runtime-config namespace the static website publishes to and reads back, as\n * passed to the `read` module by the vended static-website Terraform module.\n */\nexport const WEBSITE_RUNTIME_CONFIG_NAMESPACE = 'connection';\n\n/**\n * File the Terraform aggregation writes the website's runtime config to,\n * relative to the workspace root.\n */\nexport const TERRAFORM_WEBSITE_RUNTIME_CONFIG_FILE = `${TERRAFORM_RUNTIME_CONFIG_DIR}/${WEBSITE_RUNTIME_CONFIG_NAMESPACE}.json`;\n\n/**\n * What a generator records about the infrastructure it generated.\n *\n * Every generator that creates infrastructure records the `iac` it used, so a\n * predicate can tell a CDK project from a Terraform one at upgrade time. Absent\n * when the generator was run with no infrastructure, so its presence doubles as\n * \"infrastructure was generated\" — which is what gates the packages an infra\n * helper adds.\n */\nexport interface IacMetadata {\n readonly iac?: string;\n}\n\n/**\n * Whether infrastructure was generated at all, so the packages an infra helper\n * adds are only claimed where that helper ran.\n *\n * Reads `iac` rather than the generator's own `infra` option: every generator\n * resolves `iac` only on the infra branch, so one recorded field answers both\n * questions and no generator needs a second one.\n */\nexport const generatedInfrastructure = (m: IacMetadata): boolean =>\n m.iac !== undefined;\n\n/**\n * Whether Terraform infrastructure was generated, for the versions only a `.tf`\n * module pins — a Terraform inline script's `uv run --with` pins, which the CDK\n * branch never writes.\n */\nexport const generatedTerraform = (m: IacMetadata): boolean =>\n m.iac === 'terraform';\n\n/**\n * Whether CDK infrastructure was generated, for the packages only a construct\n * imports.\n */\nexport const generatedCdk = (m: IacMetadata): boolean => m.iac === 'cdk';\n\n/**\n * Dependencies a caller must declare to use the shared constructs project.\n * Lives here so generators can spread it without importing the generator.\n *\n * `constructs` and `aws-cdk-lib` are gated on CDK because\n * `sharedConstructsGenerator` creates the TypeScript constructs project on that\n * branch alone — a Terraform workspace gets the shared Terraform project and\n * never receives them.\n */\nexport const SHARED_CONSTRUCTS_DEPENDENCIES = [\n { name: 'constructs', when: (m: IacMetadata) => m.iac === 'cdk' },\n { name: 'aws-cdk-lib', when: (m: IacMetadata) => m.iac === 'cdk' },\n { name: '@types/node' },\n] as const satisfies readonly DeclaredTsDependency<\n ITsDepVersion,\n IacMetadata\n>[];\n"],"names":["PACKAGES_DIR","SHARED_CONSTRUCTS_NAME","SHARED_CONSTRUCTS_DIR","SHARED_TERRAFORM_NAME","SHARED_TERRAFORM_DIR","SHARED_SHADCN_NAME","SHARED_SHADCN_DIR","SHARED_INFRA_CONFIG_NAME","SHARED_INFRA_CONFIG_DIR","SHARED_SCRIPTS_NAME","SHARED_SCRIPTS_DIR","DYNAMODB_GENERATOR_IDS","TERRAFORM_RUNTIME_CONFIG_DIR","WEBSITE_RUNTIME_CONFIG_NAMESPACE","TERRAFORM_WEBSITE_RUNTIME_CONFIG_FILE","generatedInfrastructure","m","iac","undefined","generatedTerraform","generatedCdk","SHARED_CONSTRUCTS_DEPENDENCIES","name","when"],"mappings":"AAAA;;;CAGC,GAID,OAAO,MAAMA,eAAe,WAAW;AACvC,OAAO,MAAMC,yBAAyB,oBAAoB;AAC1D,OAAO,MAAMC,wBAAwB,oBAAoB;AACzD,OAAO,MAAMC,wBAAwB,YAAY;AACjD,OAAO,MAAMC,uBAAuB,mBAAmB;AACvD,OAAO,MAAMC,qBAAqB,gBAAgB;AAClD,OAAO,MAAMC,oBAAoB,gBAAgB;AACjD,OAAO,MAAMC,2BAA2B,sBAAsB;AAC9D,OAAO,MAAMC,0BAA0B,sBAAsB;AAC7D,OAAO,MAAMC,sBAAsB,iBAAiB;AACpD,OAAO,MAAMC,qBAAqB,iBAAiB;AAEnD,OAAO,MAAMC,yBAAyB;IAAC;IAAe;CAAc,CAAC;AAErE;;;;;CAKC,GACD,OAAO,MAAMC,+BAA+B,CAAC,KAAK,EAAEZ,aAAa,CAAC,EAAEI,qBAAqB,eAAe,CAAC,CAAC;AAE1G;;;CAGC,GACD,OAAO,MAAMS,mCAAmC,aAAa;AAE7D;;;CAGC,GACD,OAAO,MAAMC,wCAAwC,GAAGF,6BAA6B,CAAC,EAAEC,iCAAiC,KAAK,CAAC,CAAC;AAehI;;;;;;;CAOC,GACD,OAAO,MAAME,0BAA0B,CAACC,IACtCA,EAAEC,GAAG,KAAKC,UAAU;AAEtB;;;;CAIC,GACD,OAAO,MAAMC,qBAAqB,CAACH,IACjCA,EAAEC,GAAG,KAAK,YAAY;AAExB;;;CAGC,GACD,OAAO,MAAMG,eAAe,CAACJ,IAA4BA,EAAEC,GAAG,KAAK,MAAM;AAEzE;;;;;;;;CAQC,GACD,OAAO,MAAMI,iCAAiC;IAC5C;QAAEC,MAAM;QAAcC,MAAM,CAACP,IAAmBA,EAAEC,GAAG,KAAK;IAAM;IAChE;QAAEK,MAAM;QAAeC,MAAM,CAACP,IAAmBA,EAAEC,GAAG,KAAK;IAAM;IACjE;QAAEK,MAAM;IAAc;CACvB,CAGG"}
|
package/src/utils/website-constructs/files/terraform/core/static-website/static-website.tf.template
CHANGED
|
@@ -5,6 +5,10 @@ terraform {
|
|
|
5
5
|
version = "<%- awsProviderVersion %>"
|
|
6
6
|
configuration_aliases = [aws.us_east_1]
|
|
7
7
|
}
|
|
8
|
+
null = {
|
|
9
|
+
source = "hashicorp/null"
|
|
10
|
+
version = "<%- nullProviderVersion %>"
|
|
11
|
+
}
|
|
8
12
|
random = {
|
|
9
13
|
source = "hashicorp/random"
|
|
10
14
|
version = "<%- randomProviderVersion %>"
|