@aws/nx-plugin 1.0.2 → 1.0.3

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 (55) hide show
  1. package/LICENSE-THIRD-PARTY +25 -9
  2. package/migrations.json +21 -16
  3. package/package.json +6 -6
  4. package/src/agentcore-gateway/__snapshots__/generator.spec.ts.snap +3 -3
  5. package/src/infra/app/__snapshots__/generator.spec.ts.snap +3 -3
  6. package/src/migrations/latest/terraform-init-target/metadata.json +3 -0
  7. package/src/migrations/latest/terraform-init-target/migration.js +153 -0
  8. package/src/migrations/latest/terraform-init-target/migration.js.map +1 -0
  9. package/src/migrations/v1.0.0-rc.98/0001-sandbox-pattern-nested-stacks/migration.js.map +1 -0
  10. package/src/migrations/v1.0.0-rc.98/0002-shadcn-cn-package/migration.js.map +1 -0
  11. package/src/migrations/v1.0.2/0001-terraform-harness-environment-variables/migration.d.ts +6 -0
  12. package/src/migrations/v1.0.2/0001-terraform-harness-environment-variables/migration.js.map +1 -0
  13. package/src/preset/__snapshots__/generator.spec.ts.snap +2 -2
  14. package/src/py/agent/__snapshots__/generator.constructs.spec.ts.snap +7 -7
  15. package/src/py/agent/__snapshots__/generator.frameworks.spec.ts.snap +9 -9
  16. package/src/py/agent/__snapshots__/generator.protocols.spec.ts.snap +8 -8
  17. package/src/py/dynamodb/__snapshots__/generator.spec.ts.snap +3 -3
  18. package/src/py/fast-api/__snapshots__/generator.terraform.spec.ts.snap +27 -27
  19. package/src/py/lambda-function/__snapshots__/generator.spec.ts.snap +6 -6
  20. package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +8 -8
  21. package/src/py/rdb/__snapshots__/generator.spec.ts.snap +9 -9
  22. package/src/sdk/open-api.d.ts +2 -2
  23. package/src/sdk/open-api.js +1 -1
  24. package/src/sdk/open-api.js.map +1 -1
  25. package/src/smithy/project/__snapshots__/generator.spec.ts.snap +5 -5
  26. package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +19 -19
  27. package/src/terraform/project/generator.js +52 -44
  28. package/src/terraform/project/generator.js.map +1 -1
  29. package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +27 -27
  30. package/src/ts/agent/__snapshots__/generator.spec.ts.snap +7 -7
  31. package/src/ts/dcr-proxy/__snapshots__/generator.spec.ts.snap +3 -3
  32. package/src/ts/dynamodb/__snapshots__/generator.spec.ts.snap +3 -3
  33. package/src/ts/lambda-function/__snapshots__/generator.spec.ts.snap +6 -6
  34. package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +4 -4
  35. package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +17 -17
  36. package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +28 -28
  37. package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +3 -3
  38. package/src/utils/test-migration.d.ts +20 -0
  39. package/src/utils/test-migration.js +32 -0
  40. package/src/utils/test-migration.js.map +1 -0
  41. package/src/utils/versions.d.ts +86 -86
  42. package/src/utils/versions.js +79 -79
  43. package/src/utils/versions.js.map +1 -1
  44. package/src/migrations/latest/sandbox-pattern-nested-stacks/migration.js.map +0 -1
  45. package/src/migrations/latest/shadcn-cn-package/migration.js.map +0 -1
  46. package/src/migrations/latest/terraform-harness-environment-variables/migration.js.map +0 -1
  47. /package/src/migrations/latest/{sandbox-pattern-nested-stacks → terraform-init-target}/migration.d.ts +0 -0
  48. /package/src/migrations/{latest/sandbox-pattern-nested-stacks → v1.0.0-rc.98/0001-sandbox-pattern-nested-stacks}/metadata.json +0 -0
  49. /package/src/migrations/{latest/shadcn-cn-package → v1.0.0-rc.98/0001-sandbox-pattern-nested-stacks}/migration.d.ts +0 -0
  50. /package/src/migrations/{latest/sandbox-pattern-nested-stacks → v1.0.0-rc.98/0001-sandbox-pattern-nested-stacks}/migration.js +0 -0
  51. /package/src/migrations/{latest/shadcn-cn-package → v1.0.0-rc.98/0002-shadcn-cn-package}/metadata.json +0 -0
  52. /package/src/migrations/{latest/terraform-harness-environment-variables → v1.0.0-rc.98/0002-shadcn-cn-package}/migration.d.ts +0 -0
  53. /package/src/migrations/{latest/shadcn-cn-package → v1.0.0-rc.98/0002-shadcn-cn-package}/migration.js +0 -0
  54. /package/src/migrations/{latest/terraform-harness-environment-variables → v1.0.2/0001-terraform-harness-environment-variables}/metadata.json +0 -0
  55. /package/src/migrations/{latest/terraform-harness-environment-variables → v1.0.2/0001-terraform-harness-environment-variables}/migration.js +0 -0
@@ -112,11 +112,10 @@ export async function terraformProjectGenerator(tree, schema) {
112
112
  const distDir = joinPathFragments(outDirToRootRelativePath, 'dist', '{projectRoot}');
113
113
  const tfDistDir = joinPathFragments(distDir, 'terraform');
114
114
  const checkovReportJsonPath = joinPathFragments(distDir, 'checkov', 'checkov_report.json');
115
- // `test` and `validate` each keep their `.terraform` here rather than in
116
- // `src`, so initialising one never races the backend-configured targets, or
117
- // the other, over the shared one.
118
- const testDataDir = joinPathFragments(distDir, 'terraform-test');
119
- const validateDataDir = joinPathFragments(distDir, 'terraform-validate');
115
+ // `terraform-init` keeps its `.terraform` here rather than in `src`, so it
116
+ // never races the backend-configured targets over the shared one. `test` and
117
+ // `validate` read this same directory rather than initialising their own.
118
+ const initDataDir = joinPathFragments(distDir, 'terraform-init');
120
119
  // Provider downloads persist here, so a target whose `.terraform` was cleaned
121
120
  // links the providers it already has rather than re-downloading them. Nx does
122
121
  // not interpolate `{workspaceRoot}` inside `env`, so this is relative to the
@@ -128,7 +127,8 @@ export async function terraformProjectGenerator(tree, schema) {
128
127
  // init` runs filling a shared cache concurrently each compute a different hash
129
128
  // for the same provider, because the hash covers a directory the other is
130
129
  // still writing, and terraform then rejects the mismatch against the lock
131
- // file. Per project, no two writers ever meet, so the targets stay parallel.
130
+ // file. `terraform-init` is the only target that fills it, and the targets that
131
+ // need the providers depend on that one, so no two writers ever meet.
132
132
  const pluginCacheDir = joinPathFragments(outDirToRootRelativePath, '.terraform', 'plugin-cache', '{projectRoot}');
133
133
  // Calculate relative path from current project to common/terraform/metrics
134
134
  // Use forward slashes for terraform module source paths (even on Windows)
@@ -227,6 +227,7 @@ export async function terraformProjectGenerator(tree, schema) {
227
227
  cwd: '{workspaceRoot}'
228
228
  },
229
229
  dependsOn: [
230
+ 'terraform-init',
230
231
  '^init'
231
232
  ]
232
233
  },
@@ -310,6 +311,32 @@ export async function terraformProjectGenerator(tree, schema) {
310
311
  env: {
311
312
  TF_PLUGIN_CACHE_DIR: pluginCacheDir
312
313
  }
314
+ },
315
+ dependsOn: [
316
+ 'terraform-init'
317
+ ]
318
+ },
319
+ // `-backend=false` installs the modules and providers without configuring
320
+ // the S3 backend, so this needs no credentials and runs on a fresh
321
+ // workspace before `bootstrap`. Uncached: a cache hit on another machine
322
+ // would report success over an empty `TF_DATA_DIR` and plugin cache.
323
+ 'terraform-init': {
324
+ executor: 'nx:run-commands',
325
+ options: {
326
+ commands: [
327
+ {
328
+ command: `shx mkdir -p ${pluginCacheDir}`,
329
+ forwardAllArgs: false
330
+ },
331
+ 'terraform init -backend=false'
332
+ ],
333
+ forwardAllArgs: true,
334
+ cwd: '{projectRoot}/src',
335
+ parallel: false,
336
+ env: {
337
+ TF_DATA_DIR: initDataDir,
338
+ TF_PLUGIN_CACHE_DIR: pluginCacheDir
339
+ }
313
340
  }
314
341
  },
