specweave 0.21.3 → 0.22.2
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/CLAUDE.md +409 -6
- package/README.md +38 -8
- package/bin/specweave.js +5 -8
- package/dist/plugins/specweave-github/lib/CodeValidator.d.ts +101 -0
- package/dist/plugins/specweave-github/lib/CodeValidator.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/CodeValidator.js +219 -0
- package/dist/plugins/specweave-github/lib/CodeValidator.js.map +1 -0
- package/dist/plugins/specweave-github/lib/ThreeLayerSyncManager.d.ts +182 -0
- package/dist/plugins/specweave-github/lib/ThreeLayerSyncManager.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/ThreeLayerSyncManager.js +603 -0
- package/dist/plugins/specweave-github/lib/ThreeLayerSyncManager.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-client-v2.d.ts +10 -0
- package/dist/plugins/specweave-github/lib/github-client-v2.d.ts.map +1 -1
- package/dist/plugins/specweave-github/lib/github-client-v2.js +26 -0
- package/dist/plugins/specweave-github/lib/github-client-v2.js.map +1 -1
- package/dist/plugins/specweave-github/lib/task-sync.d.ts.map +1 -1
- package/dist/plugins/specweave-github/lib/task-sync.js +7 -0
- package/dist/plugins/specweave-github/lib/task-sync.js.map +1 -1
- package/dist/plugins/specweave-github/lib/types.d.ts +34 -0
- package/dist/plugins/specweave-github/lib/types.d.ts.map +1 -1
- package/dist/src/cli/commands/init.d.ts.map +1 -1
- package/dist/src/cli/commands/init.js +60 -5
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/cli/commands/migrate-to-profiles.d.ts +1 -0
- package/dist/src/cli/commands/migrate-to-profiles.d.ts.map +1 -1
- package/dist/src/cli/commands/migrate-to-profiles.js +12 -1
- package/dist/src/cli/commands/migrate-to-profiles.js.map +1 -1
- package/dist/src/cli/commands/next-command.d.ts +52 -0
- package/dist/src/cli/commands/next-command.d.ts.map +1 -0
- package/dist/src/cli/commands/next-command.js +204 -0
- package/dist/src/cli/commands/next-command.js.map +1 -0
- package/dist/src/cli/commands/sync-specs.d.ts +16 -0
- package/dist/src/cli/commands/sync-specs.d.ts.map +1 -0
- package/dist/src/cli/commands/sync-specs.js +130 -0
- package/dist/src/cli/commands/sync-specs.js.map +1 -0
- package/dist/src/cli/count-tasks.d.ts +20 -0
- package/dist/src/cli/count-tasks.d.ts.map +1 -0
- package/dist/src/cli/count-tasks.js +50 -0
- package/dist/src/cli/count-tasks.js.map +1 -0
- package/dist/src/config/ConfigManager.d.ts.map +1 -1
- package/dist/src/config/ConfigManager.js +2 -1
- package/dist/src/config/ConfigManager.js.map +1 -1
- package/dist/src/config/types.d.ts +58 -58
- package/dist/src/core/cicd/state-manager.d.ts +8 -0
- package/dist/src/core/cicd/state-manager.d.ts.map +1 -1
- package/dist/src/core/cicd/state-manager.js +60 -15
- package/dist/src/core/cicd/state-manager.js.map +1 -1
- package/dist/src/core/cost-tracker.d.ts.map +1 -1
- package/dist/src/core/cost-tracker.js +2 -1
- package/dist/src/core/cost-tracker.js.map +1 -1
- package/dist/src/core/iac/template-engine.d.ts.map +1 -1
- package/dist/src/core/iac/template-engine.js +28 -0
- package/dist/src/core/iac/template-engine.js.map +1 -1
- package/dist/src/core/iac/template-generator.d.ts +53 -0
- package/dist/src/core/iac/template-generator.d.ts.map +1 -0
- package/dist/src/core/iac/template-generator.js +125 -0
- package/dist/src/core/iac/template-generator.js.map +1 -0
- package/dist/src/core/increment/status-auto-transition.js +3 -3
- package/dist/src/core/increment/status-auto-transition.js.map +1 -1
- package/dist/src/core/living-docs/CodeValidator.js +1 -1
- package/dist/src/core/living-docs/CodeValidator.js.map +1 -1
- package/dist/src/core/living-docs/CompletionPropagator.d.ts.map +1 -1
- package/dist/src/core/living-docs/CompletionPropagator.js +4 -3
- package/dist/src/core/living-docs/CompletionPropagator.js.map +1 -1
- package/dist/src/core/living-docs/SpecDistributor.d.ts +5 -0
- package/dist/src/core/living-docs/SpecDistributor.d.ts.map +1 -1
- package/dist/src/core/living-docs/SpecDistributor.js +12 -0
- package/dist/src/core/living-docs/SpecDistributor.js.map +1 -1
- package/dist/src/core/living-docs/content-distributor.d.ts.map +1 -1
- package/dist/src/core/living-docs/content-distributor.js +11 -1
- package/dist/src/core/living-docs/content-distributor.js.map +1 -1
- package/dist/src/core/living-docs/living-docs-sync.d.ts +166 -0
- package/dist/src/core/living-docs/living-docs-sync.d.ts.map +1 -0
- package/dist/src/core/living-docs/living-docs-sync.js +726 -0
- package/dist/src/core/living-docs/living-docs-sync.js.map +1 -0
- package/dist/src/core/living-docs/project-detector.d.ts.map +1 -1
- package/dist/src/core/living-docs/project-detector.js +38 -0
- package/dist/src/core/living-docs/project-detector.js.map +1 -1
- package/dist/src/core/living-docs/task-project-specific-generator.d.ts +7 -3
- package/dist/src/core/living-docs/task-project-specific-generator.d.ts.map +1 -1
- package/dist/src/core/living-docs/task-project-specific-generator.js +40 -24
- package/dist/src/core/living-docs/task-project-specific-generator.js.map +1 -1
- package/dist/src/core/plugin-loader.d.ts +7 -0
- package/dist/src/core/plugin-loader.d.ts.map +1 -1
- package/dist/src/core/plugin-loader.js +18 -1
- package/dist/src/core/plugin-loader.js.map +1 -1
- package/dist/src/core/serverless/platform-data-loader.d.ts +8 -0
- package/dist/src/core/serverless/platform-data-loader.d.ts.map +1 -1
- package/dist/src/core/serverless/platform-data-loader.js +14 -0
- package/dist/src/core/serverless/platform-data-loader.js.map +1 -1
- package/dist/src/core/serverless/types.d.ts +1 -1
- package/dist/src/core/serverless/types.d.ts.map +1 -1
- package/dist/src/core/status-line/status-line-manager.d.ts +6 -2
- package/dist/src/core/status-line/status-line-manager.d.ts.map +1 -1
- package/dist/src/core/status-line/status-line-manager.js +11 -5
- package/dist/src/core/status-line/status-line-manager.js.map +1 -1
- package/dist/src/core/status-line/task-counter.d.ts +69 -0
- package/dist/src/core/status-line/task-counter.d.ts.map +1 -0
- package/dist/src/core/status-line/task-counter.js +107 -0
- package/dist/src/core/status-line/task-counter.js.map +1 -0
- package/dist/src/core/types/config.d.ts +23 -0
- package/dist/src/core/types/config.d.ts.map +1 -1
- package/dist/src/core/types/config.js +10 -0
- package/dist/src/core/types/config.js.map +1 -1
- package/dist/src/core/workflow/autonomous-executor.d.ts +111 -0
- package/dist/src/core/workflow/autonomous-executor.d.ts.map +1 -0
- package/dist/src/core/workflow/autonomous-executor.js +275 -0
- package/dist/src/core/workflow/autonomous-executor.js.map +1 -0
- package/dist/src/core/workflow/backlog-scanner.d.ts +94 -0
- package/dist/src/core/workflow/backlog-scanner.d.ts.map +1 -0
- package/dist/src/core/workflow/backlog-scanner.js +170 -0
- package/dist/src/core/workflow/backlog-scanner.js.map +1 -0
- package/dist/src/core/workflow/command-invoker.d.ts +86 -0
- package/dist/src/core/workflow/command-invoker.d.ts.map +1 -0
- package/dist/src/core/workflow/command-invoker.js +131 -0
- package/dist/src/core/workflow/command-invoker.js.map +1 -0
- package/dist/src/core/workflow/cost-estimator.d.ts +120 -0
- package/dist/src/core/workflow/cost-estimator.d.ts.map +1 -0
- package/dist/src/core/workflow/cost-estimator.js +222 -0
- package/dist/src/core/workflow/cost-estimator.js.map +1 -0
- package/dist/src/core/workflow/index.d.ts +20 -0
- package/dist/src/core/workflow/index.d.ts.map +1 -0
- package/dist/src/core/workflow/index.js +24 -0
- package/dist/src/core/workflow/index.js.map +1 -0
- package/dist/src/core/workflow/state-manager.d.ts +107 -0
- package/dist/src/core/workflow/state-manager.d.ts.map +1 -0
- package/dist/src/core/workflow/state-manager.js +126 -0
- package/dist/src/core/workflow/state-manager.js.map +1 -0
- package/dist/src/core/workflow/workflow-orchestrator.d.ts +93 -0
- package/dist/src/core/workflow/workflow-orchestrator.d.ts.map +1 -0
- package/dist/src/core/workflow/workflow-orchestrator.js +195 -0
- package/dist/src/core/workflow/workflow-orchestrator.js.map +1 -0
- package/dist/src/init/ArchitecturePresenter.d.ts +47 -0
- package/dist/src/init/ArchitecturePresenter.d.ts.map +1 -0
- package/dist/src/init/ArchitecturePresenter.js +180 -0
- package/dist/src/init/ArchitecturePresenter.js.map +1 -0
- package/dist/src/init/InitFlow.d.ts.map +1 -1
- package/dist/src/init/InitFlow.js +30 -1
- package/dist/src/init/InitFlow.js.map +1 -1
- package/dist/src/init/architecture/CostEstimator.d.ts +52 -0
- package/dist/src/init/architecture/CostEstimator.d.ts.map +1 -0
- package/dist/src/init/architecture/CostEstimator.js +107 -0
- package/dist/src/init/architecture/CostEstimator.js.map +1 -0
- package/dist/src/init/architecture/InfrastructureMapper.d.ts +41 -0
- package/dist/src/init/architecture/InfrastructureMapper.d.ts.map +1 -0
- package/dist/src/init/architecture/InfrastructureMapper.js +140 -0
- package/dist/src/init/architecture/InfrastructureMapper.js.map +1 -0
- package/dist/src/init/architecture/ProjectGenerator.d.ts +44 -0
- package/dist/src/init/architecture/ProjectGenerator.d.ts.map +1 -0
- package/dist/src/init/architecture/ProjectGenerator.js +216 -0
- package/dist/src/init/architecture/ProjectGenerator.js.map +1 -0
- package/dist/src/init/architecture/types.d.ts +10 -10
- package/dist/src/init/research/src/config/types.d.ts +8 -8
- package/dist/src/metrics/dora-calculator.js +2 -2
- package/dist/src/metrics/dora-calculator.js.map +1 -1
- package/dist/src/utils/pricing-constants.d.ts +5 -2
- package/dist/src/utils/pricing-constants.d.ts.map +1 -1
- package/dist/src/utils/pricing-constants.js +3 -2
- package/dist/src/utils/pricing-constants.js.map +1 -1
- package/package.json +9 -8
- package/plugins/specweave/agents/infrastructure/AGENT.md +88 -46
- package/plugins/specweave/agents/pm/AGENT.md +58 -1
- package/plugins/specweave/commands/specweave-archive-features.md +1 -1
- package/plugins/specweave/commands/specweave-archive-increments.md +1 -1
- package/plugins/specweave/commands/specweave-check-hooks.md +5 -0
- package/plugins/specweave/commands/specweave-done.md +12 -0
- package/plugins/specweave/commands/specweave-plan.md +1 -1
- package/plugins/specweave/commands/specweave-progress.md +108 -379
- package/plugins/specweave/commands/specweave-reopen.md +1 -1
- package/plugins/specweave/commands/specweave-restore-feature.md +1 -1
- package/plugins/specweave/commands/specweave-sync-specs.md +20 -48
- package/plugins/specweave/hooks/lib/update-status-line.sh +44 -35
- package/plugins/specweave/hooks/lib/validate-spec-status.sh +163 -0
- package/plugins/specweave/hooks/user-prompt-submit.sh +17 -35
- package/plugins/specweave/lib/hooks/update-tasks-md.js +52 -9
- package/plugins/specweave/lib/hooks/update-tasks-md.ts +77 -16
- package/plugins/specweave/templates/iac/aws-lambda/defaults.json +24 -0
- package/plugins/specweave/templates/iac/aws-lambda/templates/README.md.hbs +260 -0
- package/plugins/specweave/templates/iac/aws-lambda/templates/environments/dev.tfvars.hbs +34 -0
- package/plugins/specweave/templates/iac/aws-lambda/templates/environments/prod.tfvars.hbs +37 -0
- package/plugins/specweave/templates/iac/aws-lambda/templates/environments/staging.tfvars.hbs +35 -0
- package/plugins/specweave/templates/iac/aws-lambda/templates/outputs.tf.hbs +77 -0
- package/plugins/specweave/templates/iac/aws-lambda/templates/providers.tf.hbs +36 -0
- package/plugins/specweave/templates/iac/aws-lambda/templates/variables.tf.hbs +115 -0
- package/plugins/specweave/templates/iac/azure-functions/defaults.json +25 -0
- package/plugins/specweave/templates/iac/azure-functions/templates/README.md.hbs +268 -0
- package/plugins/specweave/templates/iac/azure-functions/templates/environments/dev.tfvars.hbs +34 -0
- package/plugins/specweave/templates/iac/azure-functions/templates/environments/prod.tfvars.hbs +46 -0
- package/plugins/specweave/templates/iac/azure-functions/templates/environments/staging.tfvars.hbs +34 -0
- package/plugins/specweave/templates/iac/azure-functions/templates/main.tf.hbs +225 -0
- package/plugins/specweave/templates/iac/azure-functions/templates/outputs.tf.hbs +89 -0
- package/plugins/specweave/templates/iac/azure-functions/templates/provider.tf.hbs +27 -0
- package/plugins/specweave/templates/iac/azure-functions/templates/providers.tf.hbs +35 -0
- package/plugins/specweave/templates/iac/azure-functions/templates/variables.tf.hbs +124 -0
- package/plugins/specweave/templates/iac/firebase/defaults.json +29 -0
- package/plugins/specweave/templates/iac/firebase/templates/README.md.hbs +35 -0
- package/plugins/specweave/templates/iac/firebase/templates/environments/dev.tfvars.hbs +7 -0
- package/plugins/specweave/templates/iac/firebase/templates/environments/prod.tfvars.hbs +7 -0
- package/plugins/specweave/templates/iac/firebase/templates/environments/staging.tfvars.hbs +7 -0
- package/plugins/specweave/templates/iac/firebase/templates/main.tf.hbs +90 -0
- package/plugins/specweave/templates/iac/firebase/templates/outputs.tf.hbs +15 -0
- package/plugins/specweave/templates/iac/firebase/templates/providers.tf.hbs +23 -0
- package/plugins/specweave/templates/iac/firebase/templates/variables.tf.hbs +42 -0
- package/plugins/specweave/templates/iac/gcp-cloud-functions/defaults.json +26 -0
- package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/README.md.hbs +299 -0
- package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/environments/dev.tfvars.hbs +36 -0
- package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/environments/prod.tfvars.hbs +48 -0
- package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/environments/staging.tfvars.hbs +41 -0
- package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/main.tf.hbs +192 -0
- package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/outputs.tf.hbs +66 -0
- package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/providers.tf.hbs +25 -0
- package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/variables.tf.hbs +119 -0
- package/plugins/specweave/templates/iac/supabase/defaults.json +15 -0
- package/plugins/specweave/templates/iac/supabase/templates/README.md.hbs +46 -0
- package/plugins/specweave/templates/iac/supabase/templates/main.tf.hbs +50 -0
- package/plugins/specweave-ado/lib/enhanced-ado-sync.js +170 -0
- package/plugins/specweave-github/agents/github-manager/AGENT.md +39 -7
- package/plugins/specweave-github/commands/specweave-github-create-issue.md +5 -5
- package/plugins/specweave-github/lib/CodeValidator.js +195 -0
- package/plugins/specweave-github/lib/CodeValidator.ts +284 -0
- package/plugins/specweave-github/lib/ThreeLayerSyncManager.js +545 -0
- package/plugins/specweave-github/lib/ThreeLayerSyncManager.ts +809 -0
- package/plugins/specweave-github/lib/github-client-v2.js +29 -0
- package/plugins/specweave-github/lib/github-client-v2.ts +30 -0
- package/plugins/specweave-github/lib/task-sync.js +4 -0
- package/plugins/specweave-github/lib/task-sync.ts +7 -0
- package/plugins/specweave-github/lib/types.ts +38 -0
- package/plugins/specweave-jira/lib/enhanced-jira-sync.js +3 -3
- package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +3222 -0
- package/src/templates/AGENTS.md.template +22 -1
- package/src/templates/CLAUDE.md.template +31 -0
- package/dist/src/core/living-docs/ThreeLayerSyncManager.d.ts +0 -116
- package/dist/src/core/living-docs/ThreeLayerSyncManager.d.ts.map +0 -1
- package/dist/src/core/living-docs/ThreeLayerSyncManager.js +0 -356
- package/dist/src/core/living-docs/ThreeLayerSyncManager.js.map +0 -1
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# Azure Functions + Cosmos DB Terraform Configuration
|
|
2
|
+
# Generated by SpecWeave Serverless Architecture Intelligence
|
|
3
|
+
|
|
4
|
+
# Resource Group
|
|
5
|
+
resource "azurerm_resource_group" "{{snakeCase resourceGroupName}}" {
|
|
6
|
+
name = "{{resourceGroupName}}"
|
|
7
|
+
location = "{{location}}"
|
|
8
|
+
|
|
9
|
+
tags = {
|
|
10
|
+
Environment = "{{environment}}"
|
|
11
|
+
ManagedBy = "Terraform"
|
|
12
|
+
Project = "{{projectName}}"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
# Storage Account (required for Function App)
|
|
17
|
+
resource "azurerm_storage_account" "{{snakeCase functionName}}" {
|
|
18
|
+
name = "{{snakeCase functionName}}storage"
|
|
19
|
+
resource_group_name = azurerm_resource_group.{{snakeCase resourceGroupName}}.name
|
|
20
|
+
location = azurerm_resource_group.{{snakeCase resourceGroupName}}.location
|
|
21
|
+
account_tier = "{{storageAccountTier}}"
|
|
22
|
+
account_replication_type = "{{storageAccountReplication}}"
|
|
23
|
+
|
|
24
|
+
tags = {
|
|
25
|
+
Environment = "{{environment}}"
|
|
26
|
+
ManagedBy = "Terraform"
|
|
27
|
+
Project = "{{projectName}}"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
# App Service Plan (Consumption Plan)
|
|
32
|
+
resource "azurerm_service_plan" "{{snakeCase functionName}}" {
|
|
33
|
+
name = "{{appName}}-plan"
|
|
34
|
+
resource_group_name = azurerm_resource_group.{{snakeCase resourceGroupName}}.name
|
|
35
|
+
location = azurerm_resource_group.{{snakeCase resourceGroupName}}.location
|
|
36
|
+
os_type = "{{osType}}"
|
|
37
|
+
sku_name = "{{skuName}}"
|
|
38
|
+
|
|
39
|
+
tags = {
|
|
40
|
+
Environment = "{{environment}}"
|
|
41
|
+
ManagedBy = "Terraform"
|
|
42
|
+
Project = "{{projectName}}"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
{{#if enableApplicationInsights}}
|
|
47
|
+
# Application Insights
|
|
48
|
+
resource "azurerm_application_insights" "{{snakeCase functionName}}" {
|
|
49
|
+
name = "{{appName}}-insights"
|
|
50
|
+
resource_group_name = azurerm_resource_group.{{snakeCase resourceGroupName}}.name
|
|
51
|
+
location = azurerm_resource_group.{{snakeCase resourceGroupName}}.location
|
|
52
|
+
application_type = "web"
|
|
53
|
+
|
|
54
|
+
tags = {
|
|
55
|
+
Environment = "{{environment}}"
|
|
56
|
+
ManagedBy = "Terraform"
|
|
57
|
+
Project = "{{projectName}}"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
{{/if}}
|
|
61
|
+
|
|
62
|
+
# Linux Function App
|
|
63
|
+
resource "azurerm_linux_function_app" "{{snakeCase functionName}}" {
|
|
64
|
+
name = "{{appName}}"
|
|
65
|
+
resource_group_name = azurerm_resource_group.{{snakeCase resourceGroupName}}.name
|
|
66
|
+
location = azurerm_resource_group.{{snakeCase resourceGroupName}}.location
|
|
67
|
+
|
|
68
|
+
storage_account_name = azurerm_storage_account.{{snakeCase functionName}}.name
|
|
69
|
+
storage_account_access_key = azurerm_storage_account.{{snakeCase functionName}}.primary_access_key
|
|
70
|
+
service_plan_id = azurerm_service_plan.{{snakeCase functionName}}.id
|
|
71
|
+
|
|
72
|
+
site_config {
|
|
73
|
+
application_stack {
|
|
74
|
+
{{#if (eq runtime "node")}}
|
|
75
|
+
node_version = "{{runtimeVersion}}"
|
|
76
|
+
{{else if (eq runtime "python")}}
|
|
77
|
+
python_version = "{{runtimeVersion}}"
|
|
78
|
+
{{else if (eq runtime "dotnet")}}
|
|
79
|
+
dotnet_version = "{{runtimeVersion}}"
|
|
80
|
+
{{/if}}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
cors {
|
|
84
|
+
allowed_origins = {{tfList corsOrigins}}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
{{#if enableApplicationInsights}}
|
|
88
|
+
application_insights_key = azurerm_application_insights.{{snakeCase functionName}}.instrumentation_key
|
|
89
|
+
application_insights_connection_string = azurerm_application_insights.{{snakeCase functionName}}.connection_string
|
|
90
|
+
{{/if}}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
app_settings = {
|
|
94
|
+
"ENVIRONMENT" = "{{environment}}"
|
|
95
|
+
"COSMOS_DB_ENDPOINT" = azurerm_cosmosdb_account.{{snakeCase databaseAccountName}}.endpoint
|
|
96
|
+
"COSMOS_DB_KEY" = azurerm_cosmosdb_account.{{snakeCase databaseAccountName}}.primary_key
|
|
97
|
+
"COSMOS_DB_DATABASE" = azurerm_cosmosdb_sql_database.{{snakeCase databaseName}}.name
|
|
98
|
+
"COSMOS_DB_CONTAINER" = azurerm_cosmosdb_sql_container.{{snakeCase containerName}}.name
|
|
99
|
+
"FUNCTIONS_WORKER_RUNTIME" = "{{runtime}}"
|
|
100
|
+
{{#if customAppSettings}}
|
|
101
|
+
{{#each customAppSettings}}
|
|
102
|
+
"{{@key}}" = "{{this}}"
|
|
103
|
+
{{/each}}
|
|
104
|
+
{{/if}}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
identity {
|
|
108
|
+
type = "SystemAssigned"
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
tags = {
|
|
112
|
+
Environment = "{{environment}}"
|
|
113
|
+
ManagedBy = "Terraform"
|
|
114
|
+
Project = "{{projectName}}"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
# Cosmos DB Account
|
|
119
|
+
resource "azurerm_cosmosdb_account" "{{snakeCase databaseAccountName}}" {
|
|
120
|
+
name = "{{databaseAccountName}}"
|
|
121
|
+
resource_group_name = azurerm_resource_group.{{snakeCase resourceGroupName}}.name
|
|
122
|
+
location = azurerm_resource_group.{{snakeCase resourceGroupName}}.location
|
|
123
|
+
offer_type = "Standard"
|
|
124
|
+
kind = "GlobalDocumentDB"
|
|
125
|
+
|
|
126
|
+
consistency_policy {
|
|
127
|
+
consistency_level = "Session"
|
|
128
|
+
max_interval_in_seconds = 5
|
|
129
|
+
max_staleness_prefix = 100
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
geo_location {
|
|
133
|
+
location = azurerm_resource_group.{{snakeCase resourceGroupName}}.location
|
|
134
|
+
failover_priority = 0
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
{{#if enableMultiRegion}}
|
|
138
|
+
{{#each secondaryRegions}}
|
|
139
|
+
geo_location {
|
|
140
|
+
location = "{{this}}"
|
|
141
|
+
failover_priority = {{@index}}
|
|
142
|
+
}
|
|
143
|
+
{{/each}}
|
|
144
|
+
{{/if}}
|
|
145
|
+
|
|
146
|
+
{{#if enableAutomaticFailover}}
|
|
147
|
+
enable_automatic_failover = true
|
|
148
|
+
{{/if}}
|
|
149
|
+
|
|
150
|
+
{{#if enableBackup}}
|
|
151
|
+
backup {
|
|
152
|
+
type = "Continuous"
|
|
153
|
+
interval_in_minutes = 240
|
|
154
|
+
retention_in_hours = 8
|
|
155
|
+
}
|
|
156
|
+
{{/if}}
|
|
157
|
+
|
|
158
|
+
tags = {
|
|
159
|
+
Environment = "{{environment}}"
|
|
160
|
+
ManagedBy = "Terraform"
|
|
161
|
+
Project = "{{projectName}}"
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
# Cosmos DB SQL Database
|
|
166
|
+
resource "azurerm_cosmosdb_sql_database" "{{snakeCase databaseName}}" {
|
|
167
|
+
name = "{{databaseName}}"
|
|
168
|
+
resource_group_name = azurerm_resource_group.{{snakeCase resourceGroupName}}.name
|
|
169
|
+
account_name = azurerm_cosmosdb_account.{{snakeCase databaseAccountName}}.name
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
# Cosmos DB SQL Container
|
|
173
|
+
resource "azurerm_cosmosdb_sql_container" "{{snakeCase containerName}}" {
|
|
174
|
+
name = "{{containerName}}"
|
|
175
|
+
resource_group_name = azurerm_resource_group.{{snakeCase resourceGroupName}}.name
|
|
176
|
+
account_name = azurerm_cosmosdb_account.{{snakeCase databaseAccountName}}.name
|
|
177
|
+
database_name = azurerm_cosmosdb_sql_database.{{snakeCase databaseName}}.name
|
|
178
|
+
partition_key_path = "{{partitionKey}}"
|
|
179
|
+
partition_key_version = 1
|
|
180
|
+
throughput = {{throughput}}
|
|
181
|
+
|
|
182
|
+
indexing_policy {
|
|
183
|
+
indexing_mode = "consistent"
|
|
184
|
+
|
|
185
|
+
included_path {
|
|
186
|
+
path = "/*"
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
excluded_path {
|
|
190
|
+
path = "/\"_etag\"/?"
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
{{#if enableKeyVault}}
|
|
196
|
+
# Key Vault
|
|
197
|
+
resource "azurerm_key_vault" "{{snakeCase functionName}}" {
|
|
198
|
+
name = "{{appName}}-kv"
|
|
199
|
+
resource_group_name = azurerm_resource_group.{{snakeCase resourceGroupName}}.name
|
|
200
|
+
location = azurerm_resource_group.{{snakeCase resourceGroupName}}.location
|
|
201
|
+
tenant_id = data.azurerm_client_config.current.tenant_id
|
|
202
|
+
sku_name = "standard"
|
|
203
|
+
soft_delete_retention_days = 7
|
|
204
|
+
purge_protection_enabled = false
|
|
205
|
+
|
|
206
|
+
access_policy {
|
|
207
|
+
tenant_id = data.azurerm_client_config.current.tenant_id
|
|
208
|
+
object_id = azurerm_linux_function_app.{{snakeCase functionName}}.identity[0].principal_id
|
|
209
|
+
|
|
210
|
+
secret_permissions = [
|
|
211
|
+
"Get",
|
|
212
|
+
"List"
|
|
213
|
+
]
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
tags = {
|
|
217
|
+
Environment = "{{environment}}"
|
|
218
|
+
ManagedBy = "Terraform"
|
|
219
|
+
Project = "{{projectName}}"
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
# Data source for current Azure client config
|
|
224
|
+
data "azurerm_client_config" "current" {}
|
|
225
|
+
{{/if}}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Output Values for Azure Functions + Cosmos DB
|
|
2
|
+
# Generated by SpecWeave Serverless Architecture Intelligence
|
|
3
|
+
|
|
4
|
+
output "resource_group_name" {
|
|
5
|
+
description = "Resource group name"
|
|
6
|
+
value = azurerm_resource_group.{{snakeCase resourceGroupName}}.name
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
output "resource_group_location" {
|
|
10
|
+
description = "Resource group location"
|
|
11
|
+
value = azurerm_resource_group.{{snakeCase resourceGroupName}}.location
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
output "function_app_name" {
|
|
15
|
+
description = "Function App name"
|
|
16
|
+
value = azurerm_linux_function_app.{{snakeCase functionName}}.name
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
output "function_app_id" {
|
|
20
|
+
description = "Function App ID"
|
|
21
|
+
value = azurerm_linux_function_app.{{snakeCase functionName}}.id
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
output "function_app_default_hostname" {
|
|
25
|
+
description = "Function App default hostname (URL)"
|
|
26
|
+
value = azurerm_linux_function_app.{{snakeCase functionName}}.default_hostname
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
output "function_app_url" {
|
|
30
|
+
description = "Function App HTTPS URL"
|
|
31
|
+
value = "https://${azurerm_linux_function_app.{{snakeCase functionName}}.default_hostname}"
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
output "function_app_principal_id" {
|
|
35
|
+
description = "Function App managed identity principal ID"
|
|
36
|
+
value = azurerm_linux_function_app.{{snakeCase functionName}}.identity[0].principal_id
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
output "cosmos_db_endpoint" {
|
|
40
|
+
description = "Cosmos DB endpoint URL"
|
|
41
|
+
value = azurerm_cosmosdb_account.{{snakeCase databaseAccountName}}.endpoint
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
output "cosmos_db_id" {
|
|
45
|
+
description = "Cosmos DB account ID"
|
|
46
|
+
value = azurerm_cosmosdb_account.{{snakeCase databaseAccountName}}.id
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
output "cosmos_db_database_name" {
|
|
50
|
+
description = "Cosmos DB database name"
|
|
51
|
+
value = azurerm_cosmosdb_sql_database.{{snakeCase databaseName}}.name
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
output "cosmos_db_container_name" {
|
|
55
|
+
description = "Cosmos DB container name"
|
|
56
|
+
value = azurerm_cosmosdb_sql_container.{{snakeCase containerName}}.name
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
output "storage_account_name" {
|
|
60
|
+
description = "Storage account name"
|
|
61
|
+
value = azurerm_storage_account.{{snakeCase functionName}}.name
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
output "storage_account_primary_connection_string" {
|
|
65
|
+
description = "Storage account primary connection string"
|
|
66
|
+
value = azurerm_storage_account.{{snakeCase functionName}}.primary_connection_string
|
|
67
|
+
sensitive = true
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
{{#if enableApplicationInsights}}
|
|
71
|
+
output "application_insights_instrumentation_key" {
|
|
72
|
+
description = "Application Insights instrumentation key"
|
|
73
|
+
value = azurerm_application_insights.{{snakeCase functionName}}.instrumentation_key
|
|
74
|
+
sensitive = true
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
output "application_insights_connection_string" {
|
|
78
|
+
description = "Application Insights connection string"
|
|
79
|
+
value = azurerm_application_insights.{{snakeCase functionName}}.connection_string
|
|
80
|
+
sensitive = true
|
|
81
|
+
}
|
|
82
|
+
{{/if}}
|
|
83
|
+
|
|
84
|
+
{{#if enableKeyVault}}
|
|
85
|
+
output "key_vault_uri" {
|
|
86
|
+
description = "Key Vault URI"
|
|
87
|
+
value = azurerm_key_vault.{{snakeCase functionName}}.vault_uri
|
|
88
|
+
}
|
|
89
|
+
{{/if}}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Terraform and Azure Provider Configuration
|
|
2
|
+
# Generated by SpecWeave Serverless Architecture Intelligence
|
|
3
|
+
|
|
4
|
+
terraform {
|
|
5
|
+
required_version = ">= 1.5.0"
|
|
6
|
+
|
|
7
|
+
required_providers {
|
|
8
|
+
azurerm = {
|
|
9
|
+
source = "hashicorp/azurerm"
|
|
10
|
+
version = "~> 3.0"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
provider "azurerm" {
|
|
16
|
+
features {
|
|
17
|
+
resource_group {
|
|
18
|
+
prevent_deletion_if_contains_resources = false
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
key_vault {
|
|
22
|
+
purge_soft_delete_on_destroy = true
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
skip_provider_registration = false
|
|
27
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Terraform Provider Configuration for Azure
|
|
2
|
+
# Generated by SpecWeave Serverless Architecture Intelligence
|
|
3
|
+
|
|
4
|
+
terraform {
|
|
5
|
+
required_version = ">= 1.5.0"
|
|
6
|
+
|
|
7
|
+
required_providers {
|
|
8
|
+
azurerm = {
|
|
9
|
+
source = "hashicorp/azurerm"
|
|
10
|
+
version = "~> 3.0"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
{{#if enableRemoteState}}
|
|
15
|
+
backend "azurerm" {
|
|
16
|
+
resource_group_name = "{{tfStateResourceGroup}}"
|
|
17
|
+
storage_account_name = "{{tfStateStorageAccount}}"
|
|
18
|
+
container_name = "tfstate"
|
|
19
|
+
key = "{{projectName}}-{{environment}}.tfstate"
|
|
20
|
+
}
|
|
21
|
+
{{/if}}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
provider "azurerm" {
|
|
25
|
+
features {
|
|
26
|
+
key_vault {
|
|
27
|
+
purge_soft_delete_on_destroy = true
|
|
28
|
+
recover_soft_deleted_key_vaults = true
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
resource_group {
|
|
32
|
+
prevent_deletion_if_contains_resources = false
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Input Variables for Azure Functions + Cosmos DB
|
|
2
|
+
# Generated by SpecWeave Serverless Architecture Intelligence
|
|
3
|
+
|
|
4
|
+
variable "location" {
|
|
5
|
+
description = "Azure region for all resources"
|
|
6
|
+
type = string
|
|
7
|
+
default = "{{location}}"
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
variable "resource_group_name" {
|
|
11
|
+
description = "Resource group name"
|
|
12
|
+
type = string
|
|
13
|
+
default = "{{resourceGroupName}}"
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
variable "app_name" {
|
|
17
|
+
description = "Function App name"
|
|
18
|
+
type = string
|
|
19
|
+
default = "{{appName}}"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
variable "runtime" {
|
|
23
|
+
description = "Function runtime (node, python, dotnet)"
|
|
24
|
+
type = string
|
|
25
|
+
default = "{{runtime}}"
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
variable "runtime_version" {
|
|
29
|
+
description = "Runtime version (20 for Node.js 20, 3.11 for Python 3.11, etc.)"
|
|
30
|
+
type = string
|
|
31
|
+
default = "{{runtimeVersion}}"
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
variable "os_type" {
|
|
35
|
+
description = "OS type (Linux or Windows)"
|
|
36
|
+
type = string
|
|
37
|
+
default = "{{osType}}"
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
variable "sku_name" {
|
|
41
|
+
description = "App Service Plan SKU (Y1 for Consumption, EP1/EP2/EP3 for Premium)"
|
|
42
|
+
type = string
|
|
43
|
+
default = "{{skuName}}"
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
variable "environment" {
|
|
47
|
+
description = "Environment name (dev, staging, prod)"
|
|
48
|
+
type = string
|
|
49
|
+
default = "{{environment}}"
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
variable "database_account_name" {
|
|
53
|
+
description = "Cosmos DB account name"
|
|
54
|
+
type = string
|
|
55
|
+
default = "{{databaseAccountName}}"
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
variable "database_name" {
|
|
59
|
+
description = "Cosmos DB database name"
|
|
60
|
+
type = string
|
|
61
|
+
default = "{{databaseName}}"
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
variable "container_name" {
|
|
65
|
+
description = "Cosmos DB container name"
|
|
66
|
+
type = string
|
|
67
|
+
default = "{{containerName}}"
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
variable "partition_key" {
|
|
71
|
+
description = "Cosmos DB partition key"
|
|
72
|
+
type = string
|
|
73
|
+
default = "{{partitionKey}}"
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
variable "throughput" {
|
|
77
|
+
description = "Cosmos DB throughput (RU/s, minimum 400)"
|
|
78
|
+
type = number
|
|
79
|
+
default = {{throughput}}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
variable "cors_origins" {
|
|
83
|
+
description = "List of allowed CORS origins for Function App"
|
|
84
|
+
type = list(string)
|
|
85
|
+
default = {{tfList corsOrigins}}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
variable "project_name" {
|
|
89
|
+
description = "Project name for resource tagging"
|
|
90
|
+
type = string
|
|
91
|
+
default = "{{projectName}}"
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
variable "storage_account_tier" {
|
|
95
|
+
description = "Storage account tier (Standard or Premium)"
|
|
96
|
+
type = string
|
|
97
|
+
default = "{{storageAccountTier}}"
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
variable "storage_account_replication" {
|
|
101
|
+
description = "Storage account replication type (LRS, GRS, RAGRS, ZRS)"
|
|
102
|
+
type = string
|
|
103
|
+
default = "{{storageAccountReplication}}"
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
{{#if enableMultiRegion}}
|
|
107
|
+
variable "secondary_regions" {
|
|
108
|
+
description = "List of secondary regions for multi-region deployment"
|
|
109
|
+
type = list(string)
|
|
110
|
+
default = {{tfList secondaryRegions}}
|
|
111
|
+
}
|
|
112
|
+
{{/if}}
|
|
113
|
+
|
|
114
|
+
{{#if enableVnet}}
|
|
115
|
+
variable "vnet_id" {
|
|
116
|
+
description = "Virtual Network ID for Function App integration"
|
|
117
|
+
type = string
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
variable "subnet_id" {
|
|
121
|
+
description = "Subnet ID for Function App integration"
|
|
122
|
+
type = string
|
|
123
|
+
}
|
|
124
|
+
{{/if}}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"projectId": "my-firebase-project",
|
|
3
|
+
"region": "us-central1",
|
|
4
|
+
"appDisplayName": "My Firebase App",
|
|
5
|
+
"siteId": "my-firebase-site",
|
|
6
|
+
"functionName": "myFirebaseFunction",
|
|
7
|
+
"runtime": "nodejs20",
|
|
8
|
+
"entryPoint": "handler",
|
|
9
|
+
"memoryMb": 256,
|
|
10
|
+
"timeoutSeconds": 60,
|
|
11
|
+
"environment": "dev",
|
|
12
|
+
"databaseId": "(default)",
|
|
13
|
+
"collectionId": "my-collection",
|
|
14
|
+
"storageBucket": "my-firebase-storage",
|
|
15
|
+
"projectName": "my-project",
|
|
16
|
+
"enableAuth": false,
|
|
17
|
+
"enableStorage": false,
|
|
18
|
+
"enableAnalytics": false,
|
|
19
|
+
"enableCrashlytics": false,
|
|
20
|
+
"hostingIndexPage": "index.html",
|
|
21
|
+
"hosting404Page": "404.html",
|
|
22
|
+
"hostingHeaders": [],
|
|
23
|
+
"hostingRewrites": [
|
|
24
|
+
{
|
|
25
|
+
"source": "**",
|
|
26
|
+
"function": "myFirebaseFunction"
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Firebase (Hosting + Functions + Firestore) Terraform Configuration
|
|
2
|
+
|
|
3
|
+
**Generated by SpecWeave Serverless Architecture Intelligence**
|
|
4
|
+
|
|
5
|
+
Deploys complete Firebase backend:
|
|
6
|
+
- Firebase Web App
|
|
7
|
+
- Firebase Hosting (static site)
|
|
8
|
+
- Cloud Functions for Firebase
|
|
9
|
+
- Firestore database
|
|
10
|
+
|
|
11
|
+
## Prerequisites
|
|
12
|
+
|
|
13
|
+
1. Install Firebase CLI: `npm install -g firebase-tools`
|
|
14
|
+
2. Authenticate: `firebase login`
|
|
15
|
+
3. Create Firebase project: `firebase projects:create {{projectId}}`
|
|
16
|
+
|
|
17
|
+
## Deployment
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
terraform init
|
|
21
|
+
terraform apply -var-file="environments/dev.tfvars"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Cost: $0/month (Free Spark Plan)
|
|
25
|
+
|
|
26
|
+
Firebase free tier includes:
|
|
27
|
+
- 10 GB hosting storage
|
|
28
|
+
- 360 MB/day hosting transfer
|
|
29
|
+
- Cloud Functions: 2M invocations/month
|
|
30
|
+
- Firestore: 1 GB storage, 50K reads/day
|
|
31
|
+
|
|
32
|
+
## Support
|
|
33
|
+
|
|
34
|
+
- Firebase Docs: https://firebase.google.com/docs
|
|
35
|
+
- SpecWeave: https://spec-weave.com
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Firebase (Hosting + Functions + Firestore) Terraform Configuration
|
|
2
|
+
# Generated by SpecWeave Serverless Architecture Intelligence
|
|
3
|
+
|
|
4
|
+
# Enable Firebase for existing GCP project
|
|
5
|
+
resource "google_firebase_project" "default" {
|
|
6
|
+
provider = google-beta
|
|
7
|
+
project = "{{projectId}}"
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
# Enable required APIs
|
|
11
|
+
resource "google_project_service" "firebasehosting" {
|
|
12
|
+
project = "{{projectId}}"
|
|
13
|
+
service = "firebasehosting.googleapis.com"
|
|
14
|
+
disable_on_destroy = false
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
resource "google_project_service" "firebase" {
|
|
18
|
+
project = "{{projectId}}"
|
|
19
|
+
service = "firebase.googleapis.com"
|
|
20
|
+
disable_on_destroy = false
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
# Firebase Web App
|
|
24
|
+
resource "google_firebase_web_app" "{{snakeCase appDisplayName}}" {
|
|
25
|
+
provider = google-beta
|
|
26
|
+
project = "{{projectId}}"
|
|
27
|
+
display_name = "{{appDisplayName}}"
|
|
28
|
+
|
|
29
|
+
depends_on = [google_firebase_project.default]
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
# Firebase Hosting Site
|
|
33
|
+
resource "google_firebase_hosting_site" "{{snakeCase siteId}}" {
|
|
34
|
+
provider = google-beta
|
|
35
|
+
project = "{{projectId}}"
|
|
36
|
+
site_id = "{{siteId}}"
|
|
37
|
+
|
|
38
|
+
depends_on = [google_firebase_project.default]
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
# Firestore Database (same as GCP)
|
|
42
|
+
resource "google_firestore_database" "{{snakeCase databaseId}}" {
|
|
43
|
+
project = "{{projectId}}"
|
|
44
|
+
name = "{{databaseId}}"
|
|
45
|
+
location_id = "{{region}}"
|
|
46
|
+
type = "FIRESTORE_NATIVE"
|
|
47
|
+
|
|
48
|
+
depends_on = [google_firebase_project.default]
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
# Cloud Functions for Firebase (similar to GCP Cloud Functions)
|
|
52
|
+
resource "google_cloudfunctions2_function" "{{snakeCase functionName}}" {
|
|
53
|
+
name = "{{functionName}}"
|
|
54
|
+
location = "{{region}}"
|
|
55
|
+
project = "{{projectId}}"
|
|
56
|
+
|
|
57
|
+
build_config {
|
|
58
|
+
runtime = "{{runtime}}"
|
|
59
|
+
entry_point = "{{entryPoint}}"
|
|
60
|
+
source {
|
|
61
|
+
storage_source {
|
|
62
|
+
bucket = "{{projectId}}.appspot.com"
|
|
63
|
+
object = "function-source.zip"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
service_config {
|
|
69
|
+
max_instance_count = 10
|
|
70
|
+
available_memory = "{{memoryMb}}M"
|
|
71
|
+
timeout_seconds = {{timeoutSeconds}}
|
|
72
|
+
environment_variables = {
|
|
73
|
+
FIREBASE_CONFIG = google_firebase_web_app.{{snakeCase appDisplayName}}.app_id
|
|
74
|
+
ENVIRONMENT = "{{environment}}"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
depends_on = [google_firebase_project.default]
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
{{#if enableStorage}}
|
|
82
|
+
# Firebase Storage Bucket
|
|
83
|
+
resource "google_firebase_storage_bucket" "{{snakeCase storageBucket}}" {
|
|
84
|
+
provider = google-beta
|
|
85
|
+
project = "{{projectId}}"
|
|
86
|
+
bucket_id = "{{storageBucket}}"
|
|
87
|
+
|
|
88
|
+
depends_on = [google_firebase_project.default]
|
|
89
|
+
}
|
|
90
|
+
{{/if}}
|