@aws/nx-plugin 1.0.0-rc.9 → 1.0.0-rc.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE-THIRD-PARTY +13999 -17963
- package/README.md +30 -110
- package/executors.json +5 -0
- package/generators.json +170 -10
- package/migrations.json +364 -0
- package/package.json +40 -21
- package/src/agentcore-gateway/__snapshots__/generator.spec.ts.snap +344 -0
- package/src/agentcore-gateway/agent-connection/generator.d.ts +19 -0
- package/src/agentcore-gateway/agent-connection/generator.js +95 -0
- package/src/agentcore-gateway/agent-connection/generator.js.map +1 -0
- package/src/agentcore-gateway/agent-connection/schema.d.js +6 -0
- package/src/agentcore-gateway/agent-connection/schema.d.js.map +1 -0
- package/src/agentcore-gateway/agent-connection/schema.d.ts +13 -0
- package/src/agentcore-gateway/agent-connection/schema.json +31 -0
- package/src/agentcore-gateway/attach-upstream.d.ts +49 -0
- package/src/agentcore-gateway/attach-upstream.js +59 -0
- package/src/agentcore-gateway/attach-upstream.js.map +1 -0
- package/src/agentcore-gateway/files/cedar/policies/README.md +61 -0
- package/src/agentcore-gateway/files/cedar/policies/permit-all.cedar +26 -0
- package/src/agentcore-gateway/files/project/http/local-dev.ts.template +77 -0
- package/src/agentcore-gateway/files/project/mcp/local-dev.ts.template +134 -0
- package/src/agentcore-gateway/gateway-connection/generator.d.ts +21 -0
- package/src/agentcore-gateway/gateway-connection/generator.js +103 -0
- package/src/agentcore-gateway/gateway-connection/generator.js.map +1 -0
- package/src/agentcore-gateway/gateway-connection/schema.d.js +6 -0
- package/src/agentcore-gateway/gateway-connection/schema.d.js.map +1 -0
- package/src/agentcore-gateway/gateway-connection/schema.d.ts +13 -0
- package/src/agentcore-gateway/gateway-connection/schema.json +31 -0
- package/src/agentcore-gateway/generator.d.ts +90 -0
- package/src/agentcore-gateway/generator.js +202 -0
- package/src/agentcore-gateway/generator.js.map +1 -0
- package/src/agentcore-gateway/mcp-connection/generator.d.ts +19 -0
- package/src/agentcore-gateway/mcp-connection/generator.js +61 -0
- package/src/agentcore-gateway/mcp-connection/generator.js.map +1 -0
- package/src/agentcore-gateway/mcp-connection/schema.d.js +6 -0
- package/src/agentcore-gateway/mcp-connection/schema.d.js.map +1 -0
- package/src/agentcore-gateway/mcp-connection/schema.d.ts +13 -0
- package/src/agentcore-gateway/mcp-connection/schema.json +31 -0
- package/src/agentcore-gateway/react-connection/__snapshots__/generator.spec.ts.snap +68 -0
- package/src/agentcore-gateway/react-connection/generator.d.ts +19 -0
- package/src/agentcore-gateway/react-connection/generator.js +119 -0
- package/src/agentcore-gateway/react-connection/generator.js.map +1 -0
- package/src/agentcore-gateway/react-connection/schema.d.js +6 -0
- package/src/agentcore-gateway/react-connection/schema.d.js.map +1 -0
- package/src/agentcore-gateway/react-connection/schema.d.ts +13 -0
- package/src/agentcore-gateway/react-connection/schema.json +31 -0
- package/src/agentcore-gateway/schema.d.js +6 -0
- package/src/agentcore-gateway/schema.d.js.map +1 -0
- package/src/agentcore-gateway/schema.d.ts +17 -0
- package/src/agentcore-gateway/schema.json +72 -0
- package/src/agentcore-harness/__snapshots__/generator.spec.ts.snap +237 -0
- package/src/agentcore-harness/files/project/README.md.template +82 -0
- package/src/agentcore-harness/files/project/scripts/chat.ts.template +99 -0
- package/src/agentcore-harness/files/project/src/PROMPT.md.template +16 -0
- package/src/agentcore-harness/generator.d.ts +62 -0
- package/src/agentcore-harness/generator.js +158 -0
- package/src/agentcore-harness/generator.js.map +1 -0
- package/src/agentcore-harness/schema.d.js +8 -0
- package/src/agentcore-harness/schema.d.js.map +1 -0
- package/src/agentcore-harness/schema.d.ts +17 -0
- package/src/agentcore-harness/schema.json +53 -0
- package/src/connection/agent-local-dev.d.ts +49 -0
- package/src/connection/agent-local-dev.js +84 -0
- package/src/connection/agent-local-dev.js.map +1 -0
- package/src/connection/agent-runtime-config.js +9 -14
- package/src/connection/agent-runtime-config.js.map +1 -1
- package/src/connection/gateway-runtime-config.d.ts +19 -0
- package/src/connection/gateway-runtime-config.js +47 -0
- package/src/connection/gateway-runtime-config.js.map +1 -0
- package/src/connection/generator.d.ts +4 -11
- package/src/connection/generator.js +172 -194
- package/src/connection/generator.js.map +1 -1
- package/src/connection/{serve-local.d.ts → local-dev.d.ts} +3 -3
- package/src/connection/local-dev.js +37 -0
- package/src/connection/local-dev.js.map +1 -0
- package/src/connection/scaffold-catalog.d.ts +267 -0
- package/src/connection/scaffold-catalog.js +347 -0
- package/src/connection/scaffold-catalog.js.map +1 -0
- package/src/connection/schema-resolver.d.ts +5 -0
- package/src/connection/schema-resolver.js +27 -0
- package/src/connection/schema-resolver.js.map +1 -0
- package/src/connection/schema.d.js +6 -0
- package/src/connection/schema.d.js.map +1 -0
- package/src/connection/schema.d.ts +1 -0
- package/src/connection/schema.json +5 -0
- package/src/connection/supported-connections.d.ts +116 -0
- package/src/connection/supported-connections.js +163 -0
- package/src/connection/supported-connections.js.map +1 -0
- package/src/index.d.ts +1 -1
- package/src/index.js +2 -5
- package/src/index.js.map +1 -1
- package/src/infra/app/__snapshots__/generator.spec.ts.snap +172 -87
- package/src/infra/app/files/app/README.md.template +22 -4
- package/src/infra/app/files/app/src/main.ts.template +5 -1
- package/src/infra/app/files/app/src/stages/application-stage.ts.template +1 -1
- package/src/infra/app/generator.d.ts +44 -1
- package/src/infra/app/generator.js +209 -128
- package/src/infra/app/generator.js.map +1 -1
- package/src/infra/app/schema.d.js +6 -0
- package/src/infra/app/schema.d.js.map +1 -0
- package/src/infra/app/schema.d.ts +1 -1
- package/src/infra/app/schema.json +5 -0
- package/src/init/generator.d.ts +31 -0
- package/src/init/generator.js +46 -0
- package/src/init/generator.js.map +1 -0
- package/src/init/schema.d.js +6 -0
- package/src/init/schema.d.js.map +1 -0
- package/src/init/schema.d.ts +16 -0
- package/src/init/schema.json +35 -0
- package/src/internal/test-matrix/generator.d.ts +29 -0
- package/src/internal/test-matrix/generator.js +729 -0
- package/src/internal/test-matrix/generator.js.map +1 -0
- package/src/internal/test-matrix/schema.d.js +6 -0
- package/src/internal/test-matrix/schema.d.js.map +1 -0
- package/src/internal/test-matrix/schema.d.ts +12 -0
- package/src/internal/test-matrix/schema.json +21 -0
- package/src/license/config-types.d.ts +2 -2
- package/src/license/config-types.js +5 -3
- package/src/license/config-types.js.map +1 -1
- package/src/license/config.d.ts +12 -3
- package/src/license/config.js +295 -242
- package/src/license/config.js.map +1 -1
- package/src/license/dependency-check/check.d.ts +2 -2
- package/src/license/dependency-check/check.js +51 -46
- package/src/license/dependency-check/check.js.map +1 -1
- package/src/license/dependency-check/collectors/collector.js +41 -71
- package/src/license/dependency-check/collectors/collector.js.map +1 -1
- package/src/license/dependency-check/collectors/npm-collector.js +34 -41
- package/src/license/dependency-check/collectors/npm-collector.js.map +1 -1
- package/src/license/dependency-check/collectors/python-collector.js +61 -62
- package/src/license/dependency-check/collectors/python-collector.js.map +1 -1
- package/src/license/dependency-check/evaluator.d.ts +1 -1
- package/src/license/dependency-check/evaluator.js +91 -74
- package/src/license/dependency-check/evaluator.js.map +1 -1
- package/src/license/dependency-check/executor.js +30 -22
- package/src/license/dependency-check/executor.js.map +1 -1
- package/src/license/dependency-check/pre-approved.d.ts +1 -1
- package/src/license/dependency-check/pre-approved.js +949 -336
- package/src/license/dependency-check/pre-approved.js.map +1 -1
- package/src/license/dependency-check/types.d.ts +1 -1
- package/src/license/dependency-check/types.js +2 -3
- package/src/license/dependency-check/types.js.map +1 -1
- package/src/license/generator.d.ts +1 -1
- package/src/license/generator.js +60 -77
- package/src/license/generator.js.map +1 -1
- package/src/license/index.d.ts +4 -4
- package/src/license/index.js +3 -9
- package/src/license/index.js.map +1 -1
- package/src/license/known-exceptions.d.ts +2 -3
- package/src/license/known-exceptions.js +12 -28
- package/src/license/known-exceptions.js.map +1 -1
- package/src/license/schema.d.js +6 -0
- package/src/license/schema.d.js.map +1 -0
- package/src/license/schema.d.ts +2 -0
- package/src/license/schema.json +5 -0
- package/src/license/sync/generator.js +94 -119
- package/src/license/sync/generator.js.map +1 -1
- package/src/license/sync/project-file-sync.d.ts +1 -1
- package/src/license/sync/project-file-sync.js +28 -35
- package/src/license/sync/project-file-sync.js.map +1 -1
- package/src/mcp-server/dev-server.d.ts +1 -0
- package/src/mcp-server/dev-server.js +18 -0
- package/src/mcp-server/dev-server.js.map +1 -0
- package/src/mcp-server/generator-info.d.ts +8 -3
- package/src/mcp-server/generator-info.js +155 -167
- package/src/mcp-server/generator-info.js.map +1 -1
- package/src/mcp-server/guide-pipeline.d.ts +1 -1
- package/src/mcp-server/guide-pipeline.js +199 -206
- package/src/mcp-server/guide-pipeline.js.map +1 -1
- package/src/mcp-server/guide-render.js +10 -25
- package/src/mcp-server/guide-render.js.map +1 -1
- package/src/mcp-server/index.js +6 -10
- package/src/mcp-server/index.js.map +1 -1
- package/src/mcp-server/mdx-ast.js +39 -57
- package/src/mcp-server/mdx-ast.js.map +1 -1
- package/src/mcp-server/option-filter.js +33 -47
- package/src/mcp-server/option-filter.js.map +1 -1
- package/src/mcp-server/schema-registry.d.ts +9 -3
- package/src/mcp-server/schema-registry.js +41 -38
- package/src/mcp-server/schema-registry.js.map +1 -1
- package/src/mcp-server/schema.d.ts +1 -1
- package/src/mcp-server/schema.js +9 -7
- package/src/mcp-server/schema.js.map +1 -1
- package/src/mcp-server/server.js +24 -24
- package/src/mcp-server/server.js.map +1 -1
- package/src/mcp-server/tools/add-to-existing-project.d.ts +12 -0
- package/src/mcp-server/tools/add-to-existing-project.js +36 -0
- package/src/mcp-server/tools/add-to-existing-project.js.map +1 -0
- package/src/mcp-server/tools/create-workspace-command.js +23 -24
- package/src/mcp-server/tools/create-workspace-command.js.map +1 -1
- package/src/mcp-server/tools/general-guidance.d.ts +2 -2
- package/src/mcp-server/tools/general-guidance.js +55 -32
- package/src/mcp-server/tools/general-guidance.js.map +1 -1
- package/src/mcp-server/tools/generator-guide.d.ts +1 -1
- package/src/mcp-server/tools/generator-guide.js +29 -37
- package/src/mcp-server/tools/generator-guide.js.map +1 -1
- package/src/mcp-server/tools/list-generators.d.ts +1 -1
- package/src/mcp-server/tools/list-generators.js +19 -25
- package/src/mcp-server/tools/list-generators.js.map +1 -1
- package/src/mcp-server/tools/upgrade-workspace.d.ts +11 -0
- package/src/mcp-server/tools/upgrade-workspace.js +32 -0
- package/src/mcp-server/tools/upgrade-workspace.js.map +1 -0
- package/src/migrations/latest/add-assemble-target/metadata.json +3 -0
- package/src/migrations/latest/add-assemble-target/migration.d.ts +6 -0
- package/src/migrations/latest/add-assemble-target/migration.js +241 -0
- package/src/migrations/latest/add-assemble-target/migration.js.map +1 -0
- package/src/migrations/latest/add-destroy-sandbox-target/metadata.json +3 -0
- package/src/migrations/latest/add-destroy-sandbox-target/migration.d.ts +6 -0
- package/src/migrations/latest/add-destroy-sandbox-target/migration.js +150 -0
- package/src/migrations/latest/add-destroy-sandbox-target/migration.js.map +1 -0
- package/src/migrations/latest/declare-cacheable-target-inputs/metadata.json +3 -0
- package/src/migrations/latest/declare-cacheable-target-inputs/migration.d.ts +6 -0
- package/src/migrations/latest/declare-cacheable-target-inputs/migration.js +94 -0
- package/src/migrations/latest/declare-cacheable-target-inputs/migration.js.map +1 -0
- package/src/migrations/latest/dev-target-depends-on-pull-image/metadata.json +3 -0
- package/src/migrations/latest/dev-target-depends-on-pull-image/migration.d.ts +6 -0
- package/src/migrations/latest/dev-target-depends-on-pull-image/migration.js +67 -0
- package/src/migrations/latest/dev-target-depends-on-pull-image/migration.js.map +1 -0
- package/src/migrations/latest/docker-target-cache-soundness/metadata.json +3 -0
- package/src/migrations/latest/docker-target-cache-soundness/migration.d.ts +6 -0
- package/src/migrations/latest/docker-target-cache-soundness/migration.js +95 -0
- package/src/migrations/latest/docker-target-cache-soundness/migration.js.map +1 -0
- package/src/migrations/latest/nx-parallel-default/metadata.json +3 -0
- package/src/migrations/latest/nx-parallel-default/migration.d.ts +14 -0
- package/src/migrations/latest/nx-parallel-default/migration.js +29 -0
- package/src/migrations/latest/nx-parallel-default/migration.js.map +1 -0
- package/src/migrations/latest/open-api-codegen-executor/metadata.json +3 -0
- package/src/migrations/latest/open-api-codegen-executor/migration.d.ts +6 -0
- package/src/migrations/latest/open-api-codegen-executor/migration.js +100 -0
- package/src/migrations/latest/open-api-codegen-executor/migration.js.map +1 -0
- package/src/migrations/latest/python-test-input-scoping/metadata.json +3 -0
- package/src/migrations/latest/python-test-input-scoping/migration.d.ts +6 -0
- package/src/migrations/latest/python-test-input-scoping/migration.js +142 -0
- package/src/migrations/latest/python-test-input-scoping/migration.js.map +1 -0
- package/src/migrations/latest/python-version-drop-exact-patch/metadata.json +3 -0
- package/src/migrations/latest/python-version-drop-exact-patch/migration.d.ts +6 -0
- package/src/migrations/latest/python-version-drop-exact-patch/migration.js +43 -0
- package/src/migrations/latest/python-version-drop-exact-patch/migration.js.map +1 -0
- package/src/migrations/latest/react-website-nx-react-express-override/metadata.json +3 -0
- package/src/migrations/latest/react-website-nx-react-express-override/migration.d.ts +31 -0
- package/src/migrations/latest/react-website-nx-react-express-override/migration.js +74 -0
- package/src/migrations/latest/react-website-nx-react-express-override/migration.js.map +1 -0
- package/src/migrations/latest/terraform-fmt-check/metadata.json +3 -0
- package/src/migrations/latest/terraform-fmt-check/migration.d.ts +6 -0
- package/src/migrations/latest/terraform-fmt-check/migration.js +165 -0
- package/src/migrations/latest/terraform-fmt-check/migration.js.map +1 -0
- package/src/migrations/latest/terraform-provider-plugin-cache/metadata.json +3 -0
- package/src/migrations/latest/terraform-provider-plugin-cache/migration.d.ts +6 -0
- package/src/migrations/latest/terraform-provider-plugin-cache/migration.js +164 -0
- package/src/migrations/latest/terraform-provider-plugin-cache/migration.js.map +1 -0
- package/src/migrations/latest/terraform-rdb-proxy-iam-connect-grant/__snapshots__/migration.spec.ts.snap +23 -0
- package/src/migrations/latest/terraform-rdb-proxy-iam-connect-grant/metadata.json +3 -0
- package/src/migrations/latest/terraform-rdb-proxy-iam-connect-grant/migration.d.ts +6 -0
- package/src/migrations/latest/terraform-rdb-proxy-iam-connect-grant/migration.js +88 -0
- package/src/migrations/latest/terraform-rdb-proxy-iam-connect-grant/migration.js.map +1 -0
- package/src/migrations/latest/vitest-coverage-output-dir/metadata.json +3 -0
- package/src/migrations/latest/vitest-coverage-output-dir/migration.d.ts +6 -0
- package/src/migrations/latest/vitest-coverage-output-dir/migration.js +177 -0
- package/src/migrations/latest/vitest-coverage-output-dir/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.50/0001-modernize-function-props-cast/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.50/0001-modernize-function-props-cast/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.50/0001-modernize-function-props-cast/migration.js +65 -0
- package/src/migrations/v1.0.0-rc.50/0001-modernize-function-props-cast/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.50/0002-restrict-cors-to-custom-domains/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.50/0002-restrict-cors-to-custom-domains/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.50/0002-restrict-cors-to-custom-domains/migration.js +108 -0
- package/src/migrations/v1.0.0-rc.50/0002-restrict-cors-to-custom-domains/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.50/0003-terraform-bootstrap-adopt-existing-bucket/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.50/0003-terraform-bootstrap-adopt-existing-bucket/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.50/0003-terraform-bootstrap-adopt-existing-bucket/migration.js +128 -0
- package/src/migrations/v1.0.0-rc.50/0003-terraform-bootstrap-adopt-existing-bucket/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.52/0001-user-identity-waf-allow-localhost-callback/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.52/0001-user-identity-waf-allow-localhost-callback/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.52/0001-user-identity-waf-allow-localhost-callback/migration.js +215 -0
- package/src/migrations/v1.0.0-rc.52/0001-user-identity-waf-allow-localhost-callback/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.54/0001-order-access-log-delivery-after-bucket-policy/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.54/0001-order-access-log-delivery-after-bucket-policy/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.54/0001-order-access-log-delivery-after-bucket-policy/migration.js +93 -0
- package/src/migrations/v1.0.0-rc.54/0001-order-access-log-delivery-after-bucket-policy/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.55/0001-backfill-generator-metadata/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.55/0001-backfill-generator-metadata/migration.d.ts +96 -0
- package/src/migrations/v1.0.0-rc.55/0001-backfill-generator-metadata/migration.js +670 -0
- package/src/migrations/v1.0.0-rc.55/0001-backfill-generator-metadata/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.56/0001-dynamodb-local-remove-optimize-flag/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.56/0001-dynamodb-local-remove-optimize-flag/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.56/0001-dynamodb-local-remove-optimize-flag/migration.js +89 -0
- package/src/migrations/v1.0.0-rc.56/0001-dynamodb-local-remove-optimize-flag/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.57/0001-ts-agent-session-management-support/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.57/0001-ts-agent-session-management-support/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.57/0001-ts-agent-session-management-support/migration.js +449 -0
- package/src/migrations/v1.0.0-rc.57/0001-ts-agent-session-management-support/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.58/0001-smithy-ssdk-bundle-pins/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.58/0001-smithy-ssdk-bundle-pins/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.58/0001-smithy-ssdk-bundle-pins/migration.js +78 -0
- package/src/migrations/v1.0.0-rc.58/0001-smithy-ssdk-bundle-pins/migration.js.map +1 -0
- package/src/{smithy/project/files/build.Dockerfile.template → migrations/v1.0.0-rc.58/0001-smithy-ssdk-bundle-pins/rc57-service.Dockerfile.fixture} +1 -4
- package/src/migrations/v1.0.0-rc.59/0001-gateway-agent-targets/__snapshots__/migration.spec.ts.snap +223 -0
- package/src/migrations/v1.0.0-rc.59/0001-gateway-agent-targets/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.59/0001-gateway-agent-targets/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.59/0001-gateway-agent-targets/migration.js +217 -0
- package/src/migrations/v1.0.0-rc.59/0001-gateway-agent-targets/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.60/0001-gateway-cognito-passthrough/__snapshots__/migration.spec.ts.snap +149 -0
- package/src/migrations/v1.0.0-rc.60/0001-gateway-cognito-passthrough/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.60/0001-gateway-cognito-passthrough/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.60/0001-gateway-cognito-passthrough/migration.js +195 -0
- package/src/migrations/v1.0.0-rc.60/0001-gateway-cognito-passthrough/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.60/0002-waf-log-group-removal/__snapshots__/migration.spec.ts.snap +57 -0
- package/src/migrations/v1.0.0-rc.60/0002-waf-log-group-removal/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.60/0002-waf-log-group-removal/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.60/0002-waf-log-group-removal/migration.js +77 -0
- package/src/migrations/v1.0.0-rc.60/0002-waf-log-group-removal/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.60/0003-strip-pip-from-python-images/__snapshots__/migration.spec.ts.snap +48 -0
- package/src/migrations/v1.0.0-rc.60/0003-strip-pip-from-python-images/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.60/0003-strip-pip-from-python-images/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.60/0003-strip-pip-from-python-images/migration.js +91 -0
- package/src/migrations/v1.0.0-rc.60/0003-strip-pip-from-python-images/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.61/0001-py-agent-lifespan-construction/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.61/0001-py-agent-lifespan-construction/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.61/0001-py-agent-lifespan-construction/migration.js +412 -0
- package/src/migrations/v1.0.0-rc.61/0001-py-agent-lifespan-construction/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.62/0001-rename-load-runtime-config-target/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.62/0001-rename-load-runtime-config-target/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.62/0001-rename-load-runtime-config-target/migration.js +33 -0
- package/src/migrations/v1.0.0-rc.62/0001-rename-load-runtime-config-target/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.63/0001-add-deploy-sandbox-target/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.63/0001-add-deploy-sandbox-target/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.63/0001-add-deploy-sandbox-target/migration.js +83 -0
- package/src/migrations/v1.0.0-rc.63/0001-add-deploy-sandbox-target/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.64/0001-smithy-build-without-docker/legacy-service.Dockerfile.fixture +95 -0
- package/src/migrations/v1.0.0-rc.64/0001-smithy-build-without-docker/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.64/0001-smithy-build-without-docker/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.64/0001-smithy-build-without-docker/migration.js +154 -0
- package/src/migrations/v1.0.0-rc.64/0001-smithy-build-without-docker/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.65/0001-vite-config-import-meta-dirname/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.65/0001-vite-config-import-meta-dirname/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.65/0001-vite-config-import-meta-dirname/migration.js +71 -0
- package/src/migrations/v1.0.0-rc.65/0001-vite-config-import-meta-dirname/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.65/0002-rolldown-code-splitting/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.65/0002-rolldown-code-splitting/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.65/0002-rolldown-code-splitting/migration.js +57 -0
- package/src/migrations/v1.0.0-rc.65/0002-rolldown-code-splitting/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.67/0001-smithy-server-package-rename/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.67/0001-smithy-server-package-rename/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.67/0001-smithy-server-package-rename/migration.js +123 -0
- package/src/migrations/v1.0.0-rc.67/0001-smithy-server-package-rename/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/files/build-system-prompt.ts.fixture +23 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/files/build-user-prompt.ts.fixture +96 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/files/config-path.ts.fixture +1 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/files/file-to-translate.ts.fixture +10 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/files/get-files-to-translate.ts.fixture +96 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/files/header.ts.fixture +15 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/files/log.ts.fixture +18 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/files/main-call.ts.fixture +6 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/files/main.ts.fixture +79 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/files/project-root.ts.fixture +1 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/files/run-with-concurrency.ts.fixture +57 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/files/scripts-dir.ts.fixture +1 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/files/translate-file-for-language.ts.fixture +61 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/grit/already-migrated.grit +1 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/grit/build-system-prompt.grit +6 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/grit/build-user-prompt.grit +6 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/grit/config-path.grit +1 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/grit/file-to-translate.grit +11 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/grit/get-files-to-translate.grit +7 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/grit/log.grit +3 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/grit/main-call.grit +1 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/grit/main.grit +8 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/grit/project-root.grit +1 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/grit/run-with-concurrency.grit +6 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/grit/translate-file-for-language.grit +6 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/migration.d.ts +2 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/migration.js +103 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/test-fixtures/released-script-first.ts.fixture +430 -0
- package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/test-fixtures/released-script.ts.fixture +431 -0
- package/src/migrations/v1.0.0-rc.70/0001-py-agent-a2a-lifespan-construction/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.70/0001-py-agent-a2a-lifespan-construction/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.70/0001-py-agent-a2a-lifespan-construction/migration.js +246 -0
- package/src/migrations/v1.0.0-rc.70/0001-py-agent-a2a-lifespan-construction/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.71/0001-py-agent-a2a-httpx-client-per-call/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.71/0001-py-agent-a2a-httpx-client-per-call/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.71/0001-py-agent-a2a-httpx-client-per-call/migration.js +329 -0
- package/src/migrations/v1.0.0-rc.71/0001-py-agent-a2a-httpx-client-per-call/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.72/0001-py-agent-session-management-support/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.72/0001-py-agent-session-management-support/migration.d.ts +2 -0
- package/src/migrations/v1.0.0-rc.72/0001-py-agent-session-management-support/migration.js +308 -0
- package/src/migrations/v1.0.0-rc.72/0001-py-agent-session-management-support/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.73/0001-remove-mcp-inspector-license-exceptions/metadata.json +3 -0
- package/{sdk/utils/ast.d.ts → src/migrations/v1.0.0-rc.73/0001-remove-mcp-inspector-license-exceptions/migration.d.ts} +2 -2
- package/src/migrations/v1.0.0-rc.73/0001-remove-mcp-inspector-license-exceptions/migration.js +38 -0
- package/src/migrations/v1.0.0-rc.73/0001-remove-mcp-inspector-license-exceptions/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.73/0002-apt-security-updates-in-container-images/__snapshots__/migration.spec.ts.snap +90 -0
- package/src/migrations/v1.0.0-rc.73/0002-apt-security-updates-in-container-images/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.73/0002-apt-security-updates-in-container-images/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.73/0002-apt-security-updates-in-container-images/migration.js +90 -0
- package/src/migrations/v1.0.0-rc.73/0002-apt-security-updates-in-container-images/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.74/0001-py-agent-session-id-middleware-extraction/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.74/0001-py-agent-session-id-middleware-extraction/migration.d.ts +2 -0
- package/src/migrations/v1.0.0-rc.74/0001-py-agent-session-id-middleware-extraction/migration.js +118 -0
- package/src/migrations/v1.0.0-rc.74/0001-py-agent-session-id-middleware-extraction/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.75/0001-ts-agent-session-id-middleware-extraction/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.75/0001-ts-agent-session-id-middleware-extraction/migration.d.ts +2 -0
- package/src/migrations/v1.0.0-rc.75/0001-ts-agent-session-id-middleware-extraction/migration.js +136 -0
- package/src/migrations/v1.0.0-rc.75/0001-ts-agent-session-id-middleware-extraction/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.77/0001-dynamodb-configurable-encryption/__snapshots__/migration.spec.ts.snap +429 -0
- package/src/migrations/v1.0.0-rc.77/0001-dynamodb-configurable-encryption/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.77/0001-dynamodb-configurable-encryption/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.77/0001-dynamodb-configurable-encryption/migration.js +325 -0
- package/src/migrations/v1.0.0-rc.77/0001-dynamodb-configurable-encryption/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.77/0002-user-identity-configurable-mfa/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.77/0002-user-identity-configurable-mfa/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.77/0002-user-identity-configurable-mfa/migration.js +362 -0
- package/src/migrations/v1.0.0-rc.77/0002-user-identity-configurable-mfa/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.78/0001-static-website-configurable-waf-encryption/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.78/0001-static-website-configurable-waf-encryption/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.78/0001-static-website-configurable-waf-encryption/migration.js +418 -0
- package/src/migrations/v1.0.0-rc.78/0001-static-website-configurable-waf-encryption/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.79/0001-py-agent-ag-ui-hooks/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.79/0001-py-agent-ag-ui-hooks/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.79/0001-py-agent-ag-ui-hooks/migration.js +113 -0
- package/src/migrations/v1.0.0-rc.79/0001-py-agent-ag-ui-hooks/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.82/0001-terraform-load-runtime-config-src-path/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.82/0001-terraform-load-runtime-config-src-path/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.82/0001-terraform-load-runtime-config-src-path/migration.js +48 -0
- package/src/migrations/v1.0.0-rc.82/0001-terraform-load-runtime-config-src-path/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.82/0002-runtime-config-namespace-defaults/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.82/0002-runtime-config-namespace-defaults/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.82/0002-runtime-config-namespace-defaults/migration.js +131 -0
- package/src/migrations/v1.0.0-rc.82/0002-runtime-config-namespace-defaults/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.83/0001-dynamodb-terraform-app-module-outputs/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.83/0001-dynamodb-terraform-app-module-outputs/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.83/0001-dynamodb-terraform-app-module-outputs/migration.js +69 -0
- package/src/migrations/v1.0.0-rc.83/0001-dynamodb-terraform-app-module-outputs/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.83/0002-terraform-data-resource-destroy-protection/__snapshots__/migration.spec.ts.snap +75 -0
- package/src/migrations/v1.0.0-rc.83/0002-terraform-data-resource-destroy-protection/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.83/0002-terraform-data-resource-destroy-protection/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.83/0002-terraform-data-resource-destroy-protection/migration.js +78 -0
- package/src/migrations/v1.0.0-rc.83/0002-terraform-data-resource-destroy-protection/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.83/0003-terraform-gateway-cedar-render-root-ejs/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.83/0003-terraform-gateway-cedar-render-root-ejs/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.83/0003-terraform-gateway-cedar-render-root-ejs/migration.js +38 -0
- package/src/migrations/v1.0.0-rc.83/0003-terraform-gateway-cedar-render-root-ejs/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.84/0001-rdb-terraform-aurora-app-module-defaults/__snapshots__/migration.spec.ts.snap +54 -0
- package/src/migrations/v1.0.0-rc.84/0001-rdb-terraform-aurora-app-module-defaults/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.84/0001-rdb-terraform-aurora-app-module-defaults/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.84/0001-rdb-terraform-aurora-app-module-defaults/migration.js +86 -0
- package/src/migrations/v1.0.0-rc.84/0001-rdb-terraform-aurora-app-module-defaults/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.84/0002-agentcore-harness-no-tools-by-default/__snapshots__/migration.spec.ts.snap +79 -0
- package/src/migrations/v1.0.0-rc.84/0002-agentcore-harness-no-tools-by-default/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.84/0002-agentcore-harness-no-tools-by-default/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.84/0002-agentcore-harness-no-tools-by-default/migration.js +87 -0
- package/src/migrations/v1.0.0-rc.84/0002-agentcore-harness-no-tools-by-default/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.84/0003-terraform-declare-used-providers/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.84/0003-terraform-declare-used-providers/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.84/0003-terraform-declare-used-providers/migration.js +147 -0
- package/src/migrations/v1.0.0-rc.84/0003-terraform-declare-used-providers/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.84/0004-waf-log-group-cmk-encryption/__snapshots__/migration.spec.ts.snap +286 -0
- package/src/migrations/v1.0.0-rc.84/0004-waf-log-group-cmk-encryption/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.84/0004-waf-log-group-cmk-encryption/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.84/0004-waf-log-group-cmk-encryption/migration.js +238 -0
- package/src/migrations/v1.0.0-rc.84/0004-waf-log-group-cmk-encryption/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.84/0005-terraform-harness-vpc-role-and-memory-grant/__snapshots__/migration.spec.ts.snap +521 -0
- package/src/migrations/v1.0.0-rc.84/0005-terraform-harness-vpc-role-and-memory-grant/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.84/0005-terraform-harness-vpc-role-and-memory-grant/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.84/0005-terraform-harness-vpc-role-and-memory-grant/migration.js +504 -0
- package/src/migrations/v1.0.0-rc.84/0005-terraform-harness-vpc-role-and-memory-grant/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.85/0001-terraform-project-checkov-target-and-bootstrap-destroy/metadata.json +3 -0
- package/src/migrations/v1.0.0-rc.85/0001-terraform-project-checkov-target-and-bootstrap-destroy/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.85/0001-terraform-project-checkov-target-and-bootstrap-destroy/migration.js +146 -0
- package/src/migrations/v1.0.0-rc.85/0001-terraform-project-checkov-target-and-bootstrap-destroy/migration.js.map +1 -0
- package/src/open-api/codegen/executor-schema.d.js +6 -0
- package/src/open-api/codegen/executor-schema.d.js.map +1 -0
- package/src/open-api/codegen/executor-schema.d.ts +18 -0
- package/src/open-api/codegen/executor-schema.json +33 -0
- package/src/open-api/codegen/executor.d.ts +18 -0
- package/src/open-api/codegen/executor.js +56 -0
- package/src/open-api/codegen/executor.js.map +1 -0
- package/src/open-api/json-metadata/generator.d.ts +24 -0
- package/src/open-api/json-metadata/generator.js +37 -0
- package/src/open-api/json-metadata/generator.js.map +1 -0
- package/src/open-api/json-metadata/schema.d.js +6 -0
- package/src/open-api/json-metadata/schema.d.js.map +1 -0
- package/src/open-api/json-metadata/schema.d.ts +9 -0
- package/src/open-api/json-metadata/schema.json +20 -0
- package/src/open-api/ts-client/__snapshots__/generator.additional-properties.spec.ts.snap +147 -33
- package/src/open-api/ts-client/__snapshots__/generator.arrays.spec.ts.snap +308 -75
- package/src/open-api/ts-client/__snapshots__/generator.complex-types.spec.ts.snap +298 -74
- package/src/open-api/ts-client/__snapshots__/generator.composite-types.spec.ts.snap +748 -103
- package/src/open-api/ts-client/__snapshots__/generator.content-type.spec.ts.snap +230 -37
- package/src/open-api/ts-client/__snapshots__/generator.duplicate-types.spec.ts.snap +249 -52
- package/src/open-api/ts-client/__snapshots__/generator.edge-cases.spec.ts.snap +5535 -0
- package/src/open-api/ts-client/__snapshots__/generator.fast-api-gaps.spec.ts.snap +736 -0
- package/src/open-api/ts-client/__snapshots__/generator.fast-api.spec.ts.snap +305 -71
- package/src/open-api/ts-client/__snapshots__/generator.multipart.spec.ts.snap +298 -0
- package/src/open-api/ts-client/__snapshots__/generator.primitive-types.spec.ts.snap +353 -82
- package/src/open-api/ts-client/__snapshots__/generator.request.spec.ts.snap +176 -55
- package/src/open-api/ts-client/__snapshots__/generator.reserved-keywords.spec.ts.snap +100 -24
- package/src/open-api/ts-client/__snapshots__/generator.response.spec.ts.snap +147 -33
- package/src/open-api/ts-client/__snapshots__/generator.spec-compliance.spec.ts.snap +1883 -0
- package/src/open-api/ts-client/__snapshots__/generator.streaming.spec.ts.snap +392 -88
- package/src/open-api/ts-client/__snapshots__/generator.tags.spec.ts.snap +200 -48
- package/src/open-api/ts-client/files/client.gen.ts.template +358 -24
- package/src/open-api/ts-client/files/types.gen.ts.template +6 -4
- package/src/open-api/ts-client/generator.d.ts +1 -1
- package/src/open-api/ts-client/generator.js +41 -26
- package/src/open-api/ts-client/generator.js.map +1 -1
- package/src/open-api/ts-client/schema.d.js +6 -0
- package/src/open-api/ts-client/schema.d.js.map +1 -0
- package/src/open-api/ts-hooks/files/options-proxy.gen.ts.template +7 -2
- package/src/open-api/ts-hooks/generator.d.ts +1 -1
- package/src/open-api/ts-hooks/generator.js +17 -21
- package/src/open-api/ts-hooks/generator.js.map +1 -1
- package/src/open-api/ts-hooks/generator.spec.tsx +76 -6
- package/src/open-api/ts-hooks/schema.d.js +6 -0
- package/src/open-api/ts-hooks/schema.d.js.map +1 -0
- package/src/open-api/ts-metadata/generator.d.ts +1 -1
- package/src/open-api/ts-metadata/generator.js +12 -20
- package/src/open-api/ts-metadata/generator.js.map +1 -1
- package/src/open-api/ts-metadata/schema.d.js +6 -0
- package/src/open-api/ts-metadata/schema.d.js.map +1 -0
- package/src/open-api/utils/codegen-data/languages.d.ts +1 -7
- package/src/open-api/utils/codegen-data/languages.js +59 -66
- package/src/open-api/utils/codegen-data/languages.js.map +1 -1
- package/src/open-api/utils/codegen-data/types.d.ts +255 -10
- package/src/open-api/utils/codegen-data/types.js +54 -30
- package/src/open-api/utils/codegen-data/types.js.map +1 -1
- package/src/open-api/utils/codegen-data.d.ts +4 -4
- package/src/open-api/utils/codegen-data.js +494 -674
- package/src/open-api/utils/codegen-data.js.map +1 -1
- package/src/open-api/utils/normalise.d.ts +1 -1
- package/src/open-api/utils/normalise.js +437 -246
- package/src/open-api/utils/normalise.js.map +1 -1
- package/src/open-api/utils/parse.d.ts +1 -1
- package/src/open-api/utils/parse.js +8 -14
- package/src/open-api/utils/parse.js.map +1 -1
- package/src/open-api/utils/parser.d.ts +55 -0
- package/src/open-api/utils/parser.js +787 -0
- package/src/open-api/utils/parser.js.map +1 -0
- package/src/open-api/utils/refs.d.ts +1 -1
- package/src/open-api/utils/refs.js +12 -22
- package/src/open-api/utils/refs.js.map +1 -1
- package/src/open-api/utils/types.d.ts +18 -0
- package/src/open-api/utils/types.js +5 -2
- package/src/open-api/utils/types.js.map +1 -1
- package/src/preset/__snapshots__/generator.spec.ts.snap +104 -21
- package/src/preset/generator.d.ts +15 -2
- package/src/preset/generator.js +76 -151
- package/src/preset/generator.js.map +1 -1
- package/src/preset/schema.d.js +6 -0
- package/src/preset/schema.d.js.map +1 -0
- package/src/preset/schema.d.ts +6 -3
- package/src/preset/schema.json +16 -5
- package/src/py/agent/__snapshots__/generator.constructs.spec.ts.snap +931 -0
- package/src/py/agent/__snapshots__/generator.core.spec.ts.snap +186 -0
- package/src/py/agent/__snapshots__/generator.frameworks.spec.ts.snap +771 -0
- package/src/py/agent/__snapshots__/generator.protocols.spec.ts.snap +1322 -0
- package/src/py/agent/a2a-connection/__snapshots__/generator.spec.ts.snap +231 -0
- package/src/py/agent/a2a-connection/files/agent-connection/app/__targetAgentSnakeCase___client_strands.py.template +29 -0
- package/src/py/agent/a2a-connection/files/langchain/agent-connection/app/__targetAgentSnakeCase___client_langchain.py.template +29 -0
- package/src/py/agent/a2a-connection/generator.d.ts +25 -1
- package/src/py/agent/a2a-connection/generator.js +146 -95
- package/src/py/agent/a2a-connection/generator.js.map +1 -1
- package/src/py/agent/a2a-connection/schema.d.js +8 -0
- package/src/py/agent/a2a-connection/schema.d.js.map +1 -0
- package/src/py/agent/a2a-connection/schema.d.ts +2 -1
- package/src/py/agent/a2a-connection/schema.json +5 -0
- package/src/py/agent/files/deploy/Dockerfile.template +15 -1
- package/src/py/agent/files/langchain/a2a/main.py.template +83 -0
- package/src/py/agent/files/langchain/ag-ui/main.py.template +76 -0
- package/src/py/agent/files/langchain/common/agent.py.template +30 -0
- package/src/py/agent/files/langchain/common/middleware/__init__.py.template +0 -0
- package/src/py/agent/files/langchain/common/middleware/session_id_middleware.py.template +17 -0
- package/src/py/agent/files/langchain/common/session.py.template +61 -0
- package/src/py/agent/files/{http → langchain/http}/init.py.template +17 -25
- package/src/py/agent/files/langchain/http/main.py.template +69 -0
- package/src/py/agent/files/strands/a2a/main.py.template +61 -0
- package/src/py/agent/files/strands/ag-ui/main.py.template +86 -0
- package/src/py/agent/files/strands/common/__init__.py.template +0 -0
- package/src/py/agent/files/{common → strands/common}/agent.py.template +13 -2
- package/src/py/agent/files/strands/common/middleware/__init__.py.template +0 -0
- package/src/py/agent/files/strands/common/middleware/session_id_middleware.py.template +17 -0
- package/src/py/agent/files/strands/common/session.py.template +36 -0
- package/src/py/agent/files/strands/http/init.py.template +97 -0
- package/src/py/agent/files/{http → strands/http}/main.py.template +5 -29
- package/src/py/agent/gateway-connection/__snapshots__/generator.spec.ts.snap +184 -0
- package/src/py/agent/gateway-connection/files/agent-connection/app/__gatewaySnakeCase___client_strands.py.template +35 -0
- package/src/py/agent/gateway-connection/files/langchain/agent-connection/app/__gatewaySnakeCase___client_langchain.py.template +34 -0
- package/src/py/agent/gateway-connection/generator.d.ts +33 -0
- package/src/py/agent/gateway-connection/generator.js +153 -0
- package/src/py/agent/gateway-connection/generator.js.map +1 -0
- package/src/py/agent/gateway-connection/schema.d.js +6 -0
- package/src/py/agent/gateway-connection/schema.d.js.map +1 -0
- package/src/py/agent/gateway-connection/schema.d.ts +13 -0
- package/src/py/agent/gateway-connection/schema.json +31 -0
- package/src/py/agent/generator.d.ts +165 -2
- package/src/py/agent/generator.js +445 -199
- package/src/py/agent/generator.js.map +1 -1
- package/src/py/agent/mcp-connection/__snapshots__/generator.spec.ts.snap +155 -92
- package/src/py/agent/mcp-connection/files/agent-connection/app/__mcpServerSnakeCase___client_strands.py.template +31 -0
- package/src/py/agent/mcp-connection/files/langchain/agent-connection/app/__mcpServerSnakeCase___client_langchain.py.template +31 -0
- package/src/py/agent/mcp-connection/generator.d.ts +24 -1
- package/src/py/agent/mcp-connection/generator.js +103 -130
- package/src/py/agent/mcp-connection/generator.js.map +1 -1
- package/src/py/agent/mcp-connection/schema.d.js +8 -0
- package/src/py/agent/mcp-connection/schema.d.js.map +1 -0
- package/src/py/agent/mcp-connection/schema.d.ts +2 -1
- package/src/py/agent/mcp-connection/schema.json +5 -0
- package/src/py/agent/react-connection/__snapshots__/generator.spec.ts.snap +17 -19
- package/src/py/agent/react-connection/generator.d.ts +152 -3
- package/src/py/agent/react-connection/generator.js +114 -65
- package/src/py/agent/react-connection/generator.js.map +1 -1
- package/src/py/agent/react-connection/{serve-local.d.ts → local-dev.d.ts} +5 -5
- package/src/py/agent/react-connection/local-dev.js +36 -0
- package/src/py/agent/react-connection/local-dev.js.map +1 -0
- package/src/py/agent/react-connection/schema.d.js +8 -0
- package/src/py/agent/react-connection/schema.d.js.map +1 -0
- package/src/py/agent/react-connection/schema.d.ts +2 -1
- package/src/py/agent/react-connection/schema.json +5 -0
- package/src/py/agent/schema.d.js +6 -0
- package/src/py/agent/schema.d.js.map +1 -0
- package/src/py/agent/schema.d.ts +6 -2
- package/src/py/agent/schema.json +15 -1
- package/src/py/api/generator.d.ts +1 -1
- package/src/py/api/generator.js +12 -11
- package/src/py/api/generator.js.map +1 -1
- package/src/py/api/schema.d.js +6 -0
- package/src/py/api/schema.d.js.map +1 -0
- package/src/py/api/schema.d.ts +2 -1
- package/src/py/api/schema.json +5 -0
- package/src/py/dynamodb/__snapshots__/generator.spec.ts.snap +1592 -0
- package/src/py/dynamodb/agent-connection/__snapshots__/generator.spec.ts.snap +63 -0
- package/src/py/dynamodb/agent-connection/generator.d.ts +10 -0
- package/src/py/dynamodb/agent-connection/generator.js +45 -0
- package/src/py/dynamodb/agent-connection/generator.js.map +1 -0
- package/src/py/dynamodb/agent-connection/schema.d.js +8 -0
- package/src/py/dynamodb/agent-connection/schema.d.js.map +1 -0
- package/src/py/dynamodb/agent-connection/schema.d.ts +15 -0
- package/src/py/dynamodb/agent-connection/schema.json +27 -0
- package/src/py/dynamodb/fast-api-connection/__snapshots__/generator.spec.ts.snap +32 -0
- package/src/py/dynamodb/fast-api-connection/generator.d.ts +10 -0
- package/src/py/dynamodb/fast-api-connection/generator.js +39 -0
- package/src/py/dynamodb/fast-api-connection/generator.js.map +1 -0
- package/src/py/dynamodb/fast-api-connection/schema.d.js +8 -0
- package/src/py/dynamodb/fast-api-connection/schema.d.js.map +1 -0
- package/src/py/dynamodb/fast-api-connection/schema.d.ts +13 -0
- package/src/py/dynamodb/fast-api-connection/schema.json +23 -0
- package/src/py/dynamodb/files/__name__/__init__.py.template +6 -0
- package/src/py/dynamodb/files/__name__/client.py.template +39 -0
- package/src/py/dynamodb/files/__name__/entities/__init__.py.template +4 -0
- package/src/py/dynamodb/files/__name__/entities/base.py.template +63 -0
- package/src/py/dynamodb/files/__name__/entities/example.py.template +64 -0
- package/src/py/dynamodb/files/config.json.template +24 -0
- package/src/py/dynamodb/generator.d.ts +39 -0
- package/src/py/dynamodb/generator.js +130 -0
- package/src/py/dynamodb/generator.js.map +1 -0
- package/src/py/dynamodb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +63 -0
- package/src/py/dynamodb/mcp-server-connection/generator.d.ts +10 -0
- package/src/py/dynamodb/mcp-server-connection/generator.js +45 -0
- package/src/py/dynamodb/mcp-server-connection/generator.js.map +1 -0
- package/src/py/dynamodb/mcp-server-connection/schema.d.js +8 -0
- package/src/py/dynamodb/mcp-server-connection/schema.d.js.map +1 -0
- package/src/py/dynamodb/mcp-server-connection/schema.d.ts +15 -0
- package/src/py/dynamodb/mcp-server-connection/schema.json +27 -0
- package/src/py/dynamodb/schema.d.js +6 -0
- package/src/py/dynamodb/schema.d.js.map +1 -0
- package/src/py/dynamodb/schema.d.ts +16 -0
- package/src/py/dynamodb/schema.json +76 -0
- package/src/py/fast-api/__snapshots__/generator.spec.ts.snap +240 -4693
- package/src/py/fast-api/__snapshots__/generator.terraform.spec.ts.snap +6661 -0
- package/src/py/fast-api/files/app/__name__/init.py.template +5 -22
- package/src/py/fast-api/files/app/__name__/main.py.template +4 -1
- package/src/py/fast-api/generator.d.ts +73 -1
- package/src/py/fast-api/generator.js +126 -92
- package/src/py/fast-api/generator.js.map +1 -1
- package/src/py/fast-api/react/__snapshots__/generator.spec.ts.snap +4 -3
- package/src/py/fast-api/react/generator.d.ts +17 -2
- package/src/py/fast-api/react/generator.js +38 -26
- package/src/py/fast-api/react/generator.js.map +1 -1
- package/src/py/fast-api/react/open-api.js +44 -33
- package/src/py/fast-api/react/open-api.js.map +1 -1
- package/src/py/fast-api/react/schema.d.js +6 -0
- package/src/py/fast-api/react/schema.d.js.map +1 -0
- package/src/py/fast-api/react/schema.d.ts +1 -0
- package/src/py/fast-api/react/schema.json +5 -0
- package/src/py/fast-api/schema.d.js +6 -0
- package/src/py/fast-api/schema.d.js.map +1 -0
- package/src/py/fast-api/schema.d.ts +2 -1
- package/src/py/fast-api/schema.json +6 -0
- package/src/py/lambda-function/__snapshots__/generator.spec.ts.snap +12 -4
- package/src/py/lambda-function/files/handler/__lambdaFunctionSnakeCase__.py.template +1 -1
- package/src/py/lambda-function/generator.d.ts +28 -1
- package/src/py/lambda-function/generator.js +88 -61
- package/src/py/lambda-function/generator.js.map +1 -1
- package/src/py/lambda-function/schema.d.js +6 -0
- package/src/py/lambda-function/schema.d.js.map +1 -0
- package/src/py/lambda-function/schema.d.ts +3 -2
- package/src/py/lambda-function/schema.json +6 -1
- package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +225 -21
- package/src/py/mcp-server/files/deploy/Dockerfile.template +15 -1
- package/src/py/mcp-server/generator.d.ts +69 -1
- package/src/py/mcp-server/generator.js +211 -137
- package/src/py/mcp-server/generator.js.map +1 -1
- package/src/py/mcp-server/schema.d.js +6 -0
- package/src/py/mcp-server/schema.d.js.map +1 -0
- package/src/py/mcp-server/schema.d.ts +2 -1
- package/src/py/mcp-server/schema.json +6 -0
- package/src/py/project/generator.d.ts +37 -2
- package/src/py/project/generator.js +246 -90
- package/src/py/project/generator.js.map +1 -1
- package/src/py/project/schema.d.js +6 -0
- package/src/py/project/schema.d.js.map +1 -0
- package/src/py/project/schema.d.ts +1 -0
- package/src/py/project/schema.json +6 -0
- package/src/py/rdb/__snapshots__/generator.spec.ts.snap +2113 -0
- package/src/py/rdb/agent-connection/__snapshots__/generator.spec.ts.snap +123 -0
- package/src/py/rdb/agent-connection/generator.d.ts +10 -0
- package/src/py/rdb/agent-connection/generator.js +52 -0
- package/src/py/rdb/agent-connection/generator.js.map +1 -0
- package/src/py/rdb/agent-connection/schema.d.js +8 -0
- package/src/py/rdb/agent-connection/schema.d.js.map +1 -0
- package/src/py/rdb/agent-connection/schema.d.ts +15 -0
- package/src/py/rdb/agent-connection/schema.json +27 -0
- package/src/py/rdb/fast-api-connection/__snapshots__/generator.spec.ts.snap +51 -0
- package/src/py/rdb/fast-api-connection/files/__apiModuleName__/dependencies/__rdbNameSnake__.py.template +14 -0
- package/src/py/rdb/fast-api-connection/generator.d.ts +10 -0
- package/src/py/rdb/fast-api-connection/generator.js +56 -0
- package/src/py/rdb/fast-api-connection/generator.js.map +1 -0
- package/src/py/rdb/fast-api-connection/schema.d.js +8 -0
- package/src/py/rdb/fast-api-connection/schema.d.js.map +1 -0
- package/src/py/rdb/fast-api-connection/schema.d.ts +13 -0
- package/src/py/rdb/fast-api-connection/schema.json +23 -0
- package/src/py/rdb/files/Dockerfile.create-db-user.template +14 -0
- package/src/py/rdb/files/Dockerfile.migration.template +14 -0
- package/src/py/rdb/files/__name__/connection.py.template +55 -0
- package/src/py/rdb/files/__name__/create_db_user_handler.py.template +97 -0
- package/src/py/rdb/files/__name__/migration_handler.py.template +36 -0
- package/src/py/rdb/files/__name__/models/__init__.py.template +3 -0
- package/src/py/rdb/files/__name__/models/example.py.template +8 -0
- package/src/py/rdb/files/__name__/utils.py.template +120 -0
- package/src/py/rdb/files/alembic.ini.template +38 -0
- package/src/py/rdb/files/migrations/env.py.template +80 -0
- package/src/py/rdb/files/migrations/script.py.mako.template +28 -0
- package/src/py/rdb/generator.d.ts +103 -0
- package/src/py/rdb/generator.js +368 -0
- package/src/py/rdb/generator.js.map +1 -0
- package/src/py/rdb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +119 -0
- package/src/py/rdb/mcp-server-connection/generator.d.ts +10 -0
- package/src/py/rdb/mcp-server-connection/generator.js +52 -0
- package/src/py/rdb/mcp-server-connection/generator.js.map +1 -0
- package/src/py/rdb/mcp-server-connection/schema.d.js +8 -0
- package/src/py/rdb/mcp-server-connection/schema.d.js.map +1 -0
- package/src/py/rdb/mcp-server-connection/schema.d.ts +15 -0
- package/src/py/rdb/mcp-server-connection/schema.json +27 -0
- package/src/py/rdb/schema.d.js +6 -0
- package/src/py/rdb/schema.d.js.map +1 -0
- package/src/py/rdb/schema.d.ts +16 -0
- package/src/py/rdb/schema.json +78 -0
- package/src/py/rdb/utils.d.ts +6 -0
- package/src/py/rdb/utils.js +16 -0
- package/src/py/rdb/utils.js.map +1 -0
- package/src/sdk/agentcore-gateway.d.ts +6 -0
- package/src/sdk/agentcore-gateway.js +7 -0
- package/src/sdk/agentcore-gateway.js.map +1 -0
- package/src/sdk/agentcore-harness.d.ts +6 -0
- package/src/sdk/agentcore-harness.js +7 -0
- package/src/sdk/agentcore-harness.js.map +1 -0
- package/src/sdk/connection.d.ts +6 -0
- package/src/sdk/connection.js +6 -0
- package/src/sdk/connection.js.map +1 -0
- package/src/sdk/license.d.ts +8 -0
- package/src/sdk/license.js +7 -0
- package/src/sdk/license.js.map +1 -0
- package/src/sdk/open-api.d.ts +12 -0
- package/src/sdk/open-api.js +9 -0
- package/src/sdk/open-api.js.map +1 -0
- package/src/sdk/py.d.ts +18 -0
- package/src/sdk/py.js +12 -0
- package/src/sdk/py.js.map +1 -0
- package/src/sdk/smithy.d.ts +6 -0
- package/src/sdk/smithy.js +7 -0
- package/src/sdk/smithy.js.map +1 -0
- package/src/sdk/terraform.d.ts +6 -0
- package/src/sdk/terraform.js +7 -0
- package/src/sdk/terraform.js.map +1 -0
- package/src/sdk/ts.d.ts +39 -0
- package/src/sdk/ts.js +41 -0
- package/src/sdk/ts.js.map +1 -0
- package/{sdk/utils/format.d.ts → src/sdk/utils/ast.d.ts} +1 -1
- package/src/sdk/utils/ast.js +6 -0
- package/src/sdk/utils/ast.js.map +1 -0
- package/src/sdk/utils/format.d.ts +5 -0
- package/src/sdk/utils/format.js +6 -0
- package/src/sdk/utils/format.js.map +1 -0
- package/{sdk → src/sdk}/utils/test.d.ts +1 -1
- package/src/sdk/utils/test.js +6 -0
- package/src/sdk/utils/test.js.map +1 -0
- package/src/smithy/project/__snapshots__/generator.spec.ts.snap +244 -226
- package/src/smithy/project/files/{smithy-build.json.template → service/smithy-build.json.template} +5 -5
- package/src/smithy/project/files/{src → service/src}/operations/echo.smithy.template +1 -0
- package/src/smithy/project/files/shapes/smithy-build.json.template +7 -0
- package/src/smithy/project/files/shapes/src/main.smithy.template +11 -0
- package/src/smithy/project/files/ssdk-bundle/ssdk.rolldown.config.mjs.template +52 -0
- package/src/smithy/project/generator.d.ts +91 -1
- package/src/smithy/project/generator.js +220 -45
- package/src/smithy/project/generator.js.map +1 -1
- package/src/smithy/project/schema.d.js +6 -0
- package/src/smithy/project/schema.d.js.map +1 -0
- package/src/smithy/project/schema.d.ts +2 -0
- package/src/smithy/project/schema.json +28 -1
- package/src/smithy/react-connection/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/smithy/react-connection/generator.d.ts +16 -1
- package/src/smithy/react-connection/generator.js +54 -48
- package/src/smithy/react-connection/generator.js.map +1 -1
- package/src/smithy/react-connection/schema.d.js +6 -0
- package/src/smithy/react-connection/schema.d.js.map +1 -0
- package/src/smithy/react-connection/schema.d.ts +1 -0
- package/src/smithy/react-connection/schema.json +5 -0
- package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +2618 -550
- package/src/smithy/ts/api/files/handler.ts.template +3 -3
- package/src/smithy/ts/api/files/local-server.ts.template +3 -3
- package/src/smithy/ts/api/files/operations/echo.ts.template +2 -2
- package/src/smithy/ts/api/files/service.ts.template +3 -3
- package/src/smithy/ts/api/generator.d.ts +89 -1
- package/src/smithy/ts/api/generator.js +185 -119
- package/src/smithy/ts/api/generator.js.map +1 -1
- package/src/smithy/ts/api/schema.d.js +6 -0
- package/src/smithy/ts/api/schema.d.js.map +1 -0
- package/src/smithy/ts/api/schema.d.ts +2 -1
- package/src/smithy/ts/api/schema.json +6 -0
- package/src/terraform/project/files/application/bootstrap/providers.tf.template +11 -0
- package/src/terraform/project/files/application/scripts/bootstrap-destroy.ts.template +111 -0
- package/src/terraform/project/files/application/scripts/bootstrap.ts.template +40 -1
- package/src/terraform/project/files/application/scripts/env.ts.template +11 -0
- package/src/terraform/project/files/application/scripts/init.ts.template +2 -1
- package/src/terraform/project/files/application/src/main.tf.template +6 -1
- package/src/terraform/project/files/application/src/providers.tf.template +9 -3
- package/src/terraform/project/files/checkov/checkov.yml.template +8 -0
- package/src/terraform/project/files/library/src/main.tf.template +9 -0
- package/src/terraform/project/generator.d.ts +62 -2
- package/src/terraform/project/generator.js +340 -117
- package/src/terraform/project/generator.js.map +1 -1
- package/src/terraform/project/schema.d.js +9 -0
- package/src/terraform/project/schema.d.js.map +1 -0
- package/src/terraform/project/schema.d.ts +1 -0
- package/src/terraform/project/schema.json +5 -0
- package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +2957 -725
- package/src/trpc/backend/files/src/client/index.ts.template +1 -1
- package/src/trpc/backend/files/src/handler.ts.template +1 -1
- package/src/trpc/backend/files/src/index.ts.template +5 -5
- package/src/trpc/backend/files/src/init.ts.template +1 -1
- package/src/trpc/backend/files/src/local-server.ts.template +1 -1
- package/src/trpc/backend/files/src/middleware/index.ts.template +7 -7
- package/src/trpc/backend/files/src/procedures/echo.ts.template +3 -3
- package/src/trpc/backend/files/src/router.ts.template +2 -2
- package/src/trpc/backend/files/src/schema/echo.ts.template +2 -2
- package/src/trpc/backend/files/src/schema/index.ts.template +1 -1
- package/src/trpc/backend/files-operations/scripts/generate-operations.ts.template +40 -0
- package/src/trpc/backend/generator.d.ts +91 -2
- package/src/trpc/backend/generator.js +186 -100
- package/src/trpc/backend/generator.js.map +1 -1
- package/src/trpc/backend/schema.d.js +6 -0
- package/src/trpc/backend/schema.d.js.map +1 -0
- package/src/trpc/backend/schema.d.ts +2 -1
- package/src/trpc/backend/schema.json +6 -0
- package/src/trpc/react/__snapshots__/generator.spec.ts.snap +4 -4
- package/src/trpc/react/files/src/components/__apiNameClassName__ClientProvider.tsx.template +3 -3
- package/src/trpc/react/generator.d.ts +39 -2
- package/src/trpc/react/generator.js +105 -63
- package/src/trpc/react/generator.js.map +1 -1
- package/src/trpc/react/schema.d.js +6 -0
- package/src/trpc/react/schema.d.js.map +1 -0
- package/src/trpc/react/schema.d.ts +1 -0
- package/src/trpc/react/schema.json +5 -0
- package/src/ts/agent/__snapshots__/generator.spec.ts.snap +1490 -31
- package/src/ts/agent/a2a-connection/__snapshots__/generator.spec.ts.snap +258 -0
- package/src/ts/agent/a2a-connection/files/agent-connection/app/__targetAgentKebabCase__-client-strands.ts.template +23 -0
- package/src/ts/agent/a2a-connection/generator.d.ts +47 -1
- package/src/ts/agent/a2a-connection/generator.js +112 -63
- package/src/ts/agent/a2a-connection/generator.js.map +1 -1
- package/src/ts/agent/a2a-connection/schema.d.js +8 -0
- package/src/ts/agent/a2a-connection/schema.d.js.map +1 -0
- package/src/ts/agent/a2a-connection/schema.d.ts +2 -1
- package/src/ts/agent/a2a-connection/schema.json +5 -0
- package/src/ts/agent/files/a2a/index.ts.template +5 -12
- package/src/ts/agent/files/ag-ui/index.ts.template +29 -14
- package/src/ts/agent/files/common/agent.ts.template +11 -2
- package/src/ts/agent/files/common/session.ts.template +43 -0
- package/src/ts/agent/files/common-express/middleware/session-id-middleware.ts.template +16 -0
- package/src/ts/agent/files/deploy/Dockerfile.template +20 -2
- package/src/ts/agent/files/http/client.ts.template +2 -2
- package/src/ts/agent/files/http/index.ts.template +2 -2
- package/src/ts/agent/files/http/router.ts.template +5 -5
- package/src/ts/agent/gateway-connection/__snapshots__/generator.spec.ts.snap +222 -0
- package/src/ts/agent/gateway-connection/files/agent-connection/app/__gatewayKebabCase__-client-strands.ts.template +30 -0
- package/src/ts/agent/gateway-connection/generator.d.ts +47 -0
- package/src/ts/agent/gateway-connection/generator.js +144 -0
- package/src/ts/agent/gateway-connection/generator.js.map +1 -0
- package/src/ts/agent/gateway-connection/schema.d.js +6 -0
- package/src/ts/agent/gateway-connection/schema.d.js.map +1 -0
- package/src/ts/agent/gateway-connection/schema.d.ts +13 -0
- package/src/ts/agent/gateway-connection/schema.json +31 -0
- package/src/ts/agent/generator.d.ts +206 -1
- package/src/ts/agent/generator.js +342 -159
- package/src/ts/agent/generator.js.map +1 -1
- package/src/ts/agent/mcp-connection/__snapshots__/generator.spec.ts.snap +194 -114
- package/src/ts/agent/mcp-connection/files/agent-connection/app/__mcpServerKebabCase__-client-strands.ts.template +23 -0
- package/src/ts/agent/mcp-connection/generator.d.ts +38 -1
- package/src/ts/agent/mcp-connection/generator.js +88 -65
- package/src/ts/agent/mcp-connection/generator.js.map +1 -1
- package/src/ts/agent/mcp-connection/schema.d.js +8 -0
- package/src/ts/agent/mcp-connection/schema.d.js.map +1 -0
- package/src/ts/agent/mcp-connection/schema.d.ts +2 -1
- package/src/ts/agent/mcp-connection/schema.json +5 -0
- package/src/ts/agent/react-connection/__snapshots__/generator.spec.ts.snap +8 -4
- package/src/ts/agent/react-connection/files/src/components/__agentNameClassName__AgentClientProvider.tsx.template +2 -1
- package/src/ts/agent/react-connection/generator.d.ts +204 -3
- package/src/ts/agent/react-connection/generator.js +158 -99
- package/src/ts/agent/react-connection/generator.js.map +1 -1
- package/src/ts/agent/react-connection/local-dev.d.ts +13 -0
- package/src/ts/agent/react-connection/local-dev.js +17 -0
- package/src/ts/agent/react-connection/local-dev.js.map +1 -0
- package/src/ts/agent/react-connection/schema.d.js +8 -0
- package/src/ts/agent/react-connection/schema.d.js.map +1 -0
- package/src/ts/agent/react-connection/schema.d.ts +2 -1
- package/src/ts/agent/react-connection/schema.json +5 -0
- package/src/ts/agent/schema.d.js +6 -0
- package/src/ts/agent/schema.d.js.map +1 -0
- package/src/ts/agent/schema.d.ts +5 -1
- package/src/ts/agent/schema.json +14 -0
- package/src/ts/api/generator.d.ts +1 -1
- package/src/ts/api/generator.js +16 -16
- package/src/ts/api/generator.js.map +1 -1
- package/src/ts/api/schema.d.js +6 -0
- package/src/ts/api/schema.d.js.map +1 -0
- package/src/ts/api/schema.d.ts +2 -1
- package/src/ts/api/schema.json +5 -0
- package/src/ts/astro-docs/__snapshots__/generator.spec.ts.snap +22 -8
- package/src/ts/astro-docs/files/base/src/content/docs/en/index.mdx.template +2 -2
- package/src/ts/astro-docs/files/base/src/content.config.ts.template +4 -4
- package/src/ts/astro-docs/files/translation/scripts/translate.ts.template +272 -150
- package/src/ts/astro-docs/generator.d.ts +41 -1
- package/src/ts/astro-docs/generator.js +133 -59
- package/src/ts/astro-docs/generator.js.map +1 -1
- package/src/ts/astro-docs/schema.d.js +6 -0
- package/src/ts/astro-docs/schema.d.js.map +1 -0
- package/src/ts/astro-docs/schema.d.ts +2 -2
- package/src/ts/astro-docs/schema.json +3 -3
- package/src/ts/dcr-proxy/__snapshots__/generator.spec.ts.snap +986 -0
- package/src/ts/dcr-proxy/generator.d.ts +34 -0
- package/src/ts/dcr-proxy/generator.js +115 -0
- package/src/ts/dcr-proxy/generator.js.map +1 -0
- package/src/ts/dcr-proxy/schema.d.js +6 -0
- package/src/ts/dcr-proxy/schema.d.js.map +1 -0
- package/src/ts/dcr-proxy/schema.d.ts +13 -0
- package/src/ts/dcr-proxy/schema.json +44 -0
- package/src/ts/docs/generator.d.ts +1 -1
- package/src/ts/docs/generator.js +10 -10
- package/src/ts/docs/generator.js.map +1 -1
- package/src/ts/docs/schema.d.js +6 -0
- package/src/ts/docs/schema.d.js.map +1 -0
- package/src/ts/docs/schema.d.ts +1 -4
- package/src/ts/docs/schema.json +3 -3
- package/src/ts/dynamodb/__snapshots__/generator.spec.ts.snap +481 -527
- package/src/ts/dynamodb/agent-connection/__snapshots__/generator.spec.ts.snap +23 -5
- package/src/ts/dynamodb/agent-connection/generator.d.ts +1 -1
- package/src/ts/dynamodb/agent-connection/generator.js +27 -23
- package/src/ts/dynamodb/agent-connection/generator.js.map +1 -1
- package/src/ts/dynamodb/agent-connection/schema.d.js +8 -0
- package/src/ts/dynamodb/agent-connection/schema.d.js.map +1 -0
- package/src/ts/dynamodb/agent-connection/schema.d.ts +2 -1
- package/src/ts/dynamodb/agent-connection/schema.json +5 -0
- package/src/ts/dynamodb/files/config.json.template +24 -0
- package/src/ts/dynamodb/files/src/client.ts.template +30 -11
- package/src/ts/dynamodb/files/src/entities/example.ts.template +1 -1
- package/src/ts/dynamodb/files/src/entities/index.ts.template +1 -1
- package/src/ts/dynamodb/files/src/index.ts.template +2 -11
- package/src/ts/dynamodb/generator.d.ts +42 -1
- package/src/ts/dynamodb/generator.js +110 -64
- package/src/ts/dynamodb/generator.js.map +1 -1
- package/src/ts/dynamodb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +23 -5
- package/src/ts/dynamodb/mcp-server-connection/generator.d.ts +1 -1
- package/src/ts/dynamodb/mcp-server-connection/generator.js +27 -23
- package/src/ts/dynamodb/mcp-server-connection/generator.js.map +1 -1
- package/src/ts/dynamodb/mcp-server-connection/schema.d.js +8 -0
- package/src/ts/dynamodb/mcp-server-connection/schema.d.js.map +1 -0
- package/src/ts/dynamodb/mcp-server-connection/schema.d.ts +2 -1
- package/src/ts/dynamodb/mcp-server-connection/schema.json +5 -0
- package/src/ts/dynamodb/schema.d.js +6 -0
- package/src/ts/dynamodb/schema.d.js.map +1 -0
- package/src/ts/dynamodb/schema.d.ts +3 -1
- package/src/ts/dynamodb/schema.json +26 -2
- package/src/ts/dynamodb/smithy-connection/__snapshots__/generator.spec.ts.snap +12 -3
- package/src/ts/dynamodb/smithy-connection/generator.d.ts +1 -1
- package/src/ts/dynamodb/smithy-connection/generator.js +22 -22
- package/src/ts/dynamodb/smithy-connection/generator.js.map +1 -1
- package/src/ts/dynamodb/smithy-connection/schema.d.js +8 -0
- package/src/ts/dynamodb/smithy-connection/schema.d.js.map +1 -0
- package/src/ts/dynamodb/smithy-connection/schema.d.ts +1 -0
- package/src/ts/dynamodb/smithy-connection/schema.json +5 -0
- package/src/ts/dynamodb/trpc-connection/__snapshots__/generator.spec.ts.snap +12 -3
- package/src/ts/dynamodb/trpc-connection/generator.d.ts +1 -1
- package/src/ts/dynamodb/trpc-connection/generator.js +22 -22
- package/src/ts/dynamodb/trpc-connection/generator.js.map +1 -1
- package/src/ts/dynamodb/trpc-connection/schema.d.js +8 -0
- package/src/ts/dynamodb/trpc-connection/schema.d.js.map +1 -0
- package/src/ts/dynamodb/trpc-connection/schema.d.ts +1 -0
- package/src/ts/dynamodb/trpc-connection/schema.json +5 -0
- package/src/ts/lambda-function/__snapshots__/generator.spec.ts.snap +19 -9
- package/src/ts/lambda-function/files/handler/__lambdaFunctionKebabCase__.ts.template +2 -1
- package/src/ts/lambda-function/generator.d.ts +39 -1
- package/src/ts/lambda-function/generator.js +98 -65
- package/src/ts/lambda-function/generator.js.map +1 -1
- package/src/ts/lambda-function/io.js +83 -52
- package/src/ts/lambda-function/io.js.map +1 -1
- package/src/ts/lambda-function/schema.d.js +6 -0
- package/src/ts/lambda-function/schema.d.js.map +1 -0
- package/src/ts/lambda-function/schema.d.ts +2 -1
- package/src/ts/lambda-function/schema.json +5 -0
- package/src/ts/lib/__snapshots__/generator.spec.ts.snap +83 -36
- package/src/ts/lib/__snapshots__/vitest.spec.ts.snap +2 -2
- package/src/ts/lib/biome.d.ts +1 -1
- package/src/ts/lib/biome.js +71 -38
- package/src/ts/lib/biome.js.map +1 -1
- package/src/ts/lib/generator.d.ts +24 -1
- package/src/ts/lib/generator.js +128 -94
- package/src/ts/lib/generator.js.map +1 -1
- package/src/ts/lib/grit/vitest-pass-with-no-tests.grit +1 -4
- package/src/ts/lib/schema.d.js +6 -0
- package/src/ts/lib/schema.d.js.map +1 -0
- package/src/ts/lib/schema.d.ts +1 -1
- package/src/ts/lib/schema.json +5 -0
- package/src/ts/lib/ts-project-utils.d.ts +4 -2
- package/src/ts/lib/ts-project-utils.js +85 -74
- package/src/ts/lib/ts-project-utils.js.map +1 -1
- package/src/ts/lib/types.d.ts +6 -0
- package/src/ts/lib/types.js +5 -2
- package/src/ts/lib/types.js.map +1 -1
- package/src/ts/lib/vitest.d.ts +22 -2
- package/src/ts/lib/vitest.js +83 -26
- package/src/ts/lib/vitest.js.map +1 -1
- package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +225 -44
- package/src/ts/mcp-server/files/Dockerfile.template +20 -2
- package/src/ts/mcp-server/generator.d.ts +111 -1
- package/src/ts/mcp-server/generator.js +234 -168
- package/src/ts/mcp-server/generator.js.map +1 -1
- package/src/ts/mcp-server/schema.d.js +6 -0
- package/src/ts/mcp-server/schema.d.js.map +1 -0
- package/src/ts/mcp-server/schema.d.ts +2 -1
- package/src/ts/mcp-server/schema.json +6 -0
- package/src/ts/nx-generator/__snapshots__/generator.spec.ts.snap +28 -13
- package/src/ts/nx-generator/files/common/schema.d.ts.template +1 -0
- package/src/ts/nx-generator/files/common/schema.json.template +5 -0
- package/src/ts/nx-generator/files/local/generator.spec.ts.template +1 -1
- package/src/ts/nx-generator/files/local/generator.ts.template +3 -3
- package/src/ts/nx-generator/files/nx-plugin-for-aws/generator/generator.ts.template +6 -7
- package/src/ts/nx-generator/generator.d.ts +3 -0
- package/src/ts/nx-generator/generator.js +122 -75
- package/src/ts/nx-generator/generator.js.map +1 -1
- package/src/ts/nx-generator/schema.d.js +6 -0
- package/src/ts/nx-generator/schema.d.js.map +1 -0
- package/src/ts/nx-generator/schema.d.ts +1 -0
- package/src/ts/nx-generator/schema.json +5 -0
- package/src/ts/nx-migration/files/migration.spec.ts.template +26 -0
- package/src/ts/nx-migration/files/migration.ts.template +65 -0
- package/src/ts/nx-migration/files/prompt.md.template +46 -0
- package/src/ts/nx-migration/generator.d.ts +27 -0
- package/src/ts/nx-migration/generator.js +147 -0
- package/src/ts/nx-migration/generator.js.map +1 -0
- package/src/ts/nx-migration/schema.d.js +6 -0
- package/src/ts/nx-migration/schema.d.js.map +1 -0
- package/src/ts/nx-migration/schema.d.ts +13 -0
- package/src/ts/nx-migration/schema.json +63 -0
- package/src/ts/nx-plugin/__snapshots__/generator.spec.ts.snap +36 -25
- package/src/ts/nx-plugin/files/mcp-server/resources/GENERAL_GUIDANCE.md.template +5 -6
- package/src/ts/nx-plugin/files/mcp-server/server.ts.template +5 -5
- package/src/ts/nx-plugin/files/mcp-server/tools/create-workspace-command.ts.template +2 -2
- package/src/ts/nx-plugin/files/mcp-server/tools/general-guidance.ts.template +1 -1
- package/src/ts/nx-plugin/files/mcp-server/tools/generator-guide.ts.template +2 -2
- package/src/ts/nx-plugin/files/mcp-server/tools/list-generators.ts.template +2 -2
- package/src/ts/nx-plugin/files/mcp-server/utils.ts.template +4 -4
- package/src/ts/nx-plugin/generator.d.ts +4 -1
- package/src/ts/nx-plugin/generator.js +64 -48
- package/src/ts/nx-plugin/generator.js.map +1 -1
- package/src/ts/nx-plugin/schema.d.js +9 -0
- package/src/ts/nx-plugin/schema.d.js.map +1 -0
- package/src/ts/nx-plugin/schema.json +5 -0
- package/src/ts/nx-plugin/utils.d.ts +27 -2
- package/src/ts/nx-plugin/utils.js +66 -57
- package/src/ts/nx-plugin/utils.js.map +1 -1
- package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +711 -877
- package/src/ts/rdb/agent-connection/__snapshots__/generator.spec.ts.snap +16 -6
- package/src/ts/rdb/agent-connection/generator.d.ts +1 -1
- package/src/ts/rdb/agent-connection/generator.js +44 -39
- package/src/ts/rdb/agent-connection/generator.js.map +1 -1
- package/src/ts/rdb/agent-connection/schema.d.js +8 -0
- package/src/ts/rdb/agent-connection/schema.d.js.map +1 -0
- package/src/ts/rdb/agent-connection/schema.d.ts +2 -1
- package/src/ts/rdb/agent-connection/schema.json +5 -0
- package/src/ts/rdb/files/Dockerfile.template +19 -1
- package/src/ts/rdb/files/prisma.config.ts.template +6 -5
- package/src/ts/rdb/files/src/create-db-user-handler.ts.template +9 -11
- package/src/ts/rdb/files/src/migration-handler.ts.template +5 -30
- package/src/ts/rdb/files/src/prisma.ts.template +33 -25
- package/src/ts/rdb/files/src/utils.ts.template +31 -1
- package/src/ts/rdb/generator.d.ts +118 -5
- package/src/ts/rdb/generator.js +272 -127
- package/src/ts/rdb/generator.js.map +1 -1
- package/src/ts/rdb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +16 -6
- package/src/ts/rdb/mcp-server-connection/generator.d.ts +1 -1
- package/src/ts/rdb/mcp-server-connection/generator.js +42 -37
- package/src/ts/rdb/mcp-server-connection/generator.js.map +1 -1
- package/src/ts/rdb/mcp-server-connection/schema.d.js +8 -0
- package/src/ts/rdb/mcp-server-connection/schema.d.js.map +1 -0
- package/src/ts/rdb/mcp-server-connection/schema.d.ts +2 -1
- package/src/ts/rdb/mcp-server-connection/schema.json +5 -0
- package/src/ts/rdb/schema.d.js +6 -0
- package/src/ts/rdb/schema.d.js.map +1 -0
- package/src/ts/rdb/schema.d.ts +2 -1
- package/src/ts/rdb/schema.json +7 -1
- package/src/ts/rdb/smithy-connection/__snapshots__/generator.spec.ts.snap +18 -9
- package/src/ts/rdb/smithy-connection/generator.d.ts +1 -1
- package/src/ts/rdb/smithy-connection/generator.js +48 -43
- package/src/ts/rdb/smithy-connection/generator.js.map +1 -1
- package/src/ts/rdb/smithy-connection/schema.d.js +8 -0
- package/src/ts/rdb/smithy-connection/schema.d.js.map +1 -0
- package/src/ts/rdb/smithy-connection/schema.d.ts +1 -0
- package/src/ts/rdb/smithy-connection/schema.json +5 -0
- package/src/ts/rdb/trpc-connection/__snapshots__/generator.spec.ts.snap +12 -3
- package/src/ts/rdb/trpc-connection/generator.d.ts +1 -1
- package/src/ts/rdb/trpc-connection/generator.js +37 -31
- package/src/ts/rdb/trpc-connection/generator.js.map +1 -1
- package/src/ts/rdb/trpc-connection/schema.d.js +8 -0
- package/src/ts/rdb/trpc-connection/schema.d.js.map +1 -0
- package/src/ts/rdb/trpc-connection/schema.d.ts +1 -0
- package/src/ts/rdb/trpc-connection/schema.json +5 -0
- package/src/ts/rdb/utils.js +9 -11
- package/src/ts/rdb/utils.js.map +1 -1
- package/src/ts/react-website/agui/files/common/src/hooks/useAgui__agentNameClassName__.tsx.template +17 -16
- package/src/ts/react-website/agui/generator.d.ts +97 -0
- package/src/ts/react-website/agui/generator.js +114 -67
- package/src/ts/react-website/agui/generator.js.map +1 -1
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +1705 -717
- package/src/ts/react-website/app/files/app/common/README.md.template +1 -1
- package/src/ts/react-website/app/generator.d.ts +146 -3
- package/src/ts/react-website/app/generator.js +363 -209
- package/src/ts/react-website/app/generator.js.map +1 -1
- package/src/ts/react-website/app/schema.d.js +6 -0
- package/src/ts/react-website/app/schema.d.js.map +1 -0
- package/src/ts/react-website/app/schema.d.ts +3 -3
- package/src/ts/react-website/app/schema.json +12 -6
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.spec.ts.snap +225 -31
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +78 -12
- package/src/ts/react-website/cognito-auth/files/app/components/CognitoAuth/index.tsx.template +2 -2
- package/src/ts/react-website/cognito-auth/generator.d.ts +26 -2
- package/src/ts/react-website/cognito-auth/generator.js +79 -61
- package/src/ts/react-website/cognito-auth/generator.js.map +1 -1
- package/src/ts/react-website/cognito-auth/schema.d.js +6 -0
- package/src/ts/react-website/cognito-auth/schema.d.js.map +1 -0
- package/src/ts/react-website/cognito-auth/schema.d.ts +2 -1
- package/src/ts/react-website/cognito-auth/schema.json +5 -0
- package/src/ts/react-website/cognito-auth/utils.js +34 -32
- package/src/ts/react-website/cognito-auth/utils.js.map +1 -1
- package/src/ts/react-website/runtime-config/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/react-website/runtime-config/files/app/components/RuntimeConfig/index.tsx.template +2 -2
- package/src/ts/react-website/runtime-config/generator.d.ts +1 -1
- package/src/ts/react-website/runtime-config/generator.js +29 -31
- package/src/ts/react-website/runtime-config/generator.js.map +1 -1
- package/src/ts/react-website/runtime-config/schema.d.js +6 -0
- package/src/ts/react-website/runtime-config/schema.d.js.map +1 -0
- package/src/ts/react-website/runtime-config/schema.d.ts +1 -0
- package/src/ts/react-website/runtime-config/schema.json +5 -0
- package/src/ts/sync/generator.d.ts +1 -1
- package/src/ts/sync/generator.js +154 -60
- package/src/ts/sync/generator.js.map +1 -1
- package/src/ts/website/app/generator.d.ts +1 -1
- package/src/ts/website/app/generator.js +10 -10
- package/src/ts/website/app/generator.js.map +1 -1
- package/src/ts/website/app/schema.d.js +6 -0
- package/src/ts/website/app/schema.d.js.map +1 -0
- package/src/ts/website/app/schema.d.ts +3 -3
- package/src/ts/website/app/schema.json +11 -6
- package/src/ts/website/auth/generator.d.ts +2 -2
- package/src/ts/website/auth/generator.js +11 -10
- package/src/ts/website/auth/generator.js.map +1 -1
- package/src/ts/website/auth/schema.d.js +6 -0
- package/src/ts/website/auth/schema.d.js.map +1 -0
- package/src/ts/website/auth/schema.d.ts +2 -1
- package/src/ts/website/auth/schema.json +5 -0
- package/src/utils/__snapshots__/shared-constructs.spec.ts.snap +21 -0
- package/src/utils/add-dependencies.d.ts +38 -0
- package/src/utils/add-dependencies.js +83 -0
- package/src/utils/add-dependencies.js.map +1 -0
- package/src/utils/agent-chat/agent-chat.d.ts +31 -0
- package/src/utils/agent-chat/agent-chat.js +31 -0
- package/src/utils/agent-chat/agent-chat.js.map +1 -0
- package/src/utils/agent-chat/files/a2a/chat.ts.template +33 -0
- package/src/utils/agent-chat/files/ag-ui/chat.ts.template +17 -0
- package/src/utils/agent-chat/files/common/agentcore.ts.template +81 -0
- package/src/utils/agent-chat/files/http-py/chat.ts.template +43 -0
- package/src/utils/agent-chat/files/http-ts/chat.ts.template +54 -0
- package/src/utils/agent-connection/agent-connection.d.ts +149 -26
- package/src/utils/agent-connection/agent-connection.js +510 -108
- package/src/utils/agent-connection/agent-connection.js.map +1 -1
- package/src/utils/agent-connection/files/core-a2a/agentcore-a2a-client-config.ts.template +93 -0
- package/src/utils/agent-connection/files/core-auth/agentcore-endpoints.ts.template +37 -0
- package/src/utils/agent-connection/files/core-auth/agentcore-fetch.ts.template +54 -0
- package/src/utils/agent-connection/files/core-gateway/agentcore-gateway-mcp-transport.ts.template +41 -0
- package/src/utils/agent-connection/files/core-mcp/agentcore-mcp-transport.ts.template +70 -0
- package/src/utils/agent-connection/files/core-runtime-config/runtime-config.ts.template +35 -33
- package/src/utils/agent-connection/files/core-shared/agentcore-transport.ts.template +39 -0
- package/src/utils/agent-connection/files/core-strands/a2a/agentcore-a2a-client-strands.ts.template +61 -0
- package/src/utils/agent-connection/files/{core-runtime-config/model-errors.ts.template → core-strands/base/model-errors-strands.ts.template} +26 -15
- package/src/utils/agent-connection/files/core-strands/base/tool-errors-strands.ts.template +29 -0
- package/src/utils/agent-connection/files/{core-runtime-config/with-session-id.ts.template → core-strands/base/with-session-id-strands.ts.template} +1 -1
- package/src/utils/agent-connection/files/core-strands/gateway/agentcore-gateway-mcp-client-strands.ts.template +26 -0
- package/src/utils/agent-connection/files/core-strands/mcp/agentcore-mcp-client-strands.ts.template +27 -0
- package/src/utils/agent-connection/files/py-core-a2a/agentcore_a2a_client_config.py.template +43 -0
- package/src/utils/agent-connection/files/py-core-auth/agentcore_endpoints.py.template +47 -0
- package/src/utils/agent-connection/files/py-core-auth/auth/session.py.template +51 -0
- package/src/utils/agent-connection/files/py-core-gateway/agentcore_gateway_mcp_transport.py.template +28 -0
- package/src/utils/agent-connection/files/py-core-langchain/a2a/agentcore_a2a_client_langchain.py.template +105 -0
- package/src/utils/agent-connection/files/py-core-langchain/gateway/agentcore_gateway_mcp_client_langchain.py.template +57 -0
- package/src/utils/agent-connection/files/py-core-langchain/mcp/agentcore_mcp_client_langchain.py.template +64 -0
- package/src/utils/agent-connection/files/py-core-langchain/s3/s3_checkpoint_saver_langchain.py.template +360 -0
- package/src/utils/agent-connection/files/py-core-mcp/agentcore_mcp_transport.py.template +34 -0
- package/src/utils/agent-connection/files/py-core-runtime-config/runtime_config.py.template +4 -18
- package/src/utils/agent-connection/files/py-core-runtime-config/session_context.py.template +2 -2
- package/src/utils/agent-connection/files/py-core-shared/agentcore_transport.py.template +40 -0
- package/src/utils/agent-connection/files/py-core-strands/a2a/agentcore_a2a_client_strands.py.template +111 -0
- package/src/utils/agent-connection/files/py-core-strands/base/tool_errors_strands.py.template +24 -0
- package/src/utils/agent-connection/files/{py-core-runtime-config/with_session_id.py.template → py-core-strands/base/with_session_id_strands.py.template} +2 -2
- package/src/utils/agent-connection/files/py-core-strands/gateway/agentcore_gateway_mcp_client_strands.py.template +22 -0
- package/src/utils/agent-connection/files/py-core-strands/mcp/agentcore_mcp_client_strands.py.template +30 -0
- package/src/utils/agent-core-constructs/agent-core-constructs.d.ts +88 -2
- package/src/utils/agent-core-constructs/agent-core-constructs.js +227 -30
- package/src/utils/agent-core-constructs/agent-core-constructs.js.map +1 -1
- package/src/utils/agent-core-constructs/files/cdk/app/agent-core/__nameKebabCase__/__nameKebabCase__.ts.template +273 -9
- package/src/utils/agent-core-constructs/files/cdk/app/agentcore-gateway/__nameKebabCase__/__nameKebabCase__.ts.template +87 -0
- package/src/utils/agent-core-constructs/files/cdk/app/agentcore-harness/__nameKebabCase__/__nameKebabCase__.ts.template +404 -0
- package/src/utils/agent-core-constructs/files/cdk/core/agentcore-gateway/agentcore-gateway.ts.template +624 -0
- package/src/utils/agent-core-constructs/files/cdk/core/agentcore-gateway/readiness-probe/index.js.template +55 -0
- package/src/utils/agent-core-constructs/files/terraform/app/agent-core/__nameKebabCase__/__nameKebabCase__.tf.template +288 -1
- package/src/utils/agent-core-constructs/files/terraform/app/agentcore-gateway/__nameKebabCase__/__nameKebabCase__.tf.template +576 -0
- package/src/utils/agent-core-constructs/files/terraform/app/agentcore-gateway/__nameKebabCase__/render-cedar.cjs.template +13 -0
- package/src/utils/agent-core-constructs/files/terraform/app/agentcore-harness/__nameKebabCase__/__nameKebabCase__.tf.template +516 -0
- package/src/utils/agent-core-constructs/files/terraform/core/agent-core/runtime.tf.template +163 -13
- package/src/utils/agent-core-constructs/files/terraform/core/agentcore-gateway/gateway.tf.template +14 -0
- package/src/utils/api-constructs/api-constructs.d.ts +31 -3
- package/src/utils/api-constructs/api-constructs.js +96 -32
- package/src/utils/api-constructs/api-constructs.js.map +1 -1
- package/src/utils/api-constructs/files/cdk/app/apis/http/__apiNameKebabCase__.ts.template +24 -19
- package/src/utils/api-constructs/files/cdk/app/apis/rest/__apiNameKebabCase__.ts.template +28 -20
- package/src/utils/api-constructs/files/cdk/core/api/http/http-api.ts.template +26 -9
- package/src/utils/api-constructs/files/cdk/core/api/rest/api-gateway-account/index.js.template +70 -0
- package/src/utils/api-constructs/files/cdk/core/api/rest/api-gateway-account.ts.template +82 -0
- package/src/utils/api-constructs/files/cdk/core/api/rest/rest-api.ts.template +56 -17
- package/src/utils/api-constructs/files/cdk/core/api/trpc/trpc-utils.ts.template +1 -1
- package/src/utils/api-constructs/files/cdk/core/api/utils/utils.ts.template +61 -7
- package/src/utils/api-constructs/files/terraform/app/apis/http/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +356 -19
- package/src/utils/api-constructs/files/terraform/app/apis/rest/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +635 -14
- package/src/utils/api-constructs/files/terraform/core/api/http/http-api/http-api.tf.template +1 -1
- package/src/utils/api-constructs/files/terraform/core/api/rest/api-gateway-account/api-gateway-account.tf.template +83 -0
- package/src/utils/api-constructs/files/terraform/core/api/rest/rest-api/rest-api.tf.template +65 -18
- package/src/utils/api-constructs/open-api-metadata.d.ts +21 -4
- package/src/utils/api-constructs/open-api-metadata.js +74 -39
- package/src/utils/api-constructs/open-api-metadata.js.map +1 -1
- package/src/utils/api-constructs/trpc-operations-metadata.d.ts +21 -0
- package/src/utils/api-constructs/trpc-operations-metadata.js +61 -0
- package/src/utils/api-constructs/trpc-operations-metadata.js.map +1 -0
- package/src/utils/ast/website.js +17 -19
- package/src/utils/ast/website.js.map +1 -1
- package/src/utils/ast.d.ts +47 -0
- package/src/utils/ast.js +185 -96
- package/src/utils/ast.js.map +1 -1
- package/src/utils/base-tsconfig.d.ts +30 -0
- package/src/utils/base-tsconfig.js +32 -0
- package/src/utils/base-tsconfig.js.map +1 -0
- package/src/utils/bundle/bundle.d.ts +6 -1
- package/src/utils/bundle/bundle.js +70 -48
- package/src/utils/bundle/bundle.js.map +1 -1
- package/src/utils/commands.d.ts +14 -3
- package/src/utils/commands.js +83 -28
- package/src/utils/commands.js.map +1 -1
- package/src/utils/config/index.d.ts +22 -6
- package/src/utils/config/index.js +5 -4
- package/src/utils/config/index.js.map +1 -1
- package/src/utils/config/utils.d.ts +9 -3
- package/src/utils/config/utils.js +56 -59
- package/src/utils/config/utils.js.map +1 -1
- package/src/utils/connection/open-api/files/components/__apiNameClassName__Provider.tsx.template +16 -3
- package/src/utils/connection/open-api/react.d.ts +31 -5
- package/src/utils/connection/open-api/react.js +106 -86
- package/src/utils/connection/open-api/react.js.map +1 -1
- package/src/utils/containers.js +22 -23
- package/src/utils/containers.js.map +1 -1
- package/src/utils/dcr-proxy-constructs/dcr-proxy-constructs.d.ts +38 -0
- package/src/utils/dcr-proxy-constructs/dcr-proxy-constructs.js +95 -0
- package/src/utils/dcr-proxy-constructs/dcr-proxy-constructs.js.map +1 -0
- package/src/utils/dcr-proxy-constructs/files/cdk/app/dcr-proxies/__nameKebabCase__/__nameKebabCase__.ts.template +227 -0
- package/src/utils/dcr-proxy-constructs/files/project/src/handlers/authorization-server-metadata.ts.template +39 -0
- package/src/utils/dcr-proxy-constructs/files/project/src/handlers/authorize.ts.template +26 -0
- package/src/utils/dcr-proxy-constructs/files/project/src/handlers/mcp-proxy.ts.template +89 -0
- package/src/utils/dcr-proxy-constructs/files/project/src/handlers/protected-resource-metadata.ts.template +13 -0
- package/src/utils/dcr-proxy-constructs/files/project/src/handlers/register.ts.template +70 -0
- package/src/utils/dcr-proxy-constructs/files/project/src/handlers/token.ts.template +75 -0
- package/src/utils/dcr-proxy-constructs/files/terraform/app/dcr-proxies/__nameKebabCase__/__nameKebabCase__.tf.template +414 -0
- package/src/utils/declared-dependencies.d.ts +140 -0
- package/src/utils/declared-dependencies.js +64 -0
- package/src/utils/declared-dependencies.js.map +1 -0
- package/src/utils/dependencies.d.ts +18 -0
- package/src/utils/dependencies.js +206 -0
- package/src/utils/dependencies.js.map +1 -0
- package/src/utils/docker.d.ts +101 -0
- package/src/utils/docker.js +135 -0
- package/src/utils/docker.js.map +1 -0
- package/src/utils/dynamodb-constructs/dynamodb-constructs.d.ts +2 -2
- package/src/utils/dynamodb-constructs/dynamodb-constructs.js +39 -33
- package/src/utils/dynamodb-constructs/dynamodb-constructs.js.map +1 -1
- package/src/utils/dynamodb-constructs/files/cdk/app/dynamodb/__nameKebabCase__.ts.template +18 -5
- package/src/utils/dynamodb-constructs/files/cdk/core/dynamodb.ts.template +24 -4
- package/src/utils/dynamodb-constructs/files/terraform/app/dynamodb/__nameKebabCase__/__nameKebabCase__.tf.template +66 -18
- package/src/utils/dynamodb-constructs/files/terraform/core/dynamodb/dynamodb.tf.template +46 -6
- package/src/utils/files/common/constructs/src/core/cloudfront.ts.template +14 -0
- package/src/utils/files/common/constructs/src/core/index.ts.template +5 -4
- package/src/utils/files/common/constructs/src/index.ts.template +2 -2
- package/src/utils/files/common/infra-config/src/index.ts.template +3 -3
- package/src/utils/files/common/infra-config/src/resolve-stage.ts.template +2 -2
- package/src/utils/files/common/infra-config/src/stages.config.ts.template +1 -1
- package/src/{ts/dynamodb/files/scripts → utils/files/common/scripts/src/dynamodb}/create-local-table.ts.template +65 -31
- package/src/utils/files/common/scripts/src/dynamodb/pull-image.ts.template +13 -0
- package/src/{ts/dynamodb/files/scripts → utils/files/common/scripts/src/dynamodb}/start-container.ts.template +29 -22
- package/src/utils/files/common/scripts/src/infra/infra-deploy.ts.template +2 -0
- package/src/utils/files/common/scripts/src/infra/infra-destroy.ts.template +2 -0
- package/src/utils/files/common/scripts/src/infra/stage-credentials/cdk-command.ts.template +25 -0
- package/src/utils/files/common/scripts/src/{stage-credentials → infra/stage-credentials}/run.ts.template +3 -3
- package/src/utils/files/common/scripts/src/rdb/mysql/wait-for-mysql-db.ts.template +32 -0
- package/src/utils/files/common/scripts/src/rdb/postgres/wait-for-postgres-db.ts.template +32 -0
- package/src/utils/files/common/scripts/src/rdb/shared/pull-image.ts.template +16 -0
- package/src/utils/files/common/scripts/src/rdb/shared/start-container.ts.template +100 -0
- package/src/utils/files/common/shadcn/readme/README.md.template +3 -3
- package/src/utils/files/common/shadcn/src/index.ts.template +2 -2
- package/src/utils/files/shadcn/components.json.template +1 -1
- package/src/utils/files/terraform/src/core/asset-bucket/asset-bucket.tf.template +63 -72
- package/src/utils/files/terraform/src/core/runtime-config/appconfig/appconfig.tf.template +3 -3
- package/src/utils/files/terraform/src/core/runtime-config/appconfig-deployment/appconfig-deployment.tf.template +13 -7
- package/src/utils/files/terraform/src/core/runtime-config/entry/entry.tf.template +1 -1
- package/src/utils/files/terraform/src/core/runtime-config/read/read.tf.template +9 -4
- package/src/utils/files/terraform/src/metrics/providers.tf.template +12 -0
- package/src/utils/files/website/hooks/sigv4/useSigV4.tsx.template +1 -1
- package/src/utils/format.d.ts +44 -4
- package/src/utils/format.js +323 -198
- package/src/utils/format.js.map +1 -1
- package/src/utils/fs.d.ts +24 -5
- package/src/utils/fs.js +40 -15
- package/src/utils/fs.js.map +1 -1
- package/src/utils/function-constructs/files/cdk/app/lambda-functions/__nameKebabCase__.ts.template +1 -1
- package/src/utils/function-constructs/files/terraform/app/lambda-functions/__nameKebabCase__/__nameKebabCase__.tf.template +6 -2
- package/src/utils/function-constructs/function-constructs.d.ts +1 -1
- package/src/utils/function-constructs/function-constructs.js +24 -27
- package/src/utils/function-constructs/function-constructs.js.map +1 -1
- package/src/utils/generators.d.ts +33 -0
- package/src/utils/generators.js +33 -20
- package/src/utils/generators.js.map +1 -1
- package/src/utils/git.js +19 -34
- package/src/utils/git.js.map +1 -1
- package/src/utils/iac-providers.js +5 -5
- package/src/utils/iac-providers.js.map +1 -1
- package/src/utils/iac.d.ts +2 -2
- package/src/utils/iac.js +12 -14
- package/src/utils/iac.js.map +1 -1
- package/src/utils/identity-constructs/files/cdk/core/user-identity.ts.template +218 -30
- package/src/utils/identity-constructs/files/terraform/core/user-identity/add-callback-url/add-callback-url.tf.template +32 -9
- package/src/utils/identity-constructs/files/terraform/core/user-identity/identity/identity.tf.template +226 -25
- package/src/utils/identity-constructs/files/terraform/core/user-identity/main.tf.template +33 -0
- package/src/utils/identity-constructs/identity-constructs.d.ts +11 -1
- package/src/utils/identity-constructs/identity-constructs.js +52 -31
- package/src/utils/identity-constructs/identity-constructs.js.map +1 -1
- package/src/utils/init.d.ts +73 -0
- package/src/utils/init.js +300 -0
- package/src/utils/init.js.map +1 -0
- package/src/utils/install.d.ts +32 -0
- package/src/utils/install.js +58 -0
- package/src/utils/install.js.map +1 -0
- package/src/utils/js.js +27 -20
- package/src/utils/js.js.map +1 -1
- package/src/utils/lambda-runtime-resolution.d.ts +53 -0
- package/src/utils/lambda-runtime-resolution.js +83 -0
- package/src/utils/lambda-runtime-resolution.js.map +1 -0
- package/src/utils/mcp.d.ts +9 -0
- package/src/utils/mcp.js +42 -41
- package/src/utils/mcp.js.map +1 -1
- package/src/utils/metrics.d.ts +1 -1
- package/src/utils/metrics.js +30 -45
- package/src/utils/metrics.js.map +1 -1
- package/src/utils/migration-manifest.d.ts +58 -0
- package/src/utils/migration-manifest.js +76 -0
- package/src/utils/migration-manifest.js.map +1 -0
- package/src/utils/migration-versions.d.ts +145 -0
- package/src/utils/migration-versions.js +250 -0
- package/src/utils/migration-versions.js.map +1 -0
- package/src/utils/mock-project-graph.js +12 -13
- package/src/utils/mock-project-graph.js.map +1 -1
- package/src/utils/module-format.d.ts +25 -0
- package/src/utils/module-format.js +45 -0
- package/src/utils/module-format.js.map +1 -0
- package/src/utils/names.d.ts +22 -0
- package/src/utils/names.js +44 -48
- package/src/utils/names.js.map +1 -1
- package/src/utils/npm-scope.d.ts +0 -4
- package/src/utils/npm-scope.js +7 -20
- package/src/utils/npm-scope.js.map +1 -1
- package/src/utils/nx.d.ts +91 -6
- package/src/utils/nx.js +186 -74
- package/src/utils/nx.js.map +1 -1
- package/src/utils/nxlv-python.js +27 -15
- package/src/utils/nxlv-python.js.map +1 -1
- package/src/utils/object.js +5 -11
- package/src/utils/object.js.map +1 -1
- package/src/utils/open-api-codegen-target.d.ts +28 -0
- package/src/utils/open-api-codegen-target.js +31 -0
- package/src/utils/open-api-codegen-target.js.map +1 -0
- package/src/utils/paths.js +11 -15
- package/src/utils/paths.js.map +1 -1
- package/src/utils/pkg-manager.d.ts +1 -1
- package/src/utils/pkg-manager.js +4 -9
- package/src/utils/pkg-manager.js.map +1 -1
- package/src/utils/pnpm-workspace.d.ts +1 -12
- package/src/utils/pnpm-workspace.js +16 -43
- package/src/utils/pnpm-workspace.js.map +1 -1
- package/src/utils/port.d.ts +6 -5
- package/src/utils/port.js +31 -39
- package/src/utils/port.js.map +1 -1
- package/src/utils/project-package-json.d.ts +39 -0
- package/src/utils/project-package-json.js +119 -0
- package/src/utils/project-package-json.js.map +1 -0
- package/src/utils/py.d.ts +18 -4
- package/src/utils/py.js +64 -46
- package/src/utils/py.js.map +1 -1
- package/src/utils/rdb-constructs/files/cdk/app/dbs/__nameKebabCase__.ts.template +72 -18
- package/src/utils/rdb-constructs/files/cdk/core/rdb/aurora.ts.template +130 -88
- package/src/utils/rdb-constructs/files/terraform/app/dbs/__nameKebabCase__/__nameKebabCase__.tf.template +132 -66
- package/src/utils/rdb-constructs/files/terraform/core/rdb/aurora/aurora.tf.template +78 -162
- package/src/utils/rdb-constructs/rdb-constructs.d.ts +26 -3
- package/src/utils/rdb-constructs/rdb-constructs.js +61 -33
- package/src/utils/rdb-constructs/rdb-constructs.js.map +1 -1
- package/src/utils/ruff.d.ts +59 -0
- package/src/utils/ruff.js +140 -0
- package/src/utils/ruff.js.map +1 -0
- package/src/utils/shared-constructs-constants.d.ts +68 -4
- package/src/utils/shared-constructs-constants.js +68 -15
- package/src/utils/shared-constructs-constants.js.map +1 -1
- package/src/utils/shared-constructs.d.ts +5 -2
- package/src/utils/shared-constructs.js +62 -67
- package/src/utils/shared-constructs.js.map +1 -1
- package/src/utils/shared-dynamodb-scripts.d.ts +18 -0
- package/src/utils/shared-dynamodb-scripts.js +35 -0
- package/src/utils/shared-dynamodb-scripts.js.map +1 -0
- package/src/utils/shared-infra-config.js +31 -30
- package/src/utils/shared-infra-config.js.map +1 -1
- package/src/utils/shared-infra-scripts.d.ts +26 -0
- package/src/utils/shared-infra-scripts.js +58 -0
- package/src/utils/shared-infra-scripts.js.map +1 -0
- package/src/utils/shared-rdb-scripts.d.ts +27 -0
- package/src/utils/shared-rdb-scripts.js +59 -0
- package/src/utils/shared-rdb-scripts.js.map +1 -0
- package/src/utils/shared-scripts.d.ts +1 -4
- package/src/utils/shared-scripts.js +12 -38
- package/src/utils/shared-scripts.js.map +1 -1
- package/src/utils/shared-shadcn.d.ts +26 -1
- package/src/utils/shared-shadcn.js +93 -67
- package/src/utils/shared-shadcn.js.map +1 -1
- package/src/utils/smithy.d.ts +59 -0
- package/src/utils/smithy.js +73 -0
- package/src/utils/smithy.js.map +1 -0
- package/src/utils/test-git.d.ts +39 -0
- package/src/utils/test-git.js +117 -0
- package/src/utils/test-git.js.map +1 -0
- package/src/utils/test.d.ts +10 -0
- package/src/utils/test.js +44 -25
- package/src/utils/test.js.map +1 -1
- package/src/utils/toml.d.ts +5 -0
- package/src/utils/toml.js +17 -15
- package/src/utils/toml.js.map +1 -1
- package/src/utils/version-upgrade-migration/migration.d.ts +14 -0
- package/src/utils/version-upgrade-migration/migration.js +16 -0
- package/src/utils/version-upgrade-migration/migration.js.map +1 -0
- package/src/utils/version-upgrade-migration/nx-package-updates.d.ts +45 -0
- package/src/utils/version-upgrade-migration/nx-package-updates.js +50 -0
- package/src/utils/version-upgrade-migration/nx-package-updates.js.map +1 -0
- package/src/utils/version-upgrade-migration/owned-dependencies.d.ts +76 -0
- package/src/utils/version-upgrade-migration/owned-dependencies.js +146 -0
- package/src/utils/version-upgrade-migration/owned-dependencies.js.map +1 -0
- package/src/utils/version-upgrade-migration/register.d.ts +29 -0
- package/src/utils/version-upgrade-migration/register.js +42 -0
- package/src/utils/version-upgrade-migration/register.js.map +1 -0
- package/src/utils/version-upgrade-migration/sync-embedded-versions.d.ts +26 -0
- package/src/utils/version-upgrade-migration/sync-embedded-versions.js +352 -0
- package/src/utils/version-upgrade-migration/sync-embedded-versions.js.map +1 -0
- package/src/utils/version-upgrade-migration/sync-lambda-runtimes.d.ts +28 -0
- package/src/utils/version-upgrade-migration/sync-lambda-runtimes.js +148 -0
- package/src/utils/version-upgrade-migration/sync-lambda-runtimes.js.map +1 -0
- package/src/utils/version-upgrade-migration/sync-metrics-version.d.ts +13 -0
- package/src/utils/version-upgrade-migration/sync-metrics-version.js +33 -0
- package/src/utils/version-upgrade-migration/sync-metrics-version.js.map +1 -0
- package/src/utils/version-upgrade-migration/sync-python-language-version.d.ts +31 -0
- package/src/utils/version-upgrade-migration/sync-python-language-version.js +110 -0
- package/src/utils/version-upgrade-migration/sync-python-language-version.js.map +1 -0
- package/src/utils/version-upgrade-migration/sync-vended-versions.d.ts +10 -0
- package/src/utils/version-upgrade-migration/sync-vended-versions.js +547 -0
- package/src/utils/version-upgrade-migration/sync-vended-versions.js.map +1 -0
- package/src/utils/version-upgrade-migration/vended-upgrade.d.ts +14 -0
- package/src/utils/version-upgrade-migration/vended-upgrade.js +40 -0
- package/src/utils/version-upgrade-migration/vended-upgrade.js.map +1 -0
- package/src/utils/versions.d.ts +300 -108
- package/src/utils/versions.js +317 -121
- package/src/utils/versions.js.map +1 -1
- package/src/utils/website-constructs/files/cdk/app/static-websites/__websiteNameKebabCase__.ts.template +12 -3
- package/src/utils/website-constructs/files/cdk/core/static-website.ts.template +252 -49
- package/src/utils/website-constructs/files/terraform/app/static-websites/__websiteNameKebabCase__/__websiteNameKebabCase__.tf.template +56 -1
- package/src/utils/website-constructs/files/terraform/core/static-website/static-website.tf.template +205 -107
- package/src/utils/website-constructs/website-constructs.d.ts +12 -1
- package/src/utils/website-constructs/website-constructs.js +49 -30
- package/src/utils/website-constructs/website-constructs.js.map +1 -1
- package/bin/aws-nx-mcp.d.ts +0 -2
- package/bin/aws-nx-mcp.js +0 -17
- package/bin/aws-nx-mcp.js.map +0 -1
- package/sdk/connection.d.ts +0 -6
- package/sdk/connection.js +0 -10
- package/sdk/connection.js.map +0 -1
- package/sdk/license.d.ts +0 -8
- package/sdk/license.js +0 -13
- package/sdk/license.js.map +0 -1
- package/sdk/open-api.d.ts +0 -10
- package/sdk/open-api.js +0 -15
- package/sdk/open-api.js.map +0 -1
- package/sdk/py.d.ts +0 -14
- package/sdk/py.js +0 -18
- package/sdk/py.js.map +0 -1
- package/sdk/terraform.d.ts +0 -6
- package/sdk/terraform.js +0 -11
- package/sdk/terraform.js.map +0 -1
- package/sdk/ts.d.ts +0 -29
- package/sdk/ts.js +0 -47
- package/sdk/ts.js.map +0 -1
- package/sdk/utils/ast.js +0 -12
- package/sdk/utils/ast.js.map +0 -1
- package/sdk/utils/format.js +0 -10
- package/sdk/utils/format.js.map +0 -1
- package/sdk/utils/test.js +0 -10
- package/sdk/utils/test.js.map +0 -1
- package/src/connection/agent-serve-local.d.ts +0 -33
- package/src/connection/agent-serve-local.js +0 -48
- package/src/connection/agent-serve-local.js.map +0 -1
- package/src/connection/serve-local.js +0 -41
- package/src/connection/serve-local.js.map +0 -1
- package/src/py/agent/__snapshots__/generator.spec.ts.snap +0 -771
- package/src/py/agent/a2a-connection/files/agent-connection/app/__targetAgentSnakeCase___client.py.template +0 -22
- package/src/py/agent/files/a2a/main.py.template +0 -54
- package/src/py/agent/files/ag-ui/main.py.template +0 -37
- package/src/py/agent/mcp-connection/files/agent-connection/app/__mcpServerSnakeCase___client.py.template +0 -22
- package/src/py/agent/react-connection/serve-local.js +0 -30
- package/src/py/agent/react-connection/serve-local.js.map +0 -1
- package/src/py/agent/scripts/http/chat.ts.template +0 -38
- package/src/ts/agent/a2a-connection/files/agent-connection/app/__targetAgentKebabCase__-client.ts.template +0 -19
- package/src/ts/agent/mcp-connection/files/agent-connection/app/__mcpServerKebabCase__-client.ts.template +0 -19
- package/src/ts/agent/react-connection/serve-local.d.ts +0 -13
- package/src/ts/agent/react-connection/serve-local.js +0 -19
- package/src/ts/agent/react-connection/serve-local.js.map +0 -1
- package/src/ts/agent/scripts/http/chat.ts.template +0 -35
- package/src/ts/dynamodb/files/scripts/pull-image.ts.template +0 -15
- package/src/ts/dynamodb/files/src/constants.ts.template +0 -9
- package/src/ts/dynamodb/files/src/gsi.ts.template +0 -14
- package/src/ts/rdb/files/scripts/pull-image.ts.template +0 -15
- package/src/ts/rdb/files/scripts/start-container.ts.template +0 -84
- package/src/ts/rdb/files/scripts/wait-for-db.ts.template +0 -55
- package/src/ts/rdb/files/src/constants.ts.template +0 -8
- package/src/ts/rdb/files/src/index.ts.template +0 -2
- package/src/utils/agent-connection/files/core-a2a/agentcore-a2a-client.ts.template +0 -123
- package/src/utils/agent-connection/files/core-mcp/agentcore-mcp-client.ts.template +0 -128
- package/src/utils/agent-connection/files/py-core-a2a/agentcore_a2a_client.py.template +0 -120
- package/src/utils/agent-connection/files/py-core-mcp/agentcore_mcp_client.py.template +0 -89
- package/src/utils/files/common/scripts/src/infra-deploy.ts.template +0 -2
- package/src/utils/files/common/scripts/src/infra-destroy.ts.template +0 -2
- package/src/utils/files/common/scripts/src/stage-credentials/cdk-command.ts.template +0 -18
- package/src/utils/files/terraform/scripts/reset-runtime-config.ts.template +0 -25
- /package/src/py/agent/files/{common → langchain/common}/__init__.py.template +0 -0
- /package/src/smithy/project/files/{src → service/src}/main.smithy.template +0 -0
- /package/src/utils/agent-connection/files/{py-core-runtime-config/model_errors.py.template → py-core-strands/base/model_errors_strands.py.template} +0 -0
- /package/src/utils/files/common/scripts/src/{index.ts.template → infra/index.ts.template} +0 -0
- /package/src/utils/files/common/scripts/src/{stage-credentials → infra/stage-credentials}/credentials.ts.template +0 -0
- /package/src/utils/files/common/scripts/src/{stage-credentials → infra/stage-credentials}/stage-parser.ts.template +0 -0
|
@@ -22,137 +22,6 @@ datasource db {
|
|
|
22
22
|
"
|
|
23
23
|
`;
|
|
24
24
|
|
|
25
|
-
exports[`ts#rdb generator > should add mysql prisma dependencies when engine is MySQL > packages/db/scripts/pull-image.ts 1`] = `
|
|
26
|
-
"import { spawnSync } from 'child_process';
|
|
27
|
-
|
|
28
|
-
const ENGINE = 'docker';
|
|
29
|
-
const image = process.argv[2];
|
|
30
|
-
|
|
31
|
-
const inspect = spawnSync(ENGINE, ['image', 'inspect', image], {
|
|
32
|
-
stdio: 'ignore',
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
if (inspect.status !== 0) {
|
|
36
|
-
const pull = spawnSync(ENGINE, ['pull', image], { stdio: 'inherit' });
|
|
37
|
-
if (pull.status !== 0) {
|
|
38
|
-
process.exit(pull.status ?? 1);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
"
|
|
42
|
-
`;
|
|
43
|
-
|
|
44
|
-
exports[`ts#rdb generator > should add mysql prisma dependencies when engine is MySQL > packages/db/scripts/start-container.ts 1`] = `
|
|
45
|
-
"import { spawn, spawnSync } from 'child_process';
|
|
46
|
-
|
|
47
|
-
const ENGINE = 'docker';
|
|
48
|
-
|
|
49
|
-
const [containerName, image, hostPort, dbName, dbPassword] =
|
|
50
|
-
process.argv.slice(2);
|
|
51
|
-
|
|
52
|
-
const containerExists = (): boolean =>
|
|
53
|
-
spawnSync(ENGINE, ['container', 'inspect', containerName], {
|
|
54
|
-
stdio: 'ignore',
|
|
55
|
-
}).status === 0;
|
|
56
|
-
|
|
57
|
-
const isRunning = (): boolean => {
|
|
58
|
-
const result = spawnSync(
|
|
59
|
-
ENGINE,
|
|
60
|
-
['container', 'inspect', '-f', '{{.State.Running}}', containerName],
|
|
61
|
-
{ encoding: 'utf-8' },
|
|
62
|
-
);
|
|
63
|
-
return result.status === 0 && result.stdout.trim() === 'true';
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
if (containerExists()) {
|
|
67
|
-
if (!isRunning()) {
|
|
68
|
-
const start = spawnSync(ENGINE, ['start', containerName], {
|
|
69
|
-
stdio: 'inherit',
|
|
70
|
-
});
|
|
71
|
-
if (start.status !== 0) process.exit(start.status ?? 1);
|
|
72
|
-
}
|
|
73
|
-
} else {
|
|
74
|
-
const runArgs = (
|
|
75
|
-
\`run --rm --name \${containerName}\` +
|
|
76
|
-
\` -e MYSQL_DATABASE=\${dbName}\` +
|
|
77
|
-
\` -e MYSQL_ROOT_PASSWORD=\${dbPassword}\` +
|
|
78
|
-
\` -p \${hostPort}:3306\` +
|
|
79
|
-
\` -v \${containerName}-data:/var/lib/mysql\` +
|
|
80
|
-
\` -d \${image}\`
|
|
81
|
-
).split(' ');
|
|
82
|
-
const create = spawnSync(ENGINE, runArgs, { stdio: 'inherit' });
|
|
83
|
-
if (create.status !== 0) process.exit(create.status ?? 1);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const logs = spawn(ENGINE, ['logs', '-f', containerName], {
|
|
87
|
-
stdio: ['ignore', 'inherit', 'inherit'],
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
let exiting = false;
|
|
91
|
-
|
|
92
|
-
const cleanup = () => {
|
|
93
|
-
if (exiting) return;
|
|
94
|
-
exiting = true;
|
|
95
|
-
spawnSync(ENGINE, ['stop', containerName], { stdio: 'ignore' });
|
|
96
|
-
logs.kill();
|
|
97
|
-
process.exit(0);
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
process.on('SIGTERM', cleanup);
|
|
101
|
-
process.on('SIGINT', cleanup);
|
|
102
|
-
process.on('SIGHUP', cleanup);
|
|
103
|
-
|
|
104
|
-
logs.on('exit', (code) => {
|
|
105
|
-
if (!exiting) process.exit(code ?? 0);
|
|
106
|
-
});
|
|
107
|
-
"
|
|
108
|
-
`;
|
|
109
|
-
|
|
110
|
-
exports[`ts#rdb generator > should add mysql prisma dependencies when engine is MySQL > packages/db/scripts/wait-for-db.ts 1`] = `
|
|
111
|
-
"import { createConnection, Connection } from 'mariadb';
|
|
112
|
-
|
|
113
|
-
const noop = () => undefined;
|
|
114
|
-
|
|
115
|
-
const [portArg, dbArg, userArg, passwordArg] = process.argv.slice(2);
|
|
116
|
-
const timeoutAt = Date.now() + 60000;
|
|
117
|
-
|
|
118
|
-
while (Date.now() < timeoutAt) {
|
|
119
|
-
let conn: Connection | undefined;
|
|
120
|
-
try {
|
|
121
|
-
conn = await createConnection({
|
|
122
|
-
host: 'localhost',
|
|
123
|
-
port: parseInt(portArg),
|
|
124
|
-
user: userArg,
|
|
125
|
-
password: passwordArg,
|
|
126
|
-
database: dbArg,
|
|
127
|
-
connectTimeout: 500,
|
|
128
|
-
allowPublicKeyRetrieval: true,
|
|
129
|
-
});
|
|
130
|
-
await conn.end();
|
|
131
|
-
console.log('Database is ready.');
|
|
132
|
-
process.exit(0);
|
|
133
|
-
} catch {
|
|
134
|
-
console.log('Database is not ready.');
|
|
135
|
-
await conn?.end().catch(noop);
|
|
136
|
-
}
|
|
137
|
-
await new Promise((r) => setTimeout(r, 200));
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
throw new Error(\`Timed out waiting for mysql on port \${portArg}\`);
|
|
141
|
-
"
|
|
142
|
-
`;
|
|
143
|
-
|
|
144
|
-
exports[`ts#rdb generator > should add mysql prisma dependencies when engine is MySQL > packages/db/src/constants.ts 1`] = `
|
|
145
|
-
"export const DB_PACKAGE_NAME = 'Db';
|
|
146
|
-
|
|
147
|
-
// Local development connection details (used when SERVE_LOCAL=true, see serve-local Nx target)
|
|
148
|
-
export const LOCAL_DB_PORT = 3306;
|
|
149
|
-
export const LOCAL_DB_HOST = 'localhost';
|
|
150
|
-
export const LOCAL_DB_NAME = 'database_name';
|
|
151
|
-
export const LOCAL_DB_USER = 'root';
|
|
152
|
-
export const LOCAL_DB_PASSWORD = 'password';
|
|
153
|
-
"
|
|
154
|
-
`;
|
|
155
|
-
|
|
156
25
|
exports[`ts#rdb generator > should add mysql prisma dependencies when engine is MySQL > packages/db/src/create-db-user-handler.ts 1`] = `
|
|
157
26
|
"import type { CloudFormationCustomResourceEvent } from 'aws-lambda';
|
|
158
27
|
import { randomBytes } from 'node:crypto';
|
|
@@ -199,7 +68,7 @@ const ensureDatabaseUser = async (dbUser: string): Promise<void> => {
|
|
|
199
68
|
[
|
|
200
69
|
\`CREATE USER IF NOT EXISTS \${quotedUser}@\${quotedHost} IDENTIFIED WITH AWSAuthenticationPlugin AS 'RDS'\`,
|
|
201
70
|
\`ALTER USER \${quotedUser}@\${quotedHost} IDENTIFIED WITH AWSAuthenticationPlugin AS 'RDS' REQUIRE SSL\`,
|
|
202
|
-
\`GRANT
|
|
71
|
+
\`GRANT SELECT, INSERT, UPDATE, DELETE ON \${quotedDbName}.* TO \${quotedUser}@\${quotedHost}\`,
|
|
203
72
|
].join(';\\n'),
|
|
204
73
|
);
|
|
205
74
|
} finally {
|
|
@@ -230,13 +99,14 @@ export const handler = async (
|
|
|
230
99
|
`;
|
|
231
100
|
|
|
232
101
|
exports[`ts#rdb generator > should add mysql prisma dependencies when engine is MySQL > packages/db/src/index.ts 1`] = `
|
|
233
|
-
"export
|
|
234
|
-
|
|
102
|
+
"export * from './prisma.js';
|
|
103
|
+
// Export your library code here
|
|
235
104
|
"
|
|
236
105
|
`;
|
|
237
106
|
|
|
238
107
|
exports[`ts#rdb generator > should add mysql prisma dependencies when engine is MySQL > packages/db/src/migration-handler.ts 1`] = `
|
|
239
108
|
"import { execFile } from 'node:child_process';
|
|
109
|
+
import { join } from 'node:path';
|
|
240
110
|
import { promisify } from 'node:util';
|
|
241
111
|
import { getDatabaseSecret, withConnectionRetry } from './utils.js';
|
|
242
112
|
|
|
@@ -254,7 +124,8 @@ const buildDatabaseUrl = async (): Promise<string> => {
|
|
|
254
124
|
export const handler = async () => {
|
|
255
125
|
await withConnectionRetry(async () => {
|
|
256
126
|
const databaseUrl = await buildDatabaseUrl();
|
|
257
|
-
|
|
127
|
+
const prisma = join(__dirname, 'node_modules', '.bin', 'prisma');
|
|
128
|
+
await promisify(execFile)(prisma, ['migrate', 'deploy'], {
|
|
258
129
|
cwd: __dirname,
|
|
259
130
|
env: {
|
|
260
131
|
...process.env,
|
|
@@ -270,26 +141,30 @@ exports[`ts#rdb generator > should add mysql prisma dependencies when engine is
|
|
|
270
141
|
"import { PrismaMariaDb } from '@prisma/adapter-mariadb';
|
|
271
142
|
import { Signer } from '@aws-sdk/rds-signer';
|
|
272
143
|
import { Prisma, PrismaClient } from '../generated/prisma/client.js';
|
|
273
|
-
import {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
LOCAL_DB_NAME,
|
|
277
|
-
LOCAL_DB_PASSWORD,
|
|
278
|
-
LOCAL_DB_PORT,
|
|
279
|
-
LOCAL_DB_USER,
|
|
280
|
-
} from './constants.js';
|
|
144
|
+
import { readFileSync } from 'fs';
|
|
145
|
+
import { join, dirname } from 'path';
|
|
146
|
+
import { fileURLToPath } from 'url';
|
|
281
147
|
import { getDatabaseConfig } from './utils.js';
|
|
282
148
|
|
|
149
|
+
// Generated: must match runtimeConfigKey in config.json
|
|
150
|
+
const runtimeConfigKey = 'Db';
|
|
151
|
+
|
|
152
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
153
|
+
// config.json is only present in local dev (not included in the deployed bundle); guard with LOCAL_DEV check
|
|
154
|
+
const localDev = () =>
|
|
155
|
+
JSON.parse(readFileSync(join(__dirname, '../config.json'), 'utf-8')).localDev;
|
|
156
|
+
|
|
283
157
|
export const getPrisma = async <LogOpts extends Prisma.LogLevel>(
|
|
284
158
|
log: LogOpts[] = ['warn', 'error'] as LogOpts[],
|
|
285
159
|
): Promise<PrismaClient<LogOpts>> => {
|
|
286
|
-
if (process.env.
|
|
160
|
+
if (process.env.LOCAL_DEV === 'true') {
|
|
161
|
+
const { host, port, dbName, dbUser, dbPassword } = localDev();
|
|
287
162
|
const adapter = new PrismaMariaDb({
|
|
288
|
-
host
|
|
289
|
-
port
|
|
290
|
-
database:
|
|
291
|
-
user:
|
|
292
|
-
password:
|
|
163
|
+
host,
|
|
164
|
+
port,
|
|
165
|
+
database: dbName,
|
|
166
|
+
user: dbUser,
|
|
167
|
+
password: dbPassword,
|
|
293
168
|
allowPublicKeyRetrieval: true,
|
|
294
169
|
});
|
|
295
170
|
return new PrismaClient({
|
|
@@ -299,7 +174,7 @@ export const getPrisma = async <LogOpts extends Prisma.LogLevel>(
|
|
|
299
174
|
}
|
|
300
175
|
|
|
301
176
|
const { hostname, port, database, dbUser, region } =
|
|
302
|
-
await getDatabaseConfig(
|
|
177
|
+
await getDatabaseConfig(runtimeConfigKey);
|
|
303
178
|
const iamAuthToken = await new Signer({
|
|
304
179
|
hostname,
|
|
305
180
|
port,
|
|
@@ -350,6 +225,24 @@ export type DatabaseSecret = {
|
|
|
350
225
|
port: number;
|
|
351
226
|
};
|
|
352
227
|
|
|
228
|
+
/**
|
|
229
|
+
* Connection details for the admin credentials secret. RDS-managed secrets hold
|
|
230
|
+
* only \`username\` and \`password\`, so the host, port and database name are taken
|
|
231
|
+
* from the environment when the secret omits them.
|
|
232
|
+
*/
|
|
233
|
+
type SecretConnectionOverrides = Partial<
|
|
234
|
+
Omit<DatabaseSecret, 'username' | 'password'>
|
|
235
|
+
>;
|
|
236
|
+
|
|
237
|
+
const connectionOverridesFromEnv = (): SecretConnectionOverrides => {
|
|
238
|
+
const { DATABASE_HOST, DATABASE_PORT, DATABASE_NAME } = process.env;
|
|
239
|
+
return {
|
|
240
|
+
...(DATABASE_HOST ? { host: DATABASE_HOST } : {}),
|
|
241
|
+
...(DATABASE_PORT ? { port: Number(DATABASE_PORT) } : {}),
|
|
242
|
+
...(DATABASE_NAME ? { dbname: DATABASE_NAME } : {}),
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
|
|
353
246
|
const databaseConfigPromises: Record<string, Promise<DatabaseConfig>> = {};
|
|
354
247
|
|
|
355
248
|
const getSecretValue = async (secretArn: string): Promise<string> => {
|
|
@@ -376,7 +269,18 @@ export const getDatabaseSecret = async (): Promise<DatabaseSecret> => {
|
|
|
376
269
|
);
|
|
377
270
|
}
|
|
378
271
|
|
|
379
|
-
|
|
272
|
+
const secret = JSON.parse(await getSecretValue(secretArn)) as DatabaseSecret;
|
|
273
|
+
const secretWithConnection = { ...secret, ...connectionOverridesFromEnv() };
|
|
274
|
+
|
|
275
|
+
for (const key of ['host', 'port', 'dbname'] as const) {
|
|
276
|
+
if (secretWithConnection[key] == null) {
|
|
277
|
+
throw new Error(
|
|
278
|
+
\`Database secret is missing \${key} and no override was provided in the environment.\`,
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
return secretWithConnection;
|
|
380
284
|
};
|
|
381
285
|
|
|
382
286
|
const loadDatabaseConfig = async (
|
|
@@ -424,6 +328,9 @@ const transientErrorPatterns = [
|
|
|
424
328
|
'ECONNREFUSED',
|
|
425
329
|
'ENOTFOUND',
|
|
426
330
|
'P1000', // Prisma: authentication failed
|
|
331
|
+
'P1001', // Prisma: can't reach database server
|
|
332
|
+
'P1002', // Prisma: database server reached but timed out
|
|
333
|
+
'P1010', // Prisma: user denied access (IAM auth grant not yet propagated)
|
|
427
334
|
'ER_ACCESS_DENIED_ERROR', // MySQL: access denied
|
|
428
335
|
];
|
|
429
336
|
|
|
@@ -484,14 +391,10 @@ import { CustomResource } from 'aws-cdk-lib';
|
|
|
484
391
|
import { IConnectable, IVpc, Port, SubnetType } from 'aws-cdk-lib/aws-ec2';
|
|
485
392
|
import { IGrantable, Role, ServicePrincipal } from 'aws-cdk-lib/aws-iam';
|
|
486
393
|
import { Key } from 'aws-cdk-lib/aws-kms';
|
|
487
|
-
import { Platform } from 'aws-cdk-lib/aws-ecr-assets';
|
|
488
394
|
import {
|
|
489
395
|
Architecture,
|
|
490
|
-
Code,
|
|
491
|
-
DockerImageCode,
|
|
492
|
-
DockerImageFunction,
|
|
493
396
|
Function,
|
|
494
|
-
|
|
397
|
+
FunctionOptions,
|
|
495
398
|
Tracing,
|
|
496
399
|
} from 'aws-cdk-lib/aws-lambda';
|
|
497
400
|
import {
|
|
@@ -607,16 +510,6 @@ export interface AuroraDatabaseProps extends _AuroraDatabaseProps {
|
|
|
607
510
|
*/
|
|
608
511
|
readonly runtimeConfigKey: string;
|
|
609
512
|
|
|
610
|
-
/**
|
|
611
|
-
* Migration bundle used to create a migration handler Lambda.
|
|
612
|
-
*/
|
|
613
|
-
readonly migrationBundleDir: string;
|
|
614
|
-
|
|
615
|
-
/**
|
|
616
|
-
* Bundle used to create or reconcile the application database user.
|
|
617
|
-
*/
|
|
618
|
-
readonly createDbUserBundleDir: string;
|
|
619
|
-
|
|
620
513
|
/**
|
|
621
514
|
* Writer instance for the Aurora cluster.
|
|
622
515
|
*/
|
|
@@ -656,6 +549,39 @@ export interface AuroraDatabaseProps extends _AuroraDatabaseProps {
|
|
|
656
549
|
* @default true
|
|
657
550
|
*/
|
|
658
551
|
readonly enableKeyRotation?: boolean;
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* Whether to export Aurora engine logs to CloudWatch Logs.
|
|
555
|
+
* See https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_LogAccess.html
|
|
556
|
+
*
|
|
557
|
+
* PostgreSQL logs DDL statements only (log_statement=ddl); MySQL enables
|
|
558
|
+
* Advanced Auditing scoped to connections and DDL (server_audit_events=CONNECT,QUERY_DDL).
|
|
559
|
+
* Neither logs statement parameter values, to avoid leaking PII into log data.
|
|
560
|
+
*
|
|
561
|
+
* @default true
|
|
562
|
+
*/
|
|
563
|
+
readonly enableCloudwatchLogs?: boolean;
|
|
564
|
+
|
|
565
|
+
/**
|
|
566
|
+
* Whether to enable Performance Insights on the Aurora writer instance.
|
|
567
|
+
*
|
|
568
|
+
* @default true
|
|
569
|
+
*/
|
|
570
|
+
readonly enablePerformanceInsights?: boolean;
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* Minimum Aurora Serverless v2 ACUs.
|
|
574
|
+
*
|
|
575
|
+
* @default 0.5
|
|
576
|
+
*/
|
|
577
|
+
readonly serverlessV2MinCapacity?: number;
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* Maximum Aurora Serverless v2 ACUs.
|
|
581
|
+
*
|
|
582
|
+
* @default 4
|
|
583
|
+
*/
|
|
584
|
+
readonly serverlessV2MaxCapacity?: number;
|
|
659
585
|
}
|
|
660
586
|
|
|
661
587
|
/**
|
|
@@ -676,8 +602,6 @@ export abstract class AuroraDatabase extends Construct {
|
|
|
676
602
|
adminUser,
|
|
677
603
|
databaseName,
|
|
678
604
|
runtimeConfigKey,
|
|
679
|
-
migrationBundleDir,
|
|
680
|
-
createDbUserBundleDir,
|
|
681
605
|
vpcSubnets,
|
|
682
606
|
writer,
|
|
683
607
|
enableRdsProxy = true,
|
|
@@ -685,6 +609,10 @@ export abstract class AuroraDatabase extends Construct {
|
|
|
685
609
|
deletionProtection = true,
|
|
686
610
|
removalPolicy = RemovalPolicy.RETAIN,
|
|
687
611
|
enableKeyRotation = true,
|
|
612
|
+
enableCloudwatchLogs = true,
|
|
613
|
+
enablePerformanceInsights = true,
|
|
614
|
+
serverlessV2MinCapacity = 0.5,
|
|
615
|
+
serverlessV2MaxCapacity = 4,
|
|
688
616
|
engine,
|
|
689
617
|
engineVersion,
|
|
690
618
|
...clusterProps
|
|
@@ -700,12 +628,37 @@ export abstract class AuroraDatabase extends Construct {
|
|
|
700
628
|
vpc,
|
|
701
629
|
vpcSubnets,
|
|
702
630
|
engine: engine.clusterEngine(engineVersion ?? engine.defaultVersion),
|
|
703
|
-
|
|
631
|
+
serverlessV2MinCapacity,
|
|
632
|
+
serverlessV2MaxCapacity,
|
|
633
|
+
writer:
|
|
634
|
+
writer ??
|
|
635
|
+
ClusterInstance.serverlessV2('writer', {
|
|
636
|
+
enablePerformanceInsights,
|
|
637
|
+
performanceInsightEncryptionKey: enablePerformanceInsights
|
|
638
|
+
? key
|
|
639
|
+
: undefined,
|
|
640
|
+
}),
|
|
704
641
|
credentials: Credentials.fromGeneratedSecret(adminUser, {
|
|
705
642
|
encryptionKey: key,
|
|
706
643
|
}),
|
|
707
644
|
iamAuthentication: true,
|
|
708
645
|
monitoringInterval: Duration.seconds(5),
|
|
646
|
+
cloudwatchLogsExports: enableCloudwatchLogs
|
|
647
|
+
? engine.type === 'mysql'
|
|
648
|
+
? ['audit', 'error']
|
|
649
|
+
: ['postgresql']
|
|
650
|
+
: undefined,
|
|
651
|
+
parameters: enableCloudwatchLogs
|
|
652
|
+
? engine.type === 'mysql'
|
|
653
|
+
? {
|
|
654
|
+
server_audit_logging: '1',
|
|
655
|
+
server_audit_events: 'CONNECT,QUERY_DDL',
|
|
656
|
+
}
|
|
657
|
+
: // Only safe statement-at-a-time; a multi-statement batch mixing
|
|
658
|
+
// DDL with DML (e.g. one \`psql -c "a;b;c"\` call) logs the whole
|
|
659
|
+
// raw text verbatim, including any literal DML values.
|
|
660
|
+
{ log_statement: 'ddl' }
|
|
661
|
+
: undefined,
|
|
709
662
|
defaultDatabaseName: databaseName,
|
|
710
663
|
storageEncrypted: true,
|
|
711
664
|
storageEncryptionKey: key,
|
|
@@ -741,23 +694,23 @@ export abstract class AuroraDatabase extends Construct {
|
|
|
741
694
|
this.proxy?.endpoint ?? this.cluster.clusterEndpoint.hostname;
|
|
742
695
|
const databasePort = this.cluster.clusterEndpoint.port;
|
|
743
696
|
|
|
744
|
-
const
|
|
745
|
-
|
|
746
|
-
handler: 'index.handler',
|
|
747
|
-
runtime: Runtime.NODEJS_LATEST,
|
|
697
|
+
const commonProps: FunctionOptions = {
|
|
698
|
+
vpc,
|
|
748
699
|
timeout: Duration.minutes(5),
|
|
749
700
|
tracing: Tracing.ACTIVE,
|
|
750
|
-
|
|
701
|
+
architecture: Architecture.ARM_64,
|
|
702
|
+
};
|
|
703
|
+
|
|
704
|
+
const createDbUserHandler = this.createDbUserHandler({
|
|
705
|
+
...commonProps,
|
|
751
706
|
vpcSubnets: {
|
|
752
707
|
subnetType: SubnetType.PRIVATE_WITH_EGRESS,
|
|
753
708
|
},
|
|
754
|
-
environment: {
|
|
755
|
-
DATABASE_SECRET_ARN: this.cluster.secret!.secretArn,
|
|
756
|
-
NODE_EXTRA_CA_CERTS: '/var/runtime/ca-cert.pem',
|
|
757
|
-
},
|
|
758
|
-
architecture: Architecture.ARM_64,
|
|
759
709
|
});
|
|
760
|
-
|
|
710
|
+
createDbUserHandler.addEnvironment(
|
|
711
|
+
'DATABASE_SECRET_ARN',
|
|
712
|
+
this.cluster.secret!.secretArn,
|
|
713
|
+
);
|
|
761
714
|
this.cluster.connections.allowDefaultPortFrom(
|
|
762
715
|
createDbUserHandler,
|
|
763
716
|
'Allow the create-db-user handler to connect to the database',
|
|
@@ -794,40 +747,21 @@ export abstract class AuroraDatabase extends Construct {
|
|
|
794
747
|
region: Stack.of(this).region,
|
|
795
748
|
});
|
|
796
749
|
|
|
797
|
-
const migrationHandler =
|
|
798
|
-
|
|
799
|
-
platform: Platform.LINUX_ARM64,
|
|
800
|
-
}),
|
|
750
|
+
const migrationHandler = this.createMigrationHandler({
|
|
751
|
+
...commonProps,
|
|
801
752
|
memorySize: 1024,
|
|
802
|
-
timeout: Duration.minutes(5),
|
|
803
|
-
tracing: Tracing.ACTIVE,
|
|
804
|
-
vpc,
|
|
805
|
-
environment:
|
|
806
|
-
engine.type === 'mysql'
|
|
807
|
-
? {
|
|
808
|
-
DATABASE_SECRET_ARN: this.cluster.secret!.secretArn,
|
|
809
|
-
}
|
|
810
|
-
: {
|
|
811
|
-
HOSTNAME: databaseHostname,
|
|
812
|
-
DATABASE: databaseName,
|
|
813
|
-
PORT: databasePort.toString(),
|
|
814
|
-
DBUSER: this.dbUser,
|
|
815
|
-
},
|
|
816
|
-
architecture: Architecture.ARM_64,
|
|
817
753
|
});
|
|
754
|
+
migrationHandler.addEnvironment(
|
|
755
|
+
'DATABASE_SECRET_ARN',
|
|
756
|
+
this.cluster.secret!.secretArn,
|
|
757
|
+
);
|
|
758
|
+
this.cluster.connections.allowDefaultPortFrom(migrationHandler);
|
|
759
|
+
this.grantSecretRead(migrationHandler);
|
|
818
760
|
|
|
819
|
-
|
|
820
|
-
this.cluster.connections.allowDefaultPortFrom(migrationHandler);
|
|
821
|
-
this.grantSecretRead(migrationHandler);
|
|
822
|
-
} else {
|
|
823
|
-
this.allowDefaultPortFrom(migrationHandler);
|
|
824
|
-
this.grantConnect(migrationHandler);
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
const trigger = new Trigger(this, 'MigrationTrigger', {
|
|
761
|
+
const migrationTrigger = new Trigger(this, 'MigrationTrigger', {
|
|
828
762
|
handler: migrationHandler,
|
|
829
763
|
});
|
|
830
|
-
|
|
764
|
+
migrationTrigger.node.addDependency(createDbUserResource);
|
|
831
765
|
|
|
832
766
|
new CfnOutput(this, 'ClusterEndpoint', {
|
|
833
767
|
value: this.cluster.clusterEndpoint.hostname,
|
|
@@ -840,6 +774,18 @@ export abstract class AuroraDatabase extends Construct {
|
|
|
840
774
|
}
|
|
841
775
|
}
|
|
842
776
|
|
|
777
|
+
/**
|
|
778
|
+
* Creates the Lambda handler used to create or reconcile the application database user.
|
|
779
|
+
*/
|
|
780
|
+
protected abstract createDbUserHandler(baseProps: FunctionOptions): Function;
|
|
781
|
+
|
|
782
|
+
/**
|
|
783
|
+
* Creates the Lambda handler used to run database migrations.
|
|
784
|
+
*/
|
|
785
|
+
protected abstract createMigrationHandler(
|
|
786
|
+
baseProps: FunctionOptions,
|
|
787
|
+
): Function;
|
|
788
|
+
|
|
843
789
|
public allowDefaultPortFrom(other: IConnectable, description?: string): void {
|
|
844
790
|
if (this.proxy) {
|
|
845
791
|
this.proxy.connections.allowFrom(
|
|
@@ -867,17 +813,14 @@ export abstract class AuroraDatabase extends Construct {
|
|
|
867
813
|
|
|
868
814
|
exports[`ts#rdb generator > should add mysql prisma dependencies when engine is MySQL 2`] = `
|
|
869
815
|
"import { defineConfig } from 'prisma/config';
|
|
816
|
+
import { readFileSync } from 'fs';
|
|
870
817
|
|
|
871
818
|
const getDatabaseUrl = async () => {
|
|
872
|
-
if (process.env.
|
|
873
|
-
const {
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
LOCAL_DB_PORT,
|
|
878
|
-
LOCAL_DB_USER,
|
|
879
|
-
} = await import('./src/constants.js');
|
|
880
|
-
return \`mysql://\${LOCAL_DB_USER}:\${LOCAL_DB_PASSWORD}@\${LOCAL_DB_HOST}:\${LOCAL_DB_PORT}/\${LOCAL_DB_NAME}\`;
|
|
819
|
+
if (process.env.LOCAL_DEV === 'true') {
|
|
820
|
+
const { host, port, dbName, dbUser, dbPassword } = JSON.parse(
|
|
821
|
+
readFileSync('config.json', 'utf-8'),
|
|
822
|
+
).localDev;
|
|
823
|
+
return \`mysql://\${dbUser}:\${dbPassword}@\${host}:\${port}/\${dbName}\`;
|
|
881
824
|
}
|
|
882
825
|
return process.env.DATABASE_URL;
|
|
883
826
|
};
|
|
@@ -896,7 +839,8 @@ export default defineConfig({
|
|
|
896
839
|
|
|
897
840
|
exports[`ts#rdb generator > should generate terraform modules when iac is Terraform 1`] = `
|
|
898
841
|
"# Core Aurora module
|
|
899
|
-
# This module creates an Aurora cluster
|
|
842
|
+
# This module creates an Aurora cluster whose admin credentials are generated
|
|
843
|
+
# and rotated by RDS in Secrets Manager.
|
|
900
844
|
|
|
901
845
|
terraform {
|
|
902
846
|
required_version = ">= 1.0"
|
|
@@ -904,15 +848,15 @@ terraform {
|
|
|
904
848
|
required_providers {
|
|
905
849
|
aws = {
|
|
906
850
|
source = "hashicorp/aws"
|
|
907
|
-
version = "
|
|
851
|
+
version = "6.62.0"
|
|
908
852
|
}
|
|
909
853
|
null = {
|
|
910
854
|
source = "hashicorp/null"
|
|
911
|
-
version = "
|
|
855
|
+
version = "3.3.1"
|
|
912
856
|
}
|
|
913
857
|
random = {
|
|
914
858
|
source = "hashicorp/random"
|
|
915
|
-
version = "
|
|
859
|
+
version = "3.9.0"
|
|
916
860
|
}
|
|
917
861
|
}
|
|
918
862
|
}
|
|
@@ -940,11 +884,6 @@ variable "subnet_ids" {
|
|
|
940
884
|
type = list(string)
|
|
941
885
|
}
|
|
942
886
|
|
|
943
|
-
variable "lambda_subnet_ids" {
|
|
944
|
-
description = "Subnet IDs for the credential-rotation Lambda. Must have outbound egress to AWS service endpoints (e.g. Secrets Manager) — use private subnets with a NAT gateway."
|
|
945
|
-
type = list(string)
|
|
946
|
-
}
|
|
947
|
-
|
|
948
887
|
variable "engine" {
|
|
949
888
|
description = "Aurora engine to use."
|
|
950
889
|
type = string
|
|
@@ -1014,16 +953,10 @@ variable "enable_rds_proxy" {
|
|
|
1014
953
|
default = true
|
|
1015
954
|
}
|
|
1016
955
|
|
|
1017
|
-
variable "enable_credential_rotation" {
|
|
1018
|
-
description = "Whether to enable automatic credential rotation for the admin secret."
|
|
1019
|
-
type = bool
|
|
1020
|
-
default = true
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
956
|
variable "enable_cloudwatch_logs" {
|
|
1024
|
-
description = "Whether to export Aurora engine logs to CloudWatch. PostgreSQL
|
|
957
|
+
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."
|
|
1025
958
|
type = bool
|
|
1026
|
-
default =
|
|
959
|
+
default = true
|
|
1027
960
|
}
|
|
1028
961
|
|
|
1029
962
|
variable "enable_performance_insights" {
|
|
@@ -1078,11 +1011,30 @@ resource "aws_rds_cluster_parameter_group" "database" {
|
|
|
1078
1011
|
family = local.parameter_group_family
|
|
1079
1012
|
description = "Parameter group for \${var.name} Aurora cluster"
|
|
1080
1013
|
|
|
1014
|
+
# Only safe statement-at-a-time; a multi-statement batch mixing DDL with
|
|
1015
|
+
# DML (e.g. one \`psql -c "a;b;c"\` call) logs the whole raw text verbatim,
|
|
1016
|
+
# including any literal DML values.
|
|
1081
1017
|
dynamic "parameter" {
|
|
1082
1018
|
for_each = var.engine == "aurora-postgresql" ? [1] : []
|
|
1083
1019
|
content {
|
|
1084
1020
|
name = "log_statement"
|
|
1085
|
-
value = "
|
|
1021
|
+
value = "ddl"
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
dynamic "parameter" {
|
|
1026
|
+
for_each = var.engine == "aurora-mysql" ? [1] : []
|
|
1027
|
+
content {
|
|
1028
|
+
name = "server_audit_logging"
|
|
1029
|
+
value = "1"
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
dynamic "parameter" {
|
|
1034
|
+
for_each = var.engine == "aurora-mysql" ? [1] : []
|
|
1035
|
+
content {
|
|
1036
|
+
name = "server_audit_events"
|
|
1037
|
+
value = "CONNECT,QUERY_DDL"
|
|
1086
1038
|
}
|
|
1087
1039
|
}
|
|
1088
1040
|
|
|
@@ -1093,6 +1045,8 @@ resource "aws_kms_key" "database" {
|
|
|
1093
1045
|
description = "KMS key for Aurora cluster \${var.name}"
|
|
1094
1046
|
enable_key_rotation = var.enable_key_rotation
|
|
1095
1047
|
|
|
1048
|
+
deletion_window_in_days = 30
|
|
1049
|
+
|
|
1096
1050
|
policy = jsonencode({
|
|
1097
1051
|
Version = "2012-10-17"
|
|
1098
1052
|
Statement = [
|
|
@@ -1120,6 +1074,20 @@ resource "aws_kms_key" "database" {
|
|
|
1120
1074
|
"kms:CreateGrant"
|
|
1121
1075
|
]
|
|
1122
1076
|
Resource = "*"
|
|
1077
|
+
},
|
|
1078
|
+
{
|
|
1079
|
+
Sid = "AllowSecretsManagerService"
|
|
1080
|
+
Effect = "Allow"
|
|
1081
|
+
Principal = {
|
|
1082
|
+
Service = "secretsmanager.amazonaws.com"
|
|
1083
|
+
}
|
|
1084
|
+
Action = [
|
|
1085
|
+
"kms:Encrypt",
|
|
1086
|
+
"kms:Decrypt",
|
|
1087
|
+
"kms:GenerateDataKey*",
|
|
1088
|
+
"kms:DescribeKey"
|
|
1089
|
+
]
|
|
1090
|
+
Resource = "*"
|
|
1123
1091
|
}
|
|
1124
1092
|
]
|
|
1125
1093
|
})
|
|
@@ -1174,44 +1142,16 @@ resource "aws_db_subnet_group" "database" {
|
|
|
1174
1142
|
})
|
|
1175
1143
|
}
|
|
1176
1144
|
|
|
1177
|
-
resource "random_password" "master_password" {
|
|
1178
|
-
length = 32
|
|
1179
|
-
special = true
|
|
1180
|
-
override_special = "!#$%&*()-_=+[]{}<>:?"
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
resource "aws_secretsmanager_secret" "credentials" {
|
|
1184
|
-
#checkov:skip=CKV2_AWS_57:Rotation is configured via aws_cloudformation_stack.credentials_rotation using the AWS::SecretsManager-2024-09-16 transform; Checkov cannot resolve rotation schedules created by CloudFormation transforms
|
|
1185
|
-
name_prefix = "\${var.name}-aurora-credentials-"
|
|
1186
|
-
kms_key_id = aws_kms_key.database.arn
|
|
1187
|
-
|
|
1188
|
-
tags = merge(var.tags, {
|
|
1189
|
-
Name = "\${var.name}-aurora-credentials"
|
|
1190
|
-
})
|
|
1191
|
-
}
|
|
1192
|
-
|
|
1193
|
-
resource "aws_secretsmanager_secret_version" "credentials" {
|
|
1194
|
-
secret_id = aws_secretsmanager_secret.credentials.id
|
|
1195
|
-
secret_string = jsonencode({
|
|
1196
|
-
engine = var.engine == "aurora-mysql" ? "mysql" : "postgres"
|
|
1197
|
-
username = var.admin_user
|
|
1198
|
-
password = random_password.master_password.result
|
|
1199
|
-
host = aws_rds_cluster.database.endpoint
|
|
1200
|
-
port = aws_rds_cluster.database.port
|
|
1201
|
-
dbname = var.database_name
|
|
1202
|
-
dbClusterIdentifier = aws_rds_cluster.database.cluster_identifier
|
|
1203
|
-
})
|
|
1204
|
-
}
|
|
1205
|
-
|
|
1206
1145
|
resource "aws_rds_cluster" "database" {
|
|
1207
|
-
#checkov:skip=CKV2_AWS_27:Query logging
|
|
1146
|
+
#checkov:skip=CKV2_AWS_27:Query logging is enabled by default via enable_cloudwatch_logs; checkov cannot resolve the conditional count expression on aws_rds_cluster_parameter_group.database
|
|
1208
1147
|
#checkov:skip=CKV_AWS_139:Deletion protection is enabled but checkov is unable to detect it correctly
|
|
1209
1148
|
cluster_identifier = local.cluster_name
|
|
1210
1149
|
engine = var.engine
|
|
1211
1150
|
engine_version = coalesce(var.engine_version, local.default_engine_version)
|
|
1212
1151
|
database_name = var.database_name
|
|
1213
1152
|
master_username = var.admin_user
|
|
1214
|
-
|
|
1153
|
+
manage_master_user_password = true
|
|
1154
|
+
master_user_secret_kms_key_id = aws_kms_key.database.arn
|
|
1215
1155
|
db_subnet_group_name = aws_db_subnet_group.database.name
|
|
1216
1156
|
db_cluster_parameter_group_name = var.enable_cloudwatch_logs ? aws_rds_cluster_parameter_group.database[0].name : null
|
|
1217
1157
|
vpc_security_group_ids = [aws_security_group.database.id]
|
|
@@ -1225,7 +1165,7 @@ resource "aws_rds_cluster" "database" {
|
|
|
1225
1165
|
monitoring_interval = 5
|
|
1226
1166
|
monitoring_role_arn = aws_iam_role.enhanced_monitoring.arn
|
|
1227
1167
|
copy_tags_to_snapshot = true
|
|
1228
|
-
enabled_cloudwatch_logs_exports = var.enable_cloudwatch_logs ? (var.engine == "aurora-mysql" ? ["audit", "error"
|
|
1168
|
+
enabled_cloudwatch_logs_exports = var.enable_cloudwatch_logs ? (var.engine == "aurora-mysql" ? ["audit", "error"] : ["postgresql"]) : null
|
|
1229
1169
|
|
|
1230
1170
|
serverlessv2_scaling_configuration {
|
|
1231
1171
|
min_capacity = var.serverless_min_capacity
|
|
@@ -1235,6 +1175,10 @@ resource "aws_rds_cluster" "database" {
|
|
|
1235
1175
|
tags = merge(var.tags, {
|
|
1236
1176
|
Name = "\${var.name}-aurora"
|
|
1237
1177
|
})
|
|
1178
|
+
|
|
1179
|
+
lifecycle {
|
|
1180
|
+
prevent_destroy = true
|
|
1181
|
+
}
|
|
1238
1182
|
}
|
|
1239
1183
|
|
|
1240
1184
|
resource "aws_rds_cluster_instance" "database" {
|
|
@@ -1259,75 +1203,6 @@ resource "aws_rds_cluster_instance" "database" {
|
|
|
1259
1203
|
})
|
|
1260
1204
|
}
|
|
1261
1205
|
|
|
1262
|
-
resource "aws_security_group" "rotation" {
|
|
1263
|
-
#checkov:skip=CKV2_AWS_5:Security group is attached to the hosted rotation Lambda created by AWS::SecretsManager::RotationSchedule; Checkov cannot resolve resources created by the CloudFormation transform
|
|
1264
|
-
count = var.enable_credential_rotation ? 1 : 0
|
|
1265
|
-
name_prefix = "\${var.name}-aurora-rotation-"
|
|
1266
|
-
description = "Security group for Aurora secret rotation \${var.name}"
|
|
1267
|
-
vpc_id = var.vpc_id
|
|
1268
|
-
|
|
1269
|
-
tags = merge(var.tags, {
|
|
1270
|
-
Name = "\${var.name}-aurora-rotation"
|
|
1271
|
-
})
|
|
1272
|
-
}
|
|
1273
|
-
|
|
1274
|
-
resource "aws_vpc_security_group_egress_rule" "rotation_to_database" {
|
|
1275
|
-
count = var.enable_credential_rotation ? 1 : 0
|
|
1276
|
-
security_group_id = aws_security_group.rotation[0].id
|
|
1277
|
-
referenced_security_group_id = aws_security_group.database.id
|
|
1278
|
-
from_port = coalesce(var.port, local.default_port)
|
|
1279
|
-
to_port = coalesce(var.port, local.default_port)
|
|
1280
|
-
ip_protocol = "tcp"
|
|
1281
|
-
description = "Allow outbound database traffic from secret rotation Lambda"
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
resource "aws_vpc_security_group_ingress_rule" "rotation_to_database" {
|
|
1285
|
-
count = var.enable_credential_rotation ? 1 : 0
|
|
1286
|
-
security_group_id = aws_security_group.database.id
|
|
1287
|
-
referenced_security_group_id = aws_security_group.rotation[0].id
|
|
1288
|
-
from_port = coalesce(var.port, local.default_port)
|
|
1289
|
-
to_port = coalesce(var.port, local.default_port)
|
|
1290
|
-
ip_protocol = "tcp"
|
|
1291
|
-
description = "Allow inbound database traffic from secret rotation Lambda"
|
|
1292
|
-
}
|
|
1293
|
-
|
|
1294
|
-
resource "aws_cloudformation_stack" "credentials_rotation" {
|
|
1295
|
-
#checkov:skip=CKV_AWS_124:SNS event notifications are not required for the credentials rotation stack
|
|
1296
|
-
count = var.enable_credential_rotation ? 1 : 0
|
|
1297
|
-
name = "\${local.cluster_name}-credentials-rotation"
|
|
1298
|
-
|
|
1299
|
-
capabilities = ["CAPABILITY_IAM", "CAPABILITY_AUTO_EXPAND"]
|
|
1300
|
-
|
|
1301
|
-
template_body = jsonencode({
|
|
1302
|
-
AWSTemplateFormatVersion = "2010-09-09"
|
|
1303
|
-
Transform = "AWS::SecretsManager-2024-09-16"
|
|
1304
|
-
Resources = {
|
|
1305
|
-
CredentialsRotationSchedule = {
|
|
1306
|
-
Type = "AWS::SecretsManager::RotationSchedule"
|
|
1307
|
-
Properties = {
|
|
1308
|
-
SecretId = aws_secretsmanager_secret.credentials.arn
|
|
1309
|
-
HostedRotationLambda = {
|
|
1310
|
-
RotationType = var.engine == "aurora-mysql" ? "MySQLSingleUser" : "PostgreSQLSingleUser"
|
|
1311
|
-
RotationLambdaName = "\${local.cluster_name}-credentials-rotation"
|
|
1312
|
-
VpcSecurityGroupIds = aws_security_group.rotation[0].id
|
|
1313
|
-
VpcSubnetIds = join(",", var.lambda_subnet_ids)
|
|
1314
|
-
}
|
|
1315
|
-
RotationRules = {
|
|
1316
|
-
AutomaticallyAfterDays = 30
|
|
1317
|
-
}
|
|
1318
|
-
}
|
|
1319
|
-
}
|
|
1320
|
-
}
|
|
1321
|
-
})
|
|
1322
|
-
|
|
1323
|
-
depends_on = [
|
|
1324
|
-
aws_secretsmanager_secret_version.credentials,
|
|
1325
|
-
aws_rds_cluster_instance.database,
|
|
1326
|
-
aws_vpc_security_group_egress_rule.rotation_to_database,
|
|
1327
|
-
aws_vpc_security_group_ingress_rule.rotation_to_database,
|
|
1328
|
-
]
|
|
1329
|
-
}
|
|
1330
|
-
|
|
1331
1206
|
resource "aws_iam_role" "proxy" {
|
|
1332
1207
|
count = var.enable_rds_proxy ? 1 : 0
|
|
1333
1208
|
|
|
@@ -1351,27 +1226,6 @@ resource "aws_iam_role" "proxy" {
|
|
|
1351
1226
|
})
|
|
1352
1227
|
}
|
|
1353
1228
|
|
|
1354
|
-
resource "aws_iam_role_policy" "proxy_secret_access" {
|
|
1355
|
-
count = var.enable_rds_proxy ? 1 : 0
|
|
1356
|
-
role = aws_iam_role.proxy[0].name
|
|
1357
|
-
|
|
1358
|
-
policy = jsonencode({
|
|
1359
|
-
Version = "2012-10-17"
|
|
1360
|
-
Statement = [
|
|
1361
|
-
{
|
|
1362
|
-
Effect = "Allow"
|
|
1363
|
-
Action = ["secretsmanager:GetSecretValue"]
|
|
1364
|
-
Resource = [aws_secretsmanager_secret.credentials.arn]
|
|
1365
|
-
},
|
|
1366
|
-
{
|
|
1367
|
-
Effect = "Allow"
|
|
1368
|
-
Action = ["kms:Decrypt"]
|
|
1369
|
-
Resource = [aws_kms_key.database.arn]
|
|
1370
|
-
}
|
|
1371
|
-
]
|
|
1372
|
-
})
|
|
1373
|
-
}
|
|
1374
|
-
|
|
1375
1229
|
resource "aws_security_group" "proxy" {
|
|
1376
1230
|
#checkov:skip=CKV2_AWS_5:Security group is attached to aws_db_proxy.aurora; Checkov cannot resolve count-conditional cross-resource references
|
|
1377
1231
|
count = var.enable_rds_proxy ? 1 : 0
|
|
@@ -1395,17 +1249,6 @@ resource "aws_db_proxy" "aurora" {
|
|
|
1395
1249
|
vpc_subnet_ids = var.subnet_ids
|
|
1396
1250
|
vpc_security_group_ids = [aws_security_group.proxy[0].id]
|
|
1397
1251
|
require_tls = true
|
|
1398
|
-
|
|
1399
|
-
auth {
|
|
1400
|
-
auth_scheme = "SECRETS"
|
|
1401
|
-
iam_auth = "REQUIRED"
|
|
1402
|
-
secret_arn = aws_secretsmanager_secret.credentials.arn
|
|
1403
|
-
}
|
|
1404
|
-
|
|
1405
|
-
depends_on = [
|
|
1406
|
-
aws_iam_role_policy.proxy_secret_access,
|
|
1407
|
-
aws_secretsmanager_secret_version.credentials,
|
|
1408
|
-
]
|
|
1409
1252
|
}
|
|
1410
1253
|
|
|
1411
1254
|
resource "aws_db_proxy_default_target_group" "default" {
|
|
@@ -1437,9 +1280,9 @@ resource "null_resource" "proxy_target_ready" {
|
|
|
1437
1280
|
deadline=$((start_time + 600))
|
|
1438
1281
|
while true; do
|
|
1439
1282
|
target_state=$(aws rds describe-db-proxy-targets \\
|
|
1440
|
-
--region
|
|
1441
|
-
--db-proxy-name
|
|
1442
|
-
--target-group-name
|
|
1283
|
+
--region "$AWS_REGION" \\
|
|
1284
|
+
--db-proxy-name "$DB_PROXY_NAME" \\
|
|
1285
|
+
--target-group-name "$TARGET_GROUP_NAME" \\
|
|
1443
1286
|
--query "Targets[?Type=='RDS_INSTANCE'] | [0].TargetHealth.State" \\
|
|
1444
1287
|
--output text)
|
|
1445
1288
|
|
|
@@ -1449,13 +1292,19 @@ resource "null_resource" "proxy_target_ready" {
|
|
|
1449
1292
|
|
|
1450
1293
|
current_time=$(date +%s)
|
|
1451
1294
|
if [ "$current_time" -ge "$deadline" ]; then
|
|
1452
|
-
echo "RDS Proxy target
|
|
1295
|
+
echo "RDS Proxy target $DB_CLUSTER_IDENTIFIER did not become AVAILABLE within 10 minutes. Last state: $target_state"
|
|
1453
1296
|
exit 1
|
|
1454
1297
|
fi
|
|
1455
1298
|
|
|
1456
1299
|
sleep 10
|
|
1457
1300
|
done
|
|
1458
1301
|
EOT
|
|
1302
|
+
environment = {
|
|
1303
|
+
AWS_REGION = data.aws_region.current.region
|
|
1304
|
+
DB_PROXY_NAME = self.triggers.db_proxy_name
|
|
1305
|
+
TARGET_GROUP_NAME = self.triggers.target_group_name
|
|
1306
|
+
DB_CLUSTER_IDENTIFIER = self.triggers.db_cluster_identifier
|
|
1307
|
+
}
|
|
1459
1308
|
}
|
|
1460
1309
|
|
|
1461
1310
|
depends_on = [
|
|
@@ -1582,11 +1431,21 @@ output "proxy_resource_id" {
|
|
|
1582
1431
|
value = var.enable_rds_proxy ? split(":", aws_db_proxy.aurora[0].arn)[6] : null
|
|
1583
1432
|
}
|
|
1584
1433
|
|
|
1434
|
+
output "connect_resource_id" {
|
|
1435
|
+
description = "Resource ID to use in IAM rds-db:connect policies for the application database user. Resolves to the RDS Proxy resource ID when the proxy is enabled (the default), or the Aurora cluster resource ID when it is disabled — connecting through the proxy and connecting directly to the cluster are different IAM permission boundaries."
|
|
1436
|
+
value = var.enable_rds_proxy ? split(":", aws_db_proxy.aurora[0].arn)[6] : aws_rds_cluster.database.cluster_resource_id
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1585
1439
|
output "cluster_endpoint" {
|
|
1586
1440
|
description = "Writer endpoint of the Aurora cluster or proxy."
|
|
1587
1441
|
value = var.enable_rds_proxy ? aws_db_proxy.aurora[0].endpoint : aws_rds_cluster.database.endpoint
|
|
1588
1442
|
}
|
|
1589
1443
|
|
|
1444
|
+
output "writer_endpoint" {
|
|
1445
|
+
description = "Writer endpoint of the Aurora cluster itself, bypassing the RDS Proxy. Used by the admin-credentialled handlers, which connect directly to the cluster."
|
|
1446
|
+
value = aws_rds_cluster.database.endpoint
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1590
1449
|
output "reader_endpoint" {
|
|
1591
1450
|
description = "Reader endpoint of the Aurora cluster."
|
|
1592
1451
|
value = aws_rds_cluster.database.reader_endpoint
|
|
@@ -1613,12 +1472,12 @@ output "proxy_role_name" {
|
|
|
1613
1472
|
}
|
|
1614
1473
|
|
|
1615
1474
|
output "secret_arn" {
|
|
1616
|
-
description = "ARN of the
|
|
1617
|
-
value =
|
|
1475
|
+
description = "ARN of the RDS-managed admin credentials secret. Its value is a JSON object with username and password only — connection details come from this module's other outputs."
|
|
1476
|
+
value = one(aws_rds_cluster.database.master_user_secret[*].secret_arn)
|
|
1618
1477
|
}
|
|
1619
1478
|
|
|
1620
1479
|
output "kms_key_arn" {
|
|
1621
|
-
description = "ARN of the KMS key protecting Aurora and
|
|
1480
|
+
description = "ARN of the KMS key protecting Aurora and its admin credentials secret."
|
|
1622
1481
|
value = aws_kms_key.database.arn
|
|
1623
1482
|
}
|
|
1624
1483
|
|
|
@@ -1643,8 +1502,8 @@ output "database_name" {
|
|
|
1643
1502
|
}
|
|
1644
1503
|
|
|
1645
1504
|
output "admin_user" {
|
|
1646
|
-
description = "Admin username stored in the
|
|
1647
|
-
value =
|
|
1505
|
+
description = "Admin username stored in the RDS-managed credentials secret."
|
|
1506
|
+
value = aws_rds_cluster.database.master_username
|
|
1648
1507
|
}
|
|
1649
1508
|
"
|
|
1650
1509
|
`;
|
|
@@ -1656,19 +1515,23 @@ exports[`ts#rdb generator > should generate terraform modules when iac is Terraf
|
|
|
1656
1515
|
required_providers {
|
|
1657
1516
|
archive = {
|
|
1658
1517
|
source = "hashicorp/archive"
|
|
1659
|
-
version = "
|
|
1518
|
+
version = "2.8.0"
|
|
1660
1519
|
}
|
|
1661
1520
|
aws = {
|
|
1662
1521
|
source = "hashicorp/aws"
|
|
1663
|
-
version = "
|
|
1522
|
+
version = "6.62.0"
|
|
1523
|
+
}
|
|
1524
|
+
external = {
|
|
1525
|
+
source = "hashicorp/external"
|
|
1526
|
+
version = "2.4.1"
|
|
1664
1527
|
}
|
|
1665
1528
|
null = {
|
|
1666
1529
|
source = "hashicorp/null"
|
|
1667
|
-
version = "
|
|
1530
|
+
version = "3.3.1"
|
|
1668
1531
|
}
|
|
1669
1532
|
random = {
|
|
1670
1533
|
source = "hashicorp/random"
|
|
1671
|
-
version = "
|
|
1534
|
+
version = "3.9.0"
|
|
1672
1535
|
}
|
|
1673
1536
|
}
|
|
1674
1537
|
}
|
|
@@ -1736,16 +1599,10 @@ variable "enable_rds_proxy" {
|
|
|
1736
1599
|
default = true
|
|
1737
1600
|
}
|
|
1738
1601
|
|
|
1739
|
-
variable "enable_credential_rotation" {
|
|
1740
|
-
description = "Whether to enable automatic credential rotation for the admin secret."
|
|
1741
|
-
type = bool
|
|
1742
|
-
default = true
|
|
1743
|
-
}
|
|
1744
|
-
|
|
1745
1602
|
variable "enable_cloudwatch_logs" {
|
|
1746
|
-
description = "Whether to export Aurora engine logs to CloudWatch. PostgreSQL
|
|
1603
|
+
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."
|
|
1747
1604
|
type = bool
|
|
1748
|
-
default =
|
|
1605
|
+
default = true
|
|
1749
1606
|
}
|
|
1750
1607
|
|
|
1751
1608
|
variable "enable_performance_insights" {
|
|
@@ -1766,18 +1623,25 @@ variable "enable_backup" {
|
|
|
1766
1623
|
default = false
|
|
1767
1624
|
}
|
|
1768
1625
|
|
|
1626
|
+
variable "enable_key_rotation" {
|
|
1627
|
+
description = "Whether to enable automatic key rotation on the KMS key used to encrypt the Aurora cluster and its credentials secret."
|
|
1628
|
+
type = bool
|
|
1629
|
+
default = true
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1769
1632
|
variable "tags" {
|
|
1770
1633
|
description = "Tags to apply to all resources."
|
|
1771
1634
|
type = map(string)
|
|
1772
1635
|
default = {}
|
|
1773
1636
|
}
|
|
1774
1637
|
|
|
1775
|
-
variable "
|
|
1638
|
+
variable "migration_docker_image_tag" {
|
|
1776
1639
|
description = "Docker image tag for the migration handler. Defaults to the tag built by the Nx docker target."
|
|
1777
1640
|
type = string
|
|
1778
1641
|
default = "proj-db-migration:latest"
|
|
1779
1642
|
}
|
|
1780
1643
|
|
|
1644
|
+
|
|
1781
1645
|
variable "asset_bucket_name" {
|
|
1782
1646
|
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."
|
|
1783
1647
|
type = string
|
|
@@ -1793,10 +1657,12 @@ resource "random_string" "suffix" {
|
|
|
1793
1657
|
}
|
|
1794
1658
|
|
|
1795
1659
|
locals {
|
|
1796
|
-
|
|
1797
|
-
|
|
1660
|
+
config = jsondecode(file("\${path.module}/../../../../../../../packages/db/config.json"))
|
|
1661
|
+
runtime_config_key = local.config.runtimeConfigKey
|
|
1662
|
+
create_db_user_bundle_path = "\${path.module}/../../../../../../../dist/packages/db/bundle/create-db-user"
|
|
1663
|
+
migration_function_name = "db-migration-\${random_string.suffix.result}"
|
|
1798
1664
|
create_db_user_function_name = "db-create-db-user-\${random_string.suffix.result}"
|
|
1799
|
-
database_runtime_user
|
|
1665
|
+
database_runtime_user = "db_\${random_string.suffix.result}"
|
|
1800
1666
|
}
|
|
1801
1667
|
|
|
1802
1668
|
module "aurora" {
|
|
@@ -1805,7 +1671,6 @@ module "aurora" {
|
|
|
1805
1671
|
name = "db"
|
|
1806
1672
|
vpc_id = var.vpc_id
|
|
1807
1673
|
subnet_ids = var.database_subnet_ids
|
|
1808
|
-
lambda_subnet_ids = var.lambda_subnet_ids
|
|
1809
1674
|
engine = "aurora-postgresql"
|
|
1810
1675
|
engine_version = var.engine_version
|
|
1811
1676
|
database_name = "database_name"
|
|
@@ -1817,11 +1682,11 @@ module "aurora" {
|
|
|
1817
1682
|
deletion_protection = var.deletion_protection
|
|
1818
1683
|
skip_final_snapshot = var.skip_final_snapshot
|
|
1819
1684
|
enable_rds_proxy = var.enable_rds_proxy
|
|
1820
|
-
enable_credential_rotation = var.enable_credential_rotation
|
|
1821
1685
|
enable_cloudwatch_logs = var.enable_cloudwatch_logs
|
|
1822
1686
|
enable_performance_insights = var.enable_performance_insights
|
|
1823
1687
|
performance_insights_retention_period = var.performance_insights_retention_period
|
|
1824
1688
|
enable_backup = var.enable_backup
|
|
1689
|
+
enable_key_rotation = var.enable_key_rotation
|
|
1825
1690
|
tags = var.tags
|
|
1826
1691
|
}
|
|
1827
1692
|
|
|
@@ -1862,7 +1727,7 @@ module "add_rdb_to_runtime_config" {
|
|
|
1862
1727
|
source = "../../../core/runtime-config/entry"
|
|
1863
1728
|
|
|
1864
1729
|
namespace = "database"
|
|
1865
|
-
key =
|
|
1730
|
+
key = local.runtime_config_key
|
|
1866
1731
|
value = {
|
|
1867
1732
|
hostname = module.aurora.cluster_endpoint
|
|
1868
1733
|
port = module.aurora.cluster_port
|
|
@@ -1875,9 +1740,8 @@ module "add_rdb_to_runtime_config" {
|
|
|
1875
1740
|
|
|
1876
1741
|
resource "aws_ecr_repository" "migration_handler" {
|
|
1877
1742
|
#checkov:skip=CKV_AWS_136:AES256 encryption is sufficient for ECR repositories
|
|
1878
|
-
#checkov:skip=CKV_AWS_51:Mutable tags are intentional; the migration handler is always pushed as latest and redeployment is gated on docker_digest changes in null_resource.docker_publish
|
|
1879
1743
|
name = "db-migration-\${random_string.suffix.result}"
|
|
1880
|
-
image_tag_mutability = "
|
|
1744
|
+
image_tag_mutability = "IMMUTABLE"
|
|
1881
1745
|
force_delete = true
|
|
1882
1746
|
|
|
1883
1747
|
image_scanning_configuration {
|
|
@@ -1925,22 +1789,34 @@ resource "aws_ecr_repository_policy" "migration_handler" {
|
|
|
1925
1789
|
}
|
|
1926
1790
|
|
|
1927
1791
|
data "external" "docker_digest" {
|
|
1928
|
-
program = ["sh", "-c", "echo '{\\"digest\\":\\"'$(docker inspect \${var.
|
|
1792
|
+
program = ["sh", "-c", "echo '{\\"digest\\":\\"'$(docker inspect \${var.migration_docker_image_tag} --format '{{.Id}}')'\\"}' "]
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1795
|
+
locals {
|
|
1796
|
+
# Content-based, immutable image tag derived from the local image digest
|
|
1797
|
+
image_tag = replace(data.external.docker_digest.result.digest, "sha256:", "")
|
|
1929
1798
|
}
|
|
1930
1799
|
|
|
1931
1800
|
resource "null_resource" "docker_publish" {
|
|
1932
1801
|
triggers = {
|
|
1933
1802
|
docker_digest = data.external.docker_digest.result.digest
|
|
1934
1803
|
repository_url = aws_ecr_repository.migration_handler.repository_url
|
|
1935
|
-
|
|
1804
|
+
migration_docker_image_tag = var.migration_docker_image_tag
|
|
1805
|
+
image_tag = local.image_tag
|
|
1936
1806
|
}
|
|
1937
1807
|
|
|
1938
1808
|
provisioner "local-exec" {
|
|
1939
1809
|
command = <<-EOT
|
|
1940
|
-
aws ecr get-login-password --region
|
|
1941
|
-
docker tag
|
|
1942
|
-
docker push
|
|
1810
|
+
aws ecr get-login-password --region "$AWS_REGION" | docker login --username AWS --password-stdin "$REPOSITORY_URL"
|
|
1811
|
+
docker tag "$MIGRATION_DOCKER_IMAGE_TAG" "$REPOSITORY_URL:$IMAGE_TAG"
|
|
1812
|
+
docker push "$REPOSITORY_URL:$IMAGE_TAG"
|
|
1943
1813
|
EOT
|
|
1814
|
+
environment = {
|
|
1815
|
+
AWS_REGION = data.aws_region.current.region
|
|
1816
|
+
REPOSITORY_URL = self.triggers.repository_url
|
|
1817
|
+
MIGRATION_DOCKER_IMAGE_TAG = self.triggers.migration_docker_image_tag
|
|
1818
|
+
IMAGE_TAG = self.triggers.image_tag
|
|
1819
|
+
}
|
|
1944
1820
|
}
|
|
1945
1821
|
|
|
1946
1822
|
depends_on = [aws_ecr_repository_policy.migration_handler]
|
|
@@ -1989,11 +1865,16 @@ resource "aws_iam_role_policy" "migration_handler_access" {
|
|
|
1989
1865
|
{
|
|
1990
1866
|
Effect = "Allow"
|
|
1991
1867
|
Action = [
|
|
1992
|
-
"
|
|
1868
|
+
"secretsmanager:GetSecretValue"
|
|
1993
1869
|
]
|
|
1994
|
-
Resource = [
|
|
1995
|
-
|
|
1870
|
+
Resource = [module.aurora.secret_arn]
|
|
1871
|
+
},
|
|
1872
|
+
{
|
|
1873
|
+
Effect = "Allow"
|
|
1874
|
+
Action = [
|
|
1875
|
+
"kms:Decrypt"
|
|
1996
1876
|
]
|
|
1877
|
+
Resource = [module.aurora.kms_key_arn]
|
|
1997
1878
|
}
|
|
1998
1879
|
]
|
|
1999
1880
|
})
|
|
@@ -2082,7 +1963,7 @@ resource "aws_security_group" "migration_handler" {
|
|
|
2082
1963
|
|
|
2083
1964
|
resource "aws_vpc_security_group_egress_rule" "migration_handler_to_database" {
|
|
2084
1965
|
security_group_id = aws_security_group.migration_handler.id
|
|
2085
|
-
referenced_security_group_id = module.aurora.
|
|
1966
|
+
referenced_security_group_id = module.aurora.database_security_group_id
|
|
2086
1967
|
from_port = module.aurora.cluster_port
|
|
2087
1968
|
to_port = module.aurora.cluster_port
|
|
2088
1969
|
ip_protocol = "tcp"
|
|
@@ -2124,7 +2005,7 @@ resource "aws_vpc_security_group_egress_rule" "create_db_user_https" {
|
|
|
2124
2005
|
}
|
|
2125
2006
|
|
|
2126
2007
|
resource "aws_vpc_security_group_ingress_rule" "migration_handler_to_database" {
|
|
2127
|
-
security_group_id = module.aurora.
|
|
2008
|
+
security_group_id = module.aurora.database_security_group_id
|
|
2128
2009
|
referenced_security_group_id = aws_security_group.migration_handler.id
|
|
2129
2010
|
from_port = module.aurora.cluster_port
|
|
2130
2011
|
to_port = module.aurora.cluster_port
|
|
@@ -2169,6 +2050,9 @@ resource "aws_lambda_function" "create_db_user" {
|
|
|
2169
2050
|
environment {
|
|
2170
2051
|
variables = {
|
|
2171
2052
|
DATABASE_SECRET_ARN = module.aurora.secret_arn
|
|
2053
|
+
DATABASE_HOST = module.aurora.writer_endpoint
|
|
2054
|
+
DATABASE_PORT = module.aurora.cluster_port
|
|
2055
|
+
DATABASE_NAME = module.aurora.database_name
|
|
2172
2056
|
NODE_EXTRA_CA_CERTS = "/var/runtime/ca-cert.pem"
|
|
2173
2057
|
}
|
|
2174
2058
|
}
|
|
@@ -2198,10 +2082,10 @@ resource "null_resource" "create_db_user_trigger" {
|
|
|
2198
2082
|
command = <<-EOT
|
|
2199
2083
|
output_file=$(mktemp)
|
|
2200
2084
|
response=$(aws lambda invoke \\
|
|
2201
|
-
--region
|
|
2202
|
-
--function-name
|
|
2085
|
+
--region "$AWS_REGION" \\
|
|
2086
|
+
--function-name "$FUNCTION_NAME" \\
|
|
2203
2087
|
--cli-binary-format raw-in-base64-out \\
|
|
2204
|
-
--payload
|
|
2088
|
+
--payload "{\\"RequestType\\":\\"Create\\",\\"PhysicalResourceId\\":\\"db-user:$DB_USER\\"}" \\
|
|
2205
2089
|
"$output_file")
|
|
2206
2090
|
cat "$output_file"
|
|
2207
2091
|
echo "$response"
|
|
@@ -2211,6 +2095,11 @@ resource "null_resource" "create_db_user_trigger" {
|
|
|
2211
2095
|
fi
|
|
2212
2096
|
rm -f "$output_file"
|
|
2213
2097
|
EOT
|
|
2098
|
+
environment = {
|
|
2099
|
+
AWS_REGION = data.aws_region.current.region
|
|
2100
|
+
FUNCTION_NAME = self.triggers.function_name
|
|
2101
|
+
DB_USER = self.triggers.db_user
|
|
2102
|
+
}
|
|
2214
2103
|
}
|
|
2215
2104
|
|
|
2216
2105
|
depends_on = [aws_lambda_function.create_db_user, module.aurora]
|
|
@@ -2224,7 +2113,7 @@ resource "aws_lambda_function" "migration_handler" {
|
|
|
2224
2113
|
package_type = "Image"
|
|
2225
2114
|
function_name = local.migration_function_name
|
|
2226
2115
|
role = aws_iam_role.migration_handler.arn
|
|
2227
|
-
image_uri = "\${aws_ecr_repository.migration_handler.repository_url}
|
|
2116
|
+
image_uri = "\${aws_ecr_repository.migration_handler.repository_url}:\${local.image_tag}"
|
|
2228
2117
|
memory_size = 1024
|
|
2229
2118
|
timeout = 300
|
|
2230
2119
|
architectures = ["arm64"]
|
|
@@ -2240,10 +2129,10 @@ resource "aws_lambda_function" "migration_handler" {
|
|
|
2240
2129
|
|
|
2241
2130
|
environment {
|
|
2242
2131
|
variables = {
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2132
|
+
DATABASE_SECRET_ARN = module.aurora.secret_arn
|
|
2133
|
+
DATABASE_HOST = module.aurora.writer_endpoint
|
|
2134
|
+
DATABASE_PORT = module.aurora.cluster_port
|
|
2135
|
+
DATABASE_NAME = module.aurora.database_name
|
|
2247
2136
|
}
|
|
2248
2137
|
}
|
|
2249
2138
|
|
|
@@ -2273,8 +2162,8 @@ resource "null_resource" "migration_trigger" {
|
|
|
2273
2162
|
command = <<-EOT
|
|
2274
2163
|
output_file=$(mktemp)
|
|
2275
2164
|
response=$(aws lambda invoke \\
|
|
2276
|
-
--region
|
|
2277
|
-
--function-name
|
|
2165
|
+
--region "$AWS_REGION" \\
|
|
2166
|
+
--function-name "$FUNCTION_NAME" \\
|
|
2278
2167
|
--cli-binary-format raw-in-base64-out \\
|
|
2279
2168
|
"$output_file")
|
|
2280
2169
|
cat "$output_file"
|
|
@@ -2285,6 +2174,10 @@ resource "null_resource" "migration_trigger" {
|
|
|
2285
2174
|
fi
|
|
2286
2175
|
rm -f "$output_file"
|
|
2287
2176
|
EOT
|
|
2177
|
+
environment = {
|
|
2178
|
+
AWS_REGION = data.aws_region.current.region
|
|
2179
|
+
FUNCTION_NAME = self.triggers.function_name
|
|
2180
|
+
}
|
|
2288
2181
|
}
|
|
2289
2182
|
|
|
2290
2183
|
depends_on = [
|
|
@@ -2315,6 +2208,11 @@ output "proxy_resource_id" {
|
|
|
2315
2208
|
value = module.aurora.proxy_resource_id
|
|
2316
2209
|
}
|
|
2317
2210
|
|
|
2211
|
+
output "connect_resource_id" {
|
|
2212
|
+
description = "Resource ID to use in IAM rds-db:connect policies for the application database user. Resolves to the RDS Proxy resource ID when the proxy is enabled (the default), or the Aurora cluster resource ID when it is disabled — connecting through the proxy and connecting directly to the cluster are different IAM permission boundaries."
|
|
2213
|
+
value = module.aurora.connect_resource_id
|
|
2214
|
+
}
|
|
2215
|
+
|
|
2318
2216
|
output "kms_key_arn" {
|
|
2319
2217
|
description = "ARN of the KMS key protecting Aurora and the admin credentials secret, used to grant decrypt access alongside secret_arn."
|
|
2320
2218
|
value = module.aurora.kms_key_arn
|
|
@@ -2349,13 +2247,13 @@ output "database_runtime_user" {
|
|
|
2349
2247
|
description = "Application database user created for IAM-authenticated access."
|
|
2350
2248
|
value = local.database_runtime_user
|
|
2351
2249
|
}
|
|
2352
|
-
|
|
2353
2250
|
"
|
|
2354
2251
|
`;
|
|
2355
2252
|
|
|
2356
2253
|
exports[`ts#rdb generator > should generate terraform modules with MySQL engine 1`] = `
|
|
2357
2254
|
"# Core Aurora module
|
|
2358
|
-
# This module creates an Aurora cluster
|
|
2255
|
+
# This module creates an Aurora cluster whose admin credentials are generated
|
|
2256
|
+
# and rotated by RDS in Secrets Manager.
|
|
2359
2257
|
|
|
2360
2258
|
terraform {
|
|
2361
2259
|
required_version = ">= 1.0"
|
|
@@ -2363,15 +2261,15 @@ terraform {
|
|
|
2363
2261
|
required_providers {
|
|
2364
2262
|
aws = {
|
|
2365
2263
|
source = "hashicorp/aws"
|
|
2366
|
-
version = "
|
|
2264
|
+
version = "6.62.0"
|
|
2367
2265
|
}
|
|
2368
2266
|
null = {
|
|
2369
2267
|
source = "hashicorp/null"
|
|
2370
|
-
version = "
|
|
2268
|
+
version = "3.3.1"
|
|
2371
2269
|
}
|
|
2372
2270
|
random = {
|
|
2373
2271
|
source = "hashicorp/random"
|
|
2374
|
-
version = "
|
|
2272
|
+
version = "3.9.0"
|
|
2375
2273
|
}
|
|
2376
2274
|
}
|
|
2377
2275
|
}
|
|
@@ -2399,11 +2297,6 @@ variable "subnet_ids" {
|
|
|
2399
2297
|
type = list(string)
|
|
2400
2298
|
}
|
|
2401
2299
|
|
|
2402
|
-
variable "lambda_subnet_ids" {
|
|
2403
|
-
description = "Subnet IDs for the credential-rotation Lambda. Must have outbound egress to AWS service endpoints (e.g. Secrets Manager) — use private subnets with a NAT gateway."
|
|
2404
|
-
type = list(string)
|
|
2405
|
-
}
|
|
2406
|
-
|
|
2407
2300
|
variable "engine" {
|
|
2408
2301
|
description = "Aurora engine to use."
|
|
2409
2302
|
type = string
|
|
@@ -2473,16 +2366,10 @@ variable "enable_rds_proxy" {
|
|
|
2473
2366
|
default = true
|
|
2474
2367
|
}
|
|
2475
2368
|
|
|
2476
|
-
variable "enable_credential_rotation" {
|
|
2477
|
-
description = "Whether to enable automatic credential rotation for the admin secret."
|
|
2478
|
-
type = bool
|
|
2479
|
-
default = true
|
|
2480
|
-
}
|
|
2481
|
-
|
|
2482
2369
|
variable "enable_cloudwatch_logs" {
|
|
2483
|
-
description = "Whether to export Aurora engine logs to CloudWatch. PostgreSQL
|
|
2370
|
+
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."
|
|
2484
2371
|
type = bool
|
|
2485
|
-
default =
|
|
2372
|
+
default = true
|
|
2486
2373
|
}
|
|
2487
2374
|
|
|
2488
2375
|
variable "enable_performance_insights" {
|
|
@@ -2537,11 +2424,30 @@ resource "aws_rds_cluster_parameter_group" "database" {
|
|
|
2537
2424
|
family = local.parameter_group_family
|
|
2538
2425
|
description = "Parameter group for \${var.name} Aurora cluster"
|
|
2539
2426
|
|
|
2427
|
+
# Only safe statement-at-a-time; a multi-statement batch mixing DDL with
|
|
2428
|
+
# DML (e.g. one \`psql -c "a;b;c"\` call) logs the whole raw text verbatim,
|
|
2429
|
+
# including any literal DML values.
|
|
2540
2430
|
dynamic "parameter" {
|
|
2541
2431
|
for_each = var.engine == "aurora-postgresql" ? [1] : []
|
|
2542
2432
|
content {
|
|
2543
2433
|
name = "log_statement"
|
|
2544
|
-
value = "
|
|
2434
|
+
value = "ddl"
|
|
2435
|
+
}
|
|
2436
|
+
}
|
|
2437
|
+
|
|
2438
|
+
dynamic "parameter" {
|
|
2439
|
+
for_each = var.engine == "aurora-mysql" ? [1] : []
|
|
2440
|
+
content {
|
|
2441
|
+
name = "server_audit_logging"
|
|
2442
|
+
value = "1"
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2445
|
+
|
|
2446
|
+
dynamic "parameter" {
|
|
2447
|
+
for_each = var.engine == "aurora-mysql" ? [1] : []
|
|
2448
|
+
content {
|
|
2449
|
+
name = "server_audit_events"
|
|
2450
|
+
value = "CONNECT,QUERY_DDL"
|
|
2545
2451
|
}
|
|
2546
2452
|
}
|
|
2547
2453
|
|
|
@@ -2552,6 +2458,8 @@ resource "aws_kms_key" "database" {
|
|
|
2552
2458
|
description = "KMS key for Aurora cluster \${var.name}"
|
|
2553
2459
|
enable_key_rotation = var.enable_key_rotation
|
|
2554
2460
|
|
|
2461
|
+
deletion_window_in_days = 30
|
|
2462
|
+
|
|
2555
2463
|
policy = jsonencode({
|
|
2556
2464
|
Version = "2012-10-17"
|
|
2557
2465
|
Statement = [
|
|
@@ -2579,6 +2487,20 @@ resource "aws_kms_key" "database" {
|
|
|
2579
2487
|
"kms:CreateGrant"
|
|
2580
2488
|
]
|
|
2581
2489
|
Resource = "*"
|
|
2490
|
+
},
|
|
2491
|
+
{
|
|
2492
|
+
Sid = "AllowSecretsManagerService"
|
|
2493
|
+
Effect = "Allow"
|
|
2494
|
+
Principal = {
|
|
2495
|
+
Service = "secretsmanager.amazonaws.com"
|
|
2496
|
+
}
|
|
2497
|
+
Action = [
|
|
2498
|
+
"kms:Encrypt",
|
|
2499
|
+
"kms:Decrypt",
|
|
2500
|
+
"kms:GenerateDataKey*",
|
|
2501
|
+
"kms:DescribeKey"
|
|
2502
|
+
]
|
|
2503
|
+
Resource = "*"
|
|
2582
2504
|
}
|
|
2583
2505
|
]
|
|
2584
2506
|
})
|
|
@@ -2633,44 +2555,16 @@ resource "aws_db_subnet_group" "database" {
|
|
|
2633
2555
|
})
|
|
2634
2556
|
}
|
|
2635
2557
|
|
|
2636
|
-
resource "random_password" "master_password" {
|
|
2637
|
-
length = 32
|
|
2638
|
-
special = true
|
|
2639
|
-
override_special = "!#$%&*()-_=+[]{}<>:?"
|
|
2640
|
-
}
|
|
2641
|
-
|
|
2642
|
-
resource "aws_secretsmanager_secret" "credentials" {
|
|
2643
|
-
#checkov:skip=CKV2_AWS_57:Rotation is configured via aws_cloudformation_stack.credentials_rotation using the AWS::SecretsManager-2024-09-16 transform; Checkov cannot resolve rotation schedules created by CloudFormation transforms
|
|
2644
|
-
name_prefix = "\${var.name}-aurora-credentials-"
|
|
2645
|
-
kms_key_id = aws_kms_key.database.arn
|
|
2646
|
-
|
|
2647
|
-
tags = merge(var.tags, {
|
|
2648
|
-
Name = "\${var.name}-aurora-credentials"
|
|
2649
|
-
})
|
|
2650
|
-
}
|
|
2651
|
-
|
|
2652
|
-
resource "aws_secretsmanager_secret_version" "credentials" {
|
|
2653
|
-
secret_id = aws_secretsmanager_secret.credentials.id
|
|
2654
|
-
secret_string = jsonencode({
|
|
2655
|
-
engine = var.engine == "aurora-mysql" ? "mysql" : "postgres"
|
|
2656
|
-
username = var.admin_user
|
|
2657
|
-
password = random_password.master_password.result
|
|
2658
|
-
host = aws_rds_cluster.database.endpoint
|
|
2659
|
-
port = aws_rds_cluster.database.port
|
|
2660
|
-
dbname = var.database_name
|
|
2661
|
-
dbClusterIdentifier = aws_rds_cluster.database.cluster_identifier
|
|
2662
|
-
})
|
|
2663
|
-
}
|
|
2664
|
-
|
|
2665
2558
|
resource "aws_rds_cluster" "database" {
|
|
2666
|
-
#checkov:skip=CKV2_AWS_27:Query logging
|
|
2559
|
+
#checkov:skip=CKV2_AWS_27:Query logging is enabled by default via enable_cloudwatch_logs; checkov cannot resolve the conditional count expression on aws_rds_cluster_parameter_group.database
|
|
2667
2560
|
#checkov:skip=CKV_AWS_139:Deletion protection is enabled but checkov is unable to detect it correctly
|
|
2668
2561
|
cluster_identifier = local.cluster_name
|
|
2669
2562
|
engine = var.engine
|
|
2670
2563
|
engine_version = coalesce(var.engine_version, local.default_engine_version)
|
|
2671
2564
|
database_name = var.database_name
|
|
2672
2565
|
master_username = var.admin_user
|
|
2673
|
-
|
|
2566
|
+
manage_master_user_password = true
|
|
2567
|
+
master_user_secret_kms_key_id = aws_kms_key.database.arn
|
|
2674
2568
|
db_subnet_group_name = aws_db_subnet_group.database.name
|
|
2675
2569
|
db_cluster_parameter_group_name = var.enable_cloudwatch_logs ? aws_rds_cluster_parameter_group.database[0].name : null
|
|
2676
2570
|
vpc_security_group_ids = [aws_security_group.database.id]
|
|
@@ -2684,7 +2578,7 @@ resource "aws_rds_cluster" "database" {
|
|
|
2684
2578
|
monitoring_interval = 5
|
|
2685
2579
|
monitoring_role_arn = aws_iam_role.enhanced_monitoring.arn
|
|
2686
2580
|
copy_tags_to_snapshot = true
|
|
2687
|
-
enabled_cloudwatch_logs_exports = var.enable_cloudwatch_logs ? (var.engine == "aurora-mysql" ? ["audit", "error"
|
|
2581
|
+
enabled_cloudwatch_logs_exports = var.enable_cloudwatch_logs ? (var.engine == "aurora-mysql" ? ["audit", "error"] : ["postgresql"]) : null
|
|
2688
2582
|
|
|
2689
2583
|
serverlessv2_scaling_configuration {
|
|
2690
2584
|
min_capacity = var.serverless_min_capacity
|
|
@@ -2694,6 +2588,10 @@ resource "aws_rds_cluster" "database" {
|
|
|
2694
2588
|
tags = merge(var.tags, {
|
|
2695
2589
|
Name = "\${var.name}-aurora"
|
|
2696
2590
|
})
|
|
2591
|
+
|
|
2592
|
+
lifecycle {
|
|
2593
|
+
prevent_destroy = true
|
|
2594
|
+
}
|
|
2697
2595
|
}
|
|
2698
2596
|
|
|
2699
2597
|
resource "aws_rds_cluster_instance" "database" {
|
|
@@ -2718,75 +2616,6 @@ resource "aws_rds_cluster_instance" "database" {
|
|
|
2718
2616
|
})
|
|
2719
2617
|
}
|
|
2720
2618
|
|
|
2721
|
-
resource "aws_security_group" "rotation" {
|
|
2722
|
-
#checkov:skip=CKV2_AWS_5:Security group is attached to the hosted rotation Lambda created by AWS::SecretsManager::RotationSchedule; Checkov cannot resolve resources created by the CloudFormation transform
|
|
2723
|
-
count = var.enable_credential_rotation ? 1 : 0
|
|
2724
|
-
name_prefix = "\${var.name}-aurora-rotation-"
|
|
2725
|
-
description = "Security group for Aurora secret rotation \${var.name}"
|
|
2726
|
-
vpc_id = var.vpc_id
|
|
2727
|
-
|
|
2728
|
-
tags = merge(var.tags, {
|
|
2729
|
-
Name = "\${var.name}-aurora-rotation"
|
|
2730
|
-
})
|
|
2731
|
-
}
|
|
2732
|
-
|
|
2733
|
-
resource "aws_vpc_security_group_egress_rule" "rotation_to_database" {
|
|
2734
|
-
count = var.enable_credential_rotation ? 1 : 0
|
|
2735
|
-
security_group_id = aws_security_group.rotation[0].id
|
|
2736
|
-
referenced_security_group_id = aws_security_group.database.id
|
|
2737
|
-
from_port = coalesce(var.port, local.default_port)
|
|
2738
|
-
to_port = coalesce(var.port, local.default_port)
|
|
2739
|
-
ip_protocol = "tcp"
|
|
2740
|
-
description = "Allow outbound database traffic from secret rotation Lambda"
|
|
2741
|
-
}
|
|
2742
|
-
|
|
2743
|
-
resource "aws_vpc_security_group_ingress_rule" "rotation_to_database" {
|
|
2744
|
-
count = var.enable_credential_rotation ? 1 : 0
|
|
2745
|
-
security_group_id = aws_security_group.database.id
|
|
2746
|
-
referenced_security_group_id = aws_security_group.rotation[0].id
|
|
2747
|
-
from_port = coalesce(var.port, local.default_port)
|
|
2748
|
-
to_port = coalesce(var.port, local.default_port)
|
|
2749
|
-
ip_protocol = "tcp"
|
|
2750
|
-
description = "Allow inbound database traffic from secret rotation Lambda"
|
|
2751
|
-
}
|
|
2752
|
-
|
|
2753
|
-
resource "aws_cloudformation_stack" "credentials_rotation" {
|
|
2754
|
-
#checkov:skip=CKV_AWS_124:SNS event notifications are not required for the credentials rotation stack
|
|
2755
|
-
count = var.enable_credential_rotation ? 1 : 0
|
|
2756
|
-
name = "\${local.cluster_name}-credentials-rotation"
|
|
2757
|
-
|
|
2758
|
-
capabilities = ["CAPABILITY_IAM", "CAPABILITY_AUTO_EXPAND"]
|
|
2759
|
-
|
|
2760
|
-
template_body = jsonencode({
|
|
2761
|
-
AWSTemplateFormatVersion = "2010-09-09"
|
|
2762
|
-
Transform = "AWS::SecretsManager-2024-09-16"
|
|
2763
|
-
Resources = {
|
|
2764
|
-
CredentialsRotationSchedule = {
|
|
2765
|
-
Type = "AWS::SecretsManager::RotationSchedule"
|
|
2766
|
-
Properties = {
|
|
2767
|
-
SecretId = aws_secretsmanager_secret.credentials.arn
|
|
2768
|
-
HostedRotationLambda = {
|
|
2769
|
-
RotationType = var.engine == "aurora-mysql" ? "MySQLSingleUser" : "PostgreSQLSingleUser"
|
|
2770
|
-
RotationLambdaName = "\${local.cluster_name}-credentials-rotation"
|
|
2771
|
-
VpcSecurityGroupIds = aws_security_group.rotation[0].id
|
|
2772
|
-
VpcSubnetIds = join(",", var.lambda_subnet_ids)
|
|
2773
|
-
}
|
|
2774
|
-
RotationRules = {
|
|
2775
|
-
AutomaticallyAfterDays = 30
|
|
2776
|
-
}
|
|
2777
|
-
}
|
|
2778
|
-
}
|
|
2779
|
-
}
|
|
2780
|
-
})
|
|
2781
|
-
|
|
2782
|
-
depends_on = [
|
|
2783
|
-
aws_secretsmanager_secret_version.credentials,
|
|
2784
|
-
aws_rds_cluster_instance.database,
|
|
2785
|
-
aws_vpc_security_group_egress_rule.rotation_to_database,
|
|
2786
|
-
aws_vpc_security_group_ingress_rule.rotation_to_database,
|
|
2787
|
-
]
|
|
2788
|
-
}
|
|
2789
|
-
|
|
2790
2619
|
resource "aws_iam_role" "proxy" {
|
|
2791
2620
|
count = var.enable_rds_proxy ? 1 : 0
|
|
2792
2621
|
|
|
@@ -2810,27 +2639,6 @@ resource "aws_iam_role" "proxy" {
|
|
|
2810
2639
|
})
|
|
2811
2640
|
}
|
|
2812
2641
|
|
|
2813
|
-
resource "aws_iam_role_policy" "proxy_secret_access" {
|
|
2814
|
-
count = var.enable_rds_proxy ? 1 : 0
|
|
2815
|
-
role = aws_iam_role.proxy[0].name
|
|
2816
|
-
|
|
2817
|
-
policy = jsonencode({
|
|
2818
|
-
Version = "2012-10-17"
|
|
2819
|
-
Statement = [
|
|
2820
|
-
{
|
|
2821
|
-
Effect = "Allow"
|
|
2822
|
-
Action = ["secretsmanager:GetSecretValue"]
|
|
2823
|
-
Resource = [aws_secretsmanager_secret.credentials.arn]
|
|
2824
|
-
},
|
|
2825
|
-
{
|
|
2826
|
-
Effect = "Allow"
|
|
2827
|
-
Action = ["kms:Decrypt"]
|
|
2828
|
-
Resource = [aws_kms_key.database.arn]
|
|
2829
|
-
}
|
|
2830
|
-
]
|
|
2831
|
-
})
|
|
2832
|
-
}
|
|
2833
|
-
|
|
2834
2642
|
resource "aws_security_group" "proxy" {
|
|
2835
2643
|
#checkov:skip=CKV2_AWS_5:Security group is attached to aws_db_proxy.aurora; Checkov cannot resolve count-conditional cross-resource references
|
|
2836
2644
|
count = var.enable_rds_proxy ? 1 : 0
|
|
@@ -2854,17 +2662,6 @@ resource "aws_db_proxy" "aurora" {
|
|
|
2854
2662
|
vpc_subnet_ids = var.subnet_ids
|
|
2855
2663
|
vpc_security_group_ids = [aws_security_group.proxy[0].id]
|
|
2856
2664
|
require_tls = true
|
|
2857
|
-
|
|
2858
|
-
auth {
|
|
2859
|
-
auth_scheme = "SECRETS"
|
|
2860
|
-
iam_auth = "REQUIRED"
|
|
2861
|
-
secret_arn = aws_secretsmanager_secret.credentials.arn
|
|
2862
|
-
}
|
|
2863
|
-
|
|
2864
|
-
depends_on = [
|
|
2865
|
-
aws_iam_role_policy.proxy_secret_access,
|
|
2866
|
-
aws_secretsmanager_secret_version.credentials,
|
|
2867
|
-
]
|
|
2868
2665
|
}
|
|
2869
2666
|
|
|
2870
2667
|
resource "aws_db_proxy_default_target_group" "default" {
|
|
@@ -2896,9 +2693,9 @@ resource "null_resource" "proxy_target_ready" {
|
|
|
2896
2693
|
deadline=$((start_time + 600))
|
|
2897
2694
|
while true; do
|
|
2898
2695
|
target_state=$(aws rds describe-db-proxy-targets \\
|
|
2899
|
-
--region
|
|
2900
|
-
--db-proxy-name
|
|
2901
|
-
--target-group-name
|
|
2696
|
+
--region "$AWS_REGION" \\
|
|
2697
|
+
--db-proxy-name "$DB_PROXY_NAME" \\
|
|
2698
|
+
--target-group-name "$TARGET_GROUP_NAME" \\
|
|
2902
2699
|
--query "Targets[?Type=='RDS_INSTANCE'] | [0].TargetHealth.State" \\
|
|
2903
2700
|
--output text)
|
|
2904
2701
|
|
|
@@ -2908,13 +2705,19 @@ resource "null_resource" "proxy_target_ready" {
|
|
|
2908
2705
|
|
|
2909
2706
|
current_time=$(date +%s)
|
|
2910
2707
|
if [ "$current_time" -ge "$deadline" ]; then
|
|
2911
|
-
echo "RDS Proxy target
|
|
2708
|
+
echo "RDS Proxy target $DB_CLUSTER_IDENTIFIER did not become AVAILABLE within 10 minutes. Last state: $target_state"
|
|
2912
2709
|
exit 1
|
|
2913
2710
|
fi
|
|
2914
2711
|
|
|
2915
2712
|
sleep 10
|
|
2916
2713
|
done
|
|
2917
2714
|
EOT
|
|
2715
|
+
environment = {
|
|
2716
|
+
AWS_REGION = data.aws_region.current.region
|
|
2717
|
+
DB_PROXY_NAME = self.triggers.db_proxy_name
|
|
2718
|
+
TARGET_GROUP_NAME = self.triggers.target_group_name
|
|
2719
|
+
DB_CLUSTER_IDENTIFIER = self.triggers.db_cluster_identifier
|
|
2720
|
+
}
|
|
2918
2721
|
}
|
|
2919
2722
|
|
|
2920
2723
|
depends_on = [
|
|
@@ -3041,11 +2844,21 @@ output "proxy_resource_id" {
|
|
|
3041
2844
|
value = var.enable_rds_proxy ? split(":", aws_db_proxy.aurora[0].arn)[6] : null
|
|
3042
2845
|
}
|
|
3043
2846
|
|
|
2847
|
+
output "connect_resource_id" {
|
|
2848
|
+
description = "Resource ID to use in IAM rds-db:connect policies for the application database user. Resolves to the RDS Proxy resource ID when the proxy is enabled (the default), or the Aurora cluster resource ID when it is disabled — connecting through the proxy and connecting directly to the cluster are different IAM permission boundaries."
|
|
2849
|
+
value = var.enable_rds_proxy ? split(":", aws_db_proxy.aurora[0].arn)[6] : aws_rds_cluster.database.cluster_resource_id
|
|
2850
|
+
}
|
|
2851
|
+
|
|
3044
2852
|
output "cluster_endpoint" {
|
|
3045
2853
|
description = "Writer endpoint of the Aurora cluster or proxy."
|
|
3046
2854
|
value = var.enable_rds_proxy ? aws_db_proxy.aurora[0].endpoint : aws_rds_cluster.database.endpoint
|
|
3047
2855
|
}
|
|
3048
2856
|
|
|
2857
|
+
output "writer_endpoint" {
|
|
2858
|
+
description = "Writer endpoint of the Aurora cluster itself, bypassing the RDS Proxy. Used by the admin-credentialled handlers, which connect directly to the cluster."
|
|
2859
|
+
value = aws_rds_cluster.database.endpoint
|
|
2860
|
+
}
|
|
2861
|
+
|
|
3049
2862
|
output "reader_endpoint" {
|
|
3050
2863
|
description = "Reader endpoint of the Aurora cluster."
|
|
3051
2864
|
value = aws_rds_cluster.database.reader_endpoint
|
|
@@ -3072,12 +2885,12 @@ output "proxy_role_name" {
|
|
|
3072
2885
|
}
|
|
3073
2886
|
|
|
3074
2887
|
output "secret_arn" {
|
|
3075
|
-
description = "ARN of the
|
|
3076
|
-
value =
|
|
2888
|
+
description = "ARN of the RDS-managed admin credentials secret. Its value is a JSON object with username and password only — connection details come from this module's other outputs."
|
|
2889
|
+
value = one(aws_rds_cluster.database.master_user_secret[*].secret_arn)
|
|
3077
2890
|
}
|
|
3078
2891
|
|
|
3079
2892
|
output "kms_key_arn" {
|
|
3080
|
-
description = "ARN of the KMS key protecting Aurora and
|
|
2893
|
+
description = "ARN of the KMS key protecting Aurora and its admin credentials secret."
|
|
3081
2894
|
value = aws_kms_key.database.arn
|
|
3082
2895
|
}
|
|
3083
2896
|
|
|
@@ -3102,8 +2915,8 @@ output "database_name" {
|
|
|
3102
2915
|
}
|
|
3103
2916
|
|
|
3104
2917
|
output "admin_user" {
|
|
3105
|
-
description = "Admin username stored in the
|
|
3106
|
-
value =
|
|
2918
|
+
description = "Admin username stored in the RDS-managed credentials secret."
|
|
2919
|
+
value = aws_rds_cluster.database.master_username
|
|
3107
2920
|
}
|
|
3108
2921
|
"
|
|
3109
2922
|
`;
|
|
@@ -3115,19 +2928,23 @@ exports[`ts#rdb generator > should generate terraform modules with MySQL engine
|
|
|
3115
2928
|
required_providers {
|
|
3116
2929
|
archive = {
|
|
3117
2930
|
source = "hashicorp/archive"
|
|
3118
|
-
version = "
|
|
2931
|
+
version = "2.8.0"
|
|
3119
2932
|
}
|
|
3120
2933
|
aws = {
|
|
3121
2934
|
source = "hashicorp/aws"
|
|
3122
|
-
version = "
|
|
2935
|
+
version = "6.62.0"
|
|
2936
|
+
}
|
|
2937
|
+
external = {
|
|
2938
|
+
source = "hashicorp/external"
|
|
2939
|
+
version = "2.4.1"
|
|
3123
2940
|
}
|
|
3124
2941
|
null = {
|
|
3125
2942
|
source = "hashicorp/null"
|
|
3126
|
-
version = "
|
|
2943
|
+
version = "3.3.1"
|
|
3127
2944
|
}
|
|
3128
2945
|
random = {
|
|
3129
2946
|
source = "hashicorp/random"
|
|
3130
|
-
version = "
|
|
2947
|
+
version = "3.9.0"
|
|
3131
2948
|
}
|
|
3132
2949
|
}
|
|
3133
2950
|
}
|
|
@@ -3195,16 +3012,10 @@ variable "enable_rds_proxy" {
|
|
|
3195
3012
|
default = true
|
|
3196
3013
|
}
|
|
3197
3014
|
|
|
3198
|
-
variable "enable_credential_rotation" {
|
|
3199
|
-
description = "Whether to enable automatic credential rotation for the admin secret."
|
|
3200
|
-
type = bool
|
|
3201
|
-
default = true
|
|
3202
|
-
}
|
|
3203
|
-
|
|
3204
3015
|
variable "enable_cloudwatch_logs" {
|
|
3205
|
-
description = "Whether to export Aurora engine logs to CloudWatch. PostgreSQL
|
|
3016
|
+
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."
|
|
3206
3017
|
type = bool
|
|
3207
|
-
default =
|
|
3018
|
+
default = true
|
|
3208
3019
|
}
|
|
3209
3020
|
|
|
3210
3021
|
variable "enable_performance_insights" {
|
|
@@ -3225,18 +3036,25 @@ variable "enable_backup" {
|
|
|
3225
3036
|
default = false
|
|
3226
3037
|
}
|
|
3227
3038
|
|
|
3039
|
+
variable "enable_key_rotation" {
|
|
3040
|
+
description = "Whether to enable automatic key rotation on the KMS key used to encrypt the Aurora cluster and its credentials secret."
|
|
3041
|
+
type = bool
|
|
3042
|
+
default = true
|
|
3043
|
+
}
|
|
3044
|
+
|
|
3228
3045
|
variable "tags" {
|
|
3229
3046
|
description = "Tags to apply to all resources."
|
|
3230
3047
|
type = map(string)
|
|
3231
3048
|
default = {}
|
|
3232
3049
|
}
|
|
3233
3050
|
|
|
3234
|
-
variable "
|
|
3051
|
+
variable "migration_docker_image_tag" {
|
|
3235
3052
|
description = "Docker image tag for the migration handler. Defaults to the tag built by the Nx docker target."
|
|
3236
3053
|
type = string
|
|
3237
3054
|
default = "proj-db-migration:latest"
|
|
3238
3055
|
}
|
|
3239
3056
|
|
|
3057
|
+
|
|
3240
3058
|
variable "asset_bucket_name" {
|
|
3241
3059
|
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."
|
|
3242
3060
|
type = string
|
|
@@ -3252,10 +3070,12 @@ resource "random_string" "suffix" {
|
|
|
3252
3070
|
}
|
|
3253
3071
|
|
|
3254
3072
|
locals {
|
|
3255
|
-
|
|
3256
|
-
|
|
3073
|
+
config = jsondecode(file("\${path.module}/../../../../../../../packages/db/config.json"))
|
|
3074
|
+
runtime_config_key = local.config.runtimeConfigKey
|
|
3075
|
+
create_db_user_bundle_path = "\${path.module}/../../../../../../../dist/packages/db/bundle/create-db-user"
|
|
3076
|
+
migration_function_name = "db-migration-\${random_string.suffix.result}"
|
|
3257
3077
|
create_db_user_function_name = "db-create-db-user-\${random_string.suffix.result}"
|
|
3258
|
-
database_runtime_user
|
|
3078
|
+
database_runtime_user = "db_\${random_string.suffix.result}"
|
|
3259
3079
|
}
|
|
3260
3080
|
|
|
3261
3081
|
module "aurora" {
|
|
@@ -3264,7 +3084,6 @@ module "aurora" {
|
|
|
3264
3084
|
name = "db"
|
|
3265
3085
|
vpc_id = var.vpc_id
|
|
3266
3086
|
subnet_ids = var.database_subnet_ids
|
|
3267
|
-
lambda_subnet_ids = var.lambda_subnet_ids
|
|
3268
3087
|
engine = "aurora-mysql"
|
|
3269
3088
|
engine_version = var.engine_version
|
|
3270
3089
|
database_name = "database_name"
|
|
@@ -3276,11 +3095,11 @@ module "aurora" {
|
|
|
3276
3095
|
deletion_protection = var.deletion_protection
|
|
3277
3096
|
skip_final_snapshot = var.skip_final_snapshot
|
|
3278
3097
|
enable_rds_proxy = var.enable_rds_proxy
|
|
3279
|
-
enable_credential_rotation = var.enable_credential_rotation
|
|
3280
3098
|
enable_cloudwatch_logs = var.enable_cloudwatch_logs
|
|
3281
3099
|
enable_performance_insights = var.enable_performance_insights
|
|
3282
3100
|
performance_insights_retention_period = var.performance_insights_retention_period
|
|
3283
3101
|
enable_backup = var.enable_backup
|
|
3102
|
+
enable_key_rotation = var.enable_key_rotation
|
|
3284
3103
|
tags = var.tags
|
|
3285
3104
|
}
|
|
3286
3105
|
|
|
@@ -3321,7 +3140,7 @@ module "add_rdb_to_runtime_config" {
|
|
|
3321
3140
|
source = "../../../core/runtime-config/entry"
|
|
3322
3141
|
|
|
3323
3142
|
namespace = "database"
|
|
3324
|
-
key =
|
|
3143
|
+
key = local.runtime_config_key
|
|
3325
3144
|
value = {
|
|
3326
3145
|
hostname = module.aurora.cluster_endpoint
|
|
3327
3146
|
port = module.aurora.cluster_port
|
|
@@ -3334,9 +3153,8 @@ module "add_rdb_to_runtime_config" {
|
|
|
3334
3153
|
|
|
3335
3154
|
resource "aws_ecr_repository" "migration_handler" {
|
|
3336
3155
|
#checkov:skip=CKV_AWS_136:AES256 encryption is sufficient for ECR repositories
|
|
3337
|
-
#checkov:skip=CKV_AWS_51:Mutable tags are intentional; the migration handler is always pushed as latest and redeployment is gated on docker_digest changes in null_resource.docker_publish
|
|
3338
3156
|
name = "db-migration-\${random_string.suffix.result}"
|
|
3339
|
-
image_tag_mutability = "
|
|
3157
|
+
image_tag_mutability = "IMMUTABLE"
|
|
3340
3158
|
force_delete = true
|
|
3341
3159
|
|
|
3342
3160
|
image_scanning_configuration {
|
|
@@ -3384,22 +3202,34 @@ resource "aws_ecr_repository_policy" "migration_handler" {
|
|
|
3384
3202
|
}
|
|
3385
3203
|
|
|
3386
3204
|
data "external" "docker_digest" {
|
|
3387
|
-
program = ["sh", "-c", "echo '{\\"digest\\":\\"'$(docker inspect \${var.
|
|
3205
|
+
program = ["sh", "-c", "echo '{\\"digest\\":\\"'$(docker inspect \${var.migration_docker_image_tag} --format '{{.Id}}')'\\"}' "]
|
|
3206
|
+
}
|
|
3207
|
+
|
|
3208
|
+
locals {
|
|
3209
|
+
# Content-based, immutable image tag derived from the local image digest
|
|
3210
|
+
image_tag = replace(data.external.docker_digest.result.digest, "sha256:", "")
|
|
3388
3211
|
}
|
|
3389
3212
|
|
|
3390
3213
|
resource "null_resource" "docker_publish" {
|
|
3391
3214
|
triggers = {
|
|
3392
3215
|
docker_digest = data.external.docker_digest.result.digest
|
|
3393
3216
|
repository_url = aws_ecr_repository.migration_handler.repository_url
|
|
3394
|
-
|
|
3217
|
+
migration_docker_image_tag = var.migration_docker_image_tag
|
|
3218
|
+
image_tag = local.image_tag
|
|
3395
3219
|
}
|
|
3396
3220
|
|
|
3397
3221
|
provisioner "local-exec" {
|
|
3398
3222
|
command = <<-EOT
|
|
3399
|
-
aws ecr get-login-password --region
|
|
3400
|
-
docker tag
|
|
3401
|
-
docker push
|
|
3223
|
+
aws ecr get-login-password --region "$AWS_REGION" | docker login --username AWS --password-stdin "$REPOSITORY_URL"
|
|
3224
|
+
docker tag "$MIGRATION_DOCKER_IMAGE_TAG" "$REPOSITORY_URL:$IMAGE_TAG"
|
|
3225
|
+
docker push "$REPOSITORY_URL:$IMAGE_TAG"
|
|
3402
3226
|
EOT
|
|
3227
|
+
environment = {
|
|
3228
|
+
AWS_REGION = data.aws_region.current.region
|
|
3229
|
+
REPOSITORY_URL = self.triggers.repository_url
|
|
3230
|
+
MIGRATION_DOCKER_IMAGE_TAG = self.triggers.migration_docker_image_tag
|
|
3231
|
+
IMAGE_TAG = self.triggers.image_tag
|
|
3232
|
+
}
|
|
3403
3233
|
}
|
|
3404
3234
|
|
|
3405
3235
|
depends_on = [aws_ecr_repository_policy.migration_handler]
|
|
@@ -3633,6 +3463,9 @@ resource "aws_lambda_function" "create_db_user" {
|
|
|
3633
3463
|
environment {
|
|
3634
3464
|
variables = {
|
|
3635
3465
|
DATABASE_SECRET_ARN = module.aurora.secret_arn
|
|
3466
|
+
DATABASE_HOST = module.aurora.writer_endpoint
|
|
3467
|
+
DATABASE_PORT = module.aurora.cluster_port
|
|
3468
|
+
DATABASE_NAME = module.aurora.database_name
|
|
3636
3469
|
NODE_EXTRA_CA_CERTS = "/var/runtime/ca-cert.pem"
|
|
3637
3470
|
}
|
|
3638
3471
|
}
|
|
@@ -3662,10 +3495,10 @@ resource "null_resource" "create_db_user_trigger" {
|
|
|
3662
3495
|
command = <<-EOT
|
|
3663
3496
|
output_file=$(mktemp)
|
|
3664
3497
|
response=$(aws lambda invoke \\
|
|
3665
|
-
--region
|
|
3666
|
-
--function-name
|
|
3498
|
+
--region "$AWS_REGION" \\
|
|
3499
|
+
--function-name "$FUNCTION_NAME" \\
|
|
3667
3500
|
--cli-binary-format raw-in-base64-out \\
|
|
3668
|
-
--payload
|
|
3501
|
+
--payload "{\\"RequestType\\":\\"Create\\",\\"PhysicalResourceId\\":\\"db-user:$DB_USER\\"}" \\
|
|
3669
3502
|
"$output_file")
|
|
3670
3503
|
cat "$output_file"
|
|
3671
3504
|
echo "$response"
|
|
@@ -3675,6 +3508,11 @@ resource "null_resource" "create_db_user_trigger" {
|
|
|
3675
3508
|
fi
|
|
3676
3509
|
rm -f "$output_file"
|
|
3677
3510
|
EOT
|
|
3511
|
+
environment = {
|
|
3512
|
+
AWS_REGION = data.aws_region.current.region
|
|
3513
|
+
FUNCTION_NAME = self.triggers.function_name
|
|
3514
|
+
DB_USER = self.triggers.db_user
|
|
3515
|
+
}
|
|
3678
3516
|
}
|
|
3679
3517
|
|
|
3680
3518
|
depends_on = [aws_lambda_function.create_db_user, module.aurora]
|
|
@@ -3688,7 +3526,7 @@ resource "aws_lambda_function" "migration_handler" {
|
|
|
3688
3526
|
package_type = "Image"
|
|
3689
3527
|
function_name = local.migration_function_name
|
|
3690
3528
|
role = aws_iam_role.migration_handler.arn
|
|
3691
|
-
image_uri = "\${aws_ecr_repository.migration_handler.repository_url}
|
|
3529
|
+
image_uri = "\${aws_ecr_repository.migration_handler.repository_url}:\${local.image_tag}"
|
|
3692
3530
|
memory_size = 1024
|
|
3693
3531
|
timeout = 300
|
|
3694
3532
|
architectures = ["arm64"]
|
|
@@ -3705,6 +3543,9 @@ resource "aws_lambda_function" "migration_handler" {
|
|
|
3705
3543
|
environment {
|
|
3706
3544
|
variables = {
|
|
3707
3545
|
DATABASE_SECRET_ARN = module.aurora.secret_arn
|
|
3546
|
+
DATABASE_HOST = module.aurora.writer_endpoint
|
|
3547
|
+
DATABASE_PORT = module.aurora.cluster_port
|
|
3548
|
+
DATABASE_NAME = module.aurora.database_name
|
|
3708
3549
|
}
|
|
3709
3550
|
}
|
|
3710
3551
|
|
|
@@ -3733,8 +3574,8 @@ resource "null_resource" "migration_trigger" {
|
|
|
3733
3574
|
command = <<-EOT
|
|
3734
3575
|
output_file=$(mktemp)
|
|
3735
3576
|
response=$(aws lambda invoke \\
|
|
3736
|
-
--region
|
|
3737
|
-
--function-name
|
|
3577
|
+
--region "$AWS_REGION" \\
|
|
3578
|
+
--function-name "$FUNCTION_NAME" \\
|
|
3738
3579
|
--cli-binary-format raw-in-base64-out \\
|
|
3739
3580
|
"$output_file")
|
|
3740
3581
|
cat "$output_file"
|
|
@@ -3745,6 +3586,10 @@ resource "null_resource" "migration_trigger" {
|
|
|
3745
3586
|
fi
|
|
3746
3587
|
rm -f "$output_file"
|
|
3747
3588
|
EOT
|
|
3589
|
+
environment = {
|
|
3590
|
+
AWS_REGION = data.aws_region.current.region
|
|
3591
|
+
FUNCTION_NAME = self.triggers.function_name
|
|
3592
|
+
}
|
|
3748
3593
|
}
|
|
3749
3594
|
|
|
3750
3595
|
depends_on = [
|
|
@@ -3775,6 +3620,11 @@ output "proxy_resource_id" {
|
|
|
3775
3620
|
value = module.aurora.proxy_resource_id
|
|
3776
3621
|
}
|
|
3777
3622
|
|
|
3623
|
+
output "connect_resource_id" {
|
|
3624
|
+
description = "Resource ID to use in IAM rds-db:connect policies for the application database user. Resolves to the RDS Proxy resource ID when the proxy is enabled (the default), or the Aurora cluster resource ID when it is disabled — connecting through the proxy and connecting directly to the cluster are different IAM permission boundaries."
|
|
3625
|
+
value = module.aurora.connect_resource_id
|
|
3626
|
+
}
|
|
3627
|
+
|
|
3778
3628
|
output "kms_key_arn" {
|
|
3779
3629
|
description = "ARN of the KMS key protecting Aurora and the admin credentials secret, used to grant decrypt access alongside secret_arn."
|
|
3780
3630
|
value = module.aurora.kms_key_arn
|
|
@@ -3809,7 +3659,6 @@ output "database_runtime_user" {
|
|
|
3809
3659
|
description = "Application database user created for IAM-authenticated access."
|
|
3810
3660
|
value = local.database_runtime_user
|
|
3811
3661
|
}
|
|
3812
|
-
|
|
3813
3662
|
"
|
|
3814
3663
|
`;
|
|
3815
3664
|
|
|
@@ -3835,139 +3684,6 @@ datasource db {
|
|
|
3835
3684
|
"
|
|
3836
3685
|
`;
|
|
3837
3686
|
|
|
3838
|
-
exports[`ts#rdb generator > should generate the aurora shared construct > packages/db/scripts/pull-image.ts 1`] = `
|
|
3839
|
-
"import { spawnSync } from 'child_process';
|
|
3840
|
-
|
|
3841
|
-
const ENGINE = 'docker';
|
|
3842
|
-
const image = process.argv[2];
|
|
3843
|
-
|
|
3844
|
-
const inspect = spawnSync(ENGINE, ['image', 'inspect', image], {
|
|
3845
|
-
stdio: 'ignore',
|
|
3846
|
-
});
|
|
3847
|
-
|
|
3848
|
-
if (inspect.status !== 0) {
|
|
3849
|
-
const pull = spawnSync(ENGINE, ['pull', image], { stdio: 'inherit' });
|
|
3850
|
-
if (pull.status !== 0) {
|
|
3851
|
-
process.exit(pull.status ?? 1);
|
|
3852
|
-
}
|
|
3853
|
-
}
|
|
3854
|
-
"
|
|
3855
|
-
`;
|
|
3856
|
-
|
|
3857
|
-
exports[`ts#rdb generator > should generate the aurora shared construct > packages/db/scripts/start-container.ts 1`] = `
|
|
3858
|
-
"import { spawn, spawnSync } from 'child_process';
|
|
3859
|
-
|
|
3860
|
-
const ENGINE = 'docker';
|
|
3861
|
-
|
|
3862
|
-
const [containerName, image, hostPort, dbName, dbUser, dbPassword] =
|
|
3863
|
-
process.argv.slice(2);
|
|
3864
|
-
|
|
3865
|
-
const containerExists = (): boolean =>
|
|
3866
|
-
spawnSync(ENGINE, ['container', 'inspect', containerName], {
|
|
3867
|
-
stdio: 'ignore',
|
|
3868
|
-
}).status === 0;
|
|
3869
|
-
|
|
3870
|
-
const isRunning = (): boolean => {
|
|
3871
|
-
const result = spawnSync(
|
|
3872
|
-
ENGINE,
|
|
3873
|
-
['container', 'inspect', '-f', '{{.State.Running}}', containerName],
|
|
3874
|
-
{ encoding: 'utf-8' },
|
|
3875
|
-
);
|
|
3876
|
-
return result.status === 0 && result.stdout.trim() === 'true';
|
|
3877
|
-
};
|
|
3878
|
-
|
|
3879
|
-
if (containerExists()) {
|
|
3880
|
-
if (!isRunning()) {
|
|
3881
|
-
const start = spawnSync(ENGINE, ['start', containerName], {
|
|
3882
|
-
stdio: 'inherit',
|
|
3883
|
-
});
|
|
3884
|
-
if (start.status !== 0) process.exit(start.status ?? 1);
|
|
3885
|
-
}
|
|
3886
|
-
} else {
|
|
3887
|
-
const runArgs = (
|
|
3888
|
-
\`run --rm --name \${containerName}\` +
|
|
3889
|
-
\` -e POSTGRES_DB=\${dbName}\` +
|
|
3890
|
-
\` -e POSTGRES_USER=\${dbUser}\` +
|
|
3891
|
-
\` -e POSTGRES_PASSWORD=\${dbPassword}\` +
|
|
3892
|
-
\` -e PGDATA=/var/lib/postgresql/17/docker\` +
|
|
3893
|
-
\` -p \${hostPort}:5432\` +
|
|
3894
|
-
\` -v \${containerName}-data:/var/lib/postgresql\` +
|
|
3895
|
-
\` -d \${image}\`
|
|
3896
|
-
).split(' ');
|
|
3897
|
-
const create = spawnSync(ENGINE, runArgs, { stdio: 'inherit' });
|
|
3898
|
-
if (create.status !== 0) process.exit(create.status ?? 1);
|
|
3899
|
-
}
|
|
3900
|
-
|
|
3901
|
-
const logs = spawn(ENGINE, ['logs', '-f', containerName], {
|
|
3902
|
-
stdio: ['ignore', 'inherit', 'inherit'],
|
|
3903
|
-
});
|
|
3904
|
-
|
|
3905
|
-
let exiting = false;
|
|
3906
|
-
|
|
3907
|
-
const cleanup = () => {
|
|
3908
|
-
if (exiting) return;
|
|
3909
|
-
exiting = true;
|
|
3910
|
-
spawnSync(ENGINE, ['stop', containerName], { stdio: 'ignore' });
|
|
3911
|
-
logs.kill();
|
|
3912
|
-
process.exit(0);
|
|
3913
|
-
};
|
|
3914
|
-
|
|
3915
|
-
process.on('SIGTERM', cleanup);
|
|
3916
|
-
process.on('SIGINT', cleanup);
|
|
3917
|
-
process.on('SIGHUP', cleanup);
|
|
3918
|
-
|
|
3919
|
-
logs.on('exit', (code) => {
|
|
3920
|
-
if (!exiting) process.exit(code ?? 0);
|
|
3921
|
-
});
|
|
3922
|
-
"
|
|
3923
|
-
`;
|
|
3924
|
-
|
|
3925
|
-
exports[`ts#rdb generator > should generate the aurora shared construct > packages/db/scripts/wait-for-db.ts 1`] = `
|
|
3926
|
-
"import { Client } from 'pg';
|
|
3927
|
-
|
|
3928
|
-
const noop = () => undefined;
|
|
3929
|
-
|
|
3930
|
-
const [portArg, dbArg, userArg, passwordArg] = process.argv.slice(2);
|
|
3931
|
-
const timeoutAt = Date.now() + 60000;
|
|
3932
|
-
|
|
3933
|
-
while (Date.now() < timeoutAt) {
|
|
3934
|
-
const client = new Client({
|
|
3935
|
-
host: 'localhost',
|
|
3936
|
-
port: parseInt(portArg),
|
|
3937
|
-
user: userArg,
|
|
3938
|
-
password: passwordArg,
|
|
3939
|
-
database: dbArg,
|
|
3940
|
-
connectionTimeoutMillis: 500,
|
|
3941
|
-
});
|
|
3942
|
-
client.on('error', noop);
|
|
3943
|
-
try {
|
|
3944
|
-
await client.connect();
|
|
3945
|
-
await client.end();
|
|
3946
|
-
console.log('Database is ready.');
|
|
3947
|
-
process.exit(0);
|
|
3948
|
-
} catch {
|
|
3949
|
-
console.log('Database is not ready.');
|
|
3950
|
-
await client.end().catch(noop);
|
|
3951
|
-
}
|
|
3952
|
-
await new Promise((r) => setTimeout(r, 200));
|
|
3953
|
-
}
|
|
3954
|
-
|
|
3955
|
-
throw new Error(\`Timed out waiting for postgres on port \${portArg}\`);
|
|
3956
|
-
"
|
|
3957
|
-
`;
|
|
3958
|
-
|
|
3959
|
-
exports[`ts#rdb generator > should generate the aurora shared construct > packages/db/src/constants.ts 1`] = `
|
|
3960
|
-
"export const DB_PACKAGE_NAME = 'Db';
|
|
3961
|
-
|
|
3962
|
-
// Local development connection details (used when SERVE_LOCAL=true, see serve-local Nx target)
|
|
3963
|
-
export const LOCAL_DB_PORT = 5432;
|
|
3964
|
-
export const LOCAL_DB_HOST = 'localhost';
|
|
3965
|
-
export const LOCAL_DB_NAME = 'database_name';
|
|
3966
|
-
export const LOCAL_DB_USER = 'dbadmin';
|
|
3967
|
-
export const LOCAL_DB_PASSWORD = 'password';
|
|
3968
|
-
"
|
|
3969
|
-
`;
|
|
3970
|
-
|
|
3971
3687
|
exports[`ts#rdb generator > should generate the aurora shared construct > packages/db/src/create-db-user-handler.ts 1`] = `
|
|
3972
3688
|
"import type { CloudFormationCustomResourceEvent } from 'aws-lambda';
|
|
3973
3689
|
import { randomBytes } from 'node:crypto';
|
|
@@ -4017,14 +3733,12 @@ const ensureDatabaseUser = async (dbUser: string): Promise<void> => {
|
|
|
4017
3733
|
|
|
4018
3734
|
await client.query(
|
|
4019
3735
|
\`ALTER ROLE \${quotedDbUser} WITH LOGIN;
|
|
4020
|
-
GRANT
|
|
4021
|
-
GRANT USAGE
|
|
4022
|
-
GRANT
|
|
4023
|
-
GRANT
|
|
4024
|
-
|
|
4025
|
-
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT
|
|
4026
|
-
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL PRIVILEGES ON SEQUENCES TO \${quotedDbUser};
|
|
4027
|
-
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL PRIVILEGES ON FUNCTIONS TO \${quotedDbUser};
|
|
3736
|
+
GRANT CONNECT ON DATABASE \${quotedDbName} TO \${quotedDbUser};
|
|
3737
|
+
GRANT USAGE ON SCHEMA public TO \${quotedDbUser};
|
|
3738
|
+
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO \${quotedDbUser};
|
|
3739
|
+
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO \${quotedDbUser};
|
|
3740
|
+
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO \${quotedDbUser};
|
|
3741
|
+
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT USAGE, SELECT ON SEQUENCES TO \${quotedDbUser};
|
|
4028
3742
|
GRANT rds_iam TO \${quotedDbUser};\`,
|
|
4029
3743
|
);
|
|
4030
3744
|
|
|
@@ -4059,43 +3773,33 @@ export const handler = async (
|
|
|
4059
3773
|
`;
|
|
4060
3774
|
|
|
4061
3775
|
exports[`ts#rdb generator > should generate the aurora shared construct > packages/db/src/index.ts 1`] = `
|
|
4062
|
-
"export
|
|
4063
|
-
|
|
3776
|
+
"export * from './prisma.js';
|
|
3777
|
+
// Export your library code here
|
|
4064
3778
|
"
|
|
4065
3779
|
`;
|
|
4066
3780
|
|
|
4067
3781
|
exports[`ts#rdb generator > should generate the aurora shared construct > packages/db/src/migration-handler.ts 1`] = `
|
|
4068
3782
|
"import { execFile } from 'node:child_process';
|
|
3783
|
+
import { join } from 'node:path';
|
|
4069
3784
|
import { promisify } from 'node:util';
|
|
4070
|
-
import {
|
|
4071
|
-
import { withConnectionRetry } from './utils.js';
|
|
3785
|
+
import { getDatabaseSecret, withConnectionRetry } from './utils.js';
|
|
4072
3786
|
|
|
4073
3787
|
const buildDatabaseUrl = async (): Promise<string> => {
|
|
4074
|
-
const
|
|
4075
|
-
const port = process.env.PORT!;
|
|
4076
|
-
const database = process.env.DATABASE!;
|
|
4077
|
-
const dbUser = process.env.DBUSER!;
|
|
4078
|
-
const region = process.env.AWS_REGION!;
|
|
4079
|
-
|
|
4080
|
-
const iamAuthToken = await new Signer({
|
|
4081
|
-
hostname,
|
|
4082
|
-
port: Number(port),
|
|
4083
|
-
region,
|
|
4084
|
-
username: dbUser,
|
|
4085
|
-
}).getAuthToken();
|
|
3788
|
+
const { host, port, dbname, username, password } = await getDatabaseSecret();
|
|
4086
3789
|
|
|
4087
3790
|
return (
|
|
4088
|
-
\`postgresql://\${encodeURIComponent(
|
|
4089
|
-
\`:\${encodeURIComponent(
|
|
4090
|
-
\`@\${
|
|
4091
|
-
\`?sslaccept=strict\`
|
|
3791
|
+
\`postgresql://\${encodeURIComponent(username)}\` +
|
|
3792
|
+
\`:\${encodeURIComponent(password)}\` +
|
|
3793
|
+
\`@\${host}:\${port}/\${dbname}\` +
|
|
3794
|
+
\`?sslaccept=strict\`
|
|
4092
3795
|
);
|
|
4093
3796
|
};
|
|
4094
3797
|
|
|
4095
3798
|
export const handler = async () => {
|
|
4096
3799
|
await withConnectionRetry(async () => {
|
|
4097
3800
|
const databaseUrl = await buildDatabaseUrl();
|
|
4098
|
-
|
|
3801
|
+
const prisma = join(__dirname, 'node_modules', '.bin', 'prisma');
|
|
3802
|
+
await promisify(execFile)(prisma, ['migrate', 'deploy'], {
|
|
4099
3803
|
cwd: __dirname,
|
|
4100
3804
|
env: {
|
|
4101
3805
|
...process.env,
|
|
@@ -4112,16 +3816,19 @@ exports[`ts#rdb generator > should generate the aurora shared construct > packag
|
|
|
4112
3816
|
import { Signer } from '@aws-sdk/rds-signer';
|
|
4113
3817
|
import { Prisma, PrismaClient } from '../generated/prisma/client.js';
|
|
4114
3818
|
import { Pool } from 'pg';
|
|
4115
|
-
import {
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
LOCAL_DB_NAME,
|
|
4119
|
-
LOCAL_DB_PASSWORD,
|
|
4120
|
-
LOCAL_DB_PORT,
|
|
4121
|
-
LOCAL_DB_USER,
|
|
4122
|
-
} from './constants.js';
|
|
3819
|
+
import { readFileSync } from 'fs';
|
|
3820
|
+
import { join, dirname } from 'path';
|
|
3821
|
+
import { fileURLToPath } from 'url';
|
|
4123
3822
|
import { getDatabaseConfig } from './utils.js';
|
|
4124
3823
|
|
|
3824
|
+
// Generated: must match runtimeConfigKey in config.json
|
|
3825
|
+
const runtimeConfigKey = 'Db';
|
|
3826
|
+
|
|
3827
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
3828
|
+
// config.json is only present in local dev (not included in the deployed bundle); guard with LOCAL_DEV check
|
|
3829
|
+
const localDev = () =>
|
|
3830
|
+
JSON.parse(readFileSync(join(__dirname, '../config.json'), 'utf-8')).localDev;
|
|
3831
|
+
|
|
4125
3832
|
let prismaClient: PrismaClient<Prisma.LogLevel> | undefined;
|
|
4126
3833
|
|
|
4127
3834
|
export const getPrisma = async <LogOpts extends Prisma.LogLevel>(
|
|
@@ -4129,14 +3836,15 @@ export const getPrisma = async <LogOpts extends Prisma.LogLevel>(
|
|
|
4129
3836
|
): Promise<PrismaClient<LogOpts>> => {
|
|
4130
3837
|
if (prismaClient) return prismaClient;
|
|
4131
3838
|
|
|
4132
|
-
if (process.env.
|
|
3839
|
+
if (process.env.LOCAL_DEV === 'true') {
|
|
3840
|
+
const { host, port, dbName, dbUser, dbPassword } = localDev();
|
|
4133
3841
|
const adapter = new PrismaPg(
|
|
4134
3842
|
new Pool({
|
|
4135
|
-
host
|
|
4136
|
-
port
|
|
4137
|
-
database:
|
|
4138
|
-
user:
|
|
4139
|
-
password:
|
|
3843
|
+
host,
|
|
3844
|
+
port,
|
|
3845
|
+
database: dbName,
|
|
3846
|
+
user: dbUser,
|
|
3847
|
+
password: dbPassword,
|
|
4140
3848
|
allowExitOnIdle: true,
|
|
4141
3849
|
}),
|
|
4142
3850
|
);
|
|
@@ -4148,7 +3856,7 @@ export const getPrisma = async <LogOpts extends Prisma.LogLevel>(
|
|
|
4148
3856
|
}
|
|
4149
3857
|
|
|
4150
3858
|
const { hostname, port, database, dbUser, region } =
|
|
4151
|
-
await getDatabaseConfig(
|
|
3859
|
+
await getDatabaseConfig(runtimeConfigKey);
|
|
4152
3860
|
const adapter = new PrismaPg(
|
|
4153
3861
|
new Pool({
|
|
4154
3862
|
host: hostname,
|
|
@@ -4204,6 +3912,24 @@ export type DatabaseSecret = {
|
|
|
4204
3912
|
port: number;
|
|
4205
3913
|
};
|
|
4206
3914
|
|
|
3915
|
+
/**
|
|
3916
|
+
* Connection details for the admin credentials secret. RDS-managed secrets hold
|
|
3917
|
+
* only \`username\` and \`password\`, so the host, port and database name are taken
|
|
3918
|
+
* from the environment when the secret omits them.
|
|
3919
|
+
*/
|
|
3920
|
+
type SecretConnectionOverrides = Partial<
|
|
3921
|
+
Omit<DatabaseSecret, 'username' | 'password'>
|
|
3922
|
+
>;
|
|
3923
|
+
|
|
3924
|
+
const connectionOverridesFromEnv = (): SecretConnectionOverrides => {
|
|
3925
|
+
const { DATABASE_HOST, DATABASE_PORT, DATABASE_NAME } = process.env;
|
|
3926
|
+
return {
|
|
3927
|
+
...(DATABASE_HOST ? { host: DATABASE_HOST } : {}),
|
|
3928
|
+
...(DATABASE_PORT ? { port: Number(DATABASE_PORT) } : {}),
|
|
3929
|
+
...(DATABASE_NAME ? { dbname: DATABASE_NAME } : {}),
|
|
3930
|
+
};
|
|
3931
|
+
};
|
|
3932
|
+
|
|
4207
3933
|
const databaseConfigPromises: Record<string, Promise<DatabaseConfig>> = {};
|
|
4208
3934
|
|
|
4209
3935
|
const getSecretValue = async (secretArn: string): Promise<string> => {
|
|
@@ -4230,7 +3956,18 @@ export const getDatabaseSecret = async (): Promise<DatabaseSecret> => {
|
|
|
4230
3956
|
);
|
|
4231
3957
|
}
|
|
4232
3958
|
|
|
4233
|
-
|
|
3959
|
+
const secret = JSON.parse(await getSecretValue(secretArn)) as DatabaseSecret;
|
|
3960
|
+
const secretWithConnection = { ...secret, ...connectionOverridesFromEnv() };
|
|
3961
|
+
|
|
3962
|
+
for (const key of ['host', 'port', 'dbname'] as const) {
|
|
3963
|
+
if (secretWithConnection[key] == null) {
|
|
3964
|
+
throw new Error(
|
|
3965
|
+
\`Database secret is missing \${key} and no override was provided in the environment.\`,
|
|
3966
|
+
);
|
|
3967
|
+
}
|
|
3968
|
+
}
|
|
3969
|
+
|
|
3970
|
+
return secretWithConnection;
|
|
4234
3971
|
};
|
|
4235
3972
|
|
|
4236
3973
|
const loadDatabaseConfig = async (
|
|
@@ -4278,6 +4015,9 @@ const transientErrorPatterns = [
|
|
|
4278
4015
|
'ECONNREFUSED',
|
|
4279
4016
|
'ENOTFOUND',
|
|
4280
4017
|
'P1000', // Prisma: authentication failed
|
|
4018
|
+
'P1001', // Prisma: can't reach database server
|
|
4019
|
+
'P1002', // Prisma: database server reached but timed out
|
|
4020
|
+
'P1010', // Prisma: user denied access (IAM auth grant not yet propagated)
|
|
4281
4021
|
'ER_ACCESS_DENIED_ERROR', // MySQL: access denied
|
|
4282
4022
|
];
|
|
4283
4023
|
|
|
@@ -4338,14 +4078,10 @@ import { CustomResource } from 'aws-cdk-lib';
|
|
|
4338
4078
|
import { IConnectable, IVpc, Port, SubnetType } from 'aws-cdk-lib/aws-ec2';
|
|
4339
4079
|
import { IGrantable, Role, ServicePrincipal } from 'aws-cdk-lib/aws-iam';
|
|
4340
4080
|
import { Key } from 'aws-cdk-lib/aws-kms';
|
|
4341
|
-
import { Platform } from 'aws-cdk-lib/aws-ecr-assets';
|
|
4342
4081
|
import {
|
|
4343
4082
|
Architecture,
|
|
4344
|
-
Code,
|
|
4345
|
-
DockerImageCode,
|
|
4346
|
-
DockerImageFunction,
|
|
4347
4083
|
Function,
|
|
4348
|
-
|
|
4084
|
+
FunctionOptions,
|
|
4349
4085
|
Tracing,
|
|
4350
4086
|
} from 'aws-cdk-lib/aws-lambda';
|
|
4351
4087
|
import {
|
|
@@ -4461,16 +4197,6 @@ export interface AuroraDatabaseProps extends _AuroraDatabaseProps {
|
|
|
4461
4197
|
*/
|
|
4462
4198
|
readonly runtimeConfigKey: string;
|
|
4463
4199
|
|
|
4464
|
-
/**
|
|
4465
|
-
* Migration bundle used to create a migration handler Lambda.
|
|
4466
|
-
*/
|
|
4467
|
-
readonly migrationBundleDir: string;
|
|
4468
|
-
|
|
4469
|
-
/**
|
|
4470
|
-
* Bundle used to create or reconcile the application database user.
|
|
4471
|
-
*/
|
|
4472
|
-
readonly createDbUserBundleDir: string;
|
|
4473
|
-
|
|
4474
4200
|
/**
|
|
4475
4201
|
* Writer instance for the Aurora cluster.
|
|
4476
4202
|
*/
|
|
@@ -4510,6 +4236,39 @@ export interface AuroraDatabaseProps extends _AuroraDatabaseProps {
|
|
|
4510
4236
|
* @default true
|
|
4511
4237
|
*/
|
|
4512
4238
|
readonly enableKeyRotation?: boolean;
|
|
4239
|
+
|
|
4240
|
+
/**
|
|
4241
|
+
* Whether to export Aurora engine logs to CloudWatch Logs.
|
|
4242
|
+
* See https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_LogAccess.html
|
|
4243
|
+
*
|
|
4244
|
+
* PostgreSQL logs DDL statements only (log_statement=ddl); MySQL enables
|
|
4245
|
+
* Advanced Auditing scoped to connections and DDL (server_audit_events=CONNECT,QUERY_DDL).
|
|
4246
|
+
* Neither logs statement parameter values, to avoid leaking PII into log data.
|
|
4247
|
+
*
|
|
4248
|
+
* @default true
|
|
4249
|
+
*/
|
|
4250
|
+
readonly enableCloudwatchLogs?: boolean;
|
|
4251
|
+
|
|
4252
|
+
/**
|
|
4253
|
+
* Whether to enable Performance Insights on the Aurora writer instance.
|
|
4254
|
+
*
|
|
4255
|
+
* @default true
|
|
4256
|
+
*/
|
|
4257
|
+
readonly enablePerformanceInsights?: boolean;
|
|
4258
|
+
|
|
4259
|
+
/**
|
|
4260
|
+
* Minimum Aurora Serverless v2 ACUs.
|
|
4261
|
+
*
|
|
4262
|
+
* @default 0.5
|
|
4263
|
+
*/
|
|
4264
|
+
readonly serverlessV2MinCapacity?: number;
|
|
4265
|
+
|
|
4266
|
+
/**
|
|
4267
|
+
* Maximum Aurora Serverless v2 ACUs.
|
|
4268
|
+
*
|
|
4269
|
+
* @default 4
|
|
4270
|
+
*/
|
|
4271
|
+
readonly serverlessV2MaxCapacity?: number;
|
|
4513
4272
|
}
|
|
4514
4273
|
|
|
4515
4274
|
/**
|
|
@@ -4530,8 +4289,6 @@ export abstract class AuroraDatabase extends Construct {
|
|
|
4530
4289
|
adminUser,
|
|
4531
4290
|
databaseName,
|
|
4532
4291
|
runtimeConfigKey,
|
|
4533
|
-
migrationBundleDir,
|
|
4534
|
-
createDbUserBundleDir,
|
|
4535
4292
|
vpcSubnets,
|
|
4536
4293
|
writer,
|
|
4537
4294
|
enableRdsProxy = true,
|
|
@@ -4539,6 +4296,10 @@ export abstract class AuroraDatabase extends Construct {
|
|
|
4539
4296
|
deletionProtection = true,
|
|
4540
4297
|
removalPolicy = RemovalPolicy.RETAIN,
|
|
4541
4298
|
enableKeyRotation = true,
|
|
4299
|
+
enableCloudwatchLogs = true,
|
|
4300
|
+
enablePerformanceInsights = true,
|
|
4301
|
+
serverlessV2MinCapacity = 0.5,
|
|
4302
|
+
serverlessV2MaxCapacity = 4,
|
|
4542
4303
|
engine,
|
|
4543
4304
|
engineVersion,
|
|
4544
4305
|
...clusterProps
|
|
@@ -4554,12 +4315,37 @@ export abstract class AuroraDatabase extends Construct {
|
|
|
4554
4315
|
vpc,
|
|
4555
4316
|
vpcSubnets,
|
|
4556
4317
|
engine: engine.clusterEngine(engineVersion ?? engine.defaultVersion),
|
|
4557
|
-
|
|
4318
|
+
serverlessV2MinCapacity,
|
|
4319
|
+
serverlessV2MaxCapacity,
|
|
4320
|
+
writer:
|
|
4321
|
+
writer ??
|
|
4322
|
+
ClusterInstance.serverlessV2('writer', {
|
|
4323
|
+
enablePerformanceInsights,
|
|
4324
|
+
performanceInsightEncryptionKey: enablePerformanceInsights
|
|
4325
|
+
? key
|
|
4326
|
+
: undefined,
|
|
4327
|
+
}),
|
|
4558
4328
|
credentials: Credentials.fromGeneratedSecret(adminUser, {
|
|
4559
4329
|
encryptionKey: key,
|
|
4560
4330
|
}),
|
|
4561
4331
|
iamAuthentication: true,
|
|
4562
4332
|
monitoringInterval: Duration.seconds(5),
|
|
4333
|
+
cloudwatchLogsExports: enableCloudwatchLogs
|
|
4334
|
+
? engine.type === 'mysql'
|
|
4335
|
+
? ['audit', 'error']
|
|
4336
|
+
: ['postgresql']
|
|
4337
|
+
: undefined,
|
|
4338
|
+
parameters: enableCloudwatchLogs
|
|
4339
|
+
? engine.type === 'mysql'
|
|
4340
|
+
? {
|
|
4341
|
+
server_audit_logging: '1',
|
|
4342
|
+
server_audit_events: 'CONNECT,QUERY_DDL',
|
|
4343
|
+
}
|
|
4344
|
+
: // Only safe statement-at-a-time; a multi-statement batch mixing
|
|
4345
|
+
// DDL with DML (e.g. one \`psql -c "a;b;c"\` call) logs the whole
|
|
4346
|
+
// raw text verbatim, including any literal DML values.
|
|
4347
|
+
{ log_statement: 'ddl' }
|
|
4348
|
+
: undefined,
|
|
4563
4349
|
defaultDatabaseName: databaseName,
|
|
4564
4350
|
storageEncrypted: true,
|
|
4565
4351
|
storageEncryptionKey: key,
|
|
@@ -4595,23 +4381,23 @@ export abstract class AuroraDatabase extends Construct {
|
|
|
4595
4381
|
this.proxy?.endpoint ?? this.cluster.clusterEndpoint.hostname;
|
|
4596
4382
|
const databasePort = this.cluster.clusterEndpoint.port;
|
|
4597
4383
|
|
|
4598
|
-
const
|
|
4599
|
-
|
|
4600
|
-
handler: 'index.handler',
|
|
4601
|
-
runtime: Runtime.NODEJS_LATEST,
|
|
4384
|
+
const commonProps: FunctionOptions = {
|
|
4385
|
+
vpc,
|
|
4602
4386
|
timeout: Duration.minutes(5),
|
|
4603
4387
|
tracing: Tracing.ACTIVE,
|
|
4604
|
-
|
|
4388
|
+
architecture: Architecture.ARM_64,
|
|
4389
|
+
};
|
|
4390
|
+
|
|
4391
|
+
const createDbUserHandler = this.createDbUserHandler({
|
|
4392
|
+
...commonProps,
|
|
4605
4393
|
vpcSubnets: {
|
|
4606
4394
|
subnetType: SubnetType.PRIVATE_WITH_EGRESS,
|
|
4607
4395
|
},
|
|
4608
|
-
environment: {
|
|
4609
|
-
DATABASE_SECRET_ARN: this.cluster.secret!.secretArn,
|
|
4610
|
-
NODE_EXTRA_CA_CERTS: '/var/runtime/ca-cert.pem',
|
|
4611
|
-
},
|
|
4612
|
-
architecture: Architecture.ARM_64,
|
|
4613
4396
|
});
|
|
4614
|
-
|
|
4397
|
+
createDbUserHandler.addEnvironment(
|
|
4398
|
+
'DATABASE_SECRET_ARN',
|
|
4399
|
+
this.cluster.secret!.secretArn,
|
|
4400
|
+
);
|
|
4615
4401
|
this.cluster.connections.allowDefaultPortFrom(
|
|
4616
4402
|
createDbUserHandler,
|
|
4617
4403
|
'Allow the create-db-user handler to connect to the database',
|
|
@@ -4648,40 +4434,21 @@ export abstract class AuroraDatabase extends Construct {
|
|
|
4648
4434
|
region: Stack.of(this).region,
|
|
4649
4435
|
});
|
|
4650
4436
|
|
|
4651
|
-
const migrationHandler =
|
|
4652
|
-
|
|
4653
|
-
platform: Platform.LINUX_ARM64,
|
|
4654
|
-
}),
|
|
4437
|
+
const migrationHandler = this.createMigrationHandler({
|
|
4438
|
+
...commonProps,
|
|
4655
4439
|
memorySize: 1024,
|
|
4656
|
-
timeout: Duration.minutes(5),
|
|
4657
|
-
tracing: Tracing.ACTIVE,
|
|
4658
|
-
vpc,
|
|
4659
|
-
environment:
|
|
4660
|
-
engine.type === 'mysql'
|
|
4661
|
-
? {
|
|
4662
|
-
DATABASE_SECRET_ARN: this.cluster.secret!.secretArn,
|
|
4663
|
-
}
|
|
4664
|
-
: {
|
|
4665
|
-
HOSTNAME: databaseHostname,
|
|
4666
|
-
DATABASE: databaseName,
|
|
4667
|
-
PORT: databasePort.toString(),
|
|
4668
|
-
DBUSER: this.dbUser,
|
|
4669
|
-
},
|
|
4670
|
-
architecture: Architecture.ARM_64,
|
|
4671
4440
|
});
|
|
4441
|
+
migrationHandler.addEnvironment(
|
|
4442
|
+
'DATABASE_SECRET_ARN',
|
|
4443
|
+
this.cluster.secret!.secretArn,
|
|
4444
|
+
);
|
|
4445
|
+
this.cluster.connections.allowDefaultPortFrom(migrationHandler);
|
|
4446
|
+
this.grantSecretRead(migrationHandler);
|
|
4672
4447
|
|
|
4673
|
-
|
|
4674
|
-
this.cluster.connections.allowDefaultPortFrom(migrationHandler);
|
|
4675
|
-
this.grantSecretRead(migrationHandler);
|
|
4676
|
-
} else {
|
|
4677
|
-
this.allowDefaultPortFrom(migrationHandler);
|
|
4678
|
-
this.grantConnect(migrationHandler);
|
|
4679
|
-
}
|
|
4680
|
-
|
|
4681
|
-
const trigger = new Trigger(this, 'MigrationTrigger', {
|
|
4448
|
+
const migrationTrigger = new Trigger(this, 'MigrationTrigger', {
|
|
4682
4449
|
handler: migrationHandler,
|
|
4683
4450
|
});
|
|
4684
|
-
|
|
4451
|
+
migrationTrigger.node.addDependency(createDbUserResource);
|
|
4685
4452
|
|
|
4686
4453
|
new CfnOutput(this, 'ClusterEndpoint', {
|
|
4687
4454
|
value: this.cluster.clusterEndpoint.hostname,
|
|
@@ -4694,6 +4461,18 @@ export abstract class AuroraDatabase extends Construct {
|
|
|
4694
4461
|
}
|
|
4695
4462
|
}
|
|
4696
4463
|
|
|
4464
|
+
/**
|
|
4465
|
+
* Creates the Lambda handler used to create or reconcile the application database user.
|
|
4466
|
+
*/
|
|
4467
|
+
protected abstract createDbUserHandler(baseProps: FunctionOptions): Function;
|
|
4468
|
+
|
|
4469
|
+
/**
|
|
4470
|
+
* Creates the Lambda handler used to run database migrations.
|
|
4471
|
+
*/
|
|
4472
|
+
protected abstract createMigrationHandler(
|
|
4473
|
+
baseProps: FunctionOptions,
|
|
4474
|
+
): Function;
|
|
4475
|
+
|
|
4697
4476
|
public allowDefaultPortFrom(other: IConnectable, description?: string): void {
|
|
4698
4477
|
if (this.proxy) {
|
|
4699
4478
|
this.proxy.connections.allowFrom(
|
|
@@ -4722,8 +4501,17 @@ export abstract class AuroraDatabase extends Construct {
|
|
|
4722
4501
|
exports[`ts#rdb generator > should generate the aurora shared construct 2`] = `
|
|
4723
4502
|
"import * as path from 'path';
|
|
4724
4503
|
import * as url from 'url';
|
|
4504
|
+
import { readFileSync } from 'fs';
|
|
4725
4505
|
import { Construct } from 'constructs';
|
|
4726
|
-
import {
|
|
4506
|
+
import { Platform } from 'aws-cdk-lib/aws-ecr-assets';
|
|
4507
|
+
import {
|
|
4508
|
+
Code,
|
|
4509
|
+
DockerImageCode,
|
|
4510
|
+
DockerImageFunction,
|
|
4511
|
+
Function,
|
|
4512
|
+
FunctionOptions,
|
|
4513
|
+
Runtime,
|
|
4514
|
+
} from 'aws-cdk-lib/aws-lambda';
|
|
4727
4515
|
import {
|
|
4728
4516
|
AuroraDatabase,
|
|
4729
4517
|
AuroraDatabaseEngines,
|
|
@@ -4731,14 +4519,29 @@ import {
|
|
|
4731
4519
|
} from '../../core/rdb/aurora.js';
|
|
4732
4520
|
import { findWorkspaceRoot } from '../../core/workspace.js';
|
|
4733
4521
|
|
|
4522
|
+
const { runtimeConfigKey } = JSON.parse(
|
|
4523
|
+
readFileSync(
|
|
4524
|
+
path.join(
|
|
4525
|
+
findWorkspaceRoot(url.fileURLToPath(new URL(import.meta.url))),
|
|
4526
|
+
'packages/db/config.json',
|
|
4527
|
+
),
|
|
4528
|
+
'utf-8',
|
|
4529
|
+
),
|
|
4530
|
+
) as { runtimeConfigKey: string };
|
|
4531
|
+
|
|
4532
|
+
const migrationBundleDir = path.join(
|
|
4533
|
+
findWorkspaceRoot(url.fileURLToPath(new URL(import.meta.url))),
|
|
4534
|
+
'dist/packages/db/bundle/migration',
|
|
4535
|
+
);
|
|
4536
|
+
|
|
4537
|
+
const createDbUserBundleDir = path.join(
|
|
4538
|
+
findWorkspaceRoot(url.fileURLToPath(new URL(import.meta.url))),
|
|
4539
|
+
'dist/packages/db/bundle/create-db-user',
|
|
4540
|
+
);
|
|
4541
|
+
|
|
4734
4542
|
export type DbProps = Omit<
|
|
4735
4543
|
AuroraDatabaseProps,
|
|
4736
|
-
| '
|
|
4737
|
-
| 'adminUser'
|
|
4738
|
-
| 'createDbUserBundleDir'
|
|
4739
|
-
| 'engine'
|
|
4740
|
-
| 'runtimeConfigKey'
|
|
4741
|
-
| 'migrationBundleDir'
|
|
4544
|
+
'databaseName' | 'adminUser' | 'runtimeConfigKey' | 'engine'
|
|
4742
4545
|
>;
|
|
4743
4546
|
|
|
4744
4547
|
/**
|
|
@@ -4750,35 +4553,47 @@ export class Db extends AuroraDatabase {
|
|
|
4750
4553
|
...props,
|
|
4751
4554
|
databaseName: 'database_name',
|
|
4752
4555
|
adminUser: 'databaseUser',
|
|
4753
|
-
runtimeConfigKey
|
|
4754
|
-
migrationBundleDir: path.join(
|
|
4755
|
-
findWorkspaceRoot(url.fileURLToPath(new URL(import.meta.url))),
|
|
4756
|
-
'dist/packages/db/bundle/migration',
|
|
4757
|
-
),
|
|
4758
|
-
createDbUserBundleDir: path.join(
|
|
4759
|
-
findWorkspaceRoot(url.fileURLToPath(new URL(import.meta.url))),
|
|
4760
|
-
'dist/packages/db/bundle/create-db-user',
|
|
4761
|
-
),
|
|
4556
|
+
runtimeConfigKey,
|
|
4762
4557
|
engine: AuroraDatabaseEngines.postgres({}),
|
|
4763
4558
|
});
|
|
4764
4559
|
}
|
|
4560
|
+
|
|
4561
|
+
protected override createDbUserHandler(baseProps: FunctionOptions): Function {
|
|
4562
|
+
return new Function(this, 'CreateDbUserHandler', {
|
|
4563
|
+
...baseProps,
|
|
4564
|
+
code: Code.fromAsset(createDbUserBundleDir),
|
|
4565
|
+
handler: 'index.handler',
|
|
4566
|
+
runtime: Runtime.NODEJS_24_X,
|
|
4567
|
+
environment: {
|
|
4568
|
+
NODE_EXTRA_CA_CERTS: '/var/runtime/ca-cert.pem',
|
|
4569
|
+
},
|
|
4570
|
+
});
|
|
4571
|
+
}
|
|
4572
|
+
|
|
4573
|
+
protected override createMigrationHandler(
|
|
4574
|
+
baseProps: FunctionOptions,
|
|
4575
|
+
): Function {
|
|
4576
|
+
return new DockerImageFunction(this, 'MigrationHandler', {
|
|
4577
|
+
...baseProps,
|
|
4578
|
+
code: DockerImageCode.fromImageAsset(migrationBundleDir, {
|
|
4579
|
+
platform: Platform.LINUX_ARM64,
|
|
4580
|
+
}),
|
|
4581
|
+
});
|
|
4582
|
+
}
|
|
4765
4583
|
}
|
|
4766
4584
|
"
|
|
4767
4585
|
`;
|
|
4768
4586
|
|
|
4769
4587
|
exports[`ts#rdb generator > should generate the aurora shared construct 3`] = `
|
|
4770
4588
|
"import { defineConfig } from 'prisma/config';
|
|
4589
|
+
import { readFileSync } from 'fs';
|
|
4771
4590
|
|
|
4772
4591
|
const getDatabaseUrl = async () => {
|
|
4773
|
-
if (process.env.
|
|
4774
|
-
const {
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
LOCAL_DB_PORT,
|
|
4779
|
-
LOCAL_DB_USER,
|
|
4780
|
-
} = await import('./src/constants.js');
|
|
4781
|
-
return \`postgresql://\${LOCAL_DB_USER}:\${LOCAL_DB_PASSWORD}@\${LOCAL_DB_HOST}:\${LOCAL_DB_PORT}/\${LOCAL_DB_NAME}\`;
|
|
4592
|
+
if (process.env.LOCAL_DEV === 'true') {
|
|
4593
|
+
const { host, port, dbName, dbUser, dbPassword } = JSON.parse(
|
|
4594
|
+
readFileSync('config.json', 'utf-8'),
|
|
4595
|
+
).localDev;
|
|
4596
|
+
return \`postgresql://\${dbUser}:\${dbPassword}@\${host}:\${port}/\${dbName}\`;
|
|
4782
4597
|
}
|
|
4783
4598
|
return process.env.DATABASE_URL;
|
|
4784
4599
|
};
|
|
@@ -4798,9 +4613,27 @@ export default defineConfig({
|
|
|
4798
4613
|
exports[`ts#rdb generator > should generate the aurora shared construct 4`] = `
|
|
4799
4614
|
"FROM public.ecr.aws/lambda/nodejs:24
|
|
4800
4615
|
|
|
4616
|
+
# Upgrade npm to a version free of known HIGH/CRITICAL vulnerabilities
|
|
4617
|
+
RUN npm install -g npm@12.0.2
|
|
4618
|
+
|
|
4619
|
+
# Patch OS packages beyond the base image's pinned release, and drop the
|
|
4620
|
+
# runtime's convenience copy of the AWS SDK (the handler bundle inlines its
|
|
4621
|
+
# own dependencies), keeping the image free of known HIGH/CRITICAL
|
|
4622
|
+
# vulnerabilities
|
|
4623
|
+
RUN microdnf upgrade -y --releasever latest && microdnf clean all \\
|
|
4624
|
+
&& rm -rf /var/runtime/node_modules/@aws-sdk
|
|
4625
|
+
|
|
4801
4626
|
WORKDIR \${LAMBDA_TASK_ROOT}
|
|
4802
4627
|
|
|
4803
|
-
|
|
4628
|
+
# npm blocks dependency install scripts by default; allow prisma's so its
|
|
4629
|
+
# postinstall downloads the schema-engine binary needed to run migrations.
|
|
4630
|
+
# npm is removed once prisma is installed — the handler runs prisma's own
|
|
4631
|
+
# binary directly, and npm's bundled dependencies would otherwise carry known
|
|
4632
|
+
# HIGH/CRITICAL vulnerabilities into the image.
|
|
4633
|
+
RUN printf 'allow-scripts[]=prisma\\nallow-scripts[]=@prisma/engines\\n' > .npmrc \\
|
|
4634
|
+
&& npm install prisma@7.10.0 \\
|
|
4635
|
+
&& rm .npmrc \\
|
|
4636
|
+
&& npm uninstall -g npm
|
|
4804
4637
|
|
|
4805
4638
|
COPY index.js ./index.js
|
|
4806
4639
|
COPY prisma ./prisma
|
|
@@ -4824,7 +4657,7 @@ export default defineConfig([
|
|
|
4824
4657
|
output: {
|
|
4825
4658
|
file: '../../dist/packages/db/bundle/migration/index.js',
|
|
4826
4659
|
format: 'cjs',
|
|
4827
|
-
|
|
4660
|
+
codeSplitting: false,
|
|
4828
4661
|
},
|
|
4829
4662
|
platform: 'node',
|
|
4830
4663
|
},
|
|
@@ -4834,7 +4667,7 @@ export default defineConfig([
|
|
|
4834
4667
|
output: {
|
|
4835
4668
|
file: '../../dist/packages/db/bundle/create-db-user/index.js',
|
|
4836
4669
|
format: 'cjs',
|
|
4837
|
-
|
|
4670
|
+
codeSplitting: false,
|
|
4838
4671
|
},
|
|
4839
4672
|
platform: 'node',
|
|
4840
4673
|
},
|
|
@@ -4846,6 +4679,7 @@ exports[`ts#rdb generator > should generate the aurora shared construct 6`] = `
|
|
|
4846
4679
|
"export * from './rdb/aurora.js';
|
|
4847
4680
|
export * from './app.js';
|
|
4848
4681
|
export * from './checkov.js';
|
|
4682
|
+
export * from './cloudfront.js';
|
|
4849
4683
|
export * from './runtime-config.js';
|
|
4850
4684
|
export * from './workspace.js';
|
|
4851
4685
|
"
|