315
342
  // `^production` mirrors `test`: checkov resolves the relative modules a
@@ -331,14 +358,11 @@ export async function terraformProjectGenerator(tree, schema) {
331
358
  }
332
359
  },
333
360
  // Terraform's native test framework, which runs any `.tftest.hcl` files.
334
- // A project with none is a no-op success.
335
- //
336
- // `-backend=false` installs the modules and providers the tests need
337
- // without configuring the S3 backend, so this runs before `bootstrap` and
338
- // needs no credentials. `TF_DATA_DIR` keeps that `.terraform` out of `src`,
339
- // so it never races the backend-configured targets over the shared one.
340
- // `^production` is what invalidates the cache when a consumed module
341
- // changes; `{projectRoot}/**/*` alone would serve a stale pass.
361
+ // A project with none is a no-op success. Runs against the `TF_DATA_DIR`
362
+ // `terraform-init` prepared, so it needs no credentials and works on a fresh
363
+ // workspace before `bootstrap`. `^production` is what invalidates the cache
364
+ // when a consumed module changes; `{projectRoot}/**/*` alone would serve a
365
+ // stale pass.
342
366
  //
343
367
  // `TF_DATA_DIR` is terraform's working directory, not an artifact: its
344
368
  // provider entries are symlinks into the shared plugin cache, so restoring
@@ -354,29 +378,19 @@ export async function terraformProjectGenerator(tree, schema) {
354
378
  ],
355
379
  outputs: [],
356
380
  options: {
357
- commands: [
358
- {
359
- command: `shx mkdir -p ${pluginCacheDir}`,
360
- forwardAllArgs: false
361
- },
362
- 'terraform init -backend=false',
363
- 'terraform test'
364
- ],
381
+ command: 'terraform test',
365
382
  forwardAllArgs: true,
366
383
  cwd: '{projectRoot}/src',
367
- parallel: false,
368
384
  env: {
369
- TF_DATA_DIR: testDataDir,
370
- TF_PLUGIN_CACHE_DIR: pluginCacheDir
385
+ TF_DATA_DIR: initDataDir
371
386
  }
372
- }
387
+ },
388
+ dependsOn: [
389
+ 'terraform-init'
390
+ ]
373
391
  },
374
- // Mirrors `test`: `-backend=false` installs the modules and providers
375
- // validation needs without configuring the S3 backend, so this runs on a
376
- // fresh workspace before `bootstrap` and needs no credentials. `TF_DATA_DIR`
377
- // keeps that `.terraform` out of `src`, so it never races the
378
- // backend-configured targets over the shared one, and declaring no outputs
379
- // keeps a cache hit to what it asserts (see `test` above).
392
+ // Mirrors `test`: validates against the `TF_DATA_DIR` `terraform-init`
393
+ // prepared, and declares no outputs for the same reason (see `test` above).
380
394
  validate: {
381
395
  executor: 'nx:run-commands',
382
396
  cache: true,
@@ -386,22 +400,16 @@ export async function terraformProjectGenerator(tree, schema) {
386
400
  ],
387
401
  outputs: [],
388
402
  options: {
389
- commands: [
390
- {
391
- command: `shx mkdir -p ${pluginCacheDir}`,
392
- forwardAllArgs: false
393
- },
394
- 'terraform init -backend=false',
395
- 'terraform validate'
396
- ],
403
+ command: 'terraform validate',
397
404
  forwardAllArgs: true,
398
405
  cwd: '{projectRoot}/src',
399
- parallel: false,
400
406
  env: {
401
- TF_DATA_DIR: validateDataDir,
402
- TF_PLUGIN_CACHE_DIR: pluginCacheDir
407
+ TF_DATA_DIR: initDataDir
403
408
  }
404
- }
409
+ },
410
+ dependsOn: [
411
+ 'terraform-init'
412
+ ]
405
413
  }
406
414
  };
