@ripla/godd-mcp 1.0.4-canary.9 → 1.0.4
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/README.md +89 -94
- package/dist/godd.cjs +349 -233
- package/dist/godd.js +2193 -838
- package/dist/index.js +152 -122
- package/{notes-api → notes/api}/.env.example +6 -1
- package/{notes-api → notes/api}/README.md +6 -5
- package/{notes-api → notes/api}/app/main.py +29 -2
- package/{notes-api → notes/api}/app/routers/auth.py +6 -1
- package/{notes-api → notes/api}/app/routers/issues.py +157 -1
- package/{notes-api → notes/api}/app/routers/pr.py +2 -2
- package/{notes-api → notes/api}/app/services/github_app_token.py +32 -1
- package/{notes-api → notes/api}/app/services/github_issues.py +101 -11
- package/{notes-api → notes/api}/app/services/github_pr.py +6 -1
- package/{notes-api → notes/api}/tests/test_github_app_token.py +49 -1
- package/{notes-api → notes/api}/tests/test_github_service.py +42 -0
- package/notes/api/tests/test_health.py +52 -0
- package/{notes-api → notes/api}/tests/test_issues.py +216 -0
- package/{notes-api → notes/api}/tests/test_pr.py +24 -0
- package/{notes-api → notes/api}/tests/test_pr_chain.py +19 -0
- package/{notes-api → notes/api}/uv.lock +178 -2
- package/notes/app/DESIGN.md +273 -0
- package/{notes-app → notes/app}/README.md +4 -1
- package/notes/app/docker/Dockerfile.e2e +19 -0
- package/notes/app/docker/Dockerfile.prod +15 -0
- package/notes/app/docker/Dockerfile.test +17 -0
- package/notes/app/e2e/file-tree.spec.ts +26 -0
- package/notes/app/e2e/file-view.spec.ts +25 -0
- package/notes/app/e2e/fixtures.ts +28 -0
- package/{notes-app → notes/app}/e2e/global-setup.ts +5 -7
- package/notes/app/e2e/login.spec.ts +25 -0
- package/notes/app/e2e/pages/login-page.ts +29 -0
- package/notes/app/e2e/pages/main-page.ts +29 -0
- package/notes/app/e2e/panel-resize-handle.spec.ts +213 -0
- package/{notes-app → notes/app}/eslint.config.js +9 -0
- package/{notes-app → notes/app}/package.json +0 -3
- package/{notes-app → notes/app}/pnpm-workspace.yaml +1 -0
- package/notes/app/src/components/CommentPanel.test.tsx +194 -0
- package/{notes-app → notes/app}/src/components/CommentPanel.tsx +119 -10
- package/notes/app/src/components/CommentSelectionPopover.tsx +26 -0
- package/notes/app/src/components/EditToolbar.test.tsx +102 -0
- package/{notes-app → notes/app}/src/components/EditToolbar.tsx +5 -54
- package/notes/app/src/components/FileInfoPanel.branch-tab.test.tsx +250 -0
- package/notes/app/src/components/FileInfoPanel.history-tab.test.tsx +146 -0
- package/notes/app/src/components/FileInfoPanel.test.tsx +101 -0
- package/{notes-app → notes/app}/src/components/FileInfoPanel.tsx +135 -20
- package/notes/app/src/components/IssueCommentThread.test.tsx +93 -0
- package/notes/app/src/components/IssueCommentThread.tsx +156 -0
- package/notes/app/src/components/IssueDetailView.test.tsx +1118 -0
- package/notes/app/src/components/IssueDetailView.tsx +476 -0
- package/notes/app/src/components/IssueList.test.tsx +545 -0
- package/notes/app/src/components/IssueList.tsx +374 -0
- package/{notes-app → notes/app}/src/components/LabelSelector.test.tsx +94 -8
- package/notes/app/src/components/LabelSelector.tsx +452 -0
- package/{notes-app → notes/app}/src/components/MarkdownEditor.tsx +140 -2
- package/notes/app/src/components/PanelResizeHandle.test.tsx +481 -0
- package/notes/app/src/components/PanelResizeHandle.tsx +96 -0
- package/{notes-app → notes/app}/src/hooks/useEditSession.test.ts +171 -23
- package/{notes-app → notes/app}/src/hooks/useEditSession.ts +49 -62
- package/notes/app/src/hooks/useMdUpLayout.test.ts +10 -0
- package/notes/app/src/hooks/useMdUpLayout.ts +27 -0
- package/notes/app/src/hooks/usePeriodicSync.test.ts +244 -0
- package/notes/app/src/hooks/usePeriodicSync.ts +83 -0
- package/notes/app/src/hooks/useResizablePanelWidth.test.ts +251 -0
- package/notes/app/src/hooks/useResizablePanelWidth.ts +167 -0
- package/{notes-app → notes/app}/src/lib/api.test.ts +81 -1
- package/{notes-app → notes/app}/src/lib/api.ts +98 -4
- package/notes/app/src/lib/commentAnchor.test.ts +22 -0
- package/notes/app/src/lib/commentAnchor.ts +28 -0
- package/notes/app/src/lib/commentHighlight.test.ts +110 -0
- package/notes/app/src/lib/commentHighlight.ts +44 -0
- package/notes/app/src/lib/github-sync.test.ts +126 -0
- package/notes/app/src/lib/github-sync.ts +89 -0
- package/notes/app/src/lib/issue-list-utils.test.ts +275 -0
- package/notes/app/src/lib/issue-list-utils.ts +135 -0
- package/notes/app/src/lib/issue-mobile-layout.test.ts +17 -0
- package/notes/app/src/lib/issue-mobile-layout.ts +20 -0
- package/notes/app/src/lib/issue-url-sync.test.ts +73 -0
- package/notes/app/src/lib/issue-url-sync.ts +43 -0
- package/notes/app/src/lib/main-page-default-view.test.ts +37 -0
- package/notes/app/src/lib/main-page-default-view.ts +15 -0
- package/notes/app/src/lib/resizable-panel.test.ts +199 -0
- package/notes/app/src/lib/resizable-panel.ts +136 -0
- package/notes/app/src/pages/LoginPage.test.tsx +17 -0
- package/notes/app/src/pages/MainPage.branch-modal.test.tsx +226 -0
- package/notes/app/src/pages/MainPage.issue-sync.test.tsx +145 -0
- package/notes/app/src/pages/MainPage.sidebar.test.tsx +361 -0
- package/{notes-app → notes/app}/src/pages/MainPage.tsx +406 -61
- package/{notes-app → notes/app}/src/pages/SettingsPage.test.tsx +32 -23
- package/{notes-app → notes/app}/src/pages/UserManagementPage.test.tsx +8 -18
- package/notes/app/src/test/mocks.ts +156 -0
- package/notes/app/src/test/render.tsx +27 -0
- package/package.json +3 -5
- package/notes-api/tests/test_health.py +0 -11
- package/notes-app/docker/Dockerfile.e2e +0 -14
- package/notes-app/docker/Dockerfile.prod +0 -12
- package/notes-app/docker/Dockerfile.test +0 -12
- package/notes-app/e2e/file-tree.spec.ts +0 -29
- package/notes-app/e2e/file-view.spec.ts +0 -24
- package/notes-app/e2e/login.spec.ts +0 -32
- package/notes-app/src/components/IssueDetailView.test.tsx +0 -201
- package/notes-app/src/components/IssueDetailView.tsx +0 -318
- package/notes-app/src/components/IssueList.test.tsx +0 -93
- package/notes-app/src/components/IssueList.tsx +0 -169
- package/notes-app/src/components/LabelSelector.tsx +0 -276
- package/notes-app/src/pages/LoginPage.test.tsx +0 -29
- package/stacks/django-vue.yaml +0 -33
- package/stacks/fastapi-react.yaml +0 -160
- package/stacks/flutter-firebase.yaml +0 -58
- package/stacks/nextjs-prisma.yaml +0 -33
- package/stacks/schema.json +0 -144
- package/templates/agents/architect.hbs +0 -183
- package/templates/agents/auto-documenter.hbs +0 -36
- package/templates/agents/backend-developer.hbs +0 -175
- package/templates/agents/code-reviewer.hbs +0 -29
- package/templates/agents/database-developer.hbs +0 -52
- package/templates/agents/debug-specialist.hbs +0 -39
- package/templates/agents/environment-setup.hbs +0 -41
- package/templates/agents/frontend-developer.hbs +0 -45
- package/templates/agents/integration-qa.hbs +0 -26
- package/templates/agents/performance-qa.hbs +0 -24
- package/templates/agents/pr-writer.hbs +0 -53
- package/templates/agents/quality-lead.hbs +0 -26
- package/templates/agents/requirements-analyst.hbs +0 -26
- package/templates/agents/security-analyst.hbs +0 -21
- package/templates/agents/security-reviewer.hbs +0 -20
- package/templates/agents/ssot-updater.hbs +0 -45
- package/templates/agents/technical-writer.hbs +0 -28
- package/templates/agents/unit-test-engineer.hbs +0 -19
- package/templates/agents/user-clone.hbs +0 -49
- package/templates/github-actions/aws/deploy-notes.yml.hbs +0 -117
- package/templates/github-actions/azure/deploy-notes.yml.hbs +0 -78
- package/templates/github-actions/gcp/deploy-notes.yml.hbs +0 -76
- package/templates/github-actions/vercel-railway/deploy-notes.yml.hbs +0 -49
- package/templates/mindsets/agent-stdio.hbs +0 -51
- package/templates/mindsets/dart.hbs +0 -39
- package/templates/mindsets/ddd-clean-architecture.hbs +0 -52
- package/templates/mindsets/electron.hbs +0 -41
- package/templates/mindsets/fastapi.hbs +0 -40
- package/templates/mindsets/flutter.hbs +0 -56
- package/templates/mindsets/kotlin.hbs +0 -46
- package/templates/mindsets/postgresql.hbs +0 -39
- package/templates/mindsets/python.hbs +0 -39
- package/templates/mindsets/react.hbs +0 -51
- package/templates/mindsets/swift.hbs +0 -46
- package/templates/mindsets/terraform.hbs +0 -53
- package/templates/mindsets/typescript.hbs +0 -34
- package/templates/mindsets/vite.hbs +0 -37
- package/templates/notes-compose.yml +0 -82
- package/templates/partials/cogito-geo.hbs +0 -84
- package/templates/partials/cogito-godd.hbs +0 -22
- package/templates/partials/cogito-grammar.hbs +0 -105
- package/templates/partials/cogito-particle.hbs +0 -76
- package/templates/partials/cogito-root-ai.hbs +0 -79
- package/templates/partials/cogito-root-arch.hbs +0 -75
- package/templates/partials/cogito-root-core.hbs +0 -75
- package/templates/partials/cogito-root-daily.hbs +0 -58
- package/templates/partials/cogito-root-dev.hbs +0 -71
- package/templates/partials/cogito-root-devops.hbs +0 -71
- package/templates/partials/cogito-root-framework.hbs +0 -80
- package/templates/partials/cogito-root-lang.hbs +0 -74
- package/templates/partials/godd-core.hbs +0 -50
- package/templates/partials/project-context.hbs +0 -52
- package/templates/partials/ssot-header.hbs +0 -40
- package/templates/partials/ssot-rules.hbs +0 -30
- package/templates/prompts/adr.hbs +0 -39
- package/templates/prompts/agent-dev-workflow.hbs +0 -34
- package/templates/prompts/analyze-report.hbs +0 -36
- package/templates/prompts/auto-documentation.hbs +0 -37
- package/templates/prompts/check.hbs +0 -52
- package/templates/prompts/commit.hbs +0 -96
- package/templates/prompts/dev.hbs +0 -127
- package/templates/prompts/docs-init.hbs +0 -101
- package/templates/prompts/docs-update.hbs +0 -51
- package/templates/prompts/git-workflow.hbs +0 -125
- package/templates/prompts/impact-analysis.hbs +0 -43
- package/templates/prompts/install.hbs +0 -40
- package/templates/prompts/new-branch.hbs +0 -61
- package/templates/prompts/notes-deploy.hbs +0 -138
- package/templates/prompts/pr-analyze.hbs +0 -44
- package/templates/prompts/pr-create.hbs +0 -125
- package/templates/prompts/push-execute.hbs +0 -83
- package/templates/prompts/push.hbs +0 -24
- package/templates/prompts/release-notes.hbs +0 -38
- package/templates/prompts/requirements-to-business-flow.hbs +0 -29
- package/templates/prompts/requirements-to-tickets.hbs +0 -26
- package/templates/prompts/review.hbs +0 -126
- package/templates/prompts/setup.hbs +0 -247
- package/templates/prompts/spec.hbs +0 -35
- package/templates/prompts/specification-to-tickets.hbs +0 -24
- package/templates/prompts/submit.hbs +0 -143
- package/templates/prompts/sync.hbs +0 -63
- package/templates/prompts/test-plan.hbs +0 -56
- package/templates/scripts/aws/terraform-backend-setup.sh.hbs +0 -149
- package/templates/terraform/aws/alb.tf.hbs +0 -58
- package/templates/terraform/aws/backend.tf.hbs +0 -10
- package/templates/terraform/aws/cloudfront.tf.hbs +0 -96
- package/templates/terraform/aws/ecr.tf.hbs +0 -30
- package/templates/terraform/aws/ecs.tf.hbs +0 -142
- package/templates/terraform/aws/iam.tf.hbs +0 -88
- package/templates/terraform/aws/local.tf.hbs +0 -34
- package/templates/terraform/aws/output.tf.hbs +0 -49
- package/templates/terraform/aws/provider.tf.hbs +0 -26
- package/templates/terraform/aws/rds.tf.hbs +0 -38
- package/templates/terraform/aws/s3.tf.hbs +0 -34
- package/templates/terraform/aws/secrets.tf.hbs +0 -53
- package/templates/terraform/aws/security_groups.tf.hbs +0 -81
- package/templates/terraform/aws/vpc.tf.hbs +0 -63
- package/templates/terraform/azure/backend.tf.hbs +0 -8
- package/templates/terraform/azure/iam.tf.hbs +0 -36
- package/templates/terraform/azure/main.tf.hbs +0 -203
- package/templates/terraform/azure/output.tf.hbs +0 -19
- package/templates/terraform/azure/provider.tf.hbs +0 -19
- package/templates/terraform/gcp/backend.tf.hbs +0 -6
- package/templates/terraform/gcp/iam.tf.hbs +0 -47
- package/templates/terraform/gcp/main.tf.hbs +0 -175
- package/templates/terraform/gcp/output.tf.hbs +0 -15
- package/templates/terraform/gcp/provider.tf.hbs +0 -19
- package/templates/terraform/vercel-railway/main.tf.hbs +0 -64
- package/templates/terraform/vercel-railway/output.tf.hbs +0 -11
- /package/{notes-api → notes/api}/.dockerignore +0 -0
- /package/{notes-api → notes/api}/alembic/README +0 -0
- /package/{notes-api → notes/api}/alembic/env.py +0 -0
- /package/{notes-api → notes/api}/alembic/script.py.mako +0 -0
- /package/{notes-api → notes/api}/alembic/versions/001_initial_notes_tables.py +0 -0
- /package/{notes-api → notes/api}/alembic/versions/002_add_performance_indexes.py +0 -0
- /package/{notes-api → notes/api}/alembic/versions/003_add_yjs_documents.py +0 -0
- /package/{notes-api → notes/api}/alembic/versions/004_add_comments.py +0 -0
- /package/{notes-api → notes/api}/alembic/versions/005_add_github_username.py +0 -0
- /package/{notes-api → notes/api}/alembic/versions/006_add_check_constraints.py +0 -0
- /package/{notes-api → notes/api}/alembic.ini +0 -0
- /package/{notes-api → notes/api}/app/__init__.py +0 -0
- /package/{notes-api → notes/api}/app/config.py +0 -0
- /package/{notes-api → notes/api}/app/database.py +0 -0
- /package/{notes-api → notes/api}/app/http_client.py +0 -0
- /package/{notes-api → notes/api}/app/models/__init__.py +0 -0
- /package/{notes-api → notes/api}/app/models/audit.py +0 -0
- /package/{notes-api → notes/api}/app/models/base.py +0 -0
- /package/{notes-api → notes/api}/app/models/collab.py +0 -0
- /package/{notes-api → notes/api}/app/models/comment.py +0 -0
- /package/{notes-api → notes/api}/app/models/session.py +0 -0
- /package/{notes-api → notes/api}/app/models/setting.py +0 -0
- /package/{notes-api → notes/api}/app/models/user.py +0 -0
- /package/{notes-api → notes/api}/app/path_validation.py +0 -0
- /package/{notes-api → notes/api}/app/routers/__init__.py +0 -0
- /package/{notes-api → notes/api}/app/routers/collab.py +0 -0
- /package/{notes-api → notes/api}/app/routers/comments.py +0 -0
- /package/{notes-api → notes/api}/app/routers/files.py +0 -0
- /package/{notes-api → notes/api}/app/routers/settings.py +0 -0
- /package/{notes-api → notes/api}/app/routers/tree.py +0 -0
- /package/{notes-api → notes/api}/app/routers/upload.py +0 -0
- /package/{notes-api → notes/api}/app/routers/users.py +0 -0
- /package/{notes-api → notes/api}/app/schemas/__init__.py +0 -0
- /package/{notes-api → notes/api}/app/schemas/auth.py +0 -0
- /package/{notes-api → notes/api}/app/schemas/user.py +0 -0
- /package/{notes-api → notes/api}/app/security.py +0 -0
- /package/{notes-api → notes/api}/app/services/__init__.py +0 -0
- /package/{notes-api → notes/api}/app/services/audit.py +0 -0
- /package/{notes-api → notes/api}/app/services/business_date.py +0 -0
- /package/{notes-api → notes/api}/app/services/collab.py +0 -0
- /package/{notes-api → notes/api}/app/services/github.py +0 -0
- /package/{notes-api → notes/api}/app/services/pr_chain.py +0 -0
- /package/{notes-api → notes/api}/app/startup.py +0 -0
- /package/{notes-api → notes/api}/docker/Dockerfile +0 -0
- /package/{notes-api → notes/api}/docker/Dockerfile.test +0 -0
- /package/{notes-api → notes/api}/pyproject.toml +0 -0
- /package/{notes-api → notes/api}/tests/conftest.py +0 -0
- /package/{notes-api → notes/api}/tests/test_audit.py +0 -0
- /package/{notes-api → notes/api}/tests/test_auth.py +0 -0
- /package/{notes-api → notes/api}/tests/test_business_date.py +0 -0
- /package/{notes-api → notes/api}/tests/test_collab.py +0 -0
- /package/{notes-api → notes/api}/tests/test_comments.py +0 -0
- /package/{notes-api → notes/api}/tests/test_config_ssl.py +0 -0
- /package/{notes-api → notes/api}/tests/test_config_warnings.py +0 -0
- /package/{notes-api → notes/api}/tests/test_files.py +0 -0
- /package/{notes-api → notes/api}/tests/test_path_validation.py +0 -0
- /package/{notes-api → notes/api}/tests/test_security.py +0 -0
- /package/{notes-api → notes/api}/tests/test_settings.py +0 -0
- /package/{notes-api → notes/api}/tests/test_tree.py +0 -0
- /package/{notes-api → notes/api}/tests/test_upload.py +0 -0
- /package/{notes-api → notes/api}/tests/test_users.py +0 -0
- /package/{notes-app → notes/app}/.dockerignore +0 -0
- /package/{notes-app → notes/app}/index.html +0 -0
- /package/{notes-app → notes/app}/nginx.conf +0 -0
- /package/{notes-app → notes/app}/package-lock.json +0 -0
- /package/{notes-app → notes/app}/playwright.config.ts +0 -0
- /package/{notes-app → notes/app}/pnpm-lock.yaml +0 -0
- /package/{notes-app → notes/app}/src/App.tsx +0 -0
- /package/{notes-app → notes/app}/src/components/BranchSelectorModal.tsx +0 -0
- /package/{notes-app → notes/app}/src/components/CodeBlockView.test.tsx +0 -0
- /package/{notes-app → notes/app}/src/components/CodeBlockView.tsx +0 -0
- /package/{notes-app → notes/app}/src/components/CollabStatus.tsx +0 -0
- /package/{notes-app → notes/app}/src/components/DiffPreview.tsx +0 -0
- /package/{notes-app → notes/app}/src/components/DrawioEditor.tsx +0 -0
- /package/{notes-app → notes/app}/src/components/DrawioViewer.tsx +0 -0
- /package/{notes-app → notes/app}/src/components/ErrorBoundary.test.tsx +0 -0
- /package/{notes-app → notes/app}/src/components/ErrorBoundary.tsx +0 -0
- /package/{notes-app → notes/app}/src/components/FileContentView.tsx +0 -0
- /package/{notes-app → notes/app}/src/components/FileContextMenu.test.tsx +0 -0
- /package/{notes-app → notes/app}/src/components/FileContextMenu.tsx +0 -0
- /package/{notes-app → notes/app}/src/components/FileDialogs.test.tsx +0 -0
- /package/{notes-app → notes/app}/src/components/FileDialogs.tsx +0 -0
- /package/{notes-app → notes/app}/src/components/SaveStatusIndicator.test.tsx +0 -0
- /package/{notes-app → notes/app}/src/components/SaveStatusIndicator.tsx +0 -0
- /package/{notes-app → notes/app}/src/components/Skeleton.tsx +0 -0
- /package/{notes-app → notes/app}/src/components/SpreadsheetEditor.test.tsx +0 -0
- /package/{notes-app → notes/app}/src/components/SpreadsheetEditor.tsx +0 -0
- /package/{notes-app → notes/app}/src/components/TextEditor.tsx +0 -0
- /package/{notes-app → notes/app}/src/components/ToastContainer.tsx +0 -0
- /package/{notes-app → notes/app}/src/components/TreeNode.tsx +0 -0
- /package/{notes-app → notes/app}/src/contexts/AuthContext.test.tsx +0 -0
- /package/{notes-app → notes/app}/src/contexts/AuthContext.tsx +0 -0
- /package/{notes-app → notes/app}/src/contexts/ToastContext.test.ts +0 -0
- /package/{notes-app → notes/app}/src/contexts/ToastContext.tsx +0 -0
- /package/{notes-app → notes/app}/src/hooks/useAutoSave.test.ts +0 -0
- /package/{notes-app → notes/app}/src/hooks/useAutoSave.ts +0 -0
- /package/{notes-app → notes/app}/src/hooks/useCollaboration.ts +0 -0
- /package/{notes-app → notes/app}/src/hooks/useComments.ts +0 -0
- /package/{notes-app → notes/app}/src/hooks/useYText.ts +0 -0
- /package/{notes-app → notes/app}/src/lib/branch-diff.test.ts +0 -0
- /package/{notes-app → notes/app}/src/lib/branch-diff.ts +0 -0
- /package/{notes-app → notes/app}/src/lib/created-file.test.ts +0 -0
- /package/{notes-app → notes/app}/src/lib/created-file.ts +0 -0
- /package/{notes-app → notes/app}/src/lib/csv-utils.test.ts +0 -0
- /package/{notes-app → notes/app}/src/lib/csv-utils.ts +0 -0
- /package/{notes-app → notes/app}/src/lib/deepLinkPathToSearch.test.ts +0 -0
- /package/{notes-app → notes/app}/src/lib/deepLinkPathToSearch.ts +0 -0
- /package/{notes-app → notes/app}/src/lib/draft-storage.test.ts +0 -0
- /package/{notes-app → notes/app}/src/lib/draft-storage.ts +0 -0
- /package/{notes-app → notes/app}/src/lib/mermaid-render.ts +0 -0
- /package/{notes-app → notes/app}/src/lib/postLoginRedirect.test.ts +0 -0
- /package/{notes-app → notes/app}/src/lib/postLoginRedirect.ts +0 -0
- /package/{notes-app → notes/app}/src/lib/tree-utils.ts +0 -0
- /package/{notes-app → notes/app}/src/lib/user-colors.ts +0 -0
- /package/{notes-app → notes/app}/src/lib/xlsx-utils.test.ts +0 -0
- /package/{notes-app → notes/app}/src/lib/xlsx-utils.ts +0 -0
- /package/{notes-app → notes/app}/src/main.tsx +0 -0
- /package/{notes-app → notes/app}/src/pages/LoginPage.tsx +0 -0
- /package/{notes-app → notes/app}/src/pages/MainPage.insertChildEntry.test.ts +0 -0
- /package/{notes-app → notes/app}/src/pages/SettingsPage.tsx +0 -0
- /package/{notes-app → notes/app}/src/pages/UserManagementPage.tsx +0 -0
- /package/{notes-app → notes/app}/src/styles/globals.css +0 -0
- /package/{notes-app → notes/app}/src/types.ts +0 -0
- /package/{notes-app → notes/app}/src/vite-env.d.ts +0 -0
- /package/{notes-app → notes/app}/tsconfig.json +0 -0
- /package/{notes-app → notes/app}/tsconfig.node.json +0 -0
- /package/{notes-app → notes/app}/vite.config.js +0 -0
- /package/{notes-app → notes/app}/vite.config.ts +0 -0
- /package/{notes-app → notes/app}/vitest.config.ts +0 -0
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
locals {
|
|
2
|
-
project = "godd-notes"
|
|
3
|
-
env = "{{env}}"
|
|
4
|
-
account_id = "{{accountId}}"
|
|
5
|
-
region = "{{region}}"
|
|
6
|
-
|
|
7
|
-
# VPC
|
|
8
|
-
vpc_cidr = "{{vpcCidr}}"
|
|
9
|
-
public_subnet_1a = cidrsubnet(local.vpc_cidr, 8, 1)
|
|
10
|
-
public_subnet_1c = cidrsubnet(local.vpc_cidr, 8, 2)
|
|
11
|
-
private_subnet_1a = cidrsubnet(local.vpc_cidr, 8, 10)
|
|
12
|
-
private_subnet_1c = cidrsubnet(local.vpc_cidr, 8, 11)
|
|
13
|
-
|
|
14
|
-
# ECS
|
|
15
|
-
ecs_cpu = {{ecsCpu}}
|
|
16
|
-
ecs_memory = {{ecsMemory}}
|
|
17
|
-
|
|
18
|
-
# RDS
|
|
19
|
-
rds_instance_class = "{{rdsInstanceClass}}"
|
|
20
|
-
rds_engine_version = "16"
|
|
21
|
-
rds_db_name = "notes"
|
|
22
|
-
|
|
23
|
-
# Container
|
|
24
|
-
container_port = 3100
|
|
25
|
-
|
|
26
|
-
# GitHub
|
|
27
|
-
github_owner = "{{githubOwner}}"
|
|
28
|
-
github_repo = "{{githubRepo}}"
|
|
29
|
-
|
|
30
|
-
tags = {
|
|
31
|
-
Project = local.project
|
|
32
|
-
Environment = local.env
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
output "cloudfront_domain" {
|
|
2
|
-
description = "CloudFront distribution domain name"
|
|
3
|
-
value = aws_cloudfront_distribution.notes.domain_name
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
output "cloudfront_distribution_id" {
|
|
7
|
-
description = "CloudFront distribution ID"
|
|
8
|
-
value = aws_cloudfront_distribution.notes.id
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
output "alb_dns_name" {
|
|
12
|
-
description = "ALB DNS name"
|
|
13
|
-
value = aws_lb.api.dns_name
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
output "ecr_repository_url" {
|
|
17
|
-
description = "ECR repository URL for notes-api"
|
|
18
|
-
value = aws_ecr_repository.notes_api.repository_url
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
output "ecs_cluster_name" {
|
|
22
|
-
description = "ECS cluster name"
|
|
23
|
-
value = aws_ecs_cluster.main.name
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
output "ecs_service_name" {
|
|
27
|
-
description = "ECS service name"
|
|
28
|
-
value = aws_ecs_service.api.name
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
output "rds_endpoint" {
|
|
32
|
-
description = "RDS endpoint"
|
|
33
|
-
value = aws_db_instance.main.endpoint
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
output "s3_bucket_name" {
|
|
37
|
-
description = "S3 bucket name for notes-app"
|
|
38
|
-
value = aws_s3_bucket.notes_app.id
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
output "notes_app_url" {
|
|
42
|
-
description = "Notes App URL"
|
|
43
|
-
value = "https://${aws_cloudfront_distribution.notes.domain_name}"
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
output "notes_api_url" {
|
|
47
|
-
description = "Notes API URL"
|
|
48
|
-
value = "https://${aws_cloudfront_distribution.notes.domain_name}/api"
|
|
49
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
terraform {
|
|
2
|
-
required_version = ">= 1.5"
|
|
3
|
-
|
|
4
|
-
required_providers {
|
|
5
|
-
aws = {
|
|
6
|
-
source = "hashicorp/aws"
|
|
7
|
-
version = "~> 5.0"
|
|
8
|
-
}
|
|
9
|
-
random = {
|
|
10
|
-
source = "hashicorp/random"
|
|
11
|
-
version = "~> 3.0"
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
provider "aws" {
|
|
17
|
-
region = "{{region}}"
|
|
18
|
-
|
|
19
|
-
default_tags {
|
|
20
|
-
tags = {
|
|
21
|
-
Project = "godd-notes"
|
|
22
|
-
Environment = "{{env}}"
|
|
23
|
-
ManagedBy = "terraform"
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
resource "aws_db_subnet_group" "main" {
|
|
2
|
-
name = "${local.project}-db-subnet"
|
|
3
|
-
subnet_ids = [aws_subnet.private_1a.id, aws_subnet.private_1c.id]
|
|
4
|
-
tags = local.tags
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
resource "aws_db_instance" "main" {
|
|
8
|
-
identifier = "${local.project}-db"
|
|
9
|
-
engine = "postgres"
|
|
10
|
-
engine_version = local.rds_engine_version
|
|
11
|
-
instance_class = local.rds_instance_class
|
|
12
|
-
|
|
13
|
-
allocated_storage = 20
|
|
14
|
-
max_allocated_storage = 30
|
|
15
|
-
storage_type = "gp3"
|
|
16
|
-
storage_encrypted = true
|
|
17
|
-
|
|
18
|
-
db_name = local.rds_db_name
|
|
19
|
-
username = "app_user"
|
|
20
|
-
password = random_password.rds_password.result
|
|
21
|
-
|
|
22
|
-
db_subnet_group_name = aws_db_subnet_group.main.name
|
|
23
|
-
vpc_security_group_ids = [aws_security_group.rds.id]
|
|
24
|
-
|
|
25
|
-
multi_az = false
|
|
26
|
-
publicly_accessible = false
|
|
27
|
-
|
|
28
|
-
backup_retention_period = 7
|
|
29
|
-
skip_final_snapshot = local.env == "dev"
|
|
30
|
-
deletion_protection = local.env != "dev"
|
|
31
|
-
|
|
32
|
-
tags = local.tags
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
resource "random_password" "rds_password" {
|
|
36
|
-
length = 32
|
|
37
|
-
special = false
|
|
38
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
resource "aws_s3_bucket" "notes_app" {
|
|
2
|
-
bucket = "${local.project}-${local.account_id}"
|
|
3
|
-
force_destroy = local.env == "dev"
|
|
4
|
-
tags = local.tags
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
resource "aws_s3_bucket_public_access_block" "notes_app" {
|
|
8
|
-
bucket = aws_s3_bucket.notes_app.id
|
|
9
|
-
block_public_acls = true
|
|
10
|
-
block_public_policy = true
|
|
11
|
-
ignore_public_acls = true
|
|
12
|
-
restrict_public_buckets = true
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
resource "aws_s3_bucket_policy" "notes_app" {
|
|
16
|
-
bucket = aws_s3_bucket.notes_app.id
|
|
17
|
-
policy = jsonencode({
|
|
18
|
-
Version = "2012-10-17"
|
|
19
|
-
Statement = [
|
|
20
|
-
{
|
|
21
|
-
Sid = "AllowCloudFrontOAC"
|
|
22
|
-
Effect = "Allow"
|
|
23
|
-
Principal = { Service = "cloudfront.amazonaws.com" }
|
|
24
|
-
Action = "s3:GetObject"
|
|
25
|
-
Resource = "${aws_s3_bucket.notes_app.arn}/*"
|
|
26
|
-
Condition = {
|
|
27
|
-
StringEquals = {
|
|
28
|
-
"AWS:SourceArn" = aws_cloudfront_distribution.notes.arn
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
]
|
|
33
|
-
})
|
|
34
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
resource "aws_secretsmanager_secret" "rds_credentials" {
|
|
2
|
-
name = "godd-notes/${local.env}/rds-credentials"
|
|
3
|
-
tags = local.tags
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
resource "aws_secretsmanager_secret_version" "rds_credentials" {
|
|
7
|
-
secret_id = aws_secretsmanager_secret.rds_credentials.id
|
|
8
|
-
secret_string = jsonencode({
|
|
9
|
-
host = aws_db_instance.main.address
|
|
10
|
-
username = aws_db_instance.main.username
|
|
11
|
-
password = random_password.rds_password.result
|
|
12
|
-
})
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
resource "aws_secretsmanager_secret" "jwt_secret" {
|
|
16
|
-
name = "godd-notes/${local.env}/jwt-secret"
|
|
17
|
-
tags = local.tags
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
resource "aws_secretsmanager_secret" "github_token" {
|
|
21
|
-
name = "godd-notes/${local.env}/github-token"
|
|
22
|
-
tags = local.tags
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
resource "aws_secretsmanager_secret" "github_app_id" {
|
|
26
|
-
name = "godd-notes/${local.env}/github-app-id"
|
|
27
|
-
tags = local.tags
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
resource "aws_secretsmanager_secret" "github_app_private_key" {
|
|
31
|
-
name = "godd-notes/${local.env}/github-app-private-key"
|
|
32
|
-
tags = local.tags
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
resource "aws_secretsmanager_secret" "github_app_installation_id" {
|
|
36
|
-
name = "godd-notes/${local.env}/github-app-installation-id"
|
|
37
|
-
tags = local.tags
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
resource "aws_secretsmanager_secret" "admin_credentials" {
|
|
41
|
-
name = "godd-notes/${local.env}/admin-credentials"
|
|
42
|
-
tags = local.tags
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
resource "aws_secretsmanager_secret" "origin_verify" {
|
|
46
|
-
name = "godd-notes/${local.env}/origin-verify"
|
|
47
|
-
tags = local.tags
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
resource "aws_secretsmanager_secret_version" "origin_verify" {
|
|
51
|
-
secret_id = aws_secretsmanager_secret.origin_verify.id
|
|
52
|
-
secret_string = random_password.origin_verify.result
|
|
53
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
data "aws_ec2_managed_prefix_list" "cloudfront" {
|
|
2
|
-
name = "com.amazonaws.global.cloudfront.origin-facing"
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
resource "aws_security_group" "alb" {
|
|
6
|
-
name_prefix = "${local.project}-alb-"
|
|
7
|
-
vpc_id = aws_vpc.main.id
|
|
8
|
-
tags = merge(local.tags, { Name = "${local.project}-alb-sg" })
|
|
9
|
-
|
|
10
|
-
lifecycle { create_before_destroy = true }
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
resource "aws_security_group_rule" "alb_from_cloudfront" {
|
|
14
|
-
type = "ingress"
|
|
15
|
-
from_port = 80
|
|
16
|
-
to_port = 80
|
|
17
|
-
protocol = "tcp"
|
|
18
|
-
prefix_list_ids = [data.aws_ec2_managed_prefix_list.cloudfront.id]
|
|
19
|
-
security_group_id = aws_security_group.alb.id
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
resource "aws_security_group_rule" "alb_to_ecs" {
|
|
23
|
-
type = "egress"
|
|
24
|
-
from_port = local.container_port
|
|
25
|
-
to_port = local.container_port
|
|
26
|
-
protocol = "tcp"
|
|
27
|
-
source_security_group_id = aws_security_group.ecs.id
|
|
28
|
-
security_group_id = aws_security_group.alb.id
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
resource "aws_security_group" "ecs" {
|
|
32
|
-
name_prefix = "${local.project}-ecs-"
|
|
33
|
-
vpc_id = aws_vpc.main.id
|
|
34
|
-
tags = merge(local.tags, { Name = "${local.project}-ecs-sg" })
|
|
35
|
-
|
|
36
|
-
lifecycle { create_before_destroy = true }
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
resource "aws_security_group_rule" "ecs_from_alb" {
|
|
40
|
-
type = "ingress"
|
|
41
|
-
from_port = local.container_port
|
|
42
|
-
to_port = local.container_port
|
|
43
|
-
protocol = "tcp"
|
|
44
|
-
source_security_group_id = aws_security_group.alb.id
|
|
45
|
-
security_group_id = aws_security_group.ecs.id
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
resource "aws_security_group_rule" "ecs_to_internet" {
|
|
49
|
-
type = "egress"
|
|
50
|
-
from_port = 443
|
|
51
|
-
to_port = 443
|
|
52
|
-
protocol = "tcp"
|
|
53
|
-
cidr_blocks = ["0.0.0.0/0"]
|
|
54
|
-
security_group_id = aws_security_group.ecs.id
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
resource "aws_security_group_rule" "ecs_to_rds" {
|
|
58
|
-
type = "egress"
|
|
59
|
-
from_port = 5432
|
|
60
|
-
to_port = 5432
|
|
61
|
-
protocol = "tcp"
|
|
62
|
-
source_security_group_id = aws_security_group.rds.id
|
|
63
|
-
security_group_id = aws_security_group.ecs.id
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
resource "aws_security_group" "rds" {
|
|
67
|
-
name_prefix = "${local.project}-rds-"
|
|
68
|
-
vpc_id = aws_vpc.main.id
|
|
69
|
-
tags = merge(local.tags, { Name = "${local.project}-rds-sg" })
|
|
70
|
-
|
|
71
|
-
lifecycle { create_before_destroy = true }
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
resource "aws_security_group_rule" "rds_from_ecs" {
|
|
75
|
-
type = "ingress"
|
|
76
|
-
from_port = 5432
|
|
77
|
-
to_port = 5432
|
|
78
|
-
protocol = "tcp"
|
|
79
|
-
source_security_group_id = aws_security_group.ecs.id
|
|
80
|
-
security_group_id = aws_security_group.rds.id
|
|
81
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
resource "aws_vpc" "main" {
|
|
2
|
-
cidr_block = local.vpc_cidr
|
|
3
|
-
enable_dns_support = true
|
|
4
|
-
enable_dns_hostnames = true
|
|
5
|
-
|
|
6
|
-
tags = merge(local.tags, { Name = "${local.project}-vpc" })
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
resource "aws_internet_gateway" "main" {
|
|
10
|
-
vpc_id = aws_vpc.main.id
|
|
11
|
-
tags = merge(local.tags, { Name = "${local.project}-igw" })
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
resource "aws_subnet" "public_1a" {
|
|
15
|
-
vpc_id = aws_vpc.main.id
|
|
16
|
-
cidr_block = local.public_subnet_1a
|
|
17
|
-
availability_zone = "{{region}}a"
|
|
18
|
-
map_public_ip_on_launch = true
|
|
19
|
-
tags = merge(local.tags, { Name = "${local.project}-public-1a" })
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
resource "aws_subnet" "public_1c" {
|
|
23
|
-
vpc_id = aws_vpc.main.id
|
|
24
|
-
cidr_block = local.public_subnet_1c
|
|
25
|
-
availability_zone = "{{region}}c"
|
|
26
|
-
map_public_ip_on_launch = true
|
|
27
|
-
tags = merge(local.tags, { Name = "${local.project}-public-1c" })
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
resource "aws_subnet" "private_1a" {
|
|
31
|
-
vpc_id = aws_vpc.main.id
|
|
32
|
-
cidr_block = local.private_subnet_1a
|
|
33
|
-
availability_zone = "{{region}}a"
|
|
34
|
-
tags = merge(local.tags, { Name = "${local.project}-private-1a" })
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
resource "aws_subnet" "private_1c" {
|
|
38
|
-
vpc_id = aws_vpc.main.id
|
|
39
|
-
cidr_block = local.private_subnet_1c
|
|
40
|
-
availability_zone = "{{region}}c"
|
|
41
|
-
tags = merge(local.tags, { Name = "${local.project}-private-1c" })
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
resource "aws_route_table" "public" {
|
|
45
|
-
vpc_id = aws_vpc.main.id
|
|
46
|
-
tags = merge(local.tags, { Name = "${local.project}-public-rt" })
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
resource "aws_route" "public_internet" {
|
|
50
|
-
route_table_id = aws_route_table.public.id
|
|
51
|
-
destination_cidr_block = "0.0.0.0/0"
|
|
52
|
-
gateway_id = aws_internet_gateway.main.id
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
resource "aws_route_table_association" "public_1a" {
|
|
56
|
-
subnet_id = aws_subnet.public_1a.id
|
|
57
|
-
route_table_id = aws_route_table.public.id
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
resource "aws_route_table_association" "public_1c" {
|
|
61
|
-
subnet_id = aws_subnet.public_1c.id
|
|
62
|
-
route_table_id = aws_route_table.public.id
|
|
63
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# --- Federated Credentials (GitHub Actions OIDC) ---
|
|
2
|
-
data "azurerm_client_config" "current" {}
|
|
3
|
-
|
|
4
|
-
resource "azurerm_user_assigned_identity" "deploy" {
|
|
5
|
-
name = "godd-deploy"
|
|
6
|
-
resource_group_name = azurerm_resource_group.main.name
|
|
7
|
-
location = local.location
|
|
8
|
-
tags = local.tags
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
resource "azurerm_federated_identity_credential" "github" {
|
|
12
|
-
name = "github-actions"
|
|
13
|
-
resource_group_name = azurerm_resource_group.main.name
|
|
14
|
-
parent_id = azurerm_user_assigned_identity.deploy.id
|
|
15
|
-
audience = ["api://AzureADTokenExchange"]
|
|
16
|
-
issuer = "https://token.actions.githubusercontent.com"
|
|
17
|
-
subject = "repo:{{githubOwner}}/{{githubRepo}}:ref:refs/heads/main"
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
resource "azurerm_role_assignment" "acr_push" {
|
|
21
|
-
scope = azurerm_container_registry.main.id
|
|
22
|
-
role_definition_name = "AcrPush"
|
|
23
|
-
principal_id = azurerm_user_assigned_identity.deploy.principal_id
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
resource "azurerm_role_assignment" "container_app_contributor" {
|
|
27
|
-
scope = azurerm_resource_group.main.id
|
|
28
|
-
role_definition_name = "Contributor"
|
|
29
|
-
principal_id = azurerm_user_assigned_identity.deploy.principal_id
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
resource "azurerm_role_assignment" "storage_contributor" {
|
|
33
|
-
scope = azurerm_storage_account.notes_app.id
|
|
34
|
-
role_definition_name = "Storage Blob Data Contributor"
|
|
35
|
-
principal_id = azurerm_user_assigned_identity.deploy.principal_id
|
|
36
|
-
}
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
locals {
|
|
2
|
-
project = "godd-notes"
|
|
3
|
-
env = "{{env}}"
|
|
4
|
-
location = "{{region}}"
|
|
5
|
-
|
|
6
|
-
github_owner = "{{githubOwner}}"
|
|
7
|
-
github_repo = "{{githubRepo}}"
|
|
8
|
-
|
|
9
|
-
tags = {
|
|
10
|
-
project = local.project
|
|
11
|
-
environment = local.env
|
|
12
|
-
managed-by = "terraform"
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
# --- Resource Group ---
|
|
17
|
-
resource "azurerm_resource_group" "main" {
|
|
18
|
-
name = "${local.project}-${local.env}"
|
|
19
|
-
location = local.location
|
|
20
|
-
tags = local.tags
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
# --- VNet ---
|
|
24
|
-
resource "azurerm_virtual_network" "main" {
|
|
25
|
-
name = "${local.project}-vnet"
|
|
26
|
-
resource_group_name = azurerm_resource_group.main.name
|
|
27
|
-
location = local.location
|
|
28
|
-
address_space = ["{{vpcCidr}}"]
|
|
29
|
-
tags = local.tags
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
resource "azurerm_subnet" "app" {
|
|
33
|
-
name = "app-subnet"
|
|
34
|
-
resource_group_name = azurerm_resource_group.main.name
|
|
35
|
-
virtual_network_name = azurerm_virtual_network.main.name
|
|
36
|
-
address_prefixes = [cidrsubnet("{{vpcCidr}}", 8, 1)]
|
|
37
|
-
|
|
38
|
-
delegation {
|
|
39
|
-
name = "container-apps"
|
|
40
|
-
service_delegation {
|
|
41
|
-
name = "Microsoft.App/environments"
|
|
42
|
-
actions = [
|
|
43
|
-
"Microsoft.Network/virtualNetworks/subnets/join/action"
|
|
44
|
-
]
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
resource "azurerm_subnet" "db" {
|
|
50
|
-
name = "db-subnet"
|
|
51
|
-
resource_group_name = azurerm_resource_group.main.name
|
|
52
|
-
virtual_network_name = azurerm_virtual_network.main.name
|
|
53
|
-
address_prefixes = [cidrsubnet("{{vpcCidr}}", 8, 2)]
|
|
54
|
-
|
|
55
|
-
delegation {
|
|
56
|
-
name = "postgresql"
|
|
57
|
-
service_delegation {
|
|
58
|
-
name = "Microsoft.DBforPostgreSQL/flexibleServers"
|
|
59
|
-
actions = [
|
|
60
|
-
"Microsoft.Network/virtualNetworks/subnets/join/action"
|
|
61
|
-
]
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
# --- PostgreSQL Flexible Server ---
|
|
67
|
-
resource "random_password" "db_password" {
|
|
68
|
-
length = 32
|
|
69
|
-
special = false
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
resource "azurerm_postgresql_flexible_server" "main" {
|
|
73
|
-
name = "${local.project}-db-${local.env}"
|
|
74
|
-
resource_group_name = azurerm_resource_group.main.name
|
|
75
|
-
location = local.location
|
|
76
|
-
version = "16"
|
|
77
|
-
administrator_login = "app_user"
|
|
78
|
-
administrator_password = random_password.db_password.result
|
|
79
|
-
sku_name = "{{dbSku}}"
|
|
80
|
-
storage_mb = 32768
|
|
81
|
-
delegated_subnet_id = azurerm_subnet.db.id
|
|
82
|
-
zone = "1"
|
|
83
|
-
tags = local.tags
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
resource "azurerm_postgresql_flexible_server_database" "notes" {
|
|
87
|
-
name = "notes"
|
|
88
|
-
server_id = azurerm_postgresql_flexible_server.main.id
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
# --- Container Registry ---
|
|
92
|
-
resource "azurerm_container_registry" "main" {
|
|
93
|
-
name = replace("${local.project}${local.env}acr", "-", "")
|
|
94
|
-
resource_group_name = azurerm_resource_group.main.name
|
|
95
|
-
location = local.location
|
|
96
|
-
sku = "Basic"
|
|
97
|
-
admin_enabled = false
|
|
98
|
-
tags = local.tags
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
# --- Log Analytics ---
|
|
102
|
-
resource "azurerm_log_analytics_workspace" "main" {
|
|
103
|
-
name = "${local.project}-logs"
|
|
104
|
-
resource_group_name = azurerm_resource_group.main.name
|
|
105
|
-
location = local.location
|
|
106
|
-
sku = "PerGB2018"
|
|
107
|
-
retention_in_days = 30
|
|
108
|
-
tags = local.tags
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
# --- Container Apps Environment ---
|
|
112
|
-
resource "azurerm_container_app_environment" "main" {
|
|
113
|
-
name = "${local.project}-env"
|
|
114
|
-
resource_group_name = azurerm_resource_group.main.name
|
|
115
|
-
location = local.location
|
|
116
|
-
log_analytics_workspace_id = azurerm_log_analytics_workspace.main.id
|
|
117
|
-
tags = local.tags
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
# --- Container App (notes-api) ---
|
|
121
|
-
resource "azurerm_container_app" "api" {
|
|
122
|
-
name = "${local.project}-api"
|
|
123
|
-
container_app_environment_id = azurerm_container_app_environment.main.id
|
|
124
|
-
resource_group_name = azurerm_resource_group.main.name
|
|
125
|
-
revision_mode = "Single"
|
|
126
|
-
tags = local.tags
|
|
127
|
-
|
|
128
|
-
template {
|
|
129
|
-
container {
|
|
130
|
-
name = "notes-api"
|
|
131
|
-
image = "${azurerm_container_registry.main.login_server}/notes-api:latest"
|
|
132
|
-
cpu = {{cpuLimit}}
|
|
133
|
-
memory = "{{memoryLimit}}"
|
|
134
|
-
|
|
135
|
-
env {
|
|
136
|
-
name = "DB_NAME"
|
|
137
|
-
value = "notes"
|
|
138
|
-
}
|
|
139
|
-
env {
|
|
140
|
-
name = "API_HOST"
|
|
141
|
-
value = "0.0.0.0"
|
|
142
|
-
}
|
|
143
|
-
env {
|
|
144
|
-
name = "API_PORT"
|
|
145
|
-
value = "3100"
|
|
146
|
-
}
|
|
147
|
-
env {
|
|
148
|
-
name = "DATABASE_SSL"
|
|
149
|
-
value = "true"
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
min_replicas = 0
|
|
154
|
-
max_replicas = 2
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
ingress {
|
|
158
|
-
external_enabled = true
|
|
159
|
-
target_port = 3100
|
|
160
|
-
transport = "auto"
|
|
161
|
-
|
|
162
|
-
traffic_weight {
|
|
163
|
-
percentage = 100
|
|
164
|
-
latest_revision = true
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
# --- Storage Account (notes-app SPA) ---
|
|
170
|
-
resource "azurerm_storage_account" "notes_app" {
|
|
171
|
-
name = replace("${local.project}${local.env}app", "-", "")
|
|
172
|
-
resource_group_name = azurerm_resource_group.main.name
|
|
173
|
-
location = local.location
|
|
174
|
-
account_tier = "Standard"
|
|
175
|
-
account_replication_type = "LRS"
|
|
176
|
-
tags = local.tags
|
|
177
|
-
|
|
178
|
-
static_website {
|
|
179
|
-
index_document = "index.html"
|
|
180
|
-
error_404_document = "index.html"
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
# --- CDN (Front Door alternative — CDN Profile + Endpoint) ---
|
|
185
|
-
resource "azurerm_cdn_profile" "main" {
|
|
186
|
-
name = "${local.project}-cdn"
|
|
187
|
-
resource_group_name = azurerm_resource_group.main.name
|
|
188
|
-
location = "global"
|
|
189
|
-
sku = "Standard_Microsoft"
|
|
190
|
-
tags = local.tags
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
resource "azurerm_cdn_endpoint" "app" {
|
|
194
|
-
name = "${local.project}-app"
|
|
195
|
-
profile_name = azurerm_cdn_profile.main.name
|
|
196
|
-
resource_group_name = azurerm_resource_group.main.name
|
|
197
|
-
location = "global"
|
|
198
|
-
|
|
199
|
-
origin {
|
|
200
|
-
name = "spa"
|
|
201
|
-
host_name = azurerm_storage_account.notes_app.primary_web_host
|
|
202
|
-
}
|
|
203
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
output "container_app_url" {
|
|
2
|
-
value = "https://${azurerm_container_app.api.latest_revision_fqdn}"
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
output "notes_app_url" {
|
|
6
|
-
value = azurerm_storage_account.notes_app.primary_web_endpoint
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
output "cdn_endpoint" {
|
|
10
|
-
value = azurerm_cdn_endpoint.app.fqdn
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
output "acr_login_server" {
|
|
14
|
-
value = azurerm_container_registry.main.login_server
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
output "db_host" {
|
|
18
|
-
value = azurerm_postgresql_flexible_server.main.fqdn
|
|
19
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
terraform {
|
|
2
|
-
required_version = ">= 1.5"
|
|
3
|
-
|
|
4
|
-
required_providers {
|
|
5
|
-
azurerm = {
|
|
6
|
-
source = "hashicorp/azurerm"
|
|
7
|
-
version = "~> 3.80"
|
|
8
|
-
}
|
|
9
|
-
random = {
|
|
10
|
-
source = "hashicorp/random"
|
|
11
|
-
version = "~> 3.0"
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
provider "azurerm" {
|
|
17
|
-
features {}
|
|
18
|
-
subscription_id = "{{subscriptionId}}"
|
|
19
|
-
}
|