specweave 0.22.0 → 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 +211 -0
- package/README.md +5 -5
- package/bin/specweave.js +5 -8
- package/dist/plugins/specweave-github/lib/CodeValidator.d.ts +1 -1
- package/dist/plugins/specweave-github/lib/CodeValidator.js +1 -1
- 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/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 +50 -50
- 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/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/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/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/architecture/types.d.ts +10 -10
- 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 +4 -4
- 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-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.ts +1 -1
- 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-jira/lib/enhanced-jira-sync.js +3 -3
- package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +2022 -0
- 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,299 @@
|
|
|
1
|
+
# GCP Cloud Functions + Firestore Terraform Configuration
|
|
2
|
+
|
|
3
|
+
**Generated by SpecWeave Serverless Architecture Intelligence**
|
|
4
|
+
|
|
5
|
+
This Terraform configuration deploys:
|
|
6
|
+
- Cloud Functions (2nd gen) with HTTP trigger
|
|
7
|
+
- Firestore database (Native mode)
|
|
8
|
+
- Cloud Storage bucket for function source code
|
|
9
|
+
- Service Account with Firestore access
|
|
10
|
+
{{#if enableSecretManager}}- Secret Manager for sensitive configuration{{/if}}
|
|
11
|
+
{{#if enableVpc}}- VPC Access Connector for private networking{{/if}}
|
|
12
|
+
|
|
13
|
+
## Architecture
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
Cloud Function ({{functionName}})
|
|
17
|
+
├── Runtime: {{runtime}}
|
|
18
|
+
├── Memory: {{memoryMb}} MB
|
|
19
|
+
├── Timeout: {{timeoutSeconds}}s
|
|
20
|
+
├── Min Instances: {{minInstances}} ({{#if (eq minInstances 0)}}scales to zero{{else}}always-on{{/if}})
|
|
21
|
+
└── Max Instances: {{maxInstances}}
|
|
22
|
+
|
|
23
|
+
Firestore Database ({{databaseId}})
|
|
24
|
+
├── Type: FIRESTORE_NATIVE
|
|
25
|
+
├── Location: {{region}}
|
|
26
|
+
└── Collection: {{collectionId}}
|
|
27
|
+
|
|
28
|
+
Service Account ({{serviceAccountId}})
|
|
29
|
+
└── Roles: roles/datastore.user{{#if enableSecretManager}}, roles/secretmanager.secretAccessor{{/if}}
|
|
30
|
+
|
|
31
|
+
Cloud Storage ({{bucketName}})
|
|
32
|
+
├── Location: {{bucketLocation}}
|
|
33
|
+
└── Purpose: Function source code
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Prerequisites
|
|
37
|
+
|
|
38
|
+
1. **GCP Project** with billing enabled:
|
|
39
|
+
```bash
|
|
40
|
+
gcloud config set project {{projectId}}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
2. **gcloud CLI** authenticated:
|
|
44
|
+
```bash
|
|
45
|
+
gcloud auth application-default login
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
3. **Terraform** v1.5.0+ installed:
|
|
49
|
+
```bash
|
|
50
|
+
terraform version
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
4. **Function source code** ready to deploy:
|
|
54
|
+
- Node.js: `package.json`, `index.js`, etc.
|
|
55
|
+
- Python: `requirements.txt`, `main.py`, etc.
|
|
56
|
+
- Go: `go.mod`, `main.go`, etc.
|
|
57
|
+
|
|
58
|
+
5. **Zip function source code**:
|
|
59
|
+
```bash
|
|
60
|
+
cd ../src # Navigate to your function source code
|
|
61
|
+
zip -r ../infrastructure/function-source.zip .
|
|
62
|
+
cd ../infrastructure
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Deployment Instructions
|
|
66
|
+
|
|
67
|
+
### 1. Initialize Terraform
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
terraform init
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### 2. Review the Plan
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
terraform plan
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Expected resources**: ~{{#if enableVpc}}10{{else if enableSecretManager}}9{{else}}7{{/if}} resources will be created
|
|
80
|
+
|
|
81
|
+
### 3. Deploy Infrastructure
|
|
82
|
+
|
|
83
|
+
**Development**:
|
|
84
|
+
```bash
|
|
85
|
+
terraform apply -var-file="environments/dev.tfvars"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Staging**:
|
|
89
|
+
```bash
|
|
90
|
+
terraform apply -var-file="environments/staging.tfvars"
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Production**:
|
|
94
|
+
```bash
|
|
95
|
+
terraform apply -var-file="environments/prod.tfvars"
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 4. Deploy Function Code (Alternative)
|
|
99
|
+
|
|
100
|
+
You can also deploy function code using `gcloud`:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
gcloud functions deploy {{functionName}} \
|
|
104
|
+
--gen2 \
|
|
105
|
+
--runtime={{runtime}} \
|
|
106
|
+
--region={{region}} \
|
|
107
|
+
--source=../src \
|
|
108
|
+
--entry-point={{entryPoint}} \
|
|
109
|
+
--trigger-http \
|
|
110
|
+
--allow-unauthenticated
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### 5. Test Your Function
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Get function URL
|
|
117
|
+
FUNCTION_URL=$(terraform output -raw function_url)
|
|
118
|
+
|
|
119
|
+
# Test HTTP trigger
|
|
120
|
+
curl "${FUNCTION_URL}"
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Cost Estimation
|
|
124
|
+
|
|
125
|
+
### Development Environment
|
|
126
|
+
|
|
127
|
+
**Cloud Functions (2nd gen)**:
|
|
128
|
+
- Invocations: 2M/month = Free (2M free tier)
|
|
129
|
+
- Compute time: 400,000 GB-s/month = Free (free tier)
|
|
130
|
+
- Networking: 5 GB egress = Free (1 GB free, then $0.12/GB)
|
|
131
|
+
- **Total**: $0/month (within free tier)
|
|
132
|
+
|
|
133
|
+
**Firestore**:
|
|
134
|
+
- Stored data: 1 GB = Free (1 GB free tier)
|
|
135
|
+
- Document reads: 50K/day = Free (50K free tier)
|
|
136
|
+
- Document writes: 20K/day = Free (20K free tier)
|
|
137
|
+
- Document deletes: 20K/day = Free (20K free tier)
|
|
138
|
+
- **Total**: $0/month (within free tier)
|
|
139
|
+
|
|
140
|
+
**Cloud Storage**:
|
|
141
|
+
- Storage: < 5 GB = Free (5 GB free tier)
|
|
142
|
+
- Class A operations: Minimal cost
|
|
143
|
+
- Class B operations: Free (50K free tier)
|
|
144
|
+
- **Total**: $0/month (within free tier)
|
|
145
|
+
|
|
146
|
+
**Total Monthly Cost (Dev)**: $0/month
|
|
147
|
+
|
|
148
|
+
{{#if (eq environment "prod")}}
|
|
149
|
+
### Production Environment (Estimated)
|
|
150
|
+
|
|
151
|
+
**Note**: Production costs depend on actual usage. Estimate above assumes:
|
|
152
|
+
- 10M requests/month
|
|
153
|
+
- 5 GB Firestore storage
|
|
154
|
+
- 100K document writes/day
|
|
155
|
+
|
|
156
|
+
For accurate production estimates, use [GCP Pricing Calculator](https://cloud.google.com/products/calculator).
|
|
157
|
+
{{/if}}
|
|
158
|
+
|
|
159
|
+
## Free Tier Optimization Tips
|
|
160
|
+
|
|
161
|
+
1. **Cloud Functions**:
|
|
162
|
+
- Keep min_instances = 0 to scale to zero
|
|
163
|
+
- Use 256 MB memory (good balance of performance/cost)
|
|
164
|
+
- Set appropriate timeout (avoid long-running functions)
|
|
165
|
+
- Stay under 2M invocations/month for free tier
|
|
166
|
+
|
|
167
|
+
2. **Firestore**:
|
|
168
|
+
- Use composite indexes wisely (counts against storage)
|
|
169
|
+
- Batch writes when possible (reduces write operations)
|
|
170
|
+
- Use server-side timestamps (avoids extra writes)
|
|
171
|
+
- Monitor read/write quota in console
|
|
172
|
+
|
|
173
|
+
3. **Cloud Storage**:
|
|
174
|
+
- Store only function source code (minimal storage)
|
|
175
|
+
- Use lifecycle policies to delete old versions
|
|
176
|
+
- Stay under 5 GB for free tier
|
|
177
|
+
|
|
178
|
+
4. **Networking**:
|
|
179
|
+
- Minimize egress (first 1 GB free)
|
|
180
|
+
- Use Cloud CDN for static assets
|
|
181
|
+
- Keep responses small
|
|
182
|
+
|
|
183
|
+
## Monitoring
|
|
184
|
+
|
|
185
|
+
**Cloud Logging** and **Cloud Monitoring** are enabled by default.
|
|
186
|
+
|
|
187
|
+
View logs:
|
|
188
|
+
```bash
|
|
189
|
+
gcloud functions logs read {{functionName}} \
|
|
190
|
+
--region={{region}} \
|
|
191
|
+
--limit=50
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
View metrics in Cloud Console:
|
|
195
|
+
```
|
|
196
|
+
https://console.cloud.google.com/functions/details/{{region}}/{{functionName}}?project={{projectId}}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Key metrics to monitor:
|
|
200
|
+
- Invocation count
|
|
201
|
+
- Execution time (p50, p95, p99)
|
|
202
|
+
- Error count and error rate
|
|
203
|
+
- Active instances
|
|
204
|
+
- Memory usage
|
|
205
|
+
|
|
206
|
+
## Security Best Practices
|
|
207
|
+
|
|
208
|
+
1. **Service Account**: Function uses dedicated Service Account
|
|
209
|
+
- ✅ Least privilege principle (only Firestore access)
|
|
210
|
+
- ✅ No default compute service account
|
|
211
|
+
|
|
212
|
+
2. **Secrets Management**:
|
|
213
|
+
{{#if enableSecretManager}}
|
|
214
|
+
- ✅ Secret Manager enabled
|
|
215
|
+
- Store sensitive config in Secret Manager
|
|
216
|
+
- Access via `google_secret_manager_secret_version` data source
|
|
217
|
+
{{else}}
|
|
218
|
+
- ⚠️ Secret Manager not enabled
|
|
219
|
+
- Enable with `enableSecretManager = true`
|
|
220
|
+
{{/if}}
|
|
221
|
+
|
|
222
|
+
3. **HTTPS Only**: Function enforces HTTPS
|
|
223
|
+
4. **CORS**: Configured for origins: {{corsOrigins}}
|
|
224
|
+
5. **Network Security**:
|
|
225
|
+
{{#if enableVpc}}
|
|
226
|
+
- ✅ VPC Connector enabled for private networking
|
|
227
|
+
{{else}}
|
|
228
|
+
- ⚠️ Public internet access (no VPC)
|
|
229
|
+
- Enable with `enableVpc = true`
|
|
230
|
+
{{/if}}
|
|
231
|
+
|
|
232
|
+
6. **IAM**: Function allows unauthenticated invocations
|
|
233
|
+
- ⚠️ Change `allUsers` to specific members for private APIs
|
|
234
|
+
- Use Cloud Armor for DDoS protection (production)
|
|
235
|
+
|
|
236
|
+
## Cleanup
|
|
237
|
+
|
|
238
|
+
To destroy all resources:
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
terraform destroy
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
**Warning**: This will permanently delete:
|
|
245
|
+
- Cloud Function and all code
|
|
246
|
+
- Firestore database and all data
|
|
247
|
+
- Storage bucket and all objects
|
|
248
|
+
- Service Account
|
|
249
|
+
|
|
250
|
+
## Troubleshooting
|
|
251
|
+
|
|
252
|
+
### "Project not found"
|
|
253
|
+
- Ensure GCP project exists and billing is enabled
|
|
254
|
+
- Run `gcloud config set project {{projectId}}`
|
|
255
|
+
- Verify with `gcloud projects describe {{projectId}}`
|
|
256
|
+
|
|
257
|
+
### "API not enabled"
|
|
258
|
+
- APIs are enabled automatically by Terraform
|
|
259
|
+
- If issues persist, manually enable:
|
|
260
|
+
```bash
|
|
261
|
+
gcloud services enable cloudfunctions.googleapis.com
|
|
262
|
+
gcloud services enable cloudbuild.googleapis.com
|
|
263
|
+
gcloud services enable firestore.googleapis.com
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### "Insufficient permissions"
|
|
267
|
+
- Ensure you have `roles/editor` or `roles/owner` on project
|
|
268
|
+
- Check with: `gcloud projects get-iam-policy {{projectId}}`
|
|
269
|
+
|
|
270
|
+
### "function-source.zip not found"
|
|
271
|
+
- Create zip file from your function source code:
|
|
272
|
+
```bash
|
|
273
|
+
cd ../src
|
|
274
|
+
zip -r ../infrastructure/function-source.zip .
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### "Function not responding"
|
|
278
|
+
- Check Cloud Logging for errors
|
|
279
|
+
- Verify function code has correct entry point
|
|
280
|
+
- Check CORS settings if calling from browser
|
|
281
|
+
|
|
282
|
+
## Next Steps
|
|
283
|
+
|
|
284
|
+
1. **Deploy your function code** (see step 4-5 above)
|
|
285
|
+
2. **Set up CI/CD** with Cloud Build or GitHub Actions
|
|
286
|
+
3. **Configure custom domains** for production
|
|
287
|
+
4. **Set up monitoring alerts** in Cloud Monitoring
|
|
288
|
+
5. **Enable Cloud Armor** for DDoS protection (production)
|
|
289
|
+
|
|
290
|
+
## Support
|
|
291
|
+
|
|
292
|
+
- **GCP Documentation**: https://cloud.google.com/functions/docs
|
|
293
|
+
- **Terraform GCP Provider**: https://registry.terraform.io/providers/hashicorp/google/
|
|
294
|
+
- **SpecWeave**: https://spec-weave.com
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
**Generated**: {{currentDate}}
|
|
299
|
+
**SpecWeave Version**: {{specweaveVersion}}
|
package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/environments/dev.tfvars.hbs
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Development Environment Variables for GCP Cloud Functions + Firestore
|
|
2
|
+
# Generated by SpecWeave Serverless Architecture Intelligence
|
|
3
|
+
|
|
4
|
+
project_id = "{{projectId}}"
|
|
5
|
+
region = "us-central1"
|
|
6
|
+
function_name = "{{projectName}}-dev-function"
|
|
7
|
+
runtime = "{{runtime}}"
|
|
8
|
+
entry_point = "{{entryPoint}}"
|
|
9
|
+
memory_mb = 256 # Free tier: up to 2M GB-s/month
|
|
10
|
+
timeout_seconds = 60
|
|
11
|
+
min_instances = 0 # Scale to zero for cost savings
|
|
12
|
+
max_instances = 10 # Limit for dev environment
|
|
13
|
+
environment = "dev"
|
|
14
|
+
|
|
15
|
+
# Firestore (free tier: 1 GB storage, 50K reads/day, 20K writes/day)
|
|
16
|
+
database_id = "(default)"
|
|
17
|
+
collection_id = "{{collectionId}}"
|
|
18
|
+
|
|
19
|
+
# Service Account
|
|
20
|
+
service_account_id = "{{projectName}}-dev-sa"
|
|
21
|
+
|
|
22
|
+
# CORS (allow all for development)
|
|
23
|
+
cors_origins = ["*"]
|
|
24
|
+
|
|
25
|
+
# Storage Bucket
|
|
26
|
+
bucket_name = "{{projectName}}-dev-source"
|
|
27
|
+
bucket_location = "US" # Multi-region for better availability
|
|
28
|
+
|
|
29
|
+
# Project tagging
|
|
30
|
+
project_name = "{{projectName}}"
|
|
31
|
+
|
|
32
|
+
# Free tier optimization
|
|
33
|
+
# - min_instances = 0 (scale to zero, no idle cost)
|
|
34
|
+
# - memory_mb = 256 (within free tier compute limits)
|
|
35
|
+
# - timeout_seconds = 60 (avoid long-running functions)
|
|
36
|
+
# - max_instances = 10 (prevent runaway costs)
|
package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/environments/prod.tfvars.hbs
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Production Environment Variables for GCP Cloud Functions + Firestore
|
|
2
|
+
# Generated by SpecWeave Serverless Architecture Intelligence
|
|
3
|
+
|
|
4
|
+
project_id = "{{projectId}}"
|
|
5
|
+
region = "us-central1"
|
|
6
|
+
function_name = "{{projectName}}-prod-function"
|
|
7
|
+
runtime = "{{runtime}}"
|
|
8
|
+
entry_point = "{{entryPoint}}"
|
|
9
|
+
memory_mb = 1024 # Production-grade memory
|
|
10
|
+
timeout_seconds = 300 # 5 minutes max
|
|
11
|
+
min_instances = 3 # Keep 3 instances warm for low latency
|
|
12
|
+
max_instances = 200 # Handle production traffic
|
|
13
|
+
environment = "prod"
|
|
14
|
+
|
|
15
|
+
# Firestore
|
|
16
|
+
database_id = "(default)"
|
|
17
|
+
collection_id = "{{collectionId}}"
|
|
18
|
+
|
|
19
|
+
# Service Account
|
|
20
|
+
service_account_id = "{{projectName}}-prod-sa"
|
|
21
|
+
|
|
22
|
+
# CORS (restrict to production domain only)
|
|
23
|
+
cors_origins = ["https://{{projectName}}.com"]
|
|
24
|
+
|
|
25
|
+
# Storage Bucket
|
|
26
|
+
bucket_name = "{{projectName}}-prod-source"
|
|
27
|
+
bucket_location = "US"
|
|
28
|
+
|
|
29
|
+
# Project tagging
|
|
30
|
+
project_name = "{{projectName}}"
|
|
31
|
+
|
|
32
|
+
# Concurrency settings
|
|
33
|
+
enable_concurrency = true
|
|
34
|
+
max_concurrent_requests = 80
|
|
35
|
+
|
|
36
|
+
# Production features (uncomment to enable)
|
|
37
|
+
# enable_secret_manager = true
|
|
38
|
+
# enable_vpc = true
|
|
39
|
+
# vpc_network = "my-vpc"
|
|
40
|
+
|
|
41
|
+
# Production optimizations
|
|
42
|
+
# - min_instances = 3 (eliminate cold starts)
|
|
43
|
+
# - memory_mb = 1024 (better performance, handles concurrent requests)
|
|
44
|
+
# - timeout_seconds = 300 (handle complex operations)
|
|
45
|
+
# - max_instances = 200 (auto-scale for traffic spikes)
|
|
46
|
+
# - enable_concurrency = true (maximize instance utilization)
|
|
47
|
+
# - enable_secret_manager = true (secure secrets management)
|
|
48
|
+
# - enable_vpc = true (private networking)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Staging Environment Variables for GCP Cloud Functions + Firestore
|
|
2
|
+
# Generated by SpecWeave Serverless Architecture Intelligence
|
|
3
|
+
|
|
4
|
+
project_id = "{{projectId}}"
|
|
5
|
+
region = "us-central1"
|
|
6
|
+
function_name = "{{projectName}}-staging-function"
|
|
7
|
+
runtime = "{{runtime}}"
|
|
8
|
+
entry_point = "{{entryPoint}}"
|
|
9
|
+
memory_mb = 512 # Higher memory for better performance
|
|
10
|
+
timeout_seconds = 120
|
|
11
|
+
min_instances = 1 # Keep 1 instance warm
|
|
12
|
+
max_instances = 50 # Higher limit for staging tests
|
|
13
|
+
environment = "staging"
|
|
14
|
+
|
|
15
|
+
# Firestore
|
|
16
|
+
database_id = "(default)"
|
|
17
|
+
collection_id = "{{collectionId}}"
|
|
18
|
+
|
|
19
|
+
# Service Account
|
|
20
|
+
service_account_id = "{{projectName}}-staging-sa"
|
|
21
|
+
|
|
22
|
+
# CORS (restrict to staging domain)
|
|
23
|
+
cors_origins = ["https://staging.{{projectName}}.com"]
|
|
24
|
+
|
|
25
|
+
# Storage Bucket
|
|
26
|
+
bucket_name = "{{projectName}}-staging-source"
|
|
27
|
+
bucket_location = "US"
|
|
28
|
+
|
|
29
|
+
# Project tagging
|
|
30
|
+
project_name = "{{projectName}}"
|
|
31
|
+
|
|
32
|
+
# Concurrency settings (2nd gen feature)
|
|
33
|
+
enable_concurrency = true
|
|
34
|
+
max_concurrent_requests = 80
|
|
35
|
+
|
|
36
|
+
# Staging optimizations
|
|
37
|
+
# - min_instances = 1 (reduce cold starts)
|
|
38
|
+
# - memory_mb = 512 (better performance than dev)
|
|
39
|
+
# - timeout_seconds = 120 (allow longer-running operations)
|
|
40
|
+
# - max_instances = 50 (handle load testing)
|
|
41
|
+
# - enable_concurrency = true (better resource utilization)
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# GCP Cloud Functions + Firestore Terraform Configuration
|
|
2
|
+
# Generated by SpecWeave Serverless Architecture Intelligence
|
|
3
|
+
|
|
4
|
+
# Enable required APIs
|
|
5
|
+
resource "google_project_service" "cloudfunctions" {
|
|
6
|
+
project = "{{projectId}}"
|
|
7
|
+
service = "cloudfunctions.googleapis.com"
|
|
8
|
+
|
|
9
|
+
disable_on_destroy = false
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
resource "google_project_service" "cloudbuild" {
|
|
13
|
+
project = "{{projectId}}"
|
|
14
|
+
service = "cloudbuild.googleapis.com"
|
|
15
|
+
|
|
16
|
+
disable_on_destroy = false
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
resource "google_project_service" "firestore" {
|
|
20
|
+
project = "{{projectId}}"
|
|
21
|
+
service = "firestore.googleapis.com"
|
|
22
|
+
|
|
23
|
+
disable_on_destroy = false
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
resource "google_project_service" "run" {
|
|
27
|
+
project = "{{projectId}}"
|
|
28
|
+
service = "run.googleapis.com"
|
|
29
|
+
|
|
30
|
+
disable_on_destroy = false
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
# Service Account for Cloud Function
|
|
34
|
+
resource "google_service_account" "{{snakeCase serviceAccountId}}" {
|
|
35
|
+
account_id = "{{serviceAccountId}}"
|
|
36
|
+
display_name = "Service Account for {{functionName}}"
|
|
37
|
+
project = "{{projectId}}"
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
# IAM binding for Firestore access
|
|
41
|
+
resource "google_project_iam_member" "firestore_user" {
|
|
42
|
+
project = "{{projectId}}"
|
|
43
|
+
role = "roles/datastore.user"
|
|
44
|
+
member = "serviceAccount:${google_service_account.{{snakeCase serviceAccountId}}.email}"
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
# Storage Bucket for function source code
|
|
48
|
+
resource "google_storage_bucket" "{{snakeCase bucketName}}" {
|
|
49
|
+
name = "{{bucketName}}-{{projectId}}"
|
|
50
|
+
location = "{{bucketLocation}}"
|
|
51
|
+
project = "{{projectId}}"
|
|
52
|
+
|
|
53
|
+
uniform_bucket_level_access = true
|
|
54
|
+
|
|
55
|
+
labels = {
|
|
56
|
+
environment = "{{environment}}"
|
|
57
|
+
managed_by = "terraform"
|
|
58
|
+
project = "{{projectName}}"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
# Storage Bucket Object for function source code (placeholder)
|
|
63
|
+
resource "google_storage_bucket_object" "function_source" {
|
|
64
|
+
name = "function-source-{{environment}}.zip"
|
|
65
|
+
bucket = google_storage_bucket.{{snakeCase bucketName}}.name
|
|
66
|
+
source = "function-source.zip" # You need to provide this file
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
# Cloud Function (2nd generation)
|
|
70
|
+
resource "google_cloudfunctions2_function" "{{snakeCase functionName}}" {
|
|
71
|
+
name = "{{functionName}}"
|
|
72
|
+
location = "{{region}}"
|
|
73
|
+
project = "{{projectId}}"
|
|
74
|
+
|
|
75
|
+
build_config {
|
|
76
|
+
runtime = "{{runtime}}"
|
|
77
|
+
entry_point = "{{entryPoint}}"
|
|
78
|
+
|
|
79
|
+
source {
|
|
80
|
+
storage_source {
|
|
81
|
+
bucket = google_storage_bucket.{{snakeCase bucketName}}.name
|
|
82
|
+
object = google_storage_bucket_object.function_source.name
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
service_config {
|
|
88
|
+
max_instance_count = {{maxInstances}}
|
|
89
|
+
min_instance_count = {{minInstances}}
|
|
90
|
+
available_memory = "{{memoryMb}}M"
|
|
91
|
+
timeout_seconds = {{timeoutSeconds}}
|
|
92
|
+
|
|
93
|
+
{{#if enableConcurrency}}
|
|
94
|
+
max_instance_request_concurrency = {{maxConcurrentRequests}}
|
|
95
|
+
{{/if}}
|
|
96
|
+
|
|
97
|
+
environment_variables = {
|
|
98
|
+
ENVIRONMENT = "{{environment}}"
|
|
99
|
+
GCP_PROJECT = "{{projectId}}"
|
|
100
|
+
FIRESTORE_DATABASE = "{{databaseId}}"
|
|
101
|
+
COLLECTION_ID = "{{collectionId}}"
|
|
102
|
+
{{#if customEnvVars}}
|
|
103
|
+
{{#each customEnvVars}}
|
|
104
|
+
{{@key}} = "{{this}}"
|
|
105
|
+
{{/each}}
|
|
106
|
+
{{/if}}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
service_account_email = google_service_account.{{snakeCase serviceAccountId}}.email
|
|
110
|
+
|
|
111
|
+
{{#if enableVpc}}
|
|
112
|
+
vpc_connector = google_vpc_access_connector.connector.id
|
|
113
|
+
vpc_connector_egress_settings = "ALL_TRAFFIC"
|
|
114
|
+
{{/if}}
|
|
115
|
+
|
|
116
|
+
{{#if corsOrigins}}
|
|
117
|
+
ingress_settings = "ALLOW_ALL"
|
|
118
|
+
{{/if}}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
labels = {
|
|
122
|
+
environment = "{{environment}}"
|
|
123
|
+
managed_by = "terraform"
|
|
124
|
+
project = "{{projectName}}"
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
depends_on = [
|
|
128
|
+
google_project_service.cloudfunctions,
|
|
129
|
+
google_project_service.cloudbuild,
|
|
130
|
+
google_project_service.run,
|
|
131
|
+
google_project_iam_member.firestore_user
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
# Cloud Function IAM - Allow unauthenticated invocations (API Gateway equivalent)
|
|
136
|
+
resource "google_cloudfunctions2_function_iam_member" "invoker" {
|
|
137
|
+
project = google_cloudfunctions2_function.{{snakeCase functionName}}.project
|
|
138
|
+
location = google_cloudfunctions2_function.{{snakeCase functionName}}.location
|
|
139
|
+
cloud_function = google_cloudfunctions2_function.{{snakeCase functionName}}.name
|
|
140
|
+
|
|
141
|
+
role = "roles/cloudfunctions.invoker"
|
|
142
|
+
member = "allUsers" # For public API. Use specific members for private APIs
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
# Firestore Database
|
|
146
|
+
resource "google_firestore_database" "{{snakeCase databaseId}}" {
|
|
147
|
+
project = "{{projectId}}"
|
|
148
|
+
name = "{{databaseId}}"
|
|
149
|
+
location_id = "{{region}}"
|
|
150
|
+
type = "FIRESTORE_NATIVE"
|
|
151
|
+
|
|
152
|
+
concurrency_mode = "OPTIMISTIC"
|
|
153
|
+
app_engine_integration_mode = "DISABLED"
|
|
154
|
+
|
|
155
|
+
depends_on = [google_project_service.firestore]
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
{{#if enableVpc}}
|
|
159
|
+
# VPC Access Connector for private networking
|
|
160
|
+
resource "google_vpc_access_connector" "connector" {
|
|
161
|
+
name = "{{functionName}}-vpc-connector"
|
|
162
|
+
region = "{{region}}"
|
|
163
|
+
project = "{{projectId}}"
|
|
164
|
+
ip_cidr_range = "10.8.0.0/28"
|
|
165
|
+
network = var.vpc_network
|
|
166
|
+
}
|
|
167
|
+
{{/if}}
|
|
168
|
+
|
|
169
|
+
{{#if enableSecretManager}}
|
|
170
|
+
# Secret Manager for sensitive configuration
|
|
171
|
+
resource "google_secret_manager_secret" "{{snakeCase functionName}}_secrets" {
|
|
172
|
+
secret_id = "{{functionName}}-secrets"
|
|
173
|
+
project = "{{projectId}}"
|
|
174
|
+
|
|
175
|
+
replication {
|
|
176
|
+
auto {}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
labels = {
|
|
180
|
+
environment = "{{environment}}"
|
|
181
|
+
managed_by = "terraform"
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
# IAM binding for Secret Manager access
|
|
186
|
+
resource "google_secret_manager_secret_iam_member" "secret_accessor" {
|
|
187
|
+
project = google_secret_manager_secret.{{snakeCase functionName}}_secrets.project
|
|
188
|
+
secret_id = google_secret_manager_secret.{{snakeCase functionName}}_secrets.secret_id
|
|
189
|
+
role = "roles/secretmanager.secretAccessor"
|
|
190
|
+
member = "serviceAccount:${google_service_account.{{snakeCase serviceAccountId}}.email}"
|
|
191
|
+
}
|
|
192
|
+
{{/if}}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Output Values for GCP Cloud Functions + Firestore
|
|
2
|
+
# Generated by SpecWeave Serverless Architecture Intelligence
|
|
3
|
+
|
|
4
|
+
output "function_name" {
|
|
5
|
+
description = "Cloud Function name"
|
|
6
|
+
value = google_cloudfunctions2_function.{{snakeCase functionName}}.name
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
output "function_id" {
|
|
10
|
+
description = "Cloud Function ID"
|
|
11
|
+
value = google_cloudfunctions2_function.{{snakeCase functionName}}.id
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
output "function_url" {
|
|
15
|
+
description = "Cloud Function HTTPS trigger URL"
|
|
16
|
+
value = google_cloudfunctions2_function.{{snakeCase functionName}}.service_config[0].uri
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
output "function_region" {
|
|
20
|
+
description = "Cloud Function region"
|
|
21
|
+
value = google_cloudfunctions2_function.{{snakeCase functionName}}.location
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
output "service_account_email" {
|
|
25
|
+
description = "Service Account email for Cloud Function"
|
|
26
|
+
value = google_service_account.{{snakeCase serviceAccountId}}.email
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
output "firestore_database_name" {
|
|
30
|
+
description = "Firestore database name"
|
|
31
|
+
value = google_firestore_database.{{snakeCase databaseId}}.name
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
output "firestore_location" {
|
|
35
|
+
description = "Firestore database location"
|
|
36
|
+
value = google_firestore_database.{{snakeCase databaseId}}.location_id
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
output "storage_bucket_name" {
|
|
40
|
+
description = "Storage bucket name for function source code"
|
|
41
|
+
value = google_storage_bucket.{{snakeCase bucketName}}.name
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
output "storage_bucket_url" {
|
|
45
|
+
description = "Storage bucket URL"
|
|
46
|
+
value = google_storage_bucket.{{snakeCase bucketName}}.url
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
{{#if enableSecretManager}}
|
|
50
|
+
output "secret_manager_secret_id" {
|
|
51
|
+
description = "Secret Manager secret ID"
|
|
52
|
+
value = google_secret_manager_secret.{{snakeCase functionName}}_secrets.secret_id
|
|
53
|
+
}
|
|
54
|
+
{{/if}}
|
|
55
|
+
|
|
56
|
+
{{#if enableVpc}}
|
|
57
|
+
output "vpc_connector_id" {
|
|
58
|
+
description = "VPC Access Connector ID"
|
|
59
|
+
value = google_vpc_access_connector.connector.id
|
|
60
|
+
}
|
|
61
|
+
{{/if}}
|
|
62
|
+
|
|
63
|
+
output "project_id" {
|
|
64
|
+
description = "GCP Project ID"
|
|
65
|
+
value = "{{projectId}}"
|
|
66
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Terraform Provider Configuration for GCP
|
|
2
|
+
# Generated by SpecWeave Serverless Architecture Intelligence
|
|
3
|
+
|
|
4
|
+
terraform {
|
|
5
|
+
required_version = ">= 1.5.0"
|
|
6
|
+
|
|
7
|
+
required_providers {
|
|
8
|
+
google = {
|
|
9
|
+
source = "hashicorp/google"
|
|
10
|
+
version = "~> 5.0"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
{{#if enableRemoteState}}
|
|
15
|
+
backend "gcs" {
|
|
16
|
+
bucket = "{{tfStateBucket}}"
|
|
17
|
+
prefix = "terraform/state/{{projectName}}-{{environment}}"
|
|
18
|
+
}
|
|
19
|
+
{{/if}}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
provider "google" {
|
|
23
|
+
project = "{{projectId}}"
|
|
24
|
+
region = "{{region}}"
|
|
25
|
+
}
|