407
415
  const projectConfiguration = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/nx-plugin/src/terraform/project/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n addProjectConfiguration,\n detectPackageManager,\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n readNxJson,\n type TargetConfiguration,\n type Tree,\n updateJson,\n updateNxJson,\n} from '@nx/devkit';\nimport { join, relative } from 'path';\nimport { addLicenseCheckToLintTarget } from '../../license/config.js';\nimport { getTsLibDetails } from '../../ts/lib/generator.js';\nimport { addTsDependencies } from '../../utils/add-dependencies.js';\nimport {\n declareDependencies,\n ownedElsewhere,\n} from '../../utils/declared-dependencies.js';\nimport { formatFilesInSubtree } from '../../utils/format.js';\nimport { updateGitIgnore } from '../../utils/git.js';\nimport { installDependencies } from '../../utils/install.js';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics.js';\nimport { kebabCase } from '../../utils/names.js';\nimport {\n addGeneratorMetadata,\n getGeneratorInfo,\n type NxGeneratorInfo,\n projectExists,\n} from '../../utils/nx.js';\nimport { sortObjectKeys } from '../../utils/object.js';\nimport { uvxCommand } from '../../utils/py.js';\nimport { sharedConstructsGenerator } from '../../utils/shared-constructs.js';\nimport {\n SHARED_CONSTRUCTS_DEPENDENCIES,\n SHARED_TERRAFORM_DIR,\n SHARED_TERRAFORM_NAME,\n} from '../../utils/shared-constructs-constants.js';\nimport {\n terraformProviderVersions,\n withVersions,\n} from '../../utils/versions.js';\nimport type { TerraformProjectGeneratorSchema } from './schema';\n\n// Terraform projects carry no package.json, so their build tooling and the AWS\n// SDK the vended deploy scripts import are declared at the workspace root. This\n// generator records no metadata, so nothing a predicate could read.\nexport const DEPENDENCIES = declareDependencies()({\n ts: [\n { name: '@nx-extend/terraform', dev: true, root: true },\n { name: 'shx', dev: true, root: true },\n { name: 'tsx', dev: true, root: true },\n { name: '@aws-sdk/client-s3', dev: true, root: true },\n { name: '@aws-sdk/client-sts', dev: true, root: true },\n { name: '@aws-sdk/credential-providers', dev: true, root: true },\n { name: '@smithy/config-resolver', dev: true, root: true },\n { name: '@smithy/node-config-provider', dev: true, root: true },\n // Declared for its pinned version, which goes into npm's `overrides` below.\n { name: '@nx/devkit', versionOnly: true },\n ...ownedElsewhere(SHARED_CONSTRUCTS_DEPENDENCIES),\n ],\n});\n\nconst NX_EXTEND_PLUGIN = '@nx-extend/terraform';\nexport const TERRAFORM_PROJECT_GENERATOR_INFO: NxGeneratorInfo =\n getGeneratorInfo(import.meta.filename);\n\n/**\n * Checks formatting, mirroring the TypeScript and Python `format` targets: the\n * base target fails on an unformatted file and the `fix` configuration rewrites\n * it. Writing from the base target would rewrite the `default` input the hash is\n * computed over, so the target could never cache-hit.\n *\n * Scoped to the project's own `src` rather than `-recursive`, so it checks the\n * files the vended templates cover. `-diff` names what to fix when it fails.\n */\nexport const TERRAFORM_FORMAT_TARGET: TargetConfiguration = {\n executor: 'nx:run-commands',\n cache: true,\n inputs: ['default'],\n options: {\n command: 'terraform fmt -check -diff',\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n },\n configurations: {\n fix: {\n command: 'terraform fmt',\n },\n 'skip-lint': {\n // Cross-platform no-op (`true` is not available on Windows cmd).\n command: 'node -e \"\"',\n },\n },\n};\n\nexport async function terraformProjectGenerator(\n tree: Tree,\n schema: TerraformProjectGeneratorSchema,\n): Promise<GeneratorCallback> {\n // Just use getTsLibDetails as it isn't specific to TS\n const lib = getTsLibDetails(tree, schema);\n const { fullyQualifiedName: sharedTfProjectName } = getTsLibDetails(tree, {\n name: SHARED_TERRAFORM_NAME,\n });\n\n const outDirToRootRelativePath = relative(\n join(tree.root, lib.dir, 'src'),\n tree.root,\n ).replace(/\\\\/g, '/');\n const distDir = joinPathFragments(\n outDirToRootRelativePath,\n 'dist',\n '{projectRoot}',\n );\n const tfDistDir = joinPathFragments(distDir, 'terraform');\n const checkovReportJsonPath = joinPathFragments(\n distDir,\n 'checkov',\n 'checkov_report.json',\n );\n // `test` and `validate` each keep their `.terraform` here rather than in\n // `src`, so initialising one never races the backend-configured targets, or\n // the other, over the shared one.\n const testDataDir = joinPathFragments(distDir, 'terraform-test');\n const validateDataDir = joinPathFragments(distDir, 'terraform-validate');\n\n // Provider downloads persist here, so a target whose `.terraform` was cleaned\n // links the providers it already has rather than re-downloading them. Nx does\n // not interpolate `{workspaceRoot}` inside `env`, so this is relative to the\n // target's `cwd`. It sits under `.terraform`, which this generator gitignores\n // — that is also what keeps the providers out of Nx's file walk — and unlike\n // `.nx/cache` it survives `nx reset`.\n //\n // One cache per project rather than one for the workspace: two `terraform\n // init` runs filling a shared cache concurrently each compute a different hash\n // for the same provider, because the hash covers a directory the other is\n // still writing, and terraform then rejects the mismatch against the lock\n // file. Per project, no two writers ever meet, so the targets stay parallel.\n const pluginCacheDir = joinPathFragments(\n outDirToRootRelativePath,\n '.terraform',\n 'plugin-cache',\n '{projectRoot}',\n );\n\n // Calculate relative path from current project to common/terraform/metrics\n // Use forward slashes for terraform module source paths (even on Windows)\n const metricsModulePath = relative(\n join(tree.root, lib.dir, 'src'),\n join(tree.root, 'packages', SHARED_TERRAFORM_DIR, 'src', 'metrics'),\n ).replace(/\\\\/g, '/');\n\n updateGitIgnore(tree, '.', (patterns) => [...patterns, '.terraform']);\n\n const applicationTargets: {\n [targetName: string]: TargetConfiguration;\n } = {\n apply: {\n executor: 'nx:run-commands',\n defaultConfiguration: 'dev',\n configurations: {\n dev: {\n command: `terraform apply ${tfDistDir}/dev.tfplan`,\n },\n },\n options: {\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n },\n dependsOn: ['plan'],\n },\n bootstrap: {\n executor: 'nx:run-commands',\n options: {\n forwardAllArgs: true,\n commands: ['tsx {projectRoot}/scripts/bootstrap.ts {projectRoot}'],\n cwd: '{workspaceRoot}',\n },\n },\n 'bootstrap-destroy': {\n executor: 'nx:run-commands',\n options: {\n forwardAllArgs: true,\n commands: [\n 'tsx {projectRoot}/scripts/bootstrap-destroy.ts {projectRoot}',\n ],\n cwd: '{workspaceRoot}',\n },\n },\n build: {\n dependsOn: ['format', 'checkov', 'test', `${sharedTfProjectName}:build`],\n },\n deploy: {\n dependsOn: ['apply'],\n },\n // The artifact-only sibling of build, which `plan` depends on.\n assemble: {\n dependsOn: [`${sharedTfProjectName}:assemble`],\n },\n destroy: {\n executor: 'nx:run-commands',\n defaultConfiguration: 'dev',\n configurations: {\n dev: {\n command: 'terraform destroy -var-file=env/dev.tfvars',\n },\n },\n options: {\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n },\n dependsOn: ['init'],\n },\n init: {\n executor: 'nx:run-commands',\n defaultConfiguration: 'dev',\n configurations: {\n dev: {\n env: { TF_ENV: 'dev' },\n },\n },\n options: {\n forwardAllArgs: true,\n commands: ['tsx {projectRoot}/scripts/init.ts {projectRoot}'],\n cwd: '{workspaceRoot}',\n },\n dependsOn: ['^init'],\n },\n output: {\n executor: 'nx:run-commands',\n cache: true,\n inputs: ['default'],\n options: {\n command: 'terraform output -json',\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n },\n },\n plan: {\n executor: 'nx:run-commands',\n defaultConfiguration: 'dev',\n configurations: {\n dev: {\n commands: [\n `shx mkdir -p ${tfDistDir}`,\n `terraform plan -var-file=env/dev.tfvars -out=${tfDistDir}/dev.tfplan`,\n ],\n },\n },\n options: {\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n parallel: false,\n },\n dependsOn: ['init', 'validate', '^validate', 'assemble'],\n },\n };\n\n const libTargets: {\n [targetName: string]: TargetConfiguration;\n } = {\n build: {\n dependsOn: ['format', 'checkov', 'test'],\n },\n // A Terraform library vends modules rather than a deployable artifact, so\n // its `assemble` carries only whatever the consuming projects register on it.\n assemble: {\n executor: 'nx:noop',\n },\n format: TERRAFORM_FORMAT_TARGET,\n // Terraform has no linter of its own, so `lint` orchestrates the format\n // check. It exists so `nx run-many --target lint` reaches terraform\n // projects, and so `--configuration=fix` and `--configuration=skip-lint`\n // propagate to `format` the way they do for TypeScript and Python projects.\n lint: {\n dependsOn: ['format'],\n },\n init: {\n executor: 'nx:run-commands',\n defaultConfiguration: 'dev',\n configurations: {\n dev: {\n commands: [\n {\n command: `shx mkdir -p ${pluginCacheDir}`,\n forwardAllArgs: false,\n },\n 'terraform init',\n ],\n },\n },\n options: {\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n parallel: false,\n env: { TF_PLUGIN_CACHE_DIR: pluginCacheDir },\n },\n },\n // `^production` mirrors `test`: checkov resolves the relative modules a\n // project consumes, so a change in one must invalidate the scan.\n checkov: {\n executor: 'nx:run-commands',\n cache: true,\n inputs: ['default', '^production'],\n outputs: ['{workspaceRoot}/dist/{projectRoot}/checkov'],\n options: {\n command: uvxCommand(\n 'checkov',\n `--config-file ../checkov.yml --directory . -o cli -o json --output-file-path console,${checkovReportJsonPath}`,\n ),\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n },\n },\n // Terraform's native test framework, which runs any `.tftest.hcl` files.\n // A project with none is a no-op success.\n //\n // `-backend=false` installs the modules and providers the tests need\n // without configuring the S3 backend, so this runs before `bootstrap` and\n // needs no credentials. `TF_DATA_DIR` keeps that `.terraform` out of `src`,\n // so it never races the backend-configured targets over the shared one.\n // `^production` is what invalidates the cache when a consumed module\n // changes; `{projectRoot}/**/*` alone would serve a stale pass.\n //\n // `TF_DATA_DIR` is terraform's working directory, not an artifact: its\n // provider entries are symlinks into the shared plugin cache, so restoring\n // it on another machine would yield dangling links while the commands that\n // repopulate them are skipped. Declaring no outputs keeps a cache hit to\n // what it actually asserts — that the tests passed for these inputs.\n test: {\n executor: 'nx:run-commands',\n cache: true,\n inputs: ['default', '^production'],\n outputs: [],\n options: {\n commands: [\n { command: `shx mkdir -p ${pluginCacheDir}`, forwardAllArgs: false },\n 'terraform init -backend=false',\n 'terraform test',\n ],\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n parallel: false,\n env: { TF_DATA_DIR: testDataDir, TF_PLUGIN_CACHE_DIR: pluginCacheDir },\n },\n },\n // Mirrors `test`: `-backend=false` installs the modules and providers\n // validation needs without configuring the S3 backend, so this runs on a\n // fresh workspace before `bootstrap` and needs no credentials. `TF_DATA_DIR`\n // keeps that `.terraform` out of `src`, so it never races the\n // backend-configured targets over the shared one, and declaring no outputs\n // keeps a cache hit to what it asserts (see `test` above).\n validate: {\n executor: 'nx:run-commands',\n cache: true,\n inputs: ['default', '^production'],\n outputs: [],\n options: {\n commands: [\n { command: `shx mkdir -p ${pluginCacheDir}`, forwardAllArgs: false },\n 'terraform init -backend=false',\n 'terraform validate',\n ],\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n parallel: false,\n env: {\n TF_DATA_DIR: validateDataDir,\n TF_PLUGIN_CACHE_DIR: pluginCacheDir,\n },\n },\n },\n };\n\n const projectConfiguration = {\n root: lib.dir,\n projectType: schema.type,\n sourceRoot: joinPathFragments(lib.dir, 'src'),\n targets: sortObjectKeys({\n ...libTargets,\n ...(schema.type === 'application' ? applicationTargets : {}),\n }),\n };\n\n // Only create the project configuration on first run; skip it on re-run so\n // existing project.json customisations are preserved.\n if (!projectExists(tree, lib.fullyQualifiedName)) {\n addProjectConfiguration(tree, lib.fullyQualifiedName, projectConfiguration);\n }\n\n // The `lint` target checks licenses alongside formatting, as it does for\n // TypeScript and Python projects.\n addLicenseCheckToLintTarget(tree, lib.fullyQualifiedName);\n\n // This generator IS the Terraform project, so the provider is fixed.\n addGeneratorMetadata(\n tree,\n lib.fullyQualifiedName,\n TERRAFORM_PROJECT_GENERATOR_INFO,\n { iac: 'terraform' },\n );\n\n // The guides tell the reader to declare resources in `main.tf`, add variables\n // and outputs, and configure environments in `env/*.tfvars`, so everything\n // here is scaffolded once and then left alone. Provider version bumps reach\n // `providers.tf` through the vended version sync, which rewrites the pin in\n // place rather than the whole file.\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, `./files/${schema.type}`),\n lib.dir,\n {\n metricsModulePath,\n stateKeyPrefix: kebabCase(lib.fullyQualifiedName),\n ...terraformProviderVersions(),\n },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n // Checkov skips are the user's to curate, so preserve any they have added.\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, './files/checkov'),\n lib.dir,\n {},\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n const nxJson = readNxJson(tree);\n\n if (\n !nxJson.plugins?.find((p) =>\n typeof p === 'string'\n ? p === NX_EXTEND_PLUGIN\n : p.plugin === NX_EXTEND_PLUGIN,\n )\n ) {\n nxJson.plugins = [...(nxJson.plugins ?? []), NX_EXTEND_PLUGIN];\n updateNxJson(tree, nxJson);\n }\n\n // Ensure shared constructs for Terraform are created\n await sharedConstructsGenerator(tree, { iac: 'terraform' }, DEPENDENCIES);\n\n // Add Terraform metrics\n await addGeneratorMetricsIfApplicable(tree, [\n TERRAFORM_PROJECT_GENERATOR_INFO,\n ]);\n\n addTsDependencies(tree, DEPENDENCIES);\n\n // @nx-extend/terraform has a peer dependency on @nx/devkit ^21.0.0 which causes\n // npm install to fail, so for NPM we add a resolution\n // Can remove when https://github.com/TriPSs/nx-extend/issues/407 is addressed\n if (detectPackageManager() === 'npm') {\n updateJson(tree, 'package.json', (packageJson) => {\n packageJson.overrides = {\n ...packageJson.overrides,\n ...withVersions(DEPENDENCIES, ['@nx/devkit']),\n };\n return packageJson;\n });\n }\n\n // `updateProjectConfiguration` re-serialises project.json with every inline\n // array expanded, which the vended `format` target rejects.\n await formatFilesInSubtree(tree);\n\n // `@nx-extend/terraform` is registered as an Nx plugin in nx.json, so Nx\n // loads it when computing the project graph — it must resolve even if the\n // caller would otherwise prefer to defer installing.\n return () =>\n installDependencies(tree, schema.preferInstallDependencies, {\n languages: ['typescript'],\n ensureResolvable: [NX_EXTEND_PLUGIN],\n });\n}\nexport default terraformProjectGenerator;\n"],"names":["addProjectConfiguration","detectPackageManager","generateFiles","joinPathFragments","OverwriteStrategy","readNxJson","updateJson","updateNxJson","join","relative","addLicenseCheckToLintTarget","getTsLibDetails","addTsDependencies","declareDependencies","ownedElsewhere","formatFilesInSubtree","updateGitIgnore","installDependencies","addGeneratorMetricsIfApplicable","kebabCase","addGeneratorMetadata","getGeneratorInfo","projectExists","sortObjectKeys","uvxCommand","sharedConstructsGenerator","SHARED_CONSTRUCTS_DEPENDENCIES","SHARED_TERRAFORM_DIR","SHARED_TERRAFORM_NAME","terraformProviderVersions","withVersions","DEPENDENCIES","ts","name","dev","root","versionOnly","NX_EXTEND_PLUGIN","TERRAFORM_PROJECT_GENERATOR_INFO","filename","TERRAFORM_FORMAT_TARGET","executor","cache","inputs","options","command","forwardAllArgs","cwd","configurations","fix","terraformProjectGenerator","tree","schema","lib","fullyQualifiedName","sharedTfProjectName","outDirToRootRelativePath","dir","replace","distDir","tfDistDir","checkovReportJsonPath","testDataDir","validateDataDir","pluginCacheDir","metricsModulePath","patterns","applicationTargets","apply","defaultConfiguration","dependsOn","bootstrap","commands","build","deploy","assemble","destroy","init","env","TF_ENV","output","plan","parallel","libTargets","format","lint","TF_PLUGIN_CACHE_DIR","checkov","outputs","test","TF_DATA_DIR","validate","projectConfiguration","projectType","type","sourceRoot","targets","iac","dirname","stateKeyPrefix","overwriteStrategy","KeepExisting","nxJson","plugins","find","p","plugin","packageJson","overrides","preferInstallDependencies","languages","ensureResolvable"],"mappings":"AAAA;;;CAGC,GACD,SACEA,uBAAuB,EACvBC,oBAAoB,EAEpBC,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EACjBC,UAAU,EAGVC,UAAU,EACVC,YAAY,QACP,aAA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AAMpB;IAExB,gFAAgF;IAChF,sDAAsD;IACtD,8EAA8E;IAC9E,IAAI9B,2BAA2B,OAAO;QACpCK,WAAW6C,MAAM,gBAAgB,CAACwD;YAChCA,YAAYC,SAAS,GAAG;gBACtB,GAAGD,YAAYC,SAAS;gBACxB,GAAG9E,aAAaC,cAAc;oBAAC;iBAAa,CAAC;YAC/C;YACA,OAAO4E;QACT;IACF;IAEA,4EAA4E;IAC5E,4DAA4D;IAC5D,MAAM5F,qBAAqBoC;IAE3B,yEAAyE;IACzE,0EAA0E;IAC1E,qDAAqD;IACrD,OAAO,IACLlC,oBAAoBkC,MAAMC,OAAOyD,yBAAyB,EAAE;YAC1DC,WAAW;gBAAC;aAAa;YACzBC,kBAAkB;gBAAC1E;aAAiB;QACtC;AACJ;AACA,eAAea,0BAA0B"}
1
+ {"version":3,"sources":["../../../../../../packages/nx-plugin/src/terraform/project/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n addProjectConfiguration,\n detectPackageManager,\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n readNxJson,\n type TargetConfiguration,\n type Tree,\n updateJson,\n updateNxJson,\n} from '@nx/devkit';\nimport { join, relative } from 'path';\nimport { addLicenseCheckToLintTarget } from '../../license/config.js';\nimport { getTsLibDetails } from '../../ts/lib/generator.js';\nimport { addTsDependencies } from '../../utils/add-dependencies.js';\nimport {\n declareDependencies,\n ownedElsewhere,\n} from '../../utils/declared-dependencies.js';\nimport { formatFilesInSubtree } from '../../utils/format.js';\nimport { updateGitIgnore } from '../../utils/git.js';\nimport { installDependencies } from '../../utils/install.js';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics.js';\nimport { kebabCase } from '../../utils/names.js';\nimport {\n addGeneratorMetadata,\n getGeneratorInfo,\n type NxGeneratorInfo,\n projectExists,\n} from '../../utils/nx.js';\nimport { sortObjectKeys } from '../../utils/object.js';\nimport { uvxCommand } from '../../utils/py.js';\nimport { sharedConstructsGenerator } from '../../utils/shared-constructs.js';\nimport {\n SHARED_CONSTRUCTS_DEPENDENCIES,\n SHARED_TERRAFORM_DIR,\n SHARED_TERRAFORM_NAME,\n} from '../../utils/shared-constructs-constants.js';\nimport {\n terraformProviderVersions,\n withVersions,\n} from '../../utils/versions.js';\nimport type { TerraformProjectGeneratorSchema } from './schema';\n\n// Terraform projects carry no package.json, so their build tooling and the AWS\n// SDK the vended deploy scripts import are declared at the workspace root. This\n// generator records no metadata, so nothing a predicate could read.\nexport const DEPENDENCIES = declareDependencies()({\n ts: [\n { name: '@nx-extend/terraform', dev: true, root: true },\n { name: 'shx', dev: true, root: true },\n { name: 'tsx', dev: true, root: true },\n { name: '@aws-sdk/client-s3', dev: true, root: true },\n { name: '@aws-sdk/client-sts', dev: true, root: true },\n { name: '@aws-sdk/credential-providers', dev: true, root: true },\n { name: '@smithy/config-resolver', dev: true, root: true },\n { name: '@smithy/node-config-provider', dev: true, root: true },\n // Declared for its pinned version, which goes into npm's `overrides` below.\n { name: '@nx/devkit', versionOnly: true },\n ...ownedElsewhere(SHARED_CONSTRUCTS_DEPENDENCIES),\n ],\n});\n\nconst NX_EXTEND_PLUGIN = '@nx-extend/terraform';\nexport const TERRAFORM_PROJECT_GENERATOR_INFO: NxGeneratorInfo =\n getGeneratorInfo(import.meta.filename);\n\n/**\n * Checks formatting, mirroring the TypeScript and Python `format` targets: the\n * base target fails on an unformatted file and the `fix` configuration rewrites\n * it. Writing from the base target would rewrite the `default` input the hash is\n * computed over, so the target could never cache-hit.\n *\n * Scoped to the project's own `src` rather than `-recursive`, so it checks the\n * files the vended templates cover. `-diff` names what to fix when it fails.\n */\nexport const TERRAFORM_FORMAT_TARGET: TargetConfiguration = {\n executor: 'nx:run-commands',\n cache: true,\n inputs: ['default'],\n options: {\n command: 'terraform fmt -check -diff',\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n },\n configurations: {\n fix: {\n command: 'terraform fmt',\n },\n 'skip-lint': {\n // Cross-platform no-op (`true` is not available on Windows cmd).\n command: 'node -e \"\"',\n },\n },\n};\n\nexport async function terraformProjectGenerator(\n tree: Tree,\n schema: TerraformProjectGeneratorSchema,\n): Promise<GeneratorCallback> {\n // Just use getTsLibDetails as it isn't specific to TS\n const lib = getTsLibDetails(tree, schema);\n const { fullyQualifiedName: sharedTfProjectName } = getTsLibDetails(tree, {\n name: SHARED_TERRAFORM_NAME,\n });\n\n const outDirToRootRelativePath = relative(\n join(tree.root, lib.dir, 'src'),\n tree.root,\n ).replace(/\\\\/g, '/');\n const distDir = joinPathFragments(\n outDirToRootRelativePath,\n 'dist',\n '{projectRoot}',\n );\n const tfDistDir = joinPathFragments(distDir, 'terraform');\n const checkovReportJsonPath = joinPathFragments(\n distDir,\n 'checkov',\n 'checkov_report.json',\n );\n // `terraform-init` keeps its `.terraform` here rather than in `src`, so it\n // never races the backend-configured targets over the shared one. `test` and\n // `validate` read this same directory rather than initialising their own.\n const initDataDir = joinPathFragments(distDir, 'terraform-init');\n\n // Provider downloads persist here, so a target whose `.terraform` was cleaned\n // links the providers it already has rather than re-downloading them. Nx does\n // not interpolate `{workspaceRoot}` inside `env`, so this is relative to the\n // target's `cwd`. It sits under `.terraform`, which this generator gitignores\n // — that is also what keeps the providers out of Nx's file walk — and unlike\n // `.nx/cache` it survives `nx reset`.\n //\n // One cache per project rather than one for the workspace: two `terraform\n // init` runs filling a shared cache concurrently each compute a different hash\n // for the same provider, because the hash covers a directory the other is\n // still writing, and terraform then rejects the mismatch against the lock\n // file. `terraform-init` is the only target that fills it, and the targets that\n // need the providers depend on that one, so no two writers ever meet.\n const pluginCacheDir = joinPathFragments(\n outDirToRootRelativePath,\n '.terraform',\n 'plugin-cache',\n '{projectRoot}',\n );\n\n // Calculate relative path from current project to common/terraform/metrics\n // Use forward slashes for terraform module source paths (even on Windows)\n const metricsModulePath = relative(\n join(tree.root, lib.dir, 'src'),\n join(tree.root, 'packages', SHARED_TERRAFORM_DIR, 'src', 'metrics'),\n ).replace(/\\\\/g, '/');\n\n updateGitIgnore(tree, '.', (patterns) => [...patterns, '.terraform']);\n\n const applicationTargets: {\n [targetName: string]: TargetConfiguration;\n } = {\n apply: {\n executor: 'nx:run-commands',\n defaultConfiguration: 'dev',\n configurations: {\n dev: {\n command: `terraform apply ${tfDistDir}/dev.tfplan`,\n },\n },\n options: {\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n },\n dependsOn: ['plan'],\n },\n bootstrap: {\n executor: 'nx:run-commands',\n options: {\n forwardAllArgs: true,\n commands: ['tsx {projectRoot}/scripts/bootstrap.ts {projectRoot}'],\n cwd: '{workspaceRoot}',\n },\n },\n 'bootstrap-destroy': {\n executor: 'nx:run-commands',\n options: {\n forwardAllArgs: true,\n commands: [\n 'tsx {projectRoot}/scripts/bootstrap-destroy.ts {projectRoot}',\n ],\n cwd: '{workspaceRoot}',\n },\n },\n build: {\n dependsOn: ['format', 'checkov', 'test', `${sharedTfProjectName}:build`],\n },\n deploy: {\n dependsOn: ['apply'],\n },\n // The artifact-only sibling of build, which `plan` depends on.\n assemble: {\n dependsOn: [`${sharedTfProjectName}:assemble`],\n },\n destroy: {\n executor: 'nx:run-commands',\n defaultConfiguration: 'dev',\n configurations: {\n dev: {\n command: 'terraform destroy -var-file=env/dev.tfvars',\n },\n },\n options: {\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n },\n dependsOn: ['init'],\n },\n init: {\n executor: 'nx:run-commands',\n defaultConfiguration: 'dev',\n configurations: {\n dev: {\n env: { TF_ENV: 'dev' },\n },\n },\n options: {\n forwardAllArgs: true,\n commands: ['tsx {projectRoot}/scripts/init.ts {projectRoot}'],\n cwd: '{workspaceRoot}',\n },\n dependsOn: ['terraform-init', '^init'],\n },\n output: {\n executor: 'nx:run-commands',\n cache: true,\n inputs: ['default'],\n options: {\n command: 'terraform output -json',\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n },\n },\n plan: {\n executor: 'nx:run-commands',\n defaultConfiguration: 'dev',\n configurations: {\n dev: {\n commands: [\n `shx mkdir -p ${tfDistDir}`,\n `terraform plan -var-file=env/dev.tfvars -out=${tfDistDir}/dev.tfplan`,\n ],\n },\n },\n options: {\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n parallel: false,\n },\n dependsOn: ['init', 'validate', '^validate', 'assemble'],\n },\n };\n\n const libTargets: {\n [targetName: string]: TargetConfiguration;\n } = {\n build: {\n dependsOn: ['format', 'checkov', 'test'],\n },\n // A Terraform library vends modules rather than a deployable artifact, so\n // its `assemble` carries only whatever the consuming projects register on it.\n assemble: {\n executor: 'nx:noop',\n },\n format: TERRAFORM_FORMAT_TARGET,\n // Terraform has no linter of its own, so `lint` orchestrates the format\n // check. It exists so `nx run-many --target lint` reaches terraform\n // projects, and so `--configuration=fix` and `--configuration=skip-lint`\n // propagate to `format` the way they do for TypeScript and Python projects.\n lint: {\n dependsOn: ['format'],\n },\n init: {\n executor: 'nx:run-commands',\n defaultConfiguration: 'dev',\n configurations: {\n dev: {\n commands: [\n {\n command: `shx mkdir -p ${pluginCacheDir}`,\n forwardAllArgs: false,\n },\n 'terraform init',\n ],\n },\n },\n options: {\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n parallel: false,\n env: { TF_PLUGIN_CACHE_DIR: pluginCacheDir },\n },\n dependsOn: ['terraform-init'],\n },\n // `-backend=false` installs the modules and providers without configuring\n // the S3 backend, so this needs no credentials and runs on a fresh\n // workspace before `bootstrap`. Uncached: a cache hit on another machine\n // would report success over an empty `TF_DATA_DIR` and plugin cache.\n 'terraform-init': {\n executor: 'nx:run-commands',\n options: {\n commands: [\n { command: `shx mkdir -p ${pluginCacheDir}`, forwardAllArgs: false },\n 'terraform init -backend=false',\n ],\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n parallel: false,\n env: {\n TF_DATA_DIR: initDataDir,\n TF_PLUGIN_CACHE_DIR: pluginCacheDir,\n },\n },\n },\n // `^production` mirrors `test`: checkov resolves the relative modules a\n // project consumes, so a change in one must invalidate the scan.\n checkov: {\n executor: 'nx:run-commands',\n cache: true,\n inputs: ['default', '^production'],\n outputs: ['{workspaceRoot}/dist/{projectRoot}/checkov'],\n options: {\n command: uvxCommand(\n 'checkov',\n `--config-file ../checkov.yml --directory . -o cli -o json --output-file-path console,${checkovReportJsonPath}`,\n ),\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n },\n },\n // Terraform's native test framework, which runs any `.tftest.hcl` files.\n // A project with none is a no-op success. Runs against the `TF_DATA_DIR`\n // `terraform-init` prepared, so it needs no credentials and works on a fresh\n // workspace before `bootstrap`. `^production` is what invalidates the cache\n // when a consumed module changes; `{projectRoot}/**/*` alone would serve a\n // stale pass.\n //\n // `TF_DATA_DIR` is terraform's working directory, not an artifact: its\n // provider entries are symlinks into the shared plugin cache, so restoring\n // it on another machine would yield dangling links while the commands that\n // repopulate them are skipped. Declaring no outputs keeps a cache hit to\n // what it actually asserts — that the tests passed for these inputs.\n test: {\n executor: 'nx:run-commands',\n cache: true,\n inputs: ['default', '^production'],\n outputs: [],\n options: {\n command: 'terraform test',\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n env: { TF_DATA_DIR: initDataDir },\n },\n dependsOn: ['terraform-init'],\n },\n // Mirrors `test`: validates against the `TF_DATA_DIR` `terraform-init`\n // prepared, and declares no outputs for the same reason (see `test` above).\n validate: {\n executor: 'nx:run-commands',\n cache: true,\n inputs: ['default', '^production'],\n outputs: [],\n options: {\n command: 'terraform validate',\n forwardAllArgs: true,\n cwd: '{projectRoot}/src',\n env: { TF_DATA_DIR: initDataDir },\n },\n dependsOn: ['terraform-init'],\n },\n };\n\n const projectConfiguration = {\n root: lib.dir,\n projectType: schema.type,\n sourceRoot: joinPathFragments(lib.dir, 'src'),\n targets: sortObjectKeys({\n ...libTargets,\n ...(schema.type === 'application' ? applicationTargets : {}),\n }),\n };\n\n // Only create the project configuration on first run; skip it on re-run so\n // existing project.json customisations are preserved.\n if (!projectExists(tree, lib.fullyQualifiedName)) {\n addProjectConfiguration(tree, lib.fullyQualifiedName, projectConfiguration);\n }\n\n // The `lint` target checks licenses alongside formatting, as it does for\n // TypeScript and Python projects.\n addLicenseCheckToLintTarget(tree, lib.fullyQualifiedName);\n\n // This generator IS the Terraform project, so the provider is fixed.\n addGeneratorMetadata(\n tree,\n lib.fullyQualifiedName,\n TERRAFORM_PROJECT_GENERATOR_INFO,\n { iac: 'terraform' },\n );\n\n // The guides tell the reader to declare resources in `main.tf`, add variables\n // and outputs, and configure environments in `env/*.tfvars`, so everything\n // here is scaffolded once and then left alone. Provider version bumps reach\n // `providers.tf` through the vended version sync, which rewrites the pin in\n // place rather than the whole file.\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, `./files/${schema.type}`),\n lib.dir,\n {\n metricsModulePath,\n stateKeyPrefix: kebabCase(lib.fullyQualifiedName),\n ...terraformProviderVersions(),\n },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n // Checkov skips are the user's to curate, so preserve any they have added.\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, './files/checkov'),\n lib.dir,\n {},\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n const nxJson = readNxJson(tree);\n\n if (\n !nxJson.plugins?.find((p) =>\n typeof p === 'string'\n ? p === NX_EXTEND_PLUGIN\n : p.plugin === NX_EXTEND_PLUGIN,\n )\n ) {\n nxJson.plugins = [...(nxJson.plugins ?? []), NX_EXTEND_PLUGIN];\n updateNxJson(tree, nxJson);\n }\n\n // Ensure shared constructs for Terraform are created\n await sharedConstructsGenerator(tree, { iac: 'terraform' }, DEPENDENCIES);\n\n // Add Terraform metrics\n await addGeneratorMetricsIfApplicable(tree, [\n TERRAFORM_PROJECT_GENERATOR_INFO,\n ]);\n\n addTsDependencies(tree, DEPENDENCIES);\n\n // @nx-extend/terraform has a peer dependency on @nx/devkit ^21.0.0 which causes\n // npm install to fail, so for NPM we add a resolution\n // Can remove when https://github.com/TriPSs/nx-extend/issues/407 is addressed\n if (detectPackageManager() === 'npm') {\n updateJson(tree, 'package.json', (packageJson) => {\n packageJson.overrides = {\n ...packageJson.overrides,\n ...withVersions(DEPENDENCIES, ['@nx/devkit']),\n };\n return packageJson;\n });\n }\n\n // `updateProjectConfiguration` re-serialises project.json with every inline\n // array expanded, which the vended `format` target rejects.\n await formatFilesInSubtree(tree);\n\n // `@nx-extend/terraform` is registered as an Nx plugin in nx.json, so Nx\n // loads it when computing the project graph — it must resolve even if the\n // caller would otherwise prefer to defer installing.\n return () =>\n installDependencies(tree, schema.preferInstallDependencies, {\n languages: ['typescript'],\n ensureResolvable: [NX_EXTEND_PLUGIN],\n });\n}\nexport default terraformProjectGenerator;\n"],"names":["addProjectConfiguration","detectPackageManager","generateFiles","joinPathFragments","OverwriteStrategy","readNxJson","updateJson","updateNxJson","join","relative","addLicenseCheckToLintTarget","getTsLibDetails","addTsDependencies","declareDependencies","ownedElsewhere","formatFilesInSubtree","updateGitIgnore","installDependencies","addGeneratorMetricsIfApplicable","kebabCase","addGeneratorMetadata","getGeneratorInfo","projectExists","sortObjectKeys","uvxCommand","sharedConstructsGenerator","SHARED_CONSTRUCTS_DEPENDENCIES","SHARED_TERRAFORM_DIR","SHARED_TERRAFORM_NAME","terraformProviderVersions","withVersions","DEPENDENCIES","ts","name","dev","root","versionOnly","NX_EXTEND_PLUGIN","TERRAFORM_PROJECT_GENERATOR_INFO","filename","TERRAFORM_FORMAT_TARGET","executor","cache","inputs","options","command","forwardAllArgs","cwd","configurations","fix","terraformProjectGenerator","tree","schema","lib","fullyQualifiedName","sharedTfProjectName","outDirToRootRelativePath","dir","replace","distDir","tfDistDir","checkovReportJsonPath","initDataDir","pluginCacheDir","metricsModulePath","patterns","applicationTargets","apply","defaultConfiguration","dependsOn","bootstrap","commands","build","deploy","assemble","destroy","init","env","TF_ENV","output","plan","parallel","libTargets","format","lint","TF_PLUGIN_CACHE_DIR","TF_DATA_DIR","checkov","outputs","test","validate","projectConfiguration","projectType","type","sourceRoot","targets","iac","dirname","stateKeyPrefix","overwriteStrategy","KeepExisting","nxJson","plugins","find","p","plugin","packageJson","overrides","preferInstallDependencies","languages","ensureResolvable"],"mappings":"AAAA;;;CAGC,GACD,SACEA,uBAAuB,EACvBC,oBAAoB,EAEpBC,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EACjBC,UAAU,EAGVC,UAAU,EACVC,YAAY,QACP,aAAa;AACpB,SAASC,IAAI,EAAEC,QAAQ,QAAQ,OAAO;AACtC,SAASC,2BAA2B,QAAQ,0BAA0B;AACtE,SAASC,eAAe,QAAQ,4BAA4B;AAC5D,SAASC,iBAAiB,QAAQ,kCAAkC;AACpE,SACEC,mBAAmB,EACnBC,cAAc,QACT,uCAAuC;AAC9C,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,mBAAmB,QAAQ,yBAAyB;AAC7D,SAASC,+BAA+B,QAAQ,yBAAyB;AACzE,SAASC,SAAS,QAAQ,uBAAuB;AACjD,SACEC,oBAAoB,EACpBC,gBAAgB,EAEhBC,aAAa,QACR,oBAAoB;AAC3B,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,yBAAyB,QAAQ,mCAAmC;AAC7E,SACEC,8BAA8B,EAC9BC,oBAAoB,EACpBC,qBAAqB,QAChB,6CAA6C;AACpD,SACEC,yBAAyB,EACzBC,YAAY,QACP,0BAA0B;AAGjC,+EAA+E;AAC/E,gFAAgF;AAChF,oEAAoE;AACpE,OAAO,MAAMC,eAAelB,sBAAsB;IAChDmB,IAAI;QACF;YAAEC,MAAM;YAAwBC,KAAK;YAAMC,MAAM;QAAK;QACtD;YAAEF,MAAM;YAAOC,KAAK;YAAMC,MAAM;QAAK;QACrC;YAAEF,MAAM;YAAOC,KAAK;YAAMC,MAAM;QAAK;QACrC;YAAEF,MAAM;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WACTA,MAAMnE,mBACNmE,EAAEC,MAAM,KAAKpE,mBAEnB;QACAgE,OAAOC,OAAO,GAAG;eAAKD,OAAOC,OAAO,IAAI,EAAE;YAAGjE;SAAiB;QAC9D9B,aAAa4C,MAAMkD;IACrB;IAEA,qDAAqD;IACrD,MAAM5E,0BAA0B0B,MAAM;QAAE6C,KAAK;IAAY,GAAGjE;IAE5D,wBAAwB;IACxB,MAAMb,gCAAgCiC,MAAM;QAC1Cb;KACD;IAED1B,kBAAkBuC,MAAMpB;IAExB,gFAAgF;IAChF,sDAAsD;IACtD,8EAA8E;IAC9E,IAAI9B,2BAA2B,OAAO;QACpCK,WAAW6C,MAAM,gBAAgB,CAACuD;YAChCA,YAAYC,SAAS,GAAG;gBACtB,GAAGD,YAAYC,SAAS;gBACxB,GAAG7E,aAAaC,cAAc;oBAAC;iBAAa,CAAC;YAC/C;YACA,OAAO2E;QACT;IACF;IAEA,4EAA4E;IAC5E,4DAA4D;IAC5D,MAAM3F,qBAAqBoC;IAE3B,yEAAyE;IACzE,0EAA0E;IAC1E,qDAAqD;IACrD,OAAO,IACLlC,oBAAoBkC,MAAMC,OAAOwD,yBAAyB,EAAE;YAC1DC,WAAW;gBAAC;aAAa;YACzBC,kBAAkB;gBAACzE;aAAiB;QACtC;AACJ;AACA,eAAea,0BAA0B"}
@@ -3175,7 +3175,7 @@ terraform {
3175
3175
  required_providers {
3176
3176
  aws = {
3177
3177
  source = "hashicorp/aws"
3178
- version = "6.63.0"
3178
+ version = "6.66.0"
3179
3179
  }
3180
3180
  }
3181
3181
  }
@@ -3422,15 +3422,15 @@ output "api_log_group_arn" {
3422
3422
  required_providers {
3423
3423
  archive = {
3424
3424
  source = "hashicorp/archive"
3425
- version = "2.8.0"
3425
+ version = "2.8.1"
3426
3426
  }
3427
3427
  aws = {
3428
3428
  source = "hashicorp/aws"
3429
- version = "6.63.0"
3429
+ version = "6.66.0"
3430
3430
  }
3431
3431
  random = {
3432
3432
  source = "hashicorp/random"
3433
- version = "3.9.0"
3433
+ version = "3.9.1"
3434
3434
  }
3435
3435
  }
3436
3436
  }
@@ -3990,7 +3990,7 @@ terraform {
3990
3990
  required_providers {
3991
3991
  aws = {
3992
3992
  source = "hashicorp/aws"
3993
- version = "6.63.0"
3993
+ version = "6.66.0"
3994
3994
  }
3995
3995
  }
3996
3996
  }
@@ -4237,15 +4237,15 @@ output "api_log_group_arn" {
4237
4237
  required_providers {
4238
4238
  archive = {
4239
4239
  source = "hashicorp/archive"
4240
- version = "2.8.0"
4240
+ version = "2.8.1"
4241
4241
  }
4242
4242
  aws = {
4243
4243
  source = "hashicorp/aws"
4244
- version = "6.63.0"
4244
+ version = "6.66.0"
4245
4245
  }
4246
4246
  random = {
4247
4247
  source = "hashicorp/random"
4248
- version = "3.9.0"
4248
+ version = "3.9.1"
4249
4249
  }
4250
4250
  }
4251
4251
  }
@@ -4878,7 +4878,7 @@ terraform {
4878
4878
  required_providers {
4879
4879
  aws = {
4880
4880
  source = "hashicorp/aws"
4881
- version = "6.63.0"
4881
+ version = "6.66.0"
4882
4882
  }
4883
4883
  }
4884
4884
  }
@@ -5125,15 +5125,15 @@ output "api_log_group_arn" {
5125
5125
  required_providers {
5126
5126
  archive = {
5127
5127
  source = "hashicorp/archive"
5128
- version = "2.8.0"
5128
+ version = "2.8.1"
5129
5129
  }
5130
5130
  aws = {
5131
5131
  source = "hashicorp/aws"
5132
- version = "6.63.0"
5132
+ version = "6.66.0"
5133
5133
  }
5134
5134
  random = {
5135
5135
  source = "hashicorp/random"
5136
- version = "3.9.0"
5136
+ version = "3.9.1"
5137
5137
  }
5138
5138
  }
5139
5139
  }
@@ -5670,11 +5670,11 @@ terraform {
5670
5670
  required_providers {
5671
5671
  aws = {
5672
5672
  source = "hashicorp/aws"
5673
- version = "6.63.0"
5673
+ version = "6.66.0"
5674
5674
  }
5675
5675
  random = {
5676
5676
  source = "hashicorp/random"
5677
- version = "3.9.0"
5677
+ version = "3.9.1"
5678
5678
  }
5679
5679
  }
5680
5680
  }
@@ -5979,15 +5979,15 @@ output "waf_web_acl_arn" {
5979
5979
  required_providers {
5980
5980
  archive = {
5981
5981
  source = "hashicorp/archive"
5982
- version = "2.8.0"
5982
+ version = "2.8.1"
5983
5983
  }
5984
5984
  aws = {
5985
5985
  source = "hashicorp/aws"
5986
- version = "6.63.0"
5986
+ version = "6.66.0"
5987
5987
  }
5988
5988
  random = {
5989
5989
  source = "hashicorp/random"
5990
- version = "3.9.0"
5990
+ version = "3.9.1"
5991
5991
  }
5992
5992
  }
5993
5993
  }
@@ -6984,11 +6984,11 @@ terraform {
6984
6984
  required_providers {
6985
6985
  aws = {
6986
6986
  source = "hashicorp/aws"
6987
- version = "6.63.0"
6987
+ version = "6.66.0"
6988
6988
  }
6989
6989
  random = {
6990
6990
  source = "hashicorp/random"
6991
- version = "3.9.0"
6991
+ version = "3.9.1"
6992
6992
  }
6993
6993
  }
6994
6994
  }
@@ -7293,15 +7293,15 @@ output "waf_web_acl_arn" {
7293
7293
  required_providers {
7294
7294
  archive = {
7295
7295
  source = "hashicorp/archive"
7296
- version = "2.8.0"
7296
+ version = "2.8.1"
7297
7297
  }
7298
7298
  aws = {
7299
7299
  source = "hashicorp/aws"
7300
- version = "6.63.0"
7300
+ version = "6.66.0"
7301
7301
  }
7302
7302
  random = {
7303
7303
  source = "hashicorp/random"
7304
- version = "3.9.0"
7304
+ version = "3.9.1"
7305
7305
  }
7306
7306
  }
7307
7307
  }
@@ -8287,11 +8287,11 @@ terraform {
8287
8287
  required_providers {
8288
8288
  aws = {
8289
8289
  source = "hashicorp/aws"
8290
- version = "6.63.0"
8290
+ version = "6.66.0"
8291
8291
  }
8292
8292
  random = {
8293
8293
  source = "hashicorp/random"
8294
- version = "3.9.0"
8294
+ version = "3.9.1"
8295
8295
  }
8296
8296
  }
8297
8297
  }
@@ -8596,15 +8596,15 @@ output "waf_web_acl_arn" {
8596
8596
  required_providers {
8597
8597
  archive = {
8598
8598
  source = "hashicorp/archive"
8599
- version = "2.8.0"
8599
+ version = "2.8.1"
8600
8600
  }
8601
8601
  aws = {
8602
8602
  source = "hashicorp/aws"
8603
- version = "6.63.0"
8603
+ version = "6.66.0"
8604
8604
  }
8605
8605
  random = {
8606
8606
  source = "hashicorp/random"
8607
- version = "3.9.0"
8607
+ version = "3.9.1"
8608
8608
  }
8609
8609
  }
8610
8610
  }
@@ -663,7 +663,7 @@ WORKDIR /app
663
663
  RUN npm init -y \\
664
664
  && npm pkg set "overrides.@opentelemetry/propagator-jaeger=2.11.0" \\
665
665
  && npm pkg set "overrides.minimatch=10.2.6" \\
666
- && npm install @aws/aws-distro-opentelemetry-node-autoinstrumentation@0.12.0 \\
666
+ && npm install @aws/aws-distro-opentelemetry-node-autoinstrumentation@0.13.0 \\
667
667
  && npm uninstall -g npm
668
668
 
669
669
  # Copy bundled agent
@@ -984,11 +984,11 @@ exports[`ts#agent generator > should match snapshot for Terraform generated file
984
984
  required_providers {
985
985
  aws = {
986
986
  source = "hashicorp/aws"
987
- version = "6.63.0"
987
+ version = "6.66.0"
988
988
  }
989
989
  random = {
990
990
  source = "hashicorp/random"
991
- version = "3.9.0"
991
+ version = "3.9.1"
992
992
  }
993
993
  }
994
994
  }
@@ -1307,15 +1307,15 @@ exports[`ts#agent generator > should match snapshot for Terraform generated file
1307
1307
  required_providers {
1308
1308
  aws = {
1309
1309
  source = "hashicorp/aws"
1310
- version = "6.63.0"
1310
+ version = "6.66.0"
1311
1311
  }
1312
1312
  null = {
1313
1313
  source = "hashicorp/null"
1314
- version = "3.3.1"
1314
+ version = "3.3.2"
1315
1315
  }
1316
1316
  random = {
1317
1317
  source = "hashicorp/random"
1318
- version = "3.9.0"
1318
+ version = "3.9.1"
1319
1319
  }
1320
1320
  }
1321
1321
  }
@@ -1666,7 +1666,7 @@ resource "null_resource" "runtime_ready" {
1666
1666
 
1667
1667
  provisioner "local-exec" {
1668
1668
  command = <<-EOT
1669
- uv run --with boto3==1.43.89 python -c "
1669
+ uv run --with boto3==1.43.98 python -c "
1670
1670
  import boto3
1671
1671
  import json
1672
1672
  import os
@@ -579,15 +579,15 @@ terraform {
579
579
  required_providers {
580
580
  aws = {
581
581
  source = "hashicorp/aws"
582
- version = "6.63.0"
582
+ version = "6.66.0"
583
583
  }
584
584
  archive = {
585
585
  source = "hashicorp/archive"
586
- version = "2.8.0"
586
+ version = "2.8.1"
587
587
  }
588
588
  random = {
589
589
  source = "hashicorp/random"
590
- version = "3.9.0"
590
+ version = "3.9.1"
591
591
  }
592
592
  }
593
593
  }
@@ -35,7 +35,7 @@ exports[`ts#dynamodb generator > should generate terraform modules when iac is t
35
35
  required_providers {
36
36
  aws = {
37
37
  source = "hashicorp/aws"
38
- version = "6.63.0"
38
+ version = "6.66.0"
39
39
  }
40
40
  }
41
41
  }
@@ -232,11 +232,11 @@ exports[`ts#dynamodb generator > should generate terraform modules when iac is t
232
232
  required_providers {
233
233
  aws = {
234
234
  source = "hashicorp/aws"
235
- version = "6.63.0"
235
+ version = "6.66.0"
236
236
  }
237
237
  random = {
238
238
  source = "hashicorp/random"
239
- version = "3.9.0"
239
+ version = "3.9.1"
240
240
  }
241
241
  }
242
242
  }
@@ -141,15 +141,15 @@ exports[`ts-lambda-function generator > terraform iac > should generate terrafor
141
141
  required_providers {
142
142
  aws = {
143
143
  source = "hashicorp/aws"
144
- version = "6.63.0"
144
+ version = "6.66.0"
145
145
  }
146
146
  archive = {
147
147
  source = "hashicorp/archive"
148
- version = "2.8.0"
148
+ version = "2.8.1"
149
149
  }
150
150
  random = {
151
151
  source = "hashicorp/random"
152
- version = "3.9.0"
152
+ version = "3.9.1"
153
153
  }
154
154
  }
155
155
  }
@@ -326,15 +326,15 @@ exports[`ts-lambda-function generator > terraform iac > should match snapshot fo
326
326
  required_providers {
327
327
  aws = {
328
328
  source = "hashicorp/aws"
329
- version = "6.63.0"
329
+ version = "6.66.0"
330
330
  }
331
331
  archive = {
332
332
  source = "hashicorp/archive"
333
- version = "2.8.0"
333
+ version = "2.8.1"
334
334
  }
335
335
  random = {
336
336
  source = "hashicorp/random"
337
- version = "3.9.0"
337
+ version = "3.9.1"
338
338
  }
339
339
  }
340
340
  }
@@ -155,15 +155,15 @@ exports[`ts#mcp-server generator > should match snapshot for Terraform generated
155
155
  required_providers {
156
156
  aws = {
157
157
  source = "hashicorp/aws"
158
- version = "6.63.0"
158
+ version = "6.66.0"
159
159
  }
160
160
  null = {
161
161
  source = "hashicorp/null"
162
- version = "3.3.1"
162
+ version = "3.3.2"
163
163
  }
164
164
  random = {
165
165
  source = "hashicorp/random"
166
- version = "3.9.0"
166
+ version = "3.9.1"
167
167
  }
168
168
  }
169
169
  }
@@ -514,7 +514,7 @@ resource "null_resource" "runtime_ready" {
514
514
 
515
515
  provisioner "local-exec" {
516
516
  command = <<-EOT
517
- uv run --with boto3==1.43.89 python -c "
517
+ uv run --with boto3==1.43.98 python -c "
518
518
  import boto3
519
519
  import json
520
520
  import os