@aws/nx-plugin 0.109.0 → 0.110.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/package.json +1 -1
  2. package/src/preset/__snapshots__/generator.spec.ts.snap +11 -1
  3. package/src/preset/generator.js +12 -3
  4. package/src/preset/generator.js.map +1 -1
  5. package/src/py/fast-api/__snapshots__/generator.spec.ts.snap +184 -106
  6. package/src/py/lambda-function/__snapshots__/generator.spec.ts.snap +74 -18
  7. package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +11 -9
  8. package/src/py/strands-agent/__snapshots__/generator.spec.ts.snap +11 -9
  9. package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +114 -62
  10. package/src/terraform/project/files/application/scripts/aws-config.ts.template +41 -0
  11. package/src/terraform/project/files/application/scripts/bootstrap.ts.template +91 -0
  12. package/src/terraform/project/files/application/scripts/init.ts.template +44 -0
  13. package/src/terraform/project/generator.js +16 -11
  14. package/src/terraform/project/generator.js.map +1 -1
  15. package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +175 -97
  16. package/src/ts/lambda-function/__snapshots__/generator.spec.ts.snap +74 -18
  17. package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +11 -9
  18. package/src/ts/react-website/agui/generator.js +7 -0
  19. package/src/ts/react-website/agui/generator.js.map +1 -1
  20. package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +7 -0
  21. package/src/ts/strands-agent/__snapshots__/generator.spec.ts.snap +11 -9
  22. package/src/utils/agent-core-constructs/files/terraform/app/agent-core/__nameKebabCase__/__nameKebabCase__.tf.template +14 -12
  23. package/src/utils/api-constructs/files/terraform/app/apis/http/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +30 -17
  24. package/src/utils/api-constructs/files/terraform/app/apis/rest/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +32 -19
  25. package/src/utils/api-constructs/files/terraform/core/api/http/http-api/http-api.tf.template +2 -2
  26. package/src/utils/files/terraform/scripts/reset-runtime-config.ts.template +25 -0
  27. package/src/utils/files/terraform/src/core/asset-bucket/asset-bucket.tf.template +203 -0
  28. package/src/utils/files/terraform/src/core/runtime-config/appconfig/appconfig.tf.template +42 -39
  29. package/src/utils/files/terraform/src/core/runtime-config/appconfig-deployment/appconfig-deployment.tf.template +138 -0
  30. package/src/utils/files/terraform/src/core/runtime-config/entry/entry.tf.template +26 -90
  31. package/src/utils/files/terraform/src/core/runtime-config/read/read.tf.template +61 -5
  32. package/src/utils/function-constructs/files/terraform/app/lambda-functions/__functionNameKebabCase__/__functionNameKebabCase__.tf.template +36 -8
  33. package/src/utils/identity-constructs/files/terraform/core/user-identity/identity/identity.tf.template +6 -6
  34. package/src/utils/pnpm-workspace.d.ts +22 -0
  35. package/src/utils/pnpm-workspace.js +58 -0
  36. package/src/utils/pnpm-workspace.js.map +1 -0
  37. package/src/utils/shared-constructs.js +4 -2
  38. package/src/utils/shared-constructs.js.map +1 -1
  39. package/src/utils/versions.d.ts +4 -1
  40. package/src/utils/versions.js +3 -0
  41. package/src/utils/versions.js.map +1 -1
  42. package/src/utils/website-constructs/files/terraform/core/static-website/static-website.tf.template +7 -0
@@ -66,7 +66,20 @@ export class TestProjectTestFunction extends Function {
66
66
 
67
67
  exports[`lambda-handler project generator > terraform iacProvider > should generate terraform files for python lambda function and snapshot them > terraform-python-lambda-files 1`] = `
68
68
  {
69
- "test-project-test-function.tf": "variable "tags" {
69
+ "test-project-test-function.tf": "terraform {
70
+ required_providers {
71
+ aws = {
72
+ source = "hashicorp/aws"
73
+ version = "~> 6.0"
74
+ }
75
+ archive = {
76
+ source = "hashicorp/archive"
77
+ version = "~> 2.0"
78
+ }
79
+ }
80
+ }
81
+
82
+ variable "tags" {
70
83
  description = "Tags to apply to resources"
71
84
  type = map(string)
72
85
  default = {}
@@ -88,12 +101,17 @@ variable "additional_iam_policy_statements" {
88
101
  default = []
89
102
  }
90
103
 
104
+ variable "asset_bucket_name" {
105
+ description = "Name of the shared asset S3 bucket used to stage the Lambda deployment zip. Instantiate the \`core/asset-bucket\` module once per deployment and pass its \`bucket_name\` output here."
106
+ type = string
107
+ }
108
+
91
109
  data "aws_caller_identity" "current" {}
92
110
  data "aws_region" "current" {}
93
111
 
94
112
  locals {
95
113
  aws_account_id = data.aws_caller_identity.current.account_id
96
- aws_region = data.aws_region.current.name
114
+ aws_region = data.aws_region.current.region
97
115
  }
98
116
 
99
117
  resource "random_string" "suffix" {
@@ -168,19 +186,29 @@ data "archive_file" "lambda_zip" {
168
186
  output_path = "\${path.module}/../../../../../../../dist/packages/common/terraform/lambda-functions/test-project-test-function/lambda.zip"
169
187
  }
170
188
 
189
+ resource "aws_s3_object" "lambda_zip" {
190
+ bucket = var.asset_bucket_name
191
+ key = "lambdas/test-project-test-function/\${data.archive_file.lambda_zip.output_base64sha256}.zip"
192
+ source = data.archive_file.lambda_zip.output_path
193
+ source_hash = data.archive_file.lambda_zip.output_base64sha256
194
+ etag = data.archive_file.lambda_zip.output_md5
195
+ }
196
+
171
197
  resource "aws_lambda_function" "lambda_function" {
172
198
  #checkov:skip=CKV_AWS_117:Lambda function does not need to be in VPC for this use case
173
199
  #checkov:skip=CKV_AWS_116:Dead Letter Queue not required for this simple use case
174
200
  #checkov:skip=CKV_AWS_272:Code signing not required for this use case
175
201
  #checkov:skip=CKV_AWS_115:Concurrent execution limit not required for this use case
176
202
  #checkov:skip=CKV_AWS_173:Lambda environment variables encrypted by managed key
177
- filename = data.archive_file.lambda_zip.output_path
178
- function_name = "test-project-test-function-\${random_string.suffix.result}"
179
- role = aws_iam_role.lambda_role.arn
180
- handler = "test_project.test_function.lambda_handler"
181
- source_code_hash = data.archive_file.lambda_zip.output_base64sha256
182
- runtime = "python3.14"
183
- timeout = 30
203
+ s3_bucket = aws_s3_object.lambda_zip.bucket
204
+ s3_key = aws_s3_object.lambda_zip.key
205
+ s3_object_version = aws_s3_object.lambda_zip.version_id
206
+ function_name = "test-project-test-function-\${random_string.suffix.result}"
207
+ role = aws_iam_role.lambda_role.arn
208
+ handler = "test_project.test_function.lambda_handler"
209
+ source_code_hash = data.archive_file.lambda_zip.output_base64sha256
210
+ runtime = "python3.14"
211
+ timeout = 30
184
212
 
185
213
  tracing_config {
186
214
  mode = "Active"
@@ -219,7 +247,20 @@ output "role_name" {
219
247
  `;
220
248
 
221
249
  exports[`lambda-handler project generator > terraform iacProvider > should match snapshot for terraform generated files with different configurations > terraform-python-lambda-snapshot-function.tf 1`] = `
222
- "variable "tags" {
250
+ "terraform {
251
+ required_providers {
252
+ aws = {
253
+ source = "hashicorp/aws"
254
+ version = "~> 6.0"
255
+ }
256
+ archive = {
257
+ source = "hashicorp/archive"
258
+ version = "~> 2.0"
259
+ }
260
+ }
261
+ }
262
+
263
+ variable "tags" {
223
264
  description = "Tags to apply to resources"
224
265
  type = map(string)
225
266
  default = {}
@@ -241,12 +282,17 @@ variable "additional_iam_policy_statements" {
241
282
  default = []
242
283
  }
243
284
 
285
+ variable "asset_bucket_name" {
286
+ description = "Name of the shared asset S3 bucket used to stage the Lambda deployment zip. Instantiate the \`core/asset-bucket\` module once per deployment and pass its \`bucket_name\` output here."
287
+ type = string
288
+ }
289
+
244
290
  data "aws_caller_identity" "current" {}
245
291
  data "aws_region" "current" {}
246
292
 
247
293
  locals {
248
294
  aws_account_id = data.aws_caller_identity.current.account_id
249
- aws_region = data.aws_region.current.name
295
+ aws_region = data.aws_region.current.region
250
296
  }
251
297
 
252
298
  resource "random_string" "suffix" {
@@ -321,19 +367,29 @@ data "archive_file" "lambda_zip" {
321
367
  output_path = "\${path.module}/../../../../../../../dist/packages/common/terraform/lambda-functions/test-project-snapshot-function/lambda.zip"
322
368
  }
323
369
 
370
+ resource "aws_s3_object" "lambda_zip" {
371
+ bucket = var.asset_bucket_name
372
+ key = "lambdas/test-project-snapshot-function/\${data.archive_file.lambda_zip.output_base64sha256}.zip"
373
+ source = data.archive_file.lambda_zip.output_path
374
+ source_hash = data.archive_file.lambda_zip.output_base64sha256
375
+ etag = data.archive_file.lambda_zip.output_md5
376
+ }
377
+
324
378
  resource "aws_lambda_function" "lambda_function" {
325
379
  #checkov:skip=CKV_AWS_117:Lambda function does not need to be in VPC for this use case
326
380
  #checkov:skip=CKV_AWS_116:Dead Letter Queue not required for this simple use case
327
381
  #checkov:skip=CKV_AWS_272:Code signing not required for this use case
328
382
  #checkov:skip=CKV_AWS_115:Concurrent execution limit not required for this use case
329
383
  #checkov:skip=CKV_AWS_173:Lambda environment variables encrypted by managed key
330
- filename = data.archive_file.lambda_zip.output_path
331
- function_name = "test-project-snapshot-function-\${random_string.suffix.result}"
332
- role = aws_iam_role.lambda_role.arn
333
- handler = "test_project.snapshot_function.lambda_handler"
334
- source_code_hash = data.archive_file.lambda_zip.output_base64sha256
335
- runtime = "python3.14"
336
- timeout = 30
384
+ s3_bucket = aws_s3_object.lambda_zip.bucket
385
+ s3_key = aws_s3_object.lambda_zip.key
386
+ s3_object_version = aws_s3_object.lambda_zip.version_id
387
+ function_name = "test-project-snapshot-function-\${random_string.suffix.result}"
388
+ role = aws_iam_role.lambda_role.arn
389
+ handler = "test_project.snapshot_function.lambda_handler"
390
+ source_code_hash = data.archive_file.lambda_zip.output_base64sha256
391
+ runtime = "python3.14"
392
+ timeout = 30
337
393
 
338
394
  tracing_config {
339
395
  mode = "Active"
@@ -520,10 +520,14 @@ variable "tags" {
520
520
  default = {}
521
521
  }
522
522
 
523
- module "appconfig" {
524
- source = "../../../core/runtime-config/appconfig"
523
+ variable "appconfig_application_id" {
524
+ description = "ID of the shared runtime-config AppConfig application (from \`core/runtime-config/appconfig.application_id\`). The agent reads its runtime configuration from this application."
525
+ type = string
526
+ }
525
527
 
526
- application_name = "TerraformSnapshotServer-runtime-config"
528
+ variable "appconfig_application_arn" {
529
+ description = "ARN of the shared runtime-config AppConfig application (from \`core/runtime-config/appconfig.application_arn\`). Used to scope the IAM read permission granted to the agent runtime."
530
+ type = string
527
531
  }
528
532
 
529
533
  module "agent_core_runtime" {
@@ -533,7 +537,7 @@ module "agent_core_runtime" {
533
537
  server_protocol = "MCP"
534
538
 
535
539
  env = merge({
536
- RUNTIME_CONFIG_APP_ID = module.appconfig.application_id
540
+ RUNTIME_CONFIG_APP_ID = var.appconfig_application_id
537
541
  }, var.env)
538
542
  additional_iam_policy_statements = concat([
539
543
  {
@@ -542,12 +546,10 @@ module "agent_core_runtime" {
542
546
  "appconfig:StartConfigurationSession",
543
547
  "appconfig:GetLatestConfiguration"
544
548
  ]
545
- Resource = ["\${module.appconfig.application_arn}/*"]
549
+ Resource = ["\${var.appconfig_application_arn}/*"]
546
550
  }
547
551
  ], var.additional_iam_policy_statements)
548
552
  tags = var.tags
549
-
550
- depends_on = [module.appconfig]
551
553
  }
552
554
 
553
555
  # Add agent runtime ARN to runtime config
@@ -572,8 +574,8 @@ output "agent_core_runtime_arn" {
572
574
  }
573
575
 
574
576
  output "appconfig_application_id" {
575
- description = "AppConfig Application ID for runtime config"
576
- value = module.appconfig.application_id
577
+ description = "AppConfig Application ID for runtime config (passthrough of the shared \`appconfig_application_id\` input)."
578
+ value = var.appconfig_application_id
577
579
  }
578
580
  "
579
581
  `;
@@ -183,10 +183,14 @@ variable "tags" {
183
183
  default = {}
184
184
  }
185
185
 
186
- module "appconfig" {
187
- source = "../../../core/runtime-config/appconfig"
186
+ variable "appconfig_application_id" {
187
+ description = "ID of the shared runtime-config AppConfig application (from \`core/runtime-config/appconfig.application_id\`). The agent reads its runtime configuration from this application."
188
+ type = string
189
+ }
188
190
 
189
- application_name = "TerraformSnapshotAgent-runtime-config"
191
+ variable "appconfig_application_arn" {
192
+ description = "ARN of the shared runtime-config AppConfig application (from \`core/runtime-config/appconfig.application_arn\`). Used to scope the IAM read permission granted to the agent runtime."
193
+ type = string
190
194
  }
191
195
 
192
196
  module "agent_core_runtime" {
@@ -196,7 +200,7 @@ module "agent_core_runtime" {
196
200
  server_protocol = "HTTP"
197
201
 
198
202
  env = merge({
199
- RUNTIME_CONFIG_APP_ID = module.appconfig.application_id
203
+ RUNTIME_CONFIG_APP_ID = var.appconfig_application_id
200
204
  }, var.env)
201
205
  additional_iam_policy_statements = concat([
202
206
  {
@@ -205,7 +209,7 @@ module "agent_core_runtime" {
205
209
  "appconfig:StartConfigurationSession",
206
210
  "appconfig:GetLatestConfiguration"
207
211
  ]
208
- Resource = ["\${module.appconfig.application_arn}/*"]
212
+ Resource = ["\${var.appconfig_application_arn}/*"]
209
213
  },
210
214
  # Grant access for the agent to invoke bedrock models
211
215
  {
@@ -221,8 +225,6 @@ module "agent_core_runtime" {
221
225
  }
222
226
  ], var.additional_iam_policy_statements)
223
227
  tags = var.tags
224
-
225
- depends_on = [module.appconfig]
226
228
  }
227
229
 
228
230
  # Add agent runtime ARN to runtime config
@@ -247,8 +249,8 @@ output "agent_core_runtime_arn" {
247
249
  }
248
250
 
249
251
  output "appconfig_application_id" {
250
- description = "AppConfig Application ID for runtime config"
251
- value = module.appconfig.application_id
252
+ description = "AppConfig Application ID for runtime config (passthrough of the shared \`appconfig_application_id\` input)."
253
+ value = var.appconfig_application_id
252
254
  }
253
255
  "
254
256
  `;