@aws/nx-plugin 1.0.0-rc.5 → 1.0.0-rc.50
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 +5300 -5843
- package/README.md +7 -7
- package/generators.json +120 -8
- package/migrations.json +21 -0
- package/package.json +39 -20
- package/src/agentcore-gateway/attach-upstream.d.ts +33 -0
- package/src/agentcore-gateway/attach-upstream.js +38 -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/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 +101 -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 +25 -0
- package/src/agentcore-gateway/generator.js +166 -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 +59 -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/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 +71 -0
- package/src/connection/{agent-serve-local.d.ts → agent-local-dev.d.ts} +7 -7
- package/src/connection/agent-local-dev.js +42 -0
- package/src/connection/agent-local-dev.js.map +1 -0
- package/src/connection/agent-runtime-config.d.ts +1 -1
- package/src/connection/agent-runtime-config.js +9 -14
- package/src/connection/agent-runtime-config.js.map +1 -1
- package/src/connection/generator.d.ts +7 -14
- package/src/connection/generator.js +167 -194
- package/src/connection/generator.js.map +1 -1
- package/src/connection/local-dev.d.ts +15 -0
- package/src/connection/local-dev.js +37 -0
- package/src/connection/local-dev.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 +107 -0
- package/src/connection/supported-connections.js +151 -0
- package/src/connection/supported-connections.js.map +1 -0
- package/src/index.js +2 -5
- package/src/index.js.map +1 -1
- package/src/infra/app/__snapshots__/generator.spec.ts.snap +106 -100
- package/src/infra/app/files/app/src/main.ts.template +1 -1
- package/src/infra/app/files/app/src/stages/application-stage.ts.template +1 -1
- package/src/infra/app/generator.d.ts +3 -3
- package/src/infra/app/generator.js +146 -123
- 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 +18 -0
- package/src/init/generator.js +35 -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/license/config-types.d.ts +2 -2
- package/src/license/config-types.js +8 -2
- package/src/license/config-types.js.map +1 -1
- package/src/license/config.d.ts +4 -4
- package/src/license/config.js +267 -242
- package/src/license/config.js.map +1 -1
- package/src/license/dependency-check/check.d.ts +6 -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.d.ts +4 -0
- package/src/license/dependency-check/collectors/python-collector.js +55 -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 +40 -68
- package/src/license/dependency-check/evaluator.js.map +1 -1
- package/src/license/dependency-check/executor.d.ts +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.js +949 -336
- package/src/license/dependency-check/pre-approved.js.map +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 +3 -3
- package/src/license/generator.js +65 -68
- package/src/license/generator.js.map +1 -1
- package/src/license/index.d.ts +2 -2
- package/src/license/index.js +3 -9
- package/src/license/index.js.map +1 -1
- package/src/license/known-exceptions.d.ts +2 -2
- package/src/license/known-exceptions.js +19 -13
- 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.d.ts +2 -2
- 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 +2 -2
- 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 +5 -1
- package/src/mcp-server/generator-info.js +149 -165
- 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 +42 -56
- 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.d.ts +1 -1
- 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 +3 -3
- package/src/mcp-server/tools/general-guidance.js +53 -31
- package/src/mcp-server/tools/general-guidance.js.map +1 -1
- package/src/mcp-server/tools/generator-guide.d.ts +2 -2
- 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 +2 -2
- 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/modernize-function-props-cast/migration.d.ts +6 -0
- package/src/migrations/latest/modernize-function-props-cast/migration.js +66 -0
- package/src/migrations/latest/modernize-function-props-cast/migration.js.map +1 -0
- package/src/migrations/latest/restrict-cors-to-custom-domains/migration.d.ts +6 -0
- package/src/migrations/latest/restrict-cors-to-custom-domains/migration.js +110 -0
- package/src/migrations/latest/restrict-cors-to-custom-domains/migration.js.map +1 -0
- package/src/migrations/latest/terraform-bootstrap-adopt-existing-bucket/migration.d.ts +6 -0
- package/src/migrations/latest/terraform-bootstrap-adopt-existing-bucket/migration.js +129 -0
- package/src/migrations/latest/terraform-bootstrap-adopt-existing-bucket/migration.js.map +1 -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 +101 -25
- 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 +3 -3
- 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 +3 -3
- 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 +84 -14
- 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 +3 -3
- 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 +3 -5
- 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 +8 -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 +5 -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 +2 -2
- package/src/open-api/utils/parse.js +11 -13
- 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 +149 -28
- package/src/preset/generator.d.ts +4 -4
- package/src/preset/generator.js +66 -147
- 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 -2
- package/src/preset/schema.json +16 -5
- package/src/py/agent/__snapshots__/generator.constructs.spec.ts.snap +321 -0
- package/src/py/agent/__snapshots__/generator.frameworks.spec.ts.snap +734 -0
- package/src/py/agent/__snapshots__/{generator.spec.ts.snap → generator.protocols.spec.ts.snap} +182 -314
- package/src/py/agent/a2a-connection/__snapshots__/generator.spec.ts.snap +189 -0
- package/src/py/agent/a2a-connection/files/agent-connection/app/__targetAgentSnakeCase___client_strands.py.template +30 -0
- package/src/py/agent/a2a-connection/files/langchain/agent-connection/app/__targetAgentSnakeCase___client_langchain.py.template +28 -0
- package/src/py/agent/a2a-connection/generator.d.ts +3 -3
- package/src/py/agent/a2a-connection/generator.js +113 -85
- 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 +1 -0
- package/src/py/agent/a2a-connection/schema.json +5 -0
- package/src/py/agent/files/a2a-langchain/main.py.template +89 -0
- package/src/py/agent/files/ag-ui-langchain/main.py.template +83 -0
- package/src/py/agent/files/common/agent.py.template +2 -0
- package/src/py/agent/files/common-langchain/agent.py.template +30 -0
- package/src/py/agent/files/deploy/Dockerfile.template +1 -1
- package/src/py/agent/files/http/init.py.template +7 -25
- package/src/py/agent/files/http/main.py.template +3 -4
- package/src/py/agent/files/http-langchain/main.py.template +84 -0
- 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 +10 -0
- package/src/py/agent/gateway-connection/generator.js +119 -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 +3 -3
- package/src/py/agent/generator.js +290 -183
- package/src/py/agent/generator.js.map +1 -1
- package/src/py/agent/mcp-connection/__snapshots__/generator.spec.ts.snap +153 -89
- package/src/py/agent/mcp-connection/files/agent-connection/app/__mcpServerSnakeCase___client_strands.py.template +30 -0
- package/src/py/agent/mcp-connection/files/langchain/agent-connection/app/__mcpServerSnakeCase___client_langchain.py.template +30 -0
- package/src/py/agent/mcp-connection/generator.d.ts +3 -3
- package/src/py/agent/mcp-connection/generator.js +65 -126
- 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 +1 -0
- package/src/py/agent/mcp-connection/schema.json +5 -0
- package/src/py/agent/react-connection/__snapshots__/generator.spec.ts.snap +11 -19
- package/src/py/agent/react-connection/generator.d.ts +4 -4
- package/src/py/agent/react-connection/generator.js +55 -59
- 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} +6 -6
- 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 +1 -0
- 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 +2 -1
- package/src/py/agent/schema.json +6 -1
- package/src/py/api/generator.d.ts +3 -3
- 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 +1 -0
- package/src/py/api/schema.json +5 -0
- package/src/py/dynamodb/__snapshots__/generator.spec.ts.snap +1522 -0
- package/src/py/dynamodb/agent-connection/__snapshots__/generator.spec.ts.snap +45 -0
- package/src/py/dynamodb/agent-connection/generator.d.ts +10 -0
- package/src/py/dynamodb/agent-connection/generator.js +39 -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 +23 -0
- package/src/py/dynamodb/fast-api-connection/generator.d.ts +10 -0
- package/src/py/dynamodb/fast-api-connection/generator.js +37 -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 +10 -0
- package/src/py/dynamodb/generator.js +110 -0
- package/src/py/dynamodb/generator.js.map +1 -0
- package/src/py/dynamodb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +45 -0
- package/src/py/dynamodb/mcp-server-connection/generator.d.ts +10 -0
- package/src/py/dynamodb/mcp-server-connection/generator.js +39 -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 +75 -0
- package/src/py/fast-api/__snapshots__/generator.spec.ts.snap +238 -4694
- package/src/py/fast-api/__snapshots__/generator.terraform.spec.ts.snap +5409 -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 +3 -3
- package/src/py/fast-api/generator.js +90 -87
- 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 +4 -4
- package/src/py/fast-api/react/generator.js +25 -25
- package/src/py/fast-api/react/generator.js.map +1 -1
- package/src/py/fast-api/react/open-api.d.ts +1 -1
- package/src/py/fast-api/react/open-api.js +31 -29
- 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 +1 -0
- package/src/py/fast-api/schema.json +5 -0
- package/src/py/lambda-function/__snapshots__/generator.spec.ts.snap +4 -4
- package/src/py/lambda-function/generator.d.ts +3 -3
- package/src/py/lambda-function/generator.js +60 -59
- 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 +1 -0
- package/src/py/lambda-function/schema.json +5 -0
- package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +209 -19
- package/src/py/mcp-server/files/deploy/Dockerfile.template +1 -1
- package/src/py/mcp-server/generator.d.ts +3 -3
- package/src/py/mcp-server/generator.js +163 -127
- 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 +1 -0
- package/src/py/mcp-server/schema.json +5 -0
- package/src/py/project/generator.d.ts +17 -4
- package/src/py/project/generator.js +229 -130
- 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 +5 -0
- package/src/py/rdb/__snapshots__/generator.spec.ts.snap +2070 -0
- package/src/py/rdb/agent-connection/__snapshots__/generator.spec.ts.snap +104 -0
- package/src/py/rdb/agent-connection/generator.d.ts +10 -0
- package/src/py/rdb/agent-connection/generator.js +46 -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 +44 -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 +54 -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__/__init__.py.template +3 -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 +104 -0
- package/src/py/rdb/files/alembic.ini.template +38 -0
- package/src/py/rdb/files/config.json.template +14 -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 +6 -0
- package/src/py/rdb/generator.js +280 -0
- package/src/py/rdb/generator.js.map +1 -0
- package/src/py/rdb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +101 -0
- package/src/py/rdb/mcp-server-connection/generator.d.ts +10 -0
- package/src/py/rdb/mcp-server-connection/generator.js +46 -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 +77 -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/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 +10 -0
- package/src/sdk/open-api.js +8 -0
- package/src/sdk/open-api.js.map +1 -0
- package/src/sdk/py.d.ts +16 -0
- package/src/sdk/py.js +11 -0
- package/src/sdk/py.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 +37 -0
- package/src/sdk/ts.js +39 -0
- package/src/sdk/ts.js.map +1 -0
- package/{sdk → src/sdk}/utils/ast.d.ts +1 -2
- package/src/sdk/utils/ast.js +6 -0
- package/src/sdk/utils/ast.js.map +1 -0
- package/{sdk → src/sdk}/utils/format.d.ts +1 -1
- 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 +19 -24
- package/src/smithy/project/files/build.Dockerfile.template +1 -4
- package/src/smithy/project/files/src/operations/echo.smithy.template +1 -0
- package/src/smithy/project/generator.d.ts +3 -3
- package/src/smithy/project/generator.js +64 -57
- 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 +1 -0
- package/src/smithy/project/schema.json +5 -0
- package/src/smithy/react-connection/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/smithy/react-connection/generator.d.ts +3 -3
- package/src/smithy/react-connection/generator.js +39 -47
- 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 +850 -136
- package/src/smithy/ts/api/files/handler.ts.template +2 -2
- package/src/smithy/ts/api/files/local-server.ts.template +2 -2
- 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 +3 -3
- package/src/smithy/ts/api/generator.js +131 -105
- 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 +1 -0
- package/src/smithy/ts/api/schema.json +5 -0
- package/src/terraform/project/files/application/scripts/bootstrap.ts.template +40 -1
- package/src/terraform/project/files/application/src/main.tf.template +6 -1
- package/src/terraform/project/files/application/src/providers.tf.template +1 -1
- package/src/terraform/project/generator.d.ts +3 -3
- package/src/terraform/project/generator.js +159 -104
- 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 +1180 -185
- 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/generator.d.ts +4 -4
- package/src/trpc/backend/generator.js +100 -84
- 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 +3 -2
- package/src/trpc/backend/schema.json +5 -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 +4 -4
- package/src/trpc/react/generator.js +64 -59
- 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 +792 -23
- package/src/ts/agent/a2a-connection/__snapshots__/generator.spec.ts.snap +257 -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 +3 -3
- package/src/ts/agent/a2a-connection/generator.js +65 -55
- 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 +1 -0
- package/src/ts/agent/a2a-connection/schema.json +5 -0
- package/src/ts/agent/files/a2a/index.ts.template +1 -1
- package/src/ts/agent/files/ag-ui/index.ts.template +26 -10
- package/src/ts/agent/files/common/agent.ts.template +7 -2
- package/src/ts/agent/files/deploy/Dockerfile.template +13 -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 +221 -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 +10 -0
- package/src/ts/agent/gateway-connection/generator.js +117 -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 +3 -3
- package/src/ts/agent/generator.js +213 -145
- package/src/ts/agent/generator.js.map +1 -1
- package/src/ts/agent/mcp-connection/__snapshots__/generator.spec.ts.snap +193 -111
- package/src/ts/agent/mcp-connection/files/agent-connection/app/__mcpServerKebabCase__-client-strands.ts.template +22 -0
- package/src/ts/agent/mcp-connection/generator.d.ts +3 -3
- package/src/ts/agent/mcp-connection/generator.js +56 -60
- 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 +1 -0
- package/src/ts/agent/mcp-connection/schema.json +5 -0
- package/src/ts/agent/react-connection/generator.d.ts +4 -4
- package/src/ts/agent/react-connection/generator.js +88 -91
- 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 +1 -0
- 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 +1 -0
- package/src/ts/agent/schema.json +5 -0
- package/src/ts/api/generator.d.ts +3 -3
- 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 +3 -1
- package/src/ts/api/schema.json +5 -0
- package/src/ts/astro-docs/__snapshots__/generator.spec.ts.snap +15 -16
- package/src/ts/astro-docs/files/translation/scripts/translate.ts.template +3 -2
- package/src/ts/astro-docs/generator.d.ts +3 -3
- package/src/ts/astro-docs/generator.js +80 -54
- 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 +982 -0
- package/src/ts/dcr-proxy/generator.d.ts +10 -0
- package/src/ts/dcr-proxy/generator.js +98 -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 +3 -3
- 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 +402 -518
- package/src/ts/dynamodb/agent-connection/__snapshots__/generator.spec.ts.snap +5 -5
- package/src/ts/dynamodb/agent-connection/generator.d.ts +3 -3
- package/src/ts/dynamodb/agent-connection/generator.js +21 -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 +1 -0
- 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 +3 -3
- package/src/ts/dynamodb/generator.js +76 -63
- package/src/ts/dynamodb/generator.js.map +1 -1
- package/src/ts/dynamodb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +5 -5
- package/src/ts/dynamodb/mcp-server-connection/generator.d.ts +3 -3
- package/src/ts/dynamodb/mcp-server-connection/generator.js +21 -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 +1 -0
- 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 +2 -0
- package/src/ts/dynamodb/schema.json +25 -2
- package/src/ts/dynamodb/smithy-connection/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/ts/dynamodb/smithy-connection/generator.d.ts +3 -3
- package/src/ts/dynamodb/smithy-connection/generator.js +20 -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 +3 -3
- package/src/ts/dynamodb/trpc-connection/generator.d.ts +3 -3
- package/src/ts/dynamodb/trpc-connection/generator.js +20 -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 +8 -6
- package/src/ts/lambda-function/files/handler/__lambdaFunctionKebabCase__.ts.template +2 -1
- package/src/ts/lambda-function/generator.d.ts +3 -3
- package/src/ts/lambda-function/generator.js +60 -56
- 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 +1 -0
- package/src/ts/lambda-function/schema.json +5 -0
- package/src/ts/lib/__snapshots__/generator.spec.ts.snap +98 -93
- package/src/ts/lib/__snapshots__/vitest.spec.ts.snap +24 -0
- package/src/ts/lib/biome.d.ts +7 -0
- package/src/ts/lib/biome.js +91 -0
- package/src/ts/lib/biome.js.map +1 -0
- package/src/ts/lib/generator.d.ts +3 -3
- package/src/ts/lib/generator.js +107 -108
- 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 +12 -2
- package/src/ts/lib/ts-project-utils.js +95 -71
- 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 +2 -2
- package/src/ts/lib/vitest.js +30 -26
- package/src/ts/lib/vitest.js.map +1 -1
- package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +209 -42
- package/src/ts/mcp-server/files/Dockerfile.template +13 -2
- package/src/ts/mcp-server/generator.d.ts +3 -3
- package/src/ts/mcp-server/generator.js +183 -140
- 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 +1 -0
- package/src/ts/mcp-server/schema.json +5 -0
- package/src/ts/nx-generator/__snapshots__/generator.spec.ts.snap +46 -26
- 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.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 +2 -2
- package/src/ts/nx-generator/generator.js +118 -73
- 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 +61 -0
- package/src/ts/nx-migration/files/prompt.md.template +46 -0
- package/src/ts/nx-migration/generator.d.ts +24 -0
- package/src/ts/nx-migration/generator.js +122 -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 +3 -3
- package/src/ts/nx-plugin/generator.js +61 -50
- 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 +21 -1
- package/src/ts/nx-plugin/utils.js +60 -51
- package/src/ts/nx-plugin/utils.js.map +1 -1
- package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +551 -642
- package/src/ts/rdb/agent-connection/__snapshots__/generator.spec.ts.snap +6 -6
- package/src/ts/rdb/agent-connection/generator.d.ts +3 -3
- package/src/ts/rdb/agent-connection/generator.js +37 -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 +1 -0
- package/src/ts/rdb/agent-connection/schema.json +5 -0
- package/src/ts/rdb/files/Dockerfile.template +19 -1
- package/src/ts/rdb/files/config.json.template +14 -0
- 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/index.ts.template +1 -2
- 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 +3 -0
- package/src/ts/rdb/generator.d.ts +3 -7
- package/src/ts/rdb/generator.js +177 -131
- package/src/ts/rdb/generator.js.map +1 -1
- package/src/ts/rdb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +6 -6
- package/src/ts/rdb/mcp-server-connection/generator.d.ts +3 -3
- package/src/ts/rdb/mcp-server-connection/generator.js +35 -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 +1 -0
- 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 +1 -0
- package/src/ts/rdb/schema.json +6 -1
- package/src/ts/rdb/smithy-connection/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/ts/rdb/smithy-connection/generator.d.ts +3 -3
- package/src/ts/rdb/smithy-connection/generator.js +45 -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 +3 -3
- package/src/ts/rdb/trpc-connection/generator.d.ts +3 -3
- package/src/ts/rdb/trpc-connection/generator.js +35 -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.d.ts +1 -1
- 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 +1 -16
- package/src/ts/react-website/agui/generator.d.ts +1 -1
- package/src/ts/react-website/agui/generator.js +70 -62
- package/src/ts/react-website/agui/generator.js.map +1 -1
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +1387 -813
- package/src/ts/react-website/app/generator.d.ts +4 -4
- package/src/ts/react-website/app/generator.js +241 -196
- 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 +1 -1
- package/src/ts/react-website/app/schema.json +11 -6
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.spec.ts.snap +139 -26
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +48 -12
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.ux-provider.spec.ts.snap +0 -20
- 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 +4 -4
- package/src/ts/react-website/cognito-auth/generator.js +65 -63
- package/src/ts/react-website/cognito-auth/generator.js.map +1 -1
- package/src/ts/react-website/cognito-auth/grit/cloudscape-auth-menu.grit +8 -6
- package/src/ts/react-website/cognito-auth/grit/cognito-auth-wrapper.grit +1 -1
- package/src/ts/react-website/cognito-auth/grit/none-auth-menu.grit +1 -0
- package/src/ts/react-website/cognito-auth/grit/shadcn-auth-menu.grit +3 -1
- package/src/ts/react-website/cognito-auth/grit/shadcn-state-declarations.grit +3 -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 +1 -0
- package/src/ts/react-website/cognito-auth/schema.json +5 -0
- package/src/ts/react-website/cognito-auth/utils.d.ts +1 -1
- 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 +3 -3
- 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 +3 -3
- package/src/ts/sync/generator.js +137 -60
- package/src/ts/sync/generator.js.map +1 -1
- package/src/ts/website/app/generator.d.ts +3 -3
- 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 +1 -1
- package/src/ts/website/app/schema.json +11 -6
- package/src/ts/website/auth/generator.d.ts +4 -4
- 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 +1 -0
- package/src/ts/website/auth/schema.json +5 -0
- package/src/utils/__snapshots__/shared-constructs.spec.ts.snap +21 -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 +117 -25
- package/src/utils/agent-connection/agent-connection.js +467 -103
- 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 +22 -32
- 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-strands/base/model-errors-strands.ts.template +36 -0
- package/src/utils/agent-connection/files/core-strands/base/tool-errors-strands.ts.template +22 -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 +99 -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-mcp/agentcore_mcp_transport.py.template +34 -0
- package/src/utils/agent-connection/files/py-core-runtime-config/runtime_config.py.template +5 -18
- 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 +66 -0
- package/src/utils/agent-connection/files/py-core-strands/base/model_errors_strands.py.template +40 -0
- 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 +12 -3
- package/src/utils/agent-core-constructs/agent-core-constructs.js +104 -38
- 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 +31 -4
- package/src/utils/agent-core-constructs/files/cdk/app/agentcore-gateway/__nameKebabCase__/__nameKebabCase__.ts.template +85 -0
- package/src/utils/agent-core-constructs/files/cdk/core/agentcore-gateway/agentcore-gateway.ts.template +497 -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 +32 -0
- package/src/utils/agent-core-constructs/files/terraform/app/agentcore-gateway/__nameKebabCase__/__nameKebabCase__.tf.template +488 -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/core/agent-core/runtime.tf.template +151 -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 +2 -2
- package/src/utils/api-constructs/api-constructs.js +50 -31
- package/src/utils/api-constructs/api-constructs.js.map +1 -1
- package/src/utils/api-constructs/files/cdk/app/apis/http/__apiNameKebabCase__.ts.template +20 -15
- package/src/utils/api-constructs/files/cdk/app/apis/rest/__apiNameKebabCase__.ts.template +24 -16
- 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 +54 -18
- 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 +101 -12
- package/src/utils/api-constructs/files/terraform/app/apis/rest/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +194 -8
- 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 +5 -11
- package/src/utils/api-constructs/open-api-metadata.d.ts +2 -2
- package/src/utils/api-constructs/open-api-metadata.js +22 -22
- package/src/utils/api-constructs/open-api-metadata.js.map +1 -1
- package/src/utils/ast/website.d.ts +5 -1
- package/src/utils/ast/website.js +18 -20
- package/src/utils/ast/website.js.map +1 -1
- package/src/utils/ast.d.ts +5 -1
- package/src/utils/ast.js +107 -89
- 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 +1 -1
- package/src/utils/bundle/bundle.js +51 -47
- package/src/utils/bundle/bundle.js.map +1 -1
- package/src/utils/commands.d.ts +15 -5
- package/src/utils/commands.js +87 -28
- package/src/utils/commands.js.map +1 -1
- package/src/utils/config/index.d.ts +21 -5
- package/src/utils/config/index.js +5 -4
- package/src/utils/config/index.js.map +1 -1
- package/src/utils/config/utils.d.ts +5 -4
- package/src/utils/config/utils.js +50 -59
- package/src/utils/config/utils.js.map +1 -1
- package/src/utils/connection/open-api/files/components/__apiNameClassName__Provider.tsx.template +1 -1
- package/src/utils/connection/open-api/react.d.ts +6 -6
- package/src/utils/connection/open-api/react.js +82 -77
- package/src/utils/connection/open-api/react.js.map +1 -1
- package/src/utils/containers.d.ts +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 +93 -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 +410 -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 +53 -0
- package/src/utils/docker.js +92 -0
- package/src/utils/docker.js.map +1 -0
- package/src/utils/dynamodb-constructs/dynamodb-constructs.d.ts +3 -3
- package/src/utils/dynamodb-constructs/dynamodb-constructs.js +39 -41
- 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 +1 -1
- package/src/utils/dynamodb-constructs/files/terraform/app/dynamodb/__nameKebabCase__/__nameKebabCase__.tf.template +24 -17
- package/src/utils/dynamodb-constructs/files/terraform/core/dynamodb/dynamodb.tf.template +1 -1
- 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/utils/files/common/scripts/src/dynamodb/start-container.ts.template +104 -0
- 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/{stage-credentials → infra/stage-credentials}/cdk-command.ts.template +6 -3
- 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 +115 -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 +1 -1
- package/src/utils/files/terraform/src/core/runtime-config/appconfig-deployment/appconfig-deployment.tf.template +12 -6
- 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/website/hooks/sigv4/useSigV4.tsx.template +1 -1
- package/src/utils/format.d.ts +70 -2
- package/src/utils/format.js +326 -108
- package/src/utils/format.js.map +1 -1
- package/src/utils/fs.d.ts +1 -1
- package/src/utils/fs.js +14 -13
- 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 +2 -2
- package/src/utils/function-constructs/function-constructs.d.ts +2 -2
- package/src/utils/function-constructs/function-constructs.js +22 -25
- package/src/utils/function-constructs/function-constructs.js.map +1 -1
- package/src/utils/generators.d.ts +4 -0
- package/src/utils/generators.js +18 -20
- package/src/utils/generators.js.map +1 -1
- package/src/utils/git.d.ts +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 +1 -1
- 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 +131 -24
- package/src/utils/identity-constructs/files/terraform/core/user-identity/add-callback-url/add-callback-url.tf.template +28 -9
- package/src/utils/identity-constructs/files/terraform/core/user-identity/identity/identity.tf.template +106 -6
- package/src/utils/identity-constructs/files/terraform/core/user-identity/main.tf.template +7 -0
- package/src/utils/identity-constructs/identity-constructs.d.ts +2 -2
- package/src/utils/identity-constructs/identity-constructs.js +42 -31
- package/src/utils/identity-constructs/identity-constructs.js.map +1 -1
- package/src/utils/init.d.ts +59 -0
- package/src/utils/init.js +282 -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.d.ts +4 -0
- package/src/utils/js.js +27 -20
- package/src/utils/js.js.map +1 -1
- package/src/utils/mcp.d.ts +10 -1
- package/src/utils/mcp.js +42 -41
- package/src/utils/mcp.js.map +1 -1
- package/src/utils/metrics.d.ts +9 -3
- package/src/utils/metrics.js +61 -46
- package/src/utils/metrics.js.map +1 -1
- package/src/utils/migration-versions.d.ts +95 -0
- package/src/utils/migration-versions.js +128 -0
- package/src/utils/migration-versions.js.map +1 -0
- package/src/utils/mock-project-graph.js +8 -12
- 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 +1 -5
- package/src/utils/npm-scope.js +7 -20
- package/src/utils/npm-scope.js.map +1 -1
- package/src/utils/nx.d.ts +57 -4
- package/src/utils/nx.js +192 -75
- package/src/utils/nx.js.map +1 -1
- package/src/utils/nxlv-python.d.ts +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/paths.d.ts +1 -1
- package/src/utils/paths.js +11 -15
- package/src/utils/paths.js.map +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 +29 -7
- package/src/utils/port.js +67 -28
- 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 +16 -3
- package/src/utils/py.js +72 -47
- 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 +112 -88
- package/src/utils/rdb-constructs/files/terraform/app/dbs/__nameKebabCase__/__nameKebabCase__.tf.template +127 -53
- package/src/utils/rdb-constructs/files/terraform/core/rdb/aurora/aurora.tf.template +60 -53
- package/src/utils/rdb-constructs/rdb-constructs.d.ts +15 -4
- package/src/utils/rdb-constructs/rdb-constructs.js +38 -41
- 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 +1 -0
- package/src/utils/shared-constructs-constants.js +16 -15
- package/src/utils/shared-constructs-constants.js.map +1 -1
- package/src/utils/shared-constructs.d.ts +2 -2
- package/src/utils/shared-constructs.js +61 -67
- package/src/utils/shared-constructs.js.map +1 -1
- package/src/utils/shared-dynamodb-scripts.d.ts +11 -0
- package/src/utils/shared-dynamodb-scripts.js +27 -0
- package/src/utils/shared-dynamodb-scripts.js.map +1 -0
- package/src/utils/shared-infra-config.d.ts +1 -1
- 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 +11 -0
- package/src/utils/shared-infra-scripts.js +43 -0
- package/src/utils/shared-infra-scripts.js.map +1 -0
- package/src/utils/shared-rdb-scripts.d.ts +16 -0
- package/src/utils/shared-rdb-scripts.js +45 -0
- package/src/utils/shared-rdb-scripts.js.map +1 -0
- package/src/utils/shared-scripts.d.ts +2 -5
- package/src/utils/shared-scripts.js +12 -38
- package/src/utils/shared-scripts.js.map +1 -1
- package/src/utils/shared-shadcn.d.ts +1 -1
- package/src/utils/shared-shadcn.js +69 -72
- package/src/utils/shared-shadcn.js.map +1 -1
- 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 +15 -1
- package/src/utils/test.js +46 -23
- package/src/utils/test.js.map +1 -1
- package/src/utils/toml.d.ts +6 -1
- package/src/utils/toml.js +20 -14
- package/src/utils/toml.js.map +1 -1
- package/src/utils/versions.d.ts +161 -99
- package/src/utils/versions.js +177 -116
- package/src/utils/versions.js.map +1 -1
- package/src/utils/website-constructs/files/cdk/app/static-websites/__websiteNameKebabCase__.ts.template +2 -2
- package/src/utils/website-constructs/files/cdk/core/static-website.ts.template +203 -41
- package/src/utils/website-constructs/files/terraform/app/static-websites/__websiteNameKebabCase__/__websiteNameKebabCase__.tf.template +1 -1
- package/src/utils/website-constructs/files/terraform/core/static-website/static-website.tf.template +145 -93
- package/src/utils/website-constructs/website-constructs.d.ts +2 -2
- package/src/utils/website-constructs/website-constructs.js +38 -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.js +0 -48
- package/src/connection/agent-serve-local.js.map +0 -1
- package/src/connection/serve-local.d.ts +0 -15
- package/src/connection/serve-local.js +0 -41
- package/src/connection/serve-local.js.map +0 -1
- package/src/py/agent/a2a-connection/files/agent-connection/app/__targetAgentSnakeCase___client.py.template +0 -22
- 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/scripts/start-container.ts.template +0 -81
- 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/lib/eslint.d.ts +0 -14
- package/src/ts/lib/eslint.js +0 -90
- package/src/ts/lib/eslint.js.map +0 -1
- package/src/ts/lib/grit/eslint-dependency-checks-warn.grit +0 -1
- 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/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/terraform/scripts/reset-runtime-config.ts.template +0 -25
- /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} +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
|
@@ -1,35 +1,6 @@
|
|
|
1
1
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
|
-
exports[`tsSmithyApiGenerator > should configure git
|
|
4
|
-
"import baseConfig from '../../eslint.config.mjs';
|
|
5
|
-
|
|
6
|
-
export default [
|
|
7
|
-
...baseConfig,
|
|
8
|
-
{
|
|
9
|
-
files: ['**/*.json'],
|
|
10
|
-
rules: {
|
|
11
|
-
'@nx/dependency-checks': [
|
|
12
|
-
'warn',
|
|
13
|
-
{
|
|
14
|
-
ignoredFiles: [
|
|
15
|
-
'{projectRoot}/eslint.config.{js,cjs,mjs,ts,cts,mts}',
|
|
16
|
-
'{projectRoot}/vitest.config.{js,ts,mjs,mts}',
|
|
17
|
-
],
|
|
18
|
-
},
|
|
19
|
-
],
|
|
20
|
-
},
|
|
21
|
-
languageOptions: {
|
|
22
|
-
parser: await import('jsonc-eslint-parser'),
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
ignores: ['**/out-tsc', '**/generated'],
|
|
27
|
-
},
|
|
28
|
-
];
|
|
29
|
-
"
|
|
30
|
-
`;
|
|
31
|
-
|
|
32
|
-
exports[`tsSmithyApiGenerator > should configure git and eslint ignores for generated code > gitignore 1`] = `"src/generated"`;
|
|
3
|
+
exports[`tsSmithyApiGenerator > should configure git ignores for generated code > gitignore 1`] = `"src/generated"`;
|
|
33
4
|
|
|
34
5
|
exports[`tsSmithyApiGenerator > should generate smithy ts api with Cognito auth > cognito-auth-infra.ts 1`] = `
|
|
35
6
|
"import { Construct } from 'constructs';
|
|
@@ -61,6 +32,7 @@ import {
|
|
|
61
32
|
IntegrationBuilder,
|
|
62
33
|
RestApiIntegration,
|
|
63
34
|
} from '../../core/api/utils.js';
|
|
35
|
+
import { findCloudFrontDomainNames } from '../../core/cloudfront.js';
|
|
64
36
|
import { AddCorsPreflightAspect, RestApi } from '../../core/api/rest-api.js';
|
|
65
37
|
import {
|
|
66
38
|
OPERATION_DETAILS,
|
|
@@ -115,7 +87,7 @@ export class TestApi<
|
|
|
115
87
|
return IntegrationBuilder.rest({
|
|
116
88
|
pattern: 'isolated',
|
|
117
89
|
operations: OPERATION_DETAILS,
|
|
118
|
-
defaultIntegrationOptions:
|
|
90
|
+
defaultIntegrationOptions: {
|
|
119
91
|
runtime: Runtime.NODEJS_LATEST,
|
|
120
92
|
handler: 'index.handler',
|
|
121
93
|
code: Code.fromAsset(
|
|
@@ -128,7 +100,7 @@ export class TestApi<
|
|
|
128
100
|
),
|
|
129
101
|
timeout: Duration.seconds(30),
|
|
130
102
|
tracing: Tracing.ACTIVE,
|
|
131
|
-
},
|
|
103
|
+
} as FunctionProps,
|
|
132
104
|
buildDefaultIntegration: (op, props: FunctionProps) => {
|
|
133
105
|
const handler = new Function(scope, \`TestApi\${op}Handler\`, props);
|
|
134
106
|
handler.addEnvironment(
|
|
@@ -156,6 +128,9 @@ export class TestApi<
|
|
|
156
128
|
authorizer: new CognitoUserPoolsAuthorizer(scope, 'TestApiAuthorizer', {
|
|
157
129
|
cognitoUserPools: [props.identity.userPool],
|
|
158
130
|
}),
|
|
131
|
+
// Accept access tokens from both sign-in flows: 'openid' (Cognito hosted UI)
|
|
132
|
+
// and 'aws.cognito.signin.user.admin' (Cognito admin/SRP auth APIs).
|
|
133
|
+
authorizationScopes: ['openid', 'aws.cognito.signin.user.admin'],
|
|
159
134
|
},
|
|
160
135
|
deployOptions: {
|
|
161
136
|
tracingEnabled: true,
|
|
@@ -182,7 +157,9 @@ export class TestApi<
|
|
|
182
157
|
*
|
|
183
158
|
* Configures the provided CloudFront distribution domains or origin strings
|
|
184
159
|
* as the only permitted CORS origins in API Gateway preflight responses and the
|
|
185
|
-
* AWS Lambda integrations.
|
|
160
|
+
* AWS Lambda integrations. Any custom domain names (aliases) configured on a
|
|
161
|
+
* CloudFront distribution are included automatically alongside its default
|
|
162
|
+
* \`*.cloudfront.net\` domain.
|
|
186
163
|
*
|
|
187
164
|
* @param origins - The origin strings, CloudFront distributions, or objects containing a CloudFront distribution to grant CORS from
|
|
188
165
|
*/
|
|
@@ -193,12 +170,14 @@ export class TestApi<
|
|
|
193
170
|
| { cloudFrontDistribution: Distribution }
|
|
194
171
|
)[]
|
|
195
172
|
) {
|
|
196
|
-
const allowedOrigins = origins.
|
|
173
|
+
const allowedOrigins = origins.flatMap((origin) =>
|
|
197
174
|
typeof origin === 'string'
|
|
198
|
-
? origin
|
|
199
|
-
:
|
|
200
|
-
|
|
201
|
-
|
|
175
|
+
? [origin]
|
|
176
|
+
: findCloudFrontDomainNames(
|
|
177
|
+
'cloudFrontDistribution' in origin
|
|
178
|
+
? origin.cloudFrontDistribution
|
|
179
|
+
: origin,
|
|
180
|
+
).map((domain) => \`https://\${domain}\`),
|
|
202
181
|
);
|
|
203
182
|
|
|
204
183
|
this.allowedOrigins = allowedOrigins;
|
|
@@ -247,6 +226,7 @@ import {
|
|
|
247
226
|
IntegrationBuilder,
|
|
248
227
|
RestApiIntegration,
|
|
249
228
|
} from '../../core/api/utils.js';
|
|
229
|
+
import { findCloudFrontDomainNames } from '../../core/cloudfront.js';
|
|
250
230
|
import { AddCorsPreflightAspect, RestApi } from '../../core/api/rest-api.js';
|
|
251
231
|
import {
|
|
252
232
|
OPERATION_DETAILS,
|
|
@@ -295,7 +275,7 @@ export class TestApi<
|
|
|
295
275
|
return IntegrationBuilder.rest({
|
|
296
276
|
pattern: 'isolated',
|
|
297
277
|
operations: OPERATION_DETAILS,
|
|
298
|
-
defaultIntegrationOptions:
|
|
278
|
+
defaultIntegrationOptions: {
|
|
299
279
|
runtime: Runtime.NODEJS_LATEST,
|
|
300
280
|
handler: 'index.handler',
|
|
301
281
|
code: Code.fromAsset(
|
|
@@ -308,7 +288,7 @@ export class TestApi<
|
|
|
308
288
|
),
|
|
309
289
|
timeout: Duration.seconds(30),
|
|
310
290
|
tracing: Tracing.ACTIVE,
|
|
311
|
-
},
|
|
291
|
+
} as FunctionProps,
|
|
312
292
|
buildDefaultIntegration: (op, props: FunctionProps) => {
|
|
313
293
|
const handler = new Function(scope, \`TestApi\${op}Handler\`, props);
|
|
314
294
|
handler.addEnvironment(
|
|
@@ -359,7 +339,9 @@ export class TestApi<
|
|
|
359
339
|
*
|
|
360
340
|
* Configures the provided CloudFront distribution domains or origin strings
|
|
361
341
|
* as the only permitted CORS origins in API Gateway preflight responses and the
|
|
362
|
-
* AWS Lambda integrations.
|
|
342
|
+
* AWS Lambda integrations. Any custom domain names (aliases) configured on a
|
|
343
|
+
* CloudFront distribution are included automatically alongside its default
|
|
344
|
+
* \`*.cloudfront.net\` domain.
|
|
363
345
|
*
|
|
364
346
|
* @param origins - The origin strings, CloudFront distributions, or objects containing a CloudFront distribution to grant CORS from
|
|
365
347
|
*/
|
|
@@ -370,12 +352,14 @@ export class TestApi<
|
|
|
370
352
|
| { cloudFrontDistribution: Distribution }
|
|
371
353
|
)[]
|
|
372
354
|
) {
|
|
373
|
-
const allowedOrigins = origins.
|
|
355
|
+
const allowedOrigins = origins.flatMap((origin) =>
|
|
374
356
|
typeof origin === 'string'
|
|
375
|
-
? origin
|
|
376
|
-
:
|
|
377
|
-
|
|
378
|
-
|
|
357
|
+
? [origin]
|
|
358
|
+
: findCloudFrontDomainNames(
|
|
359
|
+
'cloudFrontDistribution' in origin
|
|
360
|
+
? origin.cloudFrontDistribution
|
|
361
|
+
: origin,
|
|
362
|
+
).map((domain) => \`https://\${domain}\`),
|
|
379
363
|
);
|
|
380
364
|
|
|
381
365
|
this.allowedOrigins = allowedOrigins;
|
|
@@ -429,11 +413,11 @@ terraform {
|
|
|
429
413
|
required_providers {
|
|
430
414
|
aws = {
|
|
431
415
|
source = "hashicorp/aws"
|
|
432
|
-
version = "
|
|
416
|
+
version = "6.55.0"
|
|
433
417
|
}
|
|
434
418
|
random = {
|
|
435
419
|
source = "hashicorp/random"
|
|
436
|
-
version = "
|
|
420
|
+
version = "3.9.0"
|
|
437
421
|
}
|
|
438
422
|
}
|
|
439
423
|
}
|
|
@@ -503,8 +487,6 @@ data "aws_caller_identity" "current" {}
|
|
|
503
487
|
|
|
504
488
|
# Resources
|
|
505
489
|
|
|
506
|
-
# Note: CloudWatch logging removed due to account-level CloudWatch Logs role ARN requirement
|
|
507
|
-
|
|
508
490
|
# REST API Gateway
|
|
509
491
|
resource "aws_api_gateway_rest_api" "rest_api" {
|
|
510
492
|
name = var.api_name
|
|
@@ -521,10 +503,8 @@ resource "aws_api_gateway_rest_api" "rest_api" {
|
|
|
521
503
|
tags = var.tags
|
|
522
504
|
}
|
|
523
505
|
|
|
524
|
-
# Note: Deployment and
|
|
525
|
-
# after all methods and integrations are defined
|
|
526
|
-
|
|
527
|
-
# Note: CloudWatch Log Group removed due to account-level CloudWatch Logs role ARN requirement
|
|
506
|
+
# Note: Deployment, stage and access logging are created in the consuming module
|
|
507
|
+
# (e.g., foo-api.tf) after all methods and integrations are defined
|
|
528
508
|
|
|
529
509
|
# Gateway Response for CORS (4XX errors)
|
|
530
510
|
resource "aws_api_gateway_gateway_response" "cors_4xx" {
|
|
@@ -682,9 +662,7 @@ output "waf_web_acl_arn" {
|
|
|
682
662
|
value = var.enable_waf ? aws_wafv2_web_acl.api_waf[0].arn : null
|
|
683
663
|
}
|
|
684
664
|
|
|
685
|
-
# Note: Stage and
|
|
686
|
-
|
|
687
|
-
# Note: CloudWatch log group outputs removed due to account-level CloudWatch Logs role ARN requirement"
|
|
665
|
+
# Note: Stage, deployment and access log outputs are provided by the consuming module"
|
|
688
666
|
`;
|
|
689
667
|
|
|
690
668
|
exports[`tsSmithyApiGenerator > should generate smithy ts api with Terraform provider and None auth > none-auth-terraform.tf 1`] = `
|
|
@@ -694,7 +672,7 @@ exports[`tsSmithyApiGenerator > should generate smithy ts api with Terraform pro
|
|
|
694
672
|
required_providers {
|
|
695
673
|
aws = {
|
|
696
674
|
source = "hashicorp/aws"
|
|
697
|
-
version = "
|
|
675
|
+
version = "6.55.0"
|
|
698
676
|
}
|
|
699
677
|
}
|
|
700
678
|
}
|
|
@@ -716,11 +694,47 @@ variable "additional_iam_policy_statements" {
|
|
|
716
694
|
default = []
|
|
717
695
|
}
|
|
718
696
|
|
|
697
|
+
variable "appconfig_application_id" {
|
|
698
|
+
description = "ID of the shared runtime-config AppConfig application (from \`core/runtime-config/appconfig.application_id\`). When set, the Lambda functions receive \`RUNTIME_CONFIG_APP_ID\` and read access to the application."
|
|
699
|
+
type = string
|
|
700
|
+
default = null
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
variable "appconfig_application_arn" {
|
|
704
|
+
description = "ARN of the shared runtime-config AppConfig application (from \`core/runtime-config/appconfig.application_arn\`). Used to scope the IAM read permission granted to the Lambda functions."
|
|
705
|
+
type = string
|
|
706
|
+
default = null
|
|
707
|
+
}
|
|
708
|
+
|
|
719
709
|
variable "asset_bucket_name" {
|
|
720
710
|
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."
|
|
721
711
|
type = string
|
|
722
712
|
}
|
|
723
713
|
|
|
714
|
+
# VPC Configuration (optional)
|
|
715
|
+
variable "enable_vpc" {
|
|
716
|
+
description = "Deploy the Lambda function into a VPC. Set alongside vpc_id/subnet_ids."
|
|
717
|
+
type = bool
|
|
718
|
+
default = false
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
variable "vpc_id" {
|
|
722
|
+
description = "VPC ID to deploy the Lambda function into. Required when enable_vpc is true."
|
|
723
|
+
type = string
|
|
724
|
+
default = null
|
|
725
|
+
|
|
726
|
+
validation {
|
|
727
|
+
condition = !var.enable_vpc || (var.vpc_id != null && var.subnet_ids != null)
|
|
728
|
+
error_message = "vpc_id and subnet_ids must be set when enable_vpc is true."
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
variable "subnet_ids" {
|
|
733
|
+
description = "Subnet IDs to deploy the Lambda function into. Required when enable_vpc is true."
|
|
734
|
+
type = list(string)
|
|
735
|
+
default = null
|
|
736
|
+
}
|
|
737
|
+
|
|
724
738
|
# CORS Configuration (passed to core module)
|
|
725
739
|
|
|
726
740
|
variable "cors_allow_headers" {
|
|
@@ -783,6 +797,11 @@ resource "aws_s3_object" "lambda_zip" {
|
|
|
783
797
|
}
|
|
784
798
|
|
|
785
799
|
# Use the core REST API module
|
|
800
|
+
# Account-level CloudWatch role required for REST API access logging
|
|
801
|
+
module "account" {
|
|
802
|
+
source = "../../../core/api/api-gateway-account"
|
|
803
|
+
}
|
|
804
|
+
|
|
786
805
|
module "rest_api" {
|
|
787
806
|
source = "../../../core/api/rest-api"
|
|
788
807
|
|
|
@@ -812,9 +831,31 @@ resource "aws_wafv2_web_acl_association" "api_waf_association" {
|
|
|
812
831
|
depends_on = [aws_api_gateway_stage.api_stage]
|
|
813
832
|
}
|
|
814
833
|
|
|
834
|
+
# Security group for the API Lambda function, used when deployed into a VPC
|
|
835
|
+
resource "aws_security_group" "api_lambda" {
|
|
836
|
+
count = var.enable_vpc ? 1 : 0
|
|
837
|
+
|
|
838
|
+
#checkov:skip=CKV2_AWS_5:Attached to api_lambda via vpc_config block; Checkov cannot resolve this reference
|
|
839
|
+
name_prefix = "test-api-lambda-"
|
|
840
|
+
description = "Security group for the TestApi API Lambda function"
|
|
841
|
+
vpc_id = var.vpc_id
|
|
842
|
+
tags = var.tags
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
resource "aws_vpc_security_group_egress_rule" "api_lambda_https" {
|
|
846
|
+
count = var.enable_vpc ? 1 : 0
|
|
847
|
+
|
|
848
|
+
security_group_id = aws_security_group.api_lambda[0].id
|
|
849
|
+
cidr_ipv4 = "0.0.0.0/0"
|
|
850
|
+
from_port = 443
|
|
851
|
+
to_port = 443
|
|
852
|
+
ip_protocol = "tcp"
|
|
853
|
+
description = "Allow outbound HTTPS to AWS service endpoints"
|
|
854
|
+
}
|
|
855
|
+
|
|
815
856
|
# Lambda function
|
|
816
857
|
resource "aws_lambda_function" "api_lambda" {
|
|
817
|
-
#checkov:skip=CKV_AWS_117:Lambda function
|
|
858
|
+
#checkov:skip=CKV_AWS_117:Lambda function is optionally deployed into a VPC via vpc_id/subnet_ids; not required for this use case
|
|
818
859
|
#checkov:skip=CKV_AWS_116:Dead Letter Queue not required for this simple API use case
|
|
819
860
|
#checkov:skip=CKV_AWS_272:Code signing not required for this use case
|
|
820
861
|
#checkov:skip=CKV_AWS_115:Concurrent execution limit not required for this use case
|
|
@@ -836,13 +877,25 @@ resource "aws_lambda_function" "api_lambda" {
|
|
|
836
877
|
mode = "Active"
|
|
837
878
|
}
|
|
838
879
|
|
|
880
|
+
dynamic "vpc_config" {
|
|
881
|
+
for_each = var.enable_vpc ? [1] : []
|
|
882
|
+
content {
|
|
883
|
+
subnet_ids = var.subnet_ids
|
|
884
|
+
security_group_ids = [aws_security_group.api_lambda[0].id]
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
|
|
839
888
|
|
|
840
889
|
environment {
|
|
841
890
|
variables = merge({
|
|
842
|
-
}, var.
|
|
891
|
+
}, var.appconfig_application_id != null ? {
|
|
892
|
+
RUNTIME_CONFIG_APP_ID = var.appconfig_application_id
|
|
893
|
+
} : {}, var.env)
|
|
843
894
|
}
|
|
844
895
|
|
|
845
896
|
tags = var.tags
|
|
897
|
+
|
|
898
|
+
depends_on = [aws_iam_role_policy_attachment.lambda_vpc_access]
|
|
846
899
|
}
|
|
847
900
|
|
|
848
901
|
# IAM role for Lambda execution
|
|
@@ -877,18 +930,39 @@ resource "aws_iam_role_policy_attachment" "lambda_xray_execution" {
|
|
|
877
930
|
role = aws_iam_role.lambda_execution_role.name
|
|
878
931
|
}
|
|
879
932
|
|
|
933
|
+
# Attach VPC access policy to Lambda role when deployed into a VPC
|
|
934
|
+
resource "aws_iam_role_policy_attachment" "lambda_vpc_access" {
|
|
935
|
+
count = var.enable_vpc ? 1 : 0
|
|
936
|
+
policy_arn = "arn:aws:iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole"
|
|
937
|
+
role = aws_iam_role.lambda_execution_role.name
|
|
938
|
+
}
|
|
939
|
+
|
|
880
940
|
# Additional IAM policies for Lambda (if provided)
|
|
881
941
|
resource "aws_iam_role_policy" "lambda_additional_policies" {
|
|
882
|
-
count = length(
|
|
942
|
+
count = length(local.lambda_policy_statements) > 0 ? 1 : 0
|
|
883
943
|
name = "TestApiHandler-additional-policies-\${random_string.suffix.result}"
|
|
884
944
|
role = aws_iam_role.lambda_execution_role.id
|
|
885
945
|
|
|
886
946
|
policy = jsonencode({
|
|
887
947
|
Version = "2012-10-17"
|
|
888
|
-
Statement =
|
|
948
|
+
Statement = local.lambda_policy_statements
|
|
889
949
|
})
|
|
890
950
|
}
|
|
891
951
|
|
|
952
|
+
locals {
|
|
953
|
+
# Grant read access to the runtime-config AppConfig application when wired
|
|
954
|
+
lambda_policy_statements = concat(var.appconfig_application_arn != null ? [
|
|
955
|
+
{
|
|
956
|
+
Effect = "Allow"
|
|
957
|
+
Action = [
|
|
958
|
+
"appconfig:StartConfigurationSession",
|
|
959
|
+
"appconfig:GetLatestConfiguration"
|
|
960
|
+
]
|
|
961
|
+
Resource = ["\${var.appconfig_application_arn}/*"]
|
|
962
|
+
}
|
|
963
|
+
] : [], var.additional_iam_policy_statements)
|
|
964
|
+
}
|
|
965
|
+
|
|
892
966
|
# CloudWatch Log Group for Lambda
|
|
893
967
|
resource "aws_cloudwatch_log_group" "lambda_logs" {
|
|
894
968
|
#checkov:skip=CKV_AWS_158:Using default CloudWatch log encryption
|
|
@@ -1108,11 +1182,63 @@ resource "aws_api_gateway_deployment" "api_deployment" {
|
|
|
1108
1182
|
]
|
|
1109
1183
|
}
|
|
1110
1184
|
|
|
1185
|
+
# KMS key for encrypting access logs at rest
|
|
1186
|
+
resource "aws_kms_key" "access_logs" {
|
|
1187
|
+
description = "TestApi API access log encryption"
|
|
1188
|
+
deletion_window_in_days = 7
|
|
1189
|
+
enable_key_rotation = true
|
|
1190
|
+
|
|
1191
|
+
policy = jsonencode({
|
|
1192
|
+
Version = "2012-10-17"
|
|
1193
|
+
Statement = [
|
|
1194
|
+
{
|
|
1195
|
+
Sid = "Enable IAM User Permissions"
|
|
1196
|
+
Effect = "Allow"
|
|
1197
|
+
Principal = { AWS = "arn:aws:iam::\${data.aws_caller_identity.current.account_id}:root" }
|
|
1198
|
+
Action = "kms:*"
|
|
1199
|
+
Resource = "*"
|
|
1200
|
+
},
|
|
1201
|
+
{
|
|
1202
|
+
Sid = "Allow CloudWatch Logs"
|
|
1203
|
+
Effect = "Allow"
|
|
1204
|
+
Principal = { Service = "logs.\${data.aws_region.current.region}.amazonaws.com" }
|
|
1205
|
+
Action = [
|
|
1206
|
+
"kms:Encrypt",
|
|
1207
|
+
"kms:Decrypt",
|
|
1208
|
+
"kms:ReEncrypt*",
|
|
1209
|
+
"kms:GenerateDataKey*",
|
|
1210
|
+
"kms:DescribeKey"
|
|
1211
|
+
]
|
|
1212
|
+
Resource = "*"
|
|
1213
|
+
Condition = {
|
|
1214
|
+
ArnEquals = {
|
|
1215
|
+
"kms:EncryptionContext:aws:logs:arn" = "arn:aws:logs:\${data.aws_region.current.region}:\${data.aws_caller_identity.current.account_id}:log-group:/aws/apigateway/test-api-\${random_string.suffix.result}/access"
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
]
|
|
1220
|
+
})
|
|
1221
|
+
|
|
1222
|
+
tags = var.tags
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
resource "aws_kms_alias" "access_logs" {
|
|
1226
|
+
name = "alias/test-api-\${random_string.suffix.result}-access-logs"
|
|
1227
|
+
target_key_id = aws_kms_key.access_logs.key_id
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
# Access logs for the API Gateway stage
|
|
1231
|
+
resource "aws_cloudwatch_log_group" "access_logs" {
|
|
1232
|
+
name = "/aws/apigateway/test-api-\${random_string.suffix.result}/access"
|
|
1233
|
+
retention_in_days = 365
|
|
1234
|
+
kms_key_id = aws_kms_key.access_logs.arn
|
|
1235
|
+
tags = var.tags
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1111
1238
|
# API Gateway stage
|
|
1112
1239
|
resource "aws_api_gateway_stage" "api_stage" {
|
|
1113
1240
|
#checkov:skip=CKV_AWS_120:API Gateway caching not required for this use case
|
|
1114
|
-
#checkov:skip=
|
|
1115
|
-
#checkov:skip=CKV2_AWS_4:API Gateway logging level not applicable as access logging is disabled
|
|
1241
|
+
#checkov:skip=CKV2_AWS_4:Access logging is enabled below; verbose execution logging is intentionally not enabled
|
|
1116
1242
|
#checkov:skip=CKV2_AWS_51:Client certificate authentication not required for this use case
|
|
1117
1243
|
#checkov:skip=CKV2_AWS_77:WAFv2 Web ACL is attached via aws_wafv2_web_acl_association when var.enable_waf is true (default) and includes AWSManagedRulesKnownBadInputsRuleSet for Log4j protection; Checkov does not track the association across modules
|
|
1118
1244
|
deployment_id = aws_api_gateway_deployment.api_deployment.id
|
|
@@ -1120,9 +1246,39 @@ resource "aws_api_gateway_stage" "api_stage" {
|
|
|
1120
1246
|
stage_name = "prod"
|
|
1121
1247
|
xray_tracing_enabled = true
|
|
1122
1248
|
|
|
1249
|
+
access_log_settings {
|
|
1250
|
+
destination_arn = aws_cloudwatch_log_group.access_logs.arn
|
|
1251
|
+
format = jsonencode({
|
|
1252
|
+
requestId = "$context.requestId"
|
|
1253
|
+
ip = "$context.identity.sourceIp"
|
|
1254
|
+
caller = "$context.identity.caller"
|
|
1255
|
+
user = "$context.identity.user"
|
|
1256
|
+
requestTime = "$context.requestTime"
|
|
1257
|
+
httpMethod = "$context.httpMethod"
|
|
1258
|
+
resourcePath = "$context.resourcePath"
|
|
1259
|
+
status = "$context.status"
|
|
1260
|
+
protocol = "$context.protocol"
|
|
1261
|
+
responseLength = "$context.responseLength"
|
|
1262
|
+
})
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1123
1265
|
tags = var.tags
|
|
1124
1266
|
|
|
1125
|
-
|
|
1267
|
+
# Ensure the account-level role is configured before the stage is created
|
|
1268
|
+
depends_on = [aws_api_gateway_deployment.api_deployment, module.account]
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
# Default throttling applied to all resource paths and methods
|
|
1272
|
+
resource "aws_api_gateway_method_settings" "throttling" {
|
|
1273
|
+
#checkov:skip=CKV_AWS_225:API Gateway caching not required for this use case
|
|
1274
|
+
rest_api_id = module.rest_api.api_id
|
|
1275
|
+
stage_name = aws_api_gateway_stage.api_stage.stage_name
|
|
1276
|
+
method_path = "*/*"
|
|
1277
|
+
|
|
1278
|
+
settings {
|
|
1279
|
+
throttling_rate_limit = 10000
|
|
1280
|
+
throttling_burst_limit = 5000
|
|
1281
|
+
}
|
|
1126
1282
|
}
|
|
1127
1283
|
|
|
1128
1284
|
# API Gateway Resource Policy
|
|
@@ -1261,6 +1417,11 @@ output "lambda_execution_role_name" {
|
|
|
1261
1417
|
value = aws_iam_role.lambda_execution_role.name
|
|
1262
1418
|
}
|
|
1263
1419
|
|
|
1420
|
+
output "security_group_id" {
|
|
1421
|
+
description = "Security group ID of the API Lambda function, for use in ingress rules on resources it must reach (e.g. a database). Null unless enable_vpc is true."
|
|
1422
|
+
value = var.enable_vpc ? aws_security_group.api_lambda[0].id : null
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1264
1425
|
# Integration Outputs
|
|
1265
1426
|
output "integration_id" {
|
|
1266
1427
|
description = "ID of the Lambda integration"
|
|
@@ -1333,42 +1494,55 @@ exports[`tsSmithyApiGenerator > should generate smithy ts api with default optio
|
|
|
1333
1494
|
},
|
|
1334
1495
|
"compile": {
|
|
1335
1496
|
"executor": "nx:run-commands",
|
|
1497
|
+
"dependsOn": ["copy-ssdk"],
|
|
1336
1498
|
"outputs": ["{workspaceRoot}/dist/{projectRoot}/tsc"],
|
|
1337
1499
|
"options": {
|
|
1338
1500
|
"command": "tsc --build tsconfig.lib.json",
|
|
1339
1501
|
"cwd": "{projectRoot}"
|
|
1340
|
-
}
|
|
1341
|
-
"dependsOn": ["copy-ssdk"]
|
|
1502
|
+
}
|
|
1342
1503
|
},
|
|
1343
|
-
"
|
|
1344
|
-
"executor": "
|
|
1504
|
+
"format": {
|
|
1505
|
+
"executor": "nx:run-commands",
|
|
1345
1506
|
"cache": true,
|
|
1346
|
-
"inputs": ["
|
|
1507
|
+
"inputs": ["biome"],
|
|
1508
|
+
"options": {
|
|
1509
|
+
"command": "biome format {projectRoot}"
|
|
1510
|
+
},
|
|
1347
1511
|
"configurations": {
|
|
1348
1512
|
"fix": {
|
|
1349
|
-
"
|
|
1513
|
+
"command": "biome format --write {projectRoot}"
|
|
1350
1514
|
},
|
|
1351
1515
|
"skip-lint": {
|
|
1352
|
-
"
|
|
1516
|
+
"command": "node -e \\"\\""
|
|
1353
1517
|
}
|
|
1354
1518
|
}
|
|
1355
1519
|
},
|
|
1356
|
-
"
|
|
1357
|
-
"executor": "
|
|
1358
|
-
"
|
|
1520
|
+
"lint": {
|
|
1521
|
+
"executor": "nx:run-commands",
|
|
1522
|
+
"cache": true,
|
|
1523
|
+
"inputs": ["biome"],
|
|
1524
|
+
"dependsOn": ["format"],
|
|
1359
1525
|
"options": {
|
|
1360
|
-
"
|
|
1526
|
+
"command": "biome lint {projectRoot}"
|
|
1527
|
+
},
|
|
1528
|
+
"configurations": {
|
|
1529
|
+
"fix": {
|
|
1530
|
+
"command": "biome check --write {projectRoot}"
|
|
1531
|
+
},
|
|
1532
|
+
"skip-lint": {
|
|
1533
|
+
"command": "node -e \\"\\""
|
|
1534
|
+
}
|
|
1361
1535
|
}
|
|
1362
1536
|
},
|
|
1363
1537
|
"bundle": {
|
|
1538
|
+
"executor": "nx:run-commands",
|
|
1539
|
+
"dependsOn": ["compile"],
|
|
1364
1540
|
"cache": true,
|
|
1365
1541
|
"outputs": ["{workspaceRoot}/dist/{projectRoot}/bundle"],
|
|
1366
|
-
"executor": "nx:run-commands",
|
|
1367
1542
|
"options": {
|
|
1368
1543
|
"command": "rolldown -c rolldown.config.ts",
|
|
1369
1544
|
"cwd": "{projectRoot}"
|
|
1370
|
-
}
|
|
1371
|
-
"dependsOn": ["compile"]
|
|
1545
|
+
}
|
|
1372
1546
|
},
|
|
1373
1547
|
"copy-ssdk": {
|
|
1374
1548
|
"cache": true,
|
|
@@ -1391,31 +1565,31 @@ exports[`tsSmithyApiGenerator > should generate smithy ts api with default optio
|
|
|
1391
1565
|
},
|
|
1392
1566
|
"watch-copy-ssdk": {
|
|
1393
1567
|
"executor": "nx:run-commands",
|
|
1568
|
+
"continuous": true,
|
|
1394
1569
|
"options": {
|
|
1395
|
-
"command": "nx watch --projects=@proj/test-api-model --
|
|
1396
|
-
}
|
|
1397
|
-
"continuous": true
|
|
1570
|
+
"command": "nx watch --projects=@proj/test-api-model --includeDependencies -- nx run @proj/test-api:copy-ssdk"
|
|
1571
|
+
}
|
|
1398
1572
|
},
|
|
1399
1573
|
"serve": {
|
|
1400
1574
|
"executor": "nx:run-commands",
|
|
1575
|
+
"dependsOn": ["copy-ssdk", "watch-copy-ssdk"],
|
|
1576
|
+
"continuous": true,
|
|
1401
1577
|
"options": {
|
|
1402
1578
|
"command": "tsx --watch src/local-server.ts",
|
|
1403
1579
|
"cwd": "{projectRoot}"
|
|
1404
|
-
}
|
|
1405
|
-
"continuous": true,
|
|
1406
|
-
"dependsOn": ["copy-ssdk", "watch-copy-ssdk"]
|
|
1580
|
+
}
|
|
1407
1581
|
},
|
|
1408
|
-
"
|
|
1582
|
+
"dev": {
|
|
1409
1583
|
"executor": "nx:run-commands",
|
|
1584
|
+
"dependsOn": ["copy-ssdk", "watch-copy-ssdk"],
|
|
1585
|
+
"continuous": true,
|
|
1410
1586
|
"options": {
|
|
1411
1587
|
"command": "tsx --watch src/local-server.ts",
|
|
1412
1588
|
"cwd": "{projectRoot}",
|
|
1413
1589
|
"env": {
|
|
1414
|
-
"
|
|
1590
|
+
"LOCAL_DEV": "true"
|
|
1415
1591
|
}
|
|
1416
|
-
}
|
|
1417
|
-
"continuous": true,
|
|
1418
|
-
"dependsOn": ["copy-ssdk", "watch-copy-ssdk"]
|
|
1592
|
+
}
|
|
1419
1593
|
}
|
|
1420
1594
|
}
|
|
1421
1595
|
}
|
|
@@ -1708,11 +1882,11 @@ terraform {
|
|
|
1708
1882
|
required_providers {
|
|
1709
1883
|
aws = {
|
|
1710
1884
|
source = "hashicorp/aws"
|
|
1711
|
-
version = "
|
|
1885
|
+
version = "6.55.0"
|
|
1712
1886
|
}
|
|
1713
1887
|
random = {
|
|
1714
1888
|
source = "hashicorp/random"
|
|
1715
|
-
version = "
|
|
1889
|
+
version = "3.9.0"
|
|
1716
1890
|
}
|
|
1717
1891
|
}
|
|
1718
1892
|
}
|
|
@@ -1782,8 +1956,6 @@ data "aws_caller_identity" "current" {}
|
|
|
1782
1956
|
|
|
1783
1957
|
# Resources
|
|
1784
1958
|
|
|
1785
|
-
# Note: CloudWatch logging removed due to account-level CloudWatch Logs role ARN requirement
|
|
1786
|
-
|
|
1787
1959
|
# REST API Gateway
|
|
1788
1960
|
resource "aws_api_gateway_rest_api" "rest_api" {
|
|
1789
1961
|
name = var.api_name
|
|
@@ -1800,10 +1972,8 @@ resource "aws_api_gateway_rest_api" "rest_api" {
|
|
|
1800
1972
|
tags = var.tags
|
|
1801
1973
|
}
|
|
1802
1974
|
|
|
1803
|
-
# Note: Deployment and
|
|
1804
|
-
# after all methods and integrations are defined
|
|
1805
|
-
|
|
1806
|
-
# Note: CloudWatch Log Group removed due to account-level CloudWatch Logs role ARN requirement
|
|
1975
|
+
# Note: Deployment, stage and access logging are created in the consuming module
|
|
1976
|
+
# (e.g., foo-api.tf) after all methods and integrations are defined
|
|
1807
1977
|
|
|
1808
1978
|
# Gateway Response for CORS (4XX errors)
|
|
1809
1979
|
resource "aws_api_gateway_gateway_response" "cors_4xx" {
|
|
@@ -1961,16 +2131,14 @@ output "waf_web_acl_arn" {
|
|
|
1961
2131
|
value = var.enable_waf ? aws_wafv2_web_acl.api_waf[0].arn : null
|
|
1962
2132
|
}
|
|
1963
2133
|
|
|
1964
|
-
# Note: Stage and
|
|
1965
|
-
|
|
1966
|
-
# Note: CloudWatch log group outputs removed due to account-level CloudWatch Logs role ARN requirement",
|
|
2134
|
+
# Note: Stage, deployment and access log outputs are provided by the consuming module",
|
|
1967
2135
|
"test-api.tf": "terraform {
|
|
1968
2136
|
required_version = ">= 1.0"
|
|
1969
2137
|
|
|
1970
2138
|
required_providers {
|
|
1971
2139
|
aws = {
|
|
1972
2140
|
source = "hashicorp/aws"
|
|
1973
|
-
version = "
|
|
2141
|
+
version = "6.55.0"
|
|
1974
2142
|
}
|
|
1975
2143
|
}
|
|
1976
2144
|
}
|
|
@@ -2002,11 +2170,47 @@ variable "additional_iam_policy_statements" {
|
|
|
2002
2170
|
default = []
|
|
2003
2171
|
}
|
|
2004
2172
|
|
|
2173
|
+
variable "appconfig_application_id" {
|
|
2174
|
+
description = "ID of the shared runtime-config AppConfig application (from \`core/runtime-config/appconfig.application_id\`). When set, the Lambda functions receive \`RUNTIME_CONFIG_APP_ID\` and read access to the application."
|
|
2175
|
+
type = string
|
|
2176
|
+
default = null
|
|
2177
|
+
}
|
|
2178
|
+
|
|
2179
|
+
variable "appconfig_application_arn" {
|
|
2180
|
+
description = "ARN of the shared runtime-config AppConfig application (from \`core/runtime-config/appconfig.application_arn\`). Used to scope the IAM read permission granted to the Lambda functions."
|
|
2181
|
+
type = string
|
|
2182
|
+
default = null
|
|
2183
|
+
}
|
|
2184
|
+
|
|
2005
2185
|
variable "asset_bucket_name" {
|
|
2006
2186
|
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."
|
|
2007
2187
|
type = string
|
|
2008
2188
|
}
|
|
2009
2189
|
|
|
2190
|
+
# VPC Configuration (optional)
|
|
2191
|
+
variable "enable_vpc" {
|
|
2192
|
+
description = "Deploy the Lambda function into a VPC. Set alongside vpc_id/subnet_ids."
|
|
2193
|
+
type = bool
|
|
2194
|
+
default = false
|
|
2195
|
+
}
|
|
2196
|
+
|
|
2197
|
+
variable "vpc_id" {
|
|
2198
|
+
description = "VPC ID to deploy the Lambda function into. Required when enable_vpc is true."
|
|
2199
|
+
type = string
|
|
2200
|
+
default = null
|
|
2201
|
+
|
|
2202
|
+
validation {
|
|
2203
|
+
condition = !var.enable_vpc || (var.vpc_id != null && var.subnet_ids != null)
|
|
2204
|
+
error_message = "vpc_id and subnet_ids must be set when enable_vpc is true."
|
|
2205
|
+
}
|
|
2206
|
+
}
|
|
2207
|
+
|
|
2208
|
+
variable "subnet_ids" {
|
|
2209
|
+
description = "Subnet IDs to deploy the Lambda function into. Required when enable_vpc is true."
|
|
2210
|
+
type = list(string)
|
|
2211
|
+
default = null
|
|
2212
|
+
}
|
|
2213
|
+
|
|
2010
2214
|
# CORS Configuration (passed to core module)
|
|
2011
2215
|
|
|
2012
2216
|
variable "cors_allow_headers" {
|
|
@@ -2069,6 +2273,11 @@ resource "aws_s3_object" "lambda_zip" {
|
|
|
2069
2273
|
}
|
|
2070
2274
|
|
|
2071
2275
|
# Use the core REST API module
|
|
2276
|
+
# Account-level CloudWatch role required for REST API access logging
|
|
2277
|
+
module "account" {
|
|
2278
|
+
source = "../../../core/api/api-gateway-account"
|
|
2279
|
+
}
|
|
2280
|
+
|
|
2072
2281
|
module "rest_api" {
|
|
2073
2282
|
source = "../../../core/api/rest-api"
|
|
2074
2283
|
|
|
@@ -2098,9 +2307,31 @@ resource "aws_wafv2_web_acl_association" "api_waf_association" {
|
|
|
2098
2307
|
depends_on = [aws_api_gateway_stage.api_stage]
|
|
2099
2308
|
}
|
|
2100
2309
|
|
|
2310
|
+
# Security group for the API Lambda function, used when deployed into a VPC
|
|
2311
|
+
resource "aws_security_group" "api_lambda" {
|
|
2312
|
+
count = var.enable_vpc ? 1 : 0
|
|
2313
|
+
|
|
2314
|
+
#checkov:skip=CKV2_AWS_5:Attached to api_lambda via vpc_config block; Checkov cannot resolve this reference
|
|
2315
|
+
name_prefix = "test-api-lambda-"
|
|
2316
|
+
description = "Security group for the TestApi API Lambda function"
|
|
2317
|
+
vpc_id = var.vpc_id
|
|
2318
|
+
tags = var.tags
|
|
2319
|
+
}
|
|
2320
|
+
|
|
2321
|
+
resource "aws_vpc_security_group_egress_rule" "api_lambda_https" {
|
|
2322
|
+
count = var.enable_vpc ? 1 : 0
|
|
2323
|
+
|
|
2324
|
+
security_group_id = aws_security_group.api_lambda[0].id
|
|
2325
|
+
cidr_ipv4 = "0.0.0.0/0"
|
|
2326
|
+
from_port = 443
|
|
2327
|
+
to_port = 443
|
|
2328
|
+
ip_protocol = "tcp"
|
|
2329
|
+
description = "Allow outbound HTTPS to AWS service endpoints"
|
|
2330
|
+
}
|
|
2331
|
+
|
|
2101
2332
|
# Lambda function
|
|
2102
2333
|
resource "aws_lambda_function" "api_lambda" {
|
|
2103
|
-
#checkov:skip=CKV_AWS_117:Lambda function
|
|
2334
|
+
#checkov:skip=CKV_AWS_117:Lambda function is optionally deployed into a VPC via vpc_id/subnet_ids; not required for this use case
|
|
2104
2335
|
#checkov:skip=CKV_AWS_116:Dead Letter Queue not required for this simple API use case
|
|
2105
2336
|
#checkov:skip=CKV_AWS_272:Code signing not required for this use case
|
|
2106
2337
|
#checkov:skip=CKV_AWS_115:Concurrent execution limit not required for this use case
|
|
@@ -2122,13 +2353,25 @@ resource "aws_lambda_function" "api_lambda" {
|
|
|
2122
2353
|
mode = "Active"
|
|
2123
2354
|
}
|
|
2124
2355
|
|
|
2356
|
+
dynamic "vpc_config" {
|
|
2357
|
+
for_each = var.enable_vpc ? [1] : []
|
|
2358
|
+
content {
|
|
2359
|
+
subnet_ids = var.subnet_ids
|
|
2360
|
+
security_group_ids = [aws_security_group.api_lambda[0].id]
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2363
|
+
|
|
2125
2364
|
|
|
2126
2365
|
environment {
|
|
2127
2366
|
variables = merge({
|
|
2128
|
-
}, var.
|
|
2367
|
+
}, var.appconfig_application_id != null ? {
|
|
2368
|
+
RUNTIME_CONFIG_APP_ID = var.appconfig_application_id
|
|
2369
|
+
} : {}, var.env)
|
|
2129
2370
|
}
|
|
2130
2371
|
|
|
2131
2372
|
tags = var.tags
|
|
2373
|
+
|
|
2374
|
+
depends_on = [aws_iam_role_policy_attachment.lambda_vpc_access]
|
|
2132
2375
|
}
|
|
2133
2376
|
|
|
2134
2377
|
# IAM role for Lambda execution
|
|
@@ -2163,18 +2406,39 @@ resource "aws_iam_role_policy_attachment" "lambda_xray_execution" {
|
|
|
2163
2406
|
role = aws_iam_role.lambda_execution_role.name
|
|
2164
2407
|
}
|
|
2165
2408
|
|
|
2409
|
+
# Attach VPC access policy to Lambda role when deployed into a VPC
|
|
2410
|
+
resource "aws_iam_role_policy_attachment" "lambda_vpc_access" {
|
|
2411
|
+
count = var.enable_vpc ? 1 : 0
|
|
2412
|
+
policy_arn = "arn:aws:iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole"
|
|
2413
|
+
role = aws_iam_role.lambda_execution_role.name
|
|
2414
|
+
}
|
|
2415
|
+
|
|
2166
2416
|
# Additional IAM policies for Lambda (if provided)
|
|
2167
2417
|
resource "aws_iam_role_policy" "lambda_additional_policies" {
|
|
2168
|
-
count = length(
|
|
2418
|
+
count = length(local.lambda_policy_statements) > 0 ? 1 : 0
|
|
2169
2419
|
name = "TestApiHandler-additional-policies-\${random_string.suffix.result}"
|
|
2170
2420
|
role = aws_iam_role.lambda_execution_role.id
|
|
2171
2421
|
|
|
2172
2422
|
policy = jsonencode({
|
|
2173
2423
|
Version = "2012-10-17"
|
|
2174
|
-
Statement =
|
|
2424
|
+
Statement = local.lambda_policy_statements
|
|
2175
2425
|
})
|
|
2176
2426
|
}
|
|
2177
2427
|
|
|
2428
|
+
locals {
|
|
2429
|
+
# Grant read access to the runtime-config AppConfig application when wired
|
|
2430
|
+
lambda_policy_statements = concat(var.appconfig_application_arn != null ? [
|
|
2431
|
+
{
|
|
2432
|
+
Effect = "Allow"
|
|
2433
|
+
Action = [
|
|
2434
|
+
"appconfig:StartConfigurationSession",
|
|
2435
|
+
"appconfig:GetLatestConfiguration"
|
|
2436
|
+
]
|
|
2437
|
+
Resource = ["\${var.appconfig_application_arn}/*"]
|
|
2438
|
+
}
|
|
2439
|
+
] : [], var.additional_iam_policy_statements)
|
|
2440
|
+
}
|
|
2441
|
+
|
|
2178
2442
|
# CloudWatch Log Group for Lambda
|
|
2179
2443
|
resource "aws_cloudwatch_log_group" "lambda_logs" {
|
|
2180
2444
|
#checkov:skip=CKV_AWS_158:Using default CloudWatch log encryption
|
|
@@ -2223,6 +2487,9 @@ resource "aws_api_gateway_method" "proxy_method" {
|
|
|
2223
2487
|
|
|
2224
2488
|
authorization = "COGNITO_USER_POOLS"
|
|
2225
2489
|
authorizer_id = aws_api_gateway_authorizer.cognito_authorizer.id
|
|
2490
|
+
# Accept access tokens from both sign-in flows: 'openid' (Cognito hosted UI)
|
|
2491
|
+
# and 'aws.cognito.signin.user.admin' (Cognito admin/SRP auth APIs).
|
|
2492
|
+
authorization_scopes = ["openid", "aws.cognito.signin.user.admin"]
|
|
2226
2493
|
|
|
2227
2494
|
request_parameters = {
|
|
2228
2495
|
"method.request.path.proxy" = true
|
|
@@ -2309,11 +2576,63 @@ resource "aws_api_gateway_deployment" "api_deployment" {
|
|
|
2309
2576
|
]
|
|
2310
2577
|
}
|
|
2311
2578
|
|
|
2579
|
+
# KMS key for encrypting access logs at rest
|
|
2580
|
+
resource "aws_kms_key" "access_logs" {
|
|
2581
|
+
description = "TestApi API access log encryption"
|
|
2582
|
+
deletion_window_in_days = 7
|
|
2583
|
+
enable_key_rotation = true
|
|
2584
|
+
|
|
2585
|
+
policy = jsonencode({
|
|
2586
|
+
Version = "2012-10-17"
|
|
2587
|
+
Statement = [
|
|
2588
|
+
{
|
|
2589
|
+
Sid = "Enable IAM User Permissions"
|
|
2590
|
+
Effect = "Allow"
|
|
2591
|
+
Principal = { AWS = "arn:aws:iam::\${data.aws_caller_identity.current.account_id}:root" }
|
|
2592
|
+
Action = "kms:*"
|
|
2593
|
+
Resource = "*"
|
|
2594
|
+
},
|
|
2595
|
+
{
|
|
2596
|
+
Sid = "Allow CloudWatch Logs"
|
|
2597
|
+
Effect = "Allow"
|
|
2598
|
+
Principal = { Service = "logs.\${data.aws_region.current.region}.amazonaws.com" }
|
|
2599
|
+
Action = [
|
|
2600
|
+
"kms:Encrypt",
|
|
2601
|
+
"kms:Decrypt",
|
|
2602
|
+
"kms:ReEncrypt*",
|
|
2603
|
+
"kms:GenerateDataKey*",
|
|
2604
|
+
"kms:DescribeKey"
|
|
2605
|
+
]
|
|
2606
|
+
Resource = "*"
|
|
2607
|
+
Condition = {
|
|
2608
|
+
ArnEquals = {
|
|
2609
|
+
"kms:EncryptionContext:aws:logs:arn" = "arn:aws:logs:\${data.aws_region.current.region}:\${data.aws_caller_identity.current.account_id}:log-group:/aws/apigateway/test-api-\${random_string.suffix.result}/access"
|
|
2610
|
+
}
|
|
2611
|
+
}
|
|
2612
|
+
}
|
|
2613
|
+
]
|
|
2614
|
+
})
|
|
2615
|
+
|
|
2616
|
+
tags = var.tags
|
|
2617
|
+
}
|
|
2618
|
+
|
|
2619
|
+
resource "aws_kms_alias" "access_logs" {
|
|
2620
|
+
name = "alias/test-api-\${random_string.suffix.result}-access-logs"
|
|
2621
|
+
target_key_id = aws_kms_key.access_logs.key_id
|
|
2622
|
+
}
|
|
2623
|
+
|
|
2624
|
+
# Access logs for the API Gateway stage
|
|
2625
|
+
resource "aws_cloudwatch_log_group" "access_logs" {
|
|
2626
|
+
name = "/aws/apigateway/test-api-\${random_string.suffix.result}/access"
|
|
2627
|
+
retention_in_days = 365
|
|
2628
|
+
kms_key_id = aws_kms_key.access_logs.arn
|
|
2629
|
+
tags = var.tags
|
|
2630
|
+
}
|
|
2631
|
+
|
|
2312
2632
|
# API Gateway stage
|
|
2313
2633
|
resource "aws_api_gateway_stage" "api_stage" {
|
|
2314
2634
|
#checkov:skip=CKV_AWS_120:API Gateway caching not required for this use case
|
|
2315
|
-
#checkov:skip=
|
|
2316
|
-
#checkov:skip=CKV2_AWS_4:API Gateway logging level not applicable as access logging is disabled
|
|
2635
|
+
#checkov:skip=CKV2_AWS_4:Access logging is enabled below; verbose execution logging is intentionally not enabled
|
|
2317
2636
|
#checkov:skip=CKV2_AWS_51:Client certificate authentication not required for this use case
|
|
2318
2637
|
#checkov:skip=CKV2_AWS_77:WAFv2 Web ACL is attached via aws_wafv2_web_acl_association when var.enable_waf is true (default) and includes AWSManagedRulesKnownBadInputsRuleSet for Log4j protection; Checkov does not track the association across modules
|
|
2319
2638
|
deployment_id = aws_api_gateway_deployment.api_deployment.id
|
|
@@ -2321,9 +2640,39 @@ resource "aws_api_gateway_stage" "api_stage" {
|
|
|
2321
2640
|
stage_name = "prod"
|
|
2322
2641
|
xray_tracing_enabled = true
|
|
2323
2642
|
|
|
2643
|
+
access_log_settings {
|
|
2644
|
+
destination_arn = aws_cloudwatch_log_group.access_logs.arn
|
|
2645
|
+
format = jsonencode({
|
|
2646
|
+
requestId = "$context.requestId"
|
|
2647
|
+
ip = "$context.identity.sourceIp"
|
|
2648
|
+
caller = "$context.identity.caller"
|
|
2649
|
+
user = "$context.identity.user"
|
|
2650
|
+
requestTime = "$context.requestTime"
|
|
2651
|
+
httpMethod = "$context.httpMethod"
|
|
2652
|
+
resourcePath = "$context.resourcePath"
|
|
2653
|
+
status = "$context.status"
|
|
2654
|
+
protocol = "$context.protocol"
|
|
2655
|
+
responseLength = "$context.responseLength"
|
|
2656
|
+
})
|
|
2657
|
+
}
|
|
2658
|
+
|
|
2324
2659
|
tags = var.tags
|
|
2325
2660
|
|
|
2326
|
-
|
|
2661
|
+
# Ensure the account-level role is configured before the stage is created
|
|
2662
|
+
depends_on = [aws_api_gateway_deployment.api_deployment, module.account]
|
|
2663
|
+
}
|
|
2664
|
+
|
|
2665
|
+
# Default throttling applied to all resource paths and methods
|
|
2666
|
+
resource "aws_api_gateway_method_settings" "throttling" {
|
|
2667
|
+
#checkov:skip=CKV_AWS_225:API Gateway caching not required for this use case
|
|
2668
|
+
rest_api_id = module.rest_api.api_id
|
|
2669
|
+
stage_name = aws_api_gateway_stage.api_stage.stage_name
|
|
2670
|
+
method_path = "*/*"
|
|
2671
|
+
|
|
2672
|
+
settings {
|
|
2673
|
+
throttling_rate_limit = 10000
|
|
2674
|
+
throttling_burst_limit = 5000
|
|
2675
|
+
}
|
|
2327
2676
|
}
|
|
2328
2677
|
|
|
2329
2678
|
# API Gateway Resource Policy
|
|
@@ -2462,6 +2811,11 @@ output "lambda_execution_role_name" {
|
|
|
2462
2811
|
value = aws_iam_role.lambda_execution_role.name
|
|
2463
2812
|
}
|
|
2464
2813
|
|
|
2814
|
+
output "security_group_id" {
|
|
2815
|
+
description = "Security group ID of the API Lambda function, for use in ingress rules on resources it must reach (e.g. a database). Null unless enable_vpc is true."
|
|
2816
|
+
value = var.enable_vpc ? aws_security_group.api_lambda[0].id : null
|
|
2817
|
+
}
|
|
2818
|
+
|
|
2465
2819
|
# Integration Outputs
|
|
2466
2820
|
output "integration_id" {
|
|
2467
2821
|
description = "ID of the Lambda integration"
|
|
@@ -2503,11 +2857,11 @@ terraform {
|
|
|
2503
2857
|
required_providers {
|
|
2504
2858
|
aws = {
|
|
2505
2859
|
source = "hashicorp/aws"
|
|
2506
|
-
version = "
|
|
2860
|
+
version = "6.55.0"
|
|
2507
2861
|
}
|
|
2508
2862
|
random = {
|
|
2509
2863
|
source = "hashicorp/random"
|
|
2510
|
-
version = "
|
|
2864
|
+
version = "3.9.0"
|
|
2511
2865
|
}
|
|
2512
2866
|
}
|
|
2513
2867
|
}
|
|
@@ -2577,8 +2931,6 @@ data "aws_caller_identity" "current" {}
|
|
|
2577
2931
|
|
|
2578
2932
|
# Resources
|
|
2579
2933
|
|
|
2580
|
-
# Note: CloudWatch logging removed due to account-level CloudWatch Logs role ARN requirement
|
|
2581
|
-
|
|
2582
2934
|
# REST API Gateway
|
|
2583
2935
|
resource "aws_api_gateway_rest_api" "rest_api" {
|
|
2584
2936
|
name = var.api_name
|
|
@@ -2595,10 +2947,8 @@ resource "aws_api_gateway_rest_api" "rest_api" {
|
|
|
2595
2947
|
tags = var.tags
|
|
2596
2948
|
}
|
|
2597
2949
|
|
|
2598
|
-
# Note: Deployment and
|
|
2599
|
-
# after all methods and integrations are defined
|
|
2600
|
-
|
|
2601
|
-
# Note: CloudWatch Log Group removed due to account-level CloudWatch Logs role ARN requirement
|
|
2950
|
+
# Note: Deployment, stage and access logging are created in the consuming module
|
|
2951
|
+
# (e.g., foo-api.tf) after all methods and integrations are defined
|
|
2602
2952
|
|
|
2603
2953
|
# Gateway Response for CORS (4XX errors)
|
|
2604
2954
|
resource "aws_api_gateway_gateway_response" "cors_4xx" {
|
|
@@ -2756,16 +3106,14 @@ output "waf_web_acl_arn" {
|
|
|
2756
3106
|
value = var.enable_waf ? aws_wafv2_web_acl.api_waf[0].arn : null
|
|
2757
3107
|
}
|
|
2758
3108
|
|
|
2759
|
-
# Note: Stage and
|
|
2760
|
-
|
|
2761
|
-
# Note: CloudWatch log group outputs removed due to account-level CloudWatch Logs role ARN requirement",
|
|
3109
|
+
# Note: Stage, deployment and access log outputs are provided by the consuming module",
|
|
2762
3110
|
"test-api.tf": "terraform {
|
|
2763
3111
|
required_version = ">= 1.0"
|
|
2764
3112
|
|
|
2765
3113
|
required_providers {
|
|
2766
3114
|
aws = {
|
|
2767
3115
|
source = "hashicorp/aws"
|
|
2768
|
-
version = "
|
|
3116
|
+
version = "6.55.0"
|
|
2769
3117
|
}
|
|
2770
3118
|
}
|
|
2771
3119
|
}
|
|
@@ -2787,11 +3135,47 @@ variable "additional_iam_policy_statements" {
|
|
|
2787
3135
|
default = []
|
|
2788
3136
|
}
|
|
2789
3137
|
|
|
3138
|
+
variable "appconfig_application_id" {
|
|
3139
|
+
description = "ID of the shared runtime-config AppConfig application (from \`core/runtime-config/appconfig.application_id\`). When set, the Lambda functions receive \`RUNTIME_CONFIG_APP_ID\` and read access to the application."
|
|
3140
|
+
type = string
|
|
3141
|
+
default = null
|
|
3142
|
+
}
|
|
3143
|
+
|
|
3144
|
+
variable "appconfig_application_arn" {
|
|
3145
|
+
description = "ARN of the shared runtime-config AppConfig application (from \`core/runtime-config/appconfig.application_arn\`). Used to scope the IAM read permission granted to the Lambda functions."
|
|
3146
|
+
type = string
|
|
3147
|
+
default = null
|
|
3148
|
+
}
|
|
3149
|
+
|
|
2790
3150
|
variable "asset_bucket_name" {
|
|
2791
3151
|
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."
|
|
2792
3152
|
type = string
|
|
2793
3153
|
}
|
|
2794
3154
|
|
|
3155
|
+
# VPC Configuration (optional)
|
|
3156
|
+
variable "enable_vpc" {
|
|
3157
|
+
description = "Deploy the Lambda function into a VPC. Set alongside vpc_id/subnet_ids."
|
|
3158
|
+
type = bool
|
|
3159
|
+
default = false
|
|
3160
|
+
}
|
|
3161
|
+
|
|
3162
|
+
variable "vpc_id" {
|
|
3163
|
+
description = "VPC ID to deploy the Lambda function into. Required when enable_vpc is true."
|
|
3164
|
+
type = string
|
|
3165
|
+
default = null
|
|
3166
|
+
|
|
3167
|
+
validation {
|
|
3168
|
+
condition = !var.enable_vpc || (var.vpc_id != null && var.subnet_ids != null)
|
|
3169
|
+
error_message = "vpc_id and subnet_ids must be set when enable_vpc is true."
|
|
3170
|
+
}
|
|
3171
|
+
}
|
|
3172
|
+
|
|
3173
|
+
variable "subnet_ids" {
|
|
3174
|
+
description = "Subnet IDs to deploy the Lambda function into. Required when enable_vpc is true."
|
|
3175
|
+
type = list(string)
|
|
3176
|
+
default = null
|
|
3177
|
+
}
|
|
3178
|
+
|
|
2795
3179
|
# CORS Configuration (passed to core module)
|
|
2796
3180
|
|
|
2797
3181
|
variable "cors_allow_headers" {
|
|
@@ -2854,6 +3238,11 @@ resource "aws_s3_object" "lambda_zip" {
|
|
|
2854
3238
|
}
|
|
2855
3239
|
|
|
2856
3240
|
# Use the core REST API module
|
|
3241
|
+
# Account-level CloudWatch role required for REST API access logging
|
|
3242
|
+
module "account" {
|
|
3243
|
+
source = "../../../core/api/api-gateway-account"
|
|
3244
|
+
}
|
|
3245
|
+
|
|
2857
3246
|
module "rest_api" {
|
|
2858
3247
|
source = "../../../core/api/rest-api"
|
|
2859
3248
|
|
|
@@ -2883,9 +3272,31 @@ resource "aws_wafv2_web_acl_association" "api_waf_association" {
|
|
|
2883
3272
|
depends_on = [aws_api_gateway_stage.api_stage]
|
|
2884
3273
|
}
|
|
2885
3274
|
|
|
3275
|
+
# Security group for the API Lambda function, used when deployed into a VPC
|
|
3276
|
+
resource "aws_security_group" "api_lambda" {
|
|
3277
|
+
count = var.enable_vpc ? 1 : 0
|
|
3278
|
+
|
|
3279
|
+
#checkov:skip=CKV2_AWS_5:Attached to api_lambda via vpc_config block; Checkov cannot resolve this reference
|
|
3280
|
+
name_prefix = "test-api-lambda-"
|
|
3281
|
+
description = "Security group for the TestApi API Lambda function"
|
|
3282
|
+
vpc_id = var.vpc_id
|
|
3283
|
+
tags = var.tags
|
|
3284
|
+
}
|
|
3285
|
+
|
|
3286
|
+
resource "aws_vpc_security_group_egress_rule" "api_lambda_https" {
|
|
3287
|
+
count = var.enable_vpc ? 1 : 0
|
|
3288
|
+
|
|
3289
|
+
security_group_id = aws_security_group.api_lambda[0].id
|
|
3290
|
+
cidr_ipv4 = "0.0.0.0/0"
|
|
3291
|
+
from_port = 443
|
|
3292
|
+
to_port = 443
|
|
3293
|
+
ip_protocol = "tcp"
|
|
3294
|
+
description = "Allow outbound HTTPS to AWS service endpoints"
|
|
3295
|
+
}
|
|
3296
|
+
|
|
2886
3297
|
# Lambda function
|
|
2887
3298
|
resource "aws_lambda_function" "api_lambda" {
|
|
2888
|
-
#checkov:skip=CKV_AWS_117:Lambda function
|
|
3299
|
+
#checkov:skip=CKV_AWS_117:Lambda function is optionally deployed into a VPC via vpc_id/subnet_ids; not required for this use case
|
|
2889
3300
|
#checkov:skip=CKV_AWS_116:Dead Letter Queue not required for this simple API use case
|
|
2890
3301
|
#checkov:skip=CKV_AWS_272:Code signing not required for this use case
|
|
2891
3302
|
#checkov:skip=CKV_AWS_115:Concurrent execution limit not required for this use case
|
|
@@ -2907,13 +3318,25 @@ resource "aws_lambda_function" "api_lambda" {
|
|
|
2907
3318
|
mode = "Active"
|
|
2908
3319
|
}
|
|
2909
3320
|
|
|
3321
|
+
dynamic "vpc_config" {
|
|
3322
|
+
for_each = var.enable_vpc ? [1] : []
|
|
3323
|
+
content {
|
|
3324
|
+
subnet_ids = var.subnet_ids
|
|
3325
|
+
security_group_ids = [aws_security_group.api_lambda[0].id]
|
|
3326
|
+
}
|
|
3327
|
+
}
|
|
3328
|
+
|
|
2910
3329
|
|
|
2911
3330
|
environment {
|
|
2912
3331
|
variables = merge({
|
|
2913
|
-
}, var.
|
|
3332
|
+
}, var.appconfig_application_id != null ? {
|
|
3333
|
+
RUNTIME_CONFIG_APP_ID = var.appconfig_application_id
|
|
3334
|
+
} : {}, var.env)
|
|
2914
3335
|
}
|
|
2915
3336
|
|
|
2916
3337
|
tags = var.tags
|
|
3338
|
+
|
|
3339
|
+
depends_on = [aws_iam_role_policy_attachment.lambda_vpc_access]
|
|
2917
3340
|
}
|
|
2918
3341
|
|
|
2919
3342
|
# IAM role for Lambda execution
|
|
@@ -2948,18 +3371,39 @@ resource "aws_iam_role_policy_attachment" "lambda_xray_execution" {
|
|
|
2948
3371
|
role = aws_iam_role.lambda_execution_role.name
|
|
2949
3372
|
}
|
|
2950
3373
|
|
|
3374
|
+
# Attach VPC access policy to Lambda role when deployed into a VPC
|
|
3375
|
+
resource "aws_iam_role_policy_attachment" "lambda_vpc_access" {
|
|
3376
|
+
count = var.enable_vpc ? 1 : 0
|
|
3377
|
+
policy_arn = "arn:aws:iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole"
|
|
3378
|
+
role = aws_iam_role.lambda_execution_role.name
|
|
3379
|
+
}
|
|
3380
|
+
|
|
2951
3381
|
# Additional IAM policies for Lambda (if provided)
|
|
2952
3382
|
resource "aws_iam_role_policy" "lambda_additional_policies" {
|
|
2953
|
-
count = length(
|
|
3383
|
+
count = length(local.lambda_policy_statements) > 0 ? 1 : 0
|
|
2954
3384
|
name = "TestApiHandler-additional-policies-\${random_string.suffix.result}"
|
|
2955
3385
|
role = aws_iam_role.lambda_execution_role.id
|
|
2956
3386
|
|
|
2957
3387
|
policy = jsonencode({
|
|
2958
3388
|
Version = "2012-10-17"
|
|
2959
|
-
Statement =
|
|
3389
|
+
Statement = local.lambda_policy_statements
|
|
2960
3390
|
})
|
|
2961
3391
|
}
|
|
2962
3392
|
|
|
3393
|
+
locals {
|
|
3394
|
+
# Grant read access to the runtime-config AppConfig application when wired
|
|
3395
|
+
lambda_policy_statements = concat(var.appconfig_application_arn != null ? [
|
|
3396
|
+
{
|
|
3397
|
+
Effect = "Allow"
|
|
3398
|
+
Action = [
|
|
3399
|
+
"appconfig:StartConfigurationSession",
|
|
3400
|
+
"appconfig:GetLatestConfiguration"
|
|
3401
|
+
]
|
|
3402
|
+
Resource = ["\${var.appconfig_application_arn}/*"]
|
|
3403
|
+
}
|
|
3404
|
+
] : [], var.additional_iam_policy_statements)
|
|
3405
|
+
}
|
|
3406
|
+
|
|
2963
3407
|
# CloudWatch Log Group for Lambda
|
|
2964
3408
|
resource "aws_cloudwatch_log_group" "lambda_logs" {
|
|
2965
3409
|
#checkov:skip=CKV_AWS_158:Using default CloudWatch log encryption
|
|
@@ -3085,11 +3529,63 @@ resource "aws_api_gateway_deployment" "api_deployment" {
|
|
|
3085
3529
|
]
|
|
3086
3530
|
}
|
|
3087
3531
|
|
|
3532
|
+
# KMS key for encrypting access logs at rest
|
|
3533
|
+
resource "aws_kms_key" "access_logs" {
|
|
3534
|
+
description = "TestApi API access log encryption"
|
|
3535
|
+
deletion_window_in_days = 7
|
|
3536
|
+
enable_key_rotation = true
|
|
3537
|
+
|
|
3538
|
+
policy = jsonencode({
|
|
3539
|
+
Version = "2012-10-17"
|
|
3540
|
+
Statement = [
|
|
3541
|
+
{
|
|
3542
|
+
Sid = "Enable IAM User Permissions"
|
|
3543
|
+
Effect = "Allow"
|
|
3544
|
+
Principal = { AWS = "arn:aws:iam::\${data.aws_caller_identity.current.account_id}:root" }
|
|
3545
|
+
Action = "kms:*"
|
|
3546
|
+
Resource = "*"
|
|
3547
|
+
},
|
|
3548
|
+
{
|
|
3549
|
+
Sid = "Allow CloudWatch Logs"
|
|
3550
|
+
Effect = "Allow"
|
|
3551
|
+
Principal = { Service = "logs.\${data.aws_region.current.region}.amazonaws.com" }
|
|
3552
|
+
Action = [
|
|
3553
|
+
"kms:Encrypt",
|
|
3554
|
+
"kms:Decrypt",
|
|
3555
|
+
"kms:ReEncrypt*",
|
|
3556
|
+
"kms:GenerateDataKey*",
|
|
3557
|
+
"kms:DescribeKey"
|
|
3558
|
+
]
|
|
3559
|
+
Resource = "*"
|
|
3560
|
+
Condition = {
|
|
3561
|
+
ArnEquals = {
|
|
3562
|
+
"kms:EncryptionContext:aws:logs:arn" = "arn:aws:logs:\${data.aws_region.current.region}:\${data.aws_caller_identity.current.account_id}:log-group:/aws/apigateway/test-api-\${random_string.suffix.result}/access"
|
|
3563
|
+
}
|
|
3564
|
+
}
|
|
3565
|
+
}
|
|
3566
|
+
]
|
|
3567
|
+
})
|
|
3568
|
+
|
|
3569
|
+
tags = var.tags
|
|
3570
|
+
}
|
|
3571
|
+
|
|
3572
|
+
resource "aws_kms_alias" "access_logs" {
|
|
3573
|
+
name = "alias/test-api-\${random_string.suffix.result}-access-logs"
|
|
3574
|
+
target_key_id = aws_kms_key.access_logs.key_id
|
|
3575
|
+
}
|
|
3576
|
+
|
|
3577
|
+
# Access logs for the API Gateway stage
|
|
3578
|
+
resource "aws_cloudwatch_log_group" "access_logs" {
|
|
3579
|
+
name = "/aws/apigateway/test-api-\${random_string.suffix.result}/access"
|
|
3580
|
+
retention_in_days = 365
|
|
3581
|
+
kms_key_id = aws_kms_key.access_logs.arn
|
|
3582
|
+
tags = var.tags
|
|
3583
|
+
}
|
|
3584
|
+
|
|
3088
3585
|
# API Gateway stage
|
|
3089
3586
|
resource "aws_api_gateway_stage" "api_stage" {
|
|
3090
3587
|
#checkov:skip=CKV_AWS_120:API Gateway caching not required for this use case
|
|
3091
|
-
#checkov:skip=
|
|
3092
|
-
#checkov:skip=CKV2_AWS_4:API Gateway logging level not applicable as access logging is disabled
|
|
3588
|
+
#checkov:skip=CKV2_AWS_4:Access logging is enabled below; verbose execution logging is intentionally not enabled
|
|
3093
3589
|
#checkov:skip=CKV2_AWS_51:Client certificate authentication not required for this use case
|
|
3094
3590
|
#checkov:skip=CKV2_AWS_77:WAFv2 Web ACL is attached via aws_wafv2_web_acl_association when var.enable_waf is true (default) and includes AWSManagedRulesKnownBadInputsRuleSet for Log4j protection; Checkov does not track the association across modules
|
|
3095
3591
|
deployment_id = aws_api_gateway_deployment.api_deployment.id
|
|
@@ -3097,9 +3593,39 @@ resource "aws_api_gateway_stage" "api_stage" {
|
|
|
3097
3593
|
stage_name = "prod"
|
|
3098
3594
|
xray_tracing_enabled = true
|
|
3099
3595
|
|
|
3596
|
+
access_log_settings {
|
|
3597
|
+
destination_arn = aws_cloudwatch_log_group.access_logs.arn
|
|
3598
|
+
format = jsonencode({
|
|
3599
|
+
requestId = "$context.requestId"
|
|
3600
|
+
ip = "$context.identity.sourceIp"
|
|
3601
|
+
caller = "$context.identity.caller"
|
|
3602
|
+
user = "$context.identity.user"
|
|
3603
|
+
requestTime = "$context.requestTime"
|
|
3604
|
+
httpMethod = "$context.httpMethod"
|
|
3605
|
+
resourcePath = "$context.resourcePath"
|
|
3606
|
+
status = "$context.status"
|
|
3607
|
+
protocol = "$context.protocol"
|
|
3608
|
+
responseLength = "$context.responseLength"
|
|
3609
|
+
})
|
|
3610
|
+
}
|
|
3611
|
+
|
|
3100
3612
|
tags = var.tags
|
|
3101
3613
|
|
|
3102
|
-
|
|
3614
|
+
# Ensure the account-level role is configured before the stage is created
|
|
3615
|
+
depends_on = [aws_api_gateway_deployment.api_deployment, module.account]
|
|
3616
|
+
}
|
|
3617
|
+
|
|
3618
|
+
# Default throttling applied to all resource paths and methods
|
|
3619
|
+
resource "aws_api_gateway_method_settings" "throttling" {
|
|
3620
|
+
#checkov:skip=CKV_AWS_225:API Gateway caching not required for this use case
|
|
3621
|
+
rest_api_id = module.rest_api.api_id
|
|
3622
|
+
stage_name = aws_api_gateway_stage.api_stage.stage_name
|
|
3623
|
+
method_path = "*/*"
|
|
3624
|
+
|
|
3625
|
+
settings {
|
|
3626
|
+
throttling_rate_limit = 10000
|
|
3627
|
+
throttling_burst_limit = 5000
|
|
3628
|
+
}
|
|
3103
3629
|
}
|
|
3104
3630
|
|
|
3105
3631
|
# API Gateway Resource Policy
|
|
@@ -3249,6 +3775,11 @@ output "lambda_execution_role_name" {
|
|
|
3249
3775
|
value = aws_iam_role.lambda_execution_role.name
|
|
3250
3776
|
}
|
|
3251
3777
|
|
|
3778
|
+
output "security_group_id" {
|
|
3779
|
+
description = "Security group ID of the API Lambda function, for use in ingress rules on resources it must reach (e.g. a database). Null unless enable_vpc is true."
|
|
3780
|
+
value = var.enable_vpc ? aws_security_group.api_lambda[0].id : null
|
|
3781
|
+
}
|
|
3782
|
+
|
|
3252
3783
|
# Integration Outputs
|
|
3253
3784
|
output "integration_id" {
|
|
3254
3785
|
description = "ID of the Lambda integration"
|
|
@@ -3286,7 +3817,7 @@ exports[`tsSmithyApiGenerator > terraform iac > should generate terraform with c
|
|
|
3286
3817
|
required_providers {
|
|
3287
3818
|
aws = {
|
|
3288
3819
|
source = "hashicorp/aws"
|
|
3289
|
-
version = "
|
|
3820
|
+
version = "6.55.0"
|
|
3290
3821
|
}
|
|
3291
3822
|
}
|
|
3292
3823
|
}
|
|
@@ -3308,11 +3839,47 @@ variable "additional_iam_policy_statements" {
|
|
|
3308
3839
|
default = []
|
|
3309
3840
|
}
|
|
3310
3841
|
|
|
3842
|
+
variable "appconfig_application_id" {
|
|
3843
|
+
description = "ID of the shared runtime-config AppConfig application (from \`core/runtime-config/appconfig.application_id\`). When set, the Lambda functions receive \`RUNTIME_CONFIG_APP_ID\` and read access to the application."
|
|
3844
|
+
type = string
|
|
3845
|
+
default = null
|
|
3846
|
+
}
|
|
3847
|
+
|
|
3848
|
+
variable "appconfig_application_arn" {
|
|
3849
|
+
description = "ARN of the shared runtime-config AppConfig application (from \`core/runtime-config/appconfig.application_arn\`). Used to scope the IAM read permission granted to the Lambda functions."
|
|
3850
|
+
type = string
|
|
3851
|
+
default = null
|
|
3852
|
+
}
|
|
3853
|
+
|
|
3311
3854
|
variable "asset_bucket_name" {
|
|
3312
3855
|
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."
|
|
3313
3856
|
type = string
|
|
3314
3857
|
}
|
|
3315
3858
|
|
|
3859
|
+
# VPC Configuration (optional)
|
|
3860
|
+
variable "enable_vpc" {
|
|
3861
|
+
description = "Deploy the Lambda function into a VPC. Set alongside vpc_id/subnet_ids."
|
|
3862
|
+
type = bool
|
|
3863
|
+
default = false
|
|
3864
|
+
}
|
|
3865
|
+
|
|
3866
|
+
variable "vpc_id" {
|
|
3867
|
+
description = "VPC ID to deploy the Lambda function into. Required when enable_vpc is true."
|
|
3868
|
+
type = string
|
|
3869
|
+
default = null
|
|
3870
|
+
|
|
3871
|
+
validation {
|
|
3872
|
+
condition = !var.enable_vpc || (var.vpc_id != null && var.subnet_ids != null)
|
|
3873
|
+
error_message = "vpc_id and subnet_ids must be set when enable_vpc is true."
|
|
3874
|
+
}
|
|
3875
|
+
}
|
|
3876
|
+
|
|
3877
|
+
variable "subnet_ids" {
|
|
3878
|
+
description = "Subnet IDs to deploy the Lambda function into. Required when enable_vpc is true."
|
|
3879
|
+
type = list(string)
|
|
3880
|
+
default = null
|
|
3881
|
+
}
|
|
3882
|
+
|
|
3316
3883
|
# CORS Configuration (passed to core module)
|
|
3317
3884
|
|
|
3318
3885
|
variable "cors_allow_headers" {
|
|
@@ -3375,6 +3942,11 @@ resource "aws_s3_object" "lambda_zip" {
|
|
|
3375
3942
|
}
|
|
3376
3943
|
|
|
3377
3944
|
# Use the core REST API module
|
|
3945
|
+
# Account-level CloudWatch role required for REST API access logging
|
|
3946
|
+
module "account" {
|
|
3947
|
+
source = "../../../core/api/api-gateway-account"
|
|
3948
|
+
}
|
|
3949
|
+
|
|
3378
3950
|
module "rest_api" {
|
|
3379
3951
|
source = "../../../core/api/rest-api"
|
|
3380
3952
|
|
|
@@ -3404,9 +3976,31 @@ resource "aws_wafv2_web_acl_association" "api_waf_association" {
|
|
|
3404
3976
|
depends_on = [aws_api_gateway_stage.api_stage]
|
|
3405
3977
|
}
|
|
3406
3978
|
|
|
3979
|
+
# Security group for the API Lambda function, used when deployed into a VPC
|
|
3980
|
+
resource "aws_security_group" "api_lambda" {
|
|
3981
|
+
count = var.enable_vpc ? 1 : 0
|
|
3982
|
+
|
|
3983
|
+
#checkov:skip=CKV2_AWS_5:Attached to api_lambda via vpc_config block; Checkov cannot resolve this reference
|
|
3984
|
+
name_prefix = "custom-api-lambda-"
|
|
3985
|
+
description = "Security group for the CustomApi API Lambda function"
|
|
3986
|
+
vpc_id = var.vpc_id
|
|
3987
|
+
tags = var.tags
|
|
3988
|
+
}
|
|
3989
|
+
|
|
3990
|
+
resource "aws_vpc_security_group_egress_rule" "api_lambda_https" {
|
|
3991
|
+
count = var.enable_vpc ? 1 : 0
|
|
3992
|
+
|
|
3993
|
+
security_group_id = aws_security_group.api_lambda[0].id
|
|
3994
|
+
cidr_ipv4 = "0.0.0.0/0"
|
|
3995
|
+
from_port = 443
|
|
3996
|
+
to_port = 443
|
|
3997
|
+
ip_protocol = "tcp"
|
|
3998
|
+
description = "Allow outbound HTTPS to AWS service endpoints"
|
|
3999
|
+
}
|
|
4000
|
+
|
|
3407
4001
|
# Lambda function
|
|
3408
4002
|
resource "aws_lambda_function" "api_lambda" {
|
|
3409
|
-
#checkov:skip=CKV_AWS_117:Lambda function
|
|
4003
|
+
#checkov:skip=CKV_AWS_117:Lambda function is optionally deployed into a VPC via vpc_id/subnet_ids; not required for this use case
|
|
3410
4004
|
#checkov:skip=CKV_AWS_116:Dead Letter Queue not required for this simple API use case
|
|
3411
4005
|
#checkov:skip=CKV_AWS_272:Code signing not required for this use case
|
|
3412
4006
|
#checkov:skip=CKV_AWS_115:Concurrent execution limit not required for this use case
|
|
@@ -3428,13 +4022,25 @@ resource "aws_lambda_function" "api_lambda" {
|
|
|
3428
4022
|
mode = "Active"
|
|
3429
4023
|
}
|
|
3430
4024
|
|
|
4025
|
+
dynamic "vpc_config" {
|
|
4026
|
+
for_each = var.enable_vpc ? [1] : []
|
|
4027
|
+
content {
|
|
4028
|
+
subnet_ids = var.subnet_ids
|
|
4029
|
+
security_group_ids = [aws_security_group.api_lambda[0].id]
|
|
4030
|
+
}
|
|
4031
|
+
}
|
|
4032
|
+
|
|
3431
4033
|
|
|
3432
4034
|
environment {
|
|
3433
4035
|
variables = merge({
|
|
3434
|
-
}, var.
|
|
4036
|
+
}, var.appconfig_application_id != null ? {
|
|
4037
|
+
RUNTIME_CONFIG_APP_ID = var.appconfig_application_id
|
|
4038
|
+
} : {}, var.env)
|
|
3435
4039
|
}
|
|
3436
4040
|
|
|
3437
4041
|
tags = var.tags
|
|
4042
|
+
|
|
4043
|
+
depends_on = [aws_iam_role_policy_attachment.lambda_vpc_access]
|
|
3438
4044
|
}
|
|
3439
4045
|
|
|
3440
4046
|
# IAM role for Lambda execution
|
|
@@ -3469,18 +4075,39 @@ resource "aws_iam_role_policy_attachment" "lambda_xray_execution" {
|
|
|
3469
4075
|
role = aws_iam_role.lambda_execution_role.name
|
|
3470
4076
|
}
|
|
3471
4077
|
|
|
4078
|
+
# Attach VPC access policy to Lambda role when deployed into a VPC
|
|
4079
|
+
resource "aws_iam_role_policy_attachment" "lambda_vpc_access" {
|
|
4080
|
+
count = var.enable_vpc ? 1 : 0
|
|
4081
|
+
policy_arn = "arn:aws:iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole"
|
|
4082
|
+
role = aws_iam_role.lambda_execution_role.name
|
|
4083
|
+
}
|
|
4084
|
+
|
|
3472
4085
|
# Additional IAM policies for Lambda (if provided)
|
|
3473
4086
|
resource "aws_iam_role_policy" "lambda_additional_policies" {
|
|
3474
|
-
count = length(
|
|
4087
|
+
count = length(local.lambda_policy_statements) > 0 ? 1 : 0
|
|
3475
4088
|
name = "CustomApiHandler-additional-policies-\${random_string.suffix.result}"
|
|
3476
4089
|
role = aws_iam_role.lambda_execution_role.id
|
|
3477
4090
|
|
|
3478
4091
|
policy = jsonencode({
|
|
3479
4092
|
Version = "2012-10-17"
|
|
3480
|
-
Statement =
|
|
4093
|
+
Statement = local.lambda_policy_statements
|
|
3481
4094
|
})
|
|
3482
4095
|
}
|
|
3483
4096
|
|
|
4097
|
+
locals {
|
|
4098
|
+
# Grant read access to the runtime-config AppConfig application when wired
|
|
4099
|
+
lambda_policy_statements = concat(var.appconfig_application_arn != null ? [
|
|
4100
|
+
{
|
|
4101
|
+
Effect = "Allow"
|
|
4102
|
+
Action = [
|
|
4103
|
+
"appconfig:StartConfigurationSession",
|
|
4104
|
+
"appconfig:GetLatestConfiguration"
|
|
4105
|
+
]
|
|
4106
|
+
Resource = ["\${var.appconfig_application_arn}/*"]
|
|
4107
|
+
}
|
|
4108
|
+
] : [], var.additional_iam_policy_statements)
|
|
4109
|
+
}
|
|
4110
|
+
|
|
3484
4111
|
# CloudWatch Log Group for Lambda
|
|
3485
4112
|
resource "aws_cloudwatch_log_group" "lambda_logs" {
|
|
3486
4113
|
#checkov:skip=CKV_AWS_158:Using default CloudWatch log encryption
|
|
@@ -3700,11 +4327,63 @@ resource "aws_api_gateway_deployment" "api_deployment" {
|
|
|
3700
4327
|
]
|
|
3701
4328
|
}
|
|
3702
4329
|
|
|
4330
|
+
# KMS key for encrypting access logs at rest
|
|
4331
|
+
resource "aws_kms_key" "access_logs" {
|
|
4332
|
+
description = "CustomApi API access log encryption"
|
|
4333
|
+
deletion_window_in_days = 7
|
|
4334
|
+
enable_key_rotation = true
|
|
4335
|
+
|
|
4336
|
+
policy = jsonencode({
|
|
4337
|
+
Version = "2012-10-17"
|
|
4338
|
+
Statement = [
|
|
4339
|
+
{
|
|
4340
|
+
Sid = "Enable IAM User Permissions"
|
|
4341
|
+
Effect = "Allow"
|
|
4342
|
+
Principal = { AWS = "arn:aws:iam::\${data.aws_caller_identity.current.account_id}:root" }
|
|
4343
|
+
Action = "kms:*"
|
|
4344
|
+
Resource = "*"
|
|
4345
|
+
},
|
|
4346
|
+
{
|
|
4347
|
+
Sid = "Allow CloudWatch Logs"
|
|
4348
|
+
Effect = "Allow"
|
|
4349
|
+
Principal = { Service = "logs.\${data.aws_region.current.region}.amazonaws.com" }
|
|
4350
|
+
Action = [
|
|
4351
|
+
"kms:Encrypt",
|
|
4352
|
+
"kms:Decrypt",
|
|
4353
|
+
"kms:ReEncrypt*",
|
|
4354
|
+
"kms:GenerateDataKey*",
|
|
4355
|
+
"kms:DescribeKey"
|
|
4356
|
+
]
|
|
4357
|
+
Resource = "*"
|
|
4358
|
+
Condition = {
|
|
4359
|
+
ArnEquals = {
|
|
4360
|
+
"kms:EncryptionContext:aws:logs:arn" = "arn:aws:logs:\${data.aws_region.current.region}:\${data.aws_caller_identity.current.account_id}:log-group:/aws/apigateway/custom-api-\${random_string.suffix.result}/access"
|
|
4361
|
+
}
|
|
4362
|
+
}
|
|
4363
|
+
}
|
|
4364
|
+
]
|
|
4365
|
+
})
|
|
4366
|
+
|
|
4367
|
+
tags = var.tags
|
|
4368
|
+
}
|
|
4369
|
+
|
|
4370
|
+
resource "aws_kms_alias" "access_logs" {
|
|
4371
|
+
name = "alias/custom-api-\${random_string.suffix.result}-access-logs"
|
|
4372
|
+
target_key_id = aws_kms_key.access_logs.key_id
|
|
4373
|
+
}
|
|
4374
|
+
|
|
4375
|
+
# Access logs for the API Gateway stage
|
|
4376
|
+
resource "aws_cloudwatch_log_group" "access_logs" {
|
|
4377
|
+
name = "/aws/apigateway/custom-api-\${random_string.suffix.result}/access"
|
|
4378
|
+
retention_in_days = 365
|
|
4379
|
+
kms_key_id = aws_kms_key.access_logs.arn
|
|
4380
|
+
tags = var.tags
|
|
4381
|
+
}
|
|
4382
|
+
|
|
3703
4383
|
# API Gateway stage
|
|
3704
4384
|
resource "aws_api_gateway_stage" "api_stage" {
|
|
3705
4385
|
#checkov:skip=CKV_AWS_120:API Gateway caching not required for this use case
|
|
3706
|
-
#checkov:skip=
|
|
3707
|
-
#checkov:skip=CKV2_AWS_4:API Gateway logging level not applicable as access logging is disabled
|
|
4386
|
+
#checkov:skip=CKV2_AWS_4:Access logging is enabled below; verbose execution logging is intentionally not enabled
|
|
3708
4387
|
#checkov:skip=CKV2_AWS_51:Client certificate authentication not required for this use case
|
|
3709
4388
|
#checkov:skip=CKV2_AWS_77:WAFv2 Web ACL is attached via aws_wafv2_web_acl_association when var.enable_waf is true (default) and includes AWSManagedRulesKnownBadInputsRuleSet for Log4j protection; Checkov does not track the association across modules
|
|
3710
4389
|
deployment_id = aws_api_gateway_deployment.api_deployment.id
|
|
@@ -3712,9 +4391,39 @@ resource "aws_api_gateway_stage" "api_stage" {
|
|
|
3712
4391
|
stage_name = "prod"
|
|
3713
4392
|
xray_tracing_enabled = true
|
|
3714
4393
|
|
|
4394
|
+
access_log_settings {
|
|
4395
|
+
destination_arn = aws_cloudwatch_log_group.access_logs.arn
|
|
4396
|
+
format = jsonencode({
|
|
4397
|
+
requestId = "$context.requestId"
|
|
4398
|
+
ip = "$context.identity.sourceIp"
|
|
4399
|
+
caller = "$context.identity.caller"
|
|
4400
|
+
user = "$context.identity.user"
|
|
4401
|
+
requestTime = "$context.requestTime"
|
|
4402
|
+
httpMethod = "$context.httpMethod"
|
|
4403
|
+
resourcePath = "$context.resourcePath"
|
|
4404
|
+
status = "$context.status"
|
|
4405
|
+
protocol = "$context.protocol"
|
|
4406
|
+
responseLength = "$context.responseLength"
|
|
4407
|
+
})
|
|
4408
|
+
}
|
|
4409
|
+
|
|
3715
4410
|
tags = var.tags
|
|
3716
4411
|
|
|
3717
|
-
|
|
4412
|
+
# Ensure the account-level role is configured before the stage is created
|
|
4413
|
+
depends_on = [aws_api_gateway_deployment.api_deployment, module.account]
|
|
4414
|
+
}
|
|
4415
|
+
|
|
4416
|
+
# Default throttling applied to all resource paths and methods
|
|
4417
|
+
resource "aws_api_gateway_method_settings" "throttling" {
|
|
4418
|
+
#checkov:skip=CKV_AWS_225:API Gateway caching not required for this use case
|
|
4419
|
+
rest_api_id = module.rest_api.api_id
|
|
4420
|
+
stage_name = aws_api_gateway_stage.api_stage.stage_name
|
|
4421
|
+
method_path = "*/*"
|
|
4422
|
+
|
|
4423
|
+
settings {
|
|
4424
|
+
throttling_rate_limit = 10000
|
|
4425
|
+
throttling_burst_limit = 5000
|
|
4426
|
+
}
|
|
3718
4427
|
}
|
|
3719
4428
|
|
|
3720
4429
|
# API Gateway Resource Policy
|
|
@@ -3853,6 +4562,11 @@ output "lambda_execution_role_name" {
|
|
|
3853
4562
|
value = aws_iam_role.lambda_execution_role.name
|
|
3854
4563
|
}
|
|
3855
4564
|
|
|
4565
|
+
output "security_group_id" {
|
|
4566
|
+
description = "Security group ID of the API Lambda function, for use in ingress rules on resources it must reach (e.g. a database). Null unless enable_vpc is true."
|
|
4567
|
+
value = var.enable_vpc ? aws_security_group.api_lambda[0].id : null
|
|
4568
|
+
}
|
|
4569
|
+
|
|
3856
4570
|
# Integration Outputs
|
|
3857
4571
|
output "integration_id" {
|
|
3858
4572
|
description = "ID of the Lambda integration"
|