@friggframework/devtools 2.0.0-next.45 → 2.0.0-next.46
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/infrastructure/ARCHITECTURE.md +487 -0
- package/infrastructure/HEALTH.md +468 -0
- package/infrastructure/README.md +51 -0
- package/infrastructure/__tests__/postgres-config.test.js +914 -0
- package/infrastructure/__tests__/template-generation.test.js +687 -0
- package/infrastructure/create-frigg-infrastructure.js +1 -1
- package/infrastructure/docs/POSTGRES-CONFIGURATION.md +630 -0
- package/infrastructure/{DEPLOYMENT-INSTRUCTIONS.md → docs/deployment-instructions.md} +3 -3
- package/infrastructure/{IAM-POLICY-TEMPLATES.md → docs/iam-policy-templates.md} +9 -10
- package/infrastructure/domains/database/aurora-builder.js +809 -0
- package/infrastructure/domains/database/aurora-builder.test.js +950 -0
- package/infrastructure/domains/database/aurora-discovery.js +87 -0
- package/infrastructure/domains/database/aurora-discovery.test.js +188 -0
- package/infrastructure/domains/database/aurora-resolver.js +210 -0
- package/infrastructure/domains/database/aurora-resolver.test.js +347 -0
- package/infrastructure/domains/database/migration-builder.js +633 -0
- package/infrastructure/domains/database/migration-builder.test.js +294 -0
- package/infrastructure/domains/database/migration-resolver.js +163 -0
- package/infrastructure/domains/database/migration-resolver.test.js +337 -0
- package/infrastructure/domains/health/application/ports/IPropertyReconciler.js +164 -0
- package/infrastructure/domains/health/application/ports/IResourceDetector.js +129 -0
- package/infrastructure/domains/health/application/ports/IResourceImporter.js +142 -0
- package/infrastructure/domains/health/application/ports/IStackRepository.js +131 -0
- package/infrastructure/domains/health/application/ports/index.js +26 -0
- package/infrastructure/domains/health/application/use-cases/__tests__/execute-resource-import-use-case.test.js +679 -0
- package/infrastructure/domains/health/application/use-cases/__tests__/mismatch-analyzer-method-name.test.js +167 -0
- package/infrastructure/domains/health/application/use-cases/__tests__/repair-via-import-use-case.test.js +1130 -0
- package/infrastructure/domains/health/application/use-cases/execute-resource-import-use-case.js +221 -0
- package/infrastructure/domains/health/application/use-cases/reconcile-properties-use-case.js +152 -0
- package/infrastructure/domains/health/application/use-cases/reconcile-properties-use-case.test.js +343 -0
- package/infrastructure/domains/health/application/use-cases/repair-via-import-use-case.js +535 -0
- package/infrastructure/domains/health/application/use-cases/repair-via-import-use-case.test.js +376 -0
- package/infrastructure/domains/health/application/use-cases/run-health-check-use-case.js +213 -0
- package/infrastructure/domains/health/application/use-cases/run-health-check-use-case.test.js +441 -0
- package/infrastructure/domains/health/docs/ACME-DEV-DRIFT-ANALYSIS.md +267 -0
- package/infrastructure/domains/health/docs/BUILD-VS-DEPLOYED-TEMPLATE-ANALYSIS.md +324 -0
- package/infrastructure/domains/health/docs/ORPHAN-DETECTION-ANALYSIS.md +386 -0
- package/infrastructure/domains/health/docs/SPEC-CLEANUP-COMMAND.md +1419 -0
- package/infrastructure/domains/health/docs/TDD-IMPLEMENTATION-SUMMARY.md +391 -0
- package/infrastructure/domains/health/docs/TEMPLATE-COMPARISON-IMPLEMENTATION.md +551 -0
- package/infrastructure/domains/health/domain/entities/issue.js +299 -0
- package/infrastructure/domains/health/domain/entities/issue.test.js +528 -0
- package/infrastructure/domains/health/domain/entities/property-mismatch.js +108 -0
- package/infrastructure/domains/health/domain/entities/property-mismatch.test.js +275 -0
- package/infrastructure/domains/health/domain/entities/resource.js +159 -0
- package/infrastructure/domains/health/domain/entities/resource.test.js +432 -0
- package/infrastructure/domains/health/domain/entities/stack-health-report.js +306 -0
- package/infrastructure/domains/health/domain/entities/stack-health-report.test.js +601 -0
- package/infrastructure/domains/health/domain/services/__tests__/health-score-percentage-based.test.js +380 -0
- package/infrastructure/domains/health/domain/services/__tests__/import-progress-monitor.test.js +971 -0
- package/infrastructure/domains/health/domain/services/__tests__/import-template-generator.test.js +1150 -0
- package/infrastructure/domains/health/domain/services/__tests__/logical-id-mapper.test.js +672 -0
- package/infrastructure/domains/health/domain/services/__tests__/template-parser.test.js +496 -0
- package/infrastructure/domains/health/domain/services/__tests__/update-progress-monitor.test.js +419 -0
- package/infrastructure/domains/health/domain/services/health-score-calculator.js +248 -0
- package/infrastructure/domains/health/domain/services/health-score-calculator.test.js +504 -0
- package/infrastructure/domains/health/domain/services/import-progress-monitor.js +195 -0
- package/infrastructure/domains/health/domain/services/import-template-generator.js +435 -0
- package/infrastructure/domains/health/domain/services/logical-id-mapper.js +345 -0
- package/infrastructure/domains/health/domain/services/mismatch-analyzer.js +234 -0
- package/infrastructure/domains/health/domain/services/mismatch-analyzer.test.js +431 -0
- package/infrastructure/domains/health/domain/services/property-mutability-config.js +382 -0
- package/infrastructure/domains/health/domain/services/template-parser.js +245 -0
- package/infrastructure/domains/health/domain/services/update-progress-monitor.js +192 -0
- package/infrastructure/domains/health/domain/value-objects/health-score.js +138 -0
- package/infrastructure/domains/health/domain/value-objects/health-score.test.js +267 -0
- package/infrastructure/domains/health/domain/value-objects/property-mutability.js +161 -0
- package/infrastructure/domains/health/domain/value-objects/property-mutability.test.js +198 -0
- package/infrastructure/domains/health/domain/value-objects/resource-state.js +167 -0
- package/infrastructure/domains/health/domain/value-objects/resource-state.test.js +196 -0
- package/infrastructure/domains/health/domain/value-objects/stack-identifier.js +192 -0
- package/infrastructure/domains/health/domain/value-objects/stack-identifier.test.js +262 -0
- package/infrastructure/domains/health/infrastructure/adapters/__tests__/orphan-detection-cfn-tagged.test.js +312 -0
- package/infrastructure/domains/health/infrastructure/adapters/__tests__/orphan-detection-multi-stack.test.js +367 -0
- package/infrastructure/domains/health/infrastructure/adapters/__tests__/orphan-detection-relationship-analysis.test.js +432 -0
- package/infrastructure/domains/health/infrastructure/adapters/aws-property-reconciler.js +784 -0
- package/infrastructure/domains/health/infrastructure/adapters/aws-property-reconciler.test.js +1133 -0
- package/infrastructure/domains/health/infrastructure/adapters/aws-resource-detector.js +565 -0
- package/infrastructure/domains/health/infrastructure/adapters/aws-resource-detector.test.js +554 -0
- package/infrastructure/domains/health/infrastructure/adapters/aws-resource-importer.js +318 -0
- package/infrastructure/domains/health/infrastructure/adapters/aws-resource-importer.test.js +398 -0
- package/infrastructure/domains/health/infrastructure/adapters/aws-stack-repository.js +777 -0
- package/infrastructure/domains/health/infrastructure/adapters/aws-stack-repository.test.js +580 -0
- package/infrastructure/domains/integration/integration-builder.js +397 -0
- package/infrastructure/domains/integration/integration-builder.test.js +593 -0
- package/infrastructure/domains/integration/integration-resolver.js +170 -0
- package/infrastructure/domains/integration/integration-resolver.test.js +369 -0
- package/infrastructure/domains/integration/websocket-builder.js +69 -0
- package/infrastructure/domains/integration/websocket-builder.test.js +195 -0
- package/infrastructure/domains/networking/vpc-builder.js +1829 -0
- package/infrastructure/domains/networking/vpc-builder.test.js +1262 -0
- package/infrastructure/domains/networking/vpc-discovery.js +177 -0
- package/infrastructure/domains/networking/vpc-discovery.test.js +350 -0
- package/infrastructure/domains/networking/vpc-resolver.js +324 -0
- package/infrastructure/domains/networking/vpc-resolver.test.js +501 -0
- package/infrastructure/domains/parameters/ssm-builder.js +79 -0
- package/infrastructure/domains/parameters/ssm-builder.test.js +189 -0
- package/infrastructure/domains/parameters/ssm-discovery.js +84 -0
- package/infrastructure/domains/parameters/ssm-discovery.test.js +210 -0
- package/infrastructure/{iam-generator.js → domains/security/iam-generator.js} +2 -2
- package/infrastructure/domains/security/kms-builder.js +366 -0
- package/infrastructure/domains/security/kms-builder.test.js +374 -0
- package/infrastructure/domains/security/kms-discovery.js +80 -0
- package/infrastructure/domains/security/kms-discovery.test.js +177 -0
- package/infrastructure/domains/security/kms-resolver.js +96 -0
- package/infrastructure/domains/security/kms-resolver.test.js +216 -0
- package/infrastructure/domains/shared/base-builder.js +112 -0
- package/infrastructure/domains/shared/base-resolver.js +186 -0
- package/infrastructure/domains/shared/base-resolver.test.js +305 -0
- package/infrastructure/domains/shared/builder-orchestrator.js +212 -0
- package/infrastructure/domains/shared/builder-orchestrator.test.js +213 -0
- package/infrastructure/domains/shared/cloudformation-discovery-v2.js +334 -0
- package/infrastructure/domains/shared/cloudformation-discovery.js +375 -0
- package/infrastructure/domains/shared/cloudformation-discovery.test.js +590 -0
- package/infrastructure/domains/shared/environment-builder.js +119 -0
- package/infrastructure/domains/shared/environment-builder.test.js +247 -0
- package/infrastructure/domains/shared/providers/aws-provider-adapter.js +544 -0
- package/infrastructure/domains/shared/providers/aws-provider-adapter.test.js +377 -0
- package/infrastructure/domains/shared/providers/azure-provider-adapter.stub.js +93 -0
- package/infrastructure/domains/shared/providers/cloud-provider-adapter.js +136 -0
- package/infrastructure/domains/shared/providers/gcp-provider-adapter.stub.js +82 -0
- package/infrastructure/domains/shared/providers/provider-factory.js +108 -0
- package/infrastructure/domains/shared/providers/provider-factory.test.js +170 -0
- package/infrastructure/domains/shared/resource-discovery.js +192 -0
- package/infrastructure/domains/shared/resource-discovery.test.js +552 -0
- package/infrastructure/domains/shared/types/app-definition.js +205 -0
- package/infrastructure/domains/shared/types/discovery-result.js +106 -0
- package/infrastructure/domains/shared/types/discovery-result.test.js +258 -0
- package/infrastructure/domains/shared/types/index.js +46 -0
- package/infrastructure/domains/shared/types/resource-ownership.js +108 -0
- package/infrastructure/domains/shared/types/resource-ownership.test.js +101 -0
- package/infrastructure/domains/shared/utilities/base-definition-factory.js +380 -0
- package/infrastructure/domains/shared/utilities/base-definition-factory.js.bak +338 -0
- package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +248 -0
- package/infrastructure/domains/shared/utilities/handler-path-resolver.js +134 -0
- package/infrastructure/domains/shared/utilities/handler-path-resolver.test.js +268 -0
- package/infrastructure/domains/shared/utilities/prisma-layer-manager.js +55 -0
- package/infrastructure/domains/shared/utilities/prisma-layer-manager.test.js +138 -0
- package/infrastructure/{env-validator.js → domains/shared/validation/env-validator.js} +2 -1
- package/infrastructure/domains/shared/validation/env-validator.test.js +173 -0
- package/infrastructure/esbuild.config.js +53 -0
- package/infrastructure/infrastructure-composer.js +87 -0
- package/infrastructure/{serverless-template.test.js → infrastructure-composer.test.js} +115 -24
- package/infrastructure/scripts/build-prisma-layer.js +553 -0
- package/infrastructure/scripts/build-prisma-layer.test.js +102 -0
- package/infrastructure/{build-time-discovery.js → scripts/build-time-discovery.js} +80 -48
- package/infrastructure/{build-time-discovery.test.js → scripts/build-time-discovery.test.js} +5 -4
- package/layers/prisma/nodejs/package.json +8 -0
- package/management-ui/server/utils/cliIntegration.js +1 -1
- package/management-ui/server/utils/environment/awsParameterStore.js +29 -18
- package/package.json +11 -11
- package/frigg-cli/.eslintrc.js +0 -141
- package/frigg-cli/__tests__/unit/commands/build.test.js +0 -251
- package/frigg-cli/__tests__/unit/commands/db-setup.test.js +0 -548
- package/frigg-cli/__tests__/unit/commands/install.test.js +0 -400
- package/frigg-cli/__tests__/unit/commands/ui.test.js +0 -346
- package/frigg-cli/__tests__/unit/utils/database-validator.test.js +0 -366
- package/frigg-cli/__tests__/unit/utils/error-messages.test.js +0 -304
- package/frigg-cli/__tests__/unit/utils/prisma-runner.test.js +0 -486
- package/frigg-cli/__tests__/utils/mock-factory.js +0 -270
- package/frigg-cli/__tests__/utils/prisma-mock.js +0 -194
- package/frigg-cli/__tests__/utils/test-fixtures.js +0 -463
- package/frigg-cli/__tests__/utils/test-setup.js +0 -287
- package/frigg-cli/build-command/index.js +0 -65
- package/frigg-cli/db-setup-command/index.js +0 -193
- package/frigg-cli/deploy-command/index.js +0 -175
- package/frigg-cli/generate-command/__tests__/generate-command.test.js +0 -301
- package/frigg-cli/generate-command/azure-generator.js +0 -43
- package/frigg-cli/generate-command/gcp-generator.js +0 -47
- package/frigg-cli/generate-command/index.js +0 -332
- package/frigg-cli/generate-command/terraform-generator.js +0 -555
- package/frigg-cli/generate-iam-command.js +0 -118
- package/frigg-cli/index.js +0 -75
- package/frigg-cli/index.test.js +0 -158
- package/frigg-cli/init-command/backend-first-handler.js +0 -756
- package/frigg-cli/init-command/index.js +0 -93
- package/frigg-cli/init-command/template-handler.js +0 -143
- package/frigg-cli/install-command/backend-js.js +0 -33
- package/frigg-cli/install-command/commit-changes.js +0 -16
- package/frigg-cli/install-command/environment-variables.js +0 -127
- package/frigg-cli/install-command/environment-variables.test.js +0 -136
- package/frigg-cli/install-command/index.js +0 -54
- package/frigg-cli/install-command/install-package.js +0 -13
- package/frigg-cli/install-command/integration-file.js +0 -30
- package/frigg-cli/install-command/logger.js +0 -12
- package/frigg-cli/install-command/template.js +0 -90
- package/frigg-cli/install-command/validate-package.js +0 -75
- package/frigg-cli/jest.config.js +0 -124
- package/frigg-cli/package.json +0 -54
- package/frigg-cli/start-command/index.js +0 -149
- package/frigg-cli/start-command/start-command.test.js +0 -297
- package/frigg-cli/test/init-command.test.js +0 -180
- package/frigg-cli/test/npm-registry.test.js +0 -319
- package/frigg-cli/ui-command/index.js +0 -154
- package/frigg-cli/utils/app-resolver.js +0 -319
- package/frigg-cli/utils/backend-path.js +0 -25
- package/frigg-cli/utils/database-validator.js +0 -161
- package/frigg-cli/utils/error-messages.js +0 -257
- package/frigg-cli/utils/npm-registry.js +0 -167
- package/frigg-cli/utils/prisma-runner.js +0 -280
- package/frigg-cli/utils/process-manager.js +0 -199
- package/frigg-cli/utils/repo-detection.js +0 -405
- package/infrastructure/aws-discovery.js +0 -1176
- package/infrastructure/aws-discovery.test.js +0 -1220
- package/infrastructure/serverless-template.js +0 -2094
- /package/infrastructure/{WEBSOCKET-CONFIGURATION.md → docs/WEBSOCKET-CONFIGURATION.md} +0 -0
- /package/infrastructure/{GENERATE-IAM-DOCS.md → docs/generate-iam-command.md} +0 -0
- /package/infrastructure/{iam-generator.test.js → domains/security/iam-generator.test.js} +0 -0
- /package/infrastructure/{frigg-deployment-iam-stack.yaml → domains/security/templates/frigg-deployment-iam-stack.yaml} +0 -0
- /package/infrastructure/{iam-policy-basic.json → domains/security/templates/iam-policy-basic.json} +0 -0
- /package/infrastructure/{iam-policy-full.json → domains/security/templates/iam-policy-full.json} +0 -0
- /package/infrastructure/{run-discovery.js → scripts/run-discovery.js} +0 -0
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
# acme-integrations-dev Stack Drift Analysis
|
|
2
|
+
|
|
3
|
+
**Date**: 2025-10-27
|
|
4
|
+
**Stack**: acme-integrations-dev (us-east-1)
|
|
5
|
+
**Status**: 65/100 Health Score (degraded)
|
|
6
|
+
|
|
7
|
+
## Executive Summary
|
|
8
|
+
|
|
9
|
+
The Lambda functions were **manually moved from Frigg VPC to Default VPC**, causing:
|
|
10
|
+
- ✅ 16 orphaned resources (3 VPCs, 10 subnets, 3 security groups) - correctly detected
|
|
11
|
+
- ⚠️ 32 property mismatch warnings (VPC drift on all 16 Lambda functions)
|
|
12
|
+
|
|
13
|
+
**The template expects** Lambdas to use Frigg-managed VPC `vpc-0eadd96976d29ede7`.
|
|
14
|
+
**But Lambdas actually use** AWS default VPC `vpc-01f21101d4ed6db59`.
|
|
15
|
+
|
|
16
|
+
## Detailed Analysis
|
|
17
|
+
|
|
18
|
+
### CloudFormation Template Expectations
|
|
19
|
+
|
|
20
|
+
The template specifies Lambda functions should use:
|
|
21
|
+
|
|
22
|
+
```yaml
|
|
23
|
+
VpcConfig:
|
|
24
|
+
SecurityGroupIds:
|
|
25
|
+
- sg-07c01370e830b6ad6 # Frigg Lambda SG (in vpc-0eadd96976d29ede7)
|
|
26
|
+
SubnetIds:
|
|
27
|
+
- subnet-00ab9e0502e66aac3 # Private subnet 1 (in vpc-0eadd96976d29ede7)
|
|
28
|
+
- subnet-00d085a52937aaf91 # Private subnet 2 (in vpc-0eadd96976d29ede7)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**These resources belong to:** `vpc-0eadd96976d29ede7` (10.0.0.0/16)
|
|
32
|
+
|
|
33
|
+
### Actual Lambda Configuration
|
|
34
|
+
|
|
35
|
+
Lambda functions are actually running in:
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"VpcId": "vpc-01f21101d4ed6db59", // AWS Default VPC (172.31.0.0/16)
|
|
40
|
+
"SecurityGroupIds": [
|
|
41
|
+
"sg-0aca40438d17344c4" // Default VPC security group (NOT in template)
|
|
42
|
+
],
|
|
43
|
+
"SubnetIds": [
|
|
44
|
+
"subnet-020d32e3ca398a041", // Default VPC subnet 1 (NOT in template)
|
|
45
|
+
"subnet-0c186318804aba790" // Default VPC subnet 2 (NOT in template)
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**These resources belong to:** `vpc-01f21101d4ed6db59` (172.31.0.0/16) - AWS Default VPC
|
|
51
|
+
|
|
52
|
+
### Orphaned Resources Analysis
|
|
53
|
+
|
|
54
|
+
#### 1. VPC: vpc-0eadd96976d29ede7 (10.0.0.0/16) ✅ CORRECT VPC TO IMPORT
|
|
55
|
+
|
|
56
|
+
**Status:**
|
|
57
|
+
- Has CloudFormation tags: `stack-name=acme-integrations-dev`, `logical-id=FriggVPC`
|
|
58
|
+
- NOT in CloudFormation stack (stack has 0 VPCs managed)
|
|
59
|
+
- Contains subnets that are **EXPECTED by template**:
|
|
60
|
+
- `subnet-00ab9e0502e66aac3` (10.0.0.0/24) - Expected by template ✅
|
|
61
|
+
- `subnet-00d085a52937aaf91` (10.0.1.0/24) - Expected by template ✅
|
|
62
|
+
- Contains security group that is **EXPECTED by template**:
|
|
63
|
+
- `sg-07c01370e830b6ad6` - Expected by template ✅
|
|
64
|
+
|
|
65
|
+
**Conclusion:** This is the **CORRECT VPC** that should be imported! The template expects Lambdas to use this VPC, but they were manually moved to default VPC.
|
|
66
|
+
|
|
67
|
+
**Stage Verification:** Has `STAGE=dev` tag ✅
|
|
68
|
+
|
|
69
|
+
#### 2. VPC: vpc-0e2351eac99adcb83 (10.0.0.0/16) - OLD/DUPLICATE
|
|
70
|
+
|
|
71
|
+
**Status:**
|
|
72
|
+
- Has CloudFormation tags: `stack-name=acme-integrations-dev`, `logical-id=FriggVPC`
|
|
73
|
+
- NOT in CloudFormation stack
|
|
74
|
+
- Contains orphaned subnets NOT referenced by template
|
|
75
|
+
- Same CIDR as vpc-0eadd96976d29ede7 (duplicate)
|
|
76
|
+
|
|
77
|
+
**Conclusion:** Old/duplicate VPC, should be **DELETED**
|
|
78
|
+
|
|
79
|
+
**Stage Verification:** Has `STAGE=dev` tag
|
|
80
|
+
|
|
81
|
+
#### 3. VPC: vpc-020a0365610c05f0b (10.0.0.0/16) - OLD/DUPLICATE
|
|
82
|
+
|
|
83
|
+
**Status:**
|
|
84
|
+
- Has CloudFormation tags: `stack-name=acme-integrations-dev`, `logical-id=FriggVPC`
|
|
85
|
+
- NOT in CloudFormation stack
|
|
86
|
+
- Contains orphaned subnets NOT referenced by template
|
|
87
|
+
- Same CIDR as vpc-0eadd96976d29ede7 (duplicate)
|
|
88
|
+
|
|
89
|
+
**Conclusion:** Old/duplicate VPC, should be **DELETED**
|
|
90
|
+
|
|
91
|
+
**Stage Verification:** Has `STAGE=dev` tag
|
|
92
|
+
|
|
93
|
+
## What Happened?
|
|
94
|
+
|
|
95
|
+
1. **Initial Deployment**: CloudFormation created `vpc-0eadd96976d29ede7` with subnets and security groups
|
|
96
|
+
2. **VPC Removed from Stack**: VPC was removed from CloudFormation management (but resources still exist)
|
|
97
|
+
3. **Manual Migration**: Lambda functions were manually updated to use default VPC instead
|
|
98
|
+
4. **Result**: Template expects Frigg VPC, but Lambdas use default VPC → drift
|
|
99
|
+
|
|
100
|
+
## Recommended Actions
|
|
101
|
+
|
|
102
|
+
### Option 1: Import Frigg VPC and Let CloudFormation Fix Drift (RECOMMENDED)
|
|
103
|
+
|
|
104
|
+
**Steps:**
|
|
105
|
+
|
|
106
|
+
1. **Import the correct VPC and its resources:**
|
|
107
|
+
```bash
|
|
108
|
+
# Import vpc-0eadd96976d29ede7 and its subnets/SG
|
|
109
|
+
frigg repair --import quo-integrations-dev
|
|
110
|
+
# When prompted, select ONLY vpc-0eadd96976d29ede7
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
2. **CloudFormation will automatically update Lambdas:**
|
|
114
|
+
- CloudFormation will detect the VPC/subnet/SG mismatch
|
|
115
|
+
- Next stack update will **automatically** update Lambda VPC configs
|
|
116
|
+
- Lambdas will be moved from default VPC back to Frigg VPC
|
|
117
|
+
|
|
118
|
+
3. **Delete the duplicate VPCs:**
|
|
119
|
+
```bash
|
|
120
|
+
aws ec2 delete-vpc --vpc-id vpc-0e2351eac99adcb83
|
|
121
|
+
aws ec2 delete-vpc --vpc-id vpc-020a0365610c05f0b
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**CloudFormation Behavior:**
|
|
125
|
+
- ✅ YES, CloudFormation WILL automatically update Lambda VPC configs
|
|
126
|
+
- ✅ CloudFormation will handle the migration safely (blue-green deployment)
|
|
127
|
+
- ✅ No downtime - new Lambda versions created, traffic switched over
|
|
128
|
+
|
|
129
|
+
**Benefits:**
|
|
130
|
+
- ✅ Stack returns to intended state (Lambdas in Frigg VPC)
|
|
131
|
+
- ✅ Health score improves to 100/100
|
|
132
|
+
- ✅ Proper VPC isolation restored
|
|
133
|
+
- ✅ CloudFormation manages all resources again
|
|
134
|
+
|
|
135
|
+
**Risks:**
|
|
136
|
+
- ⚠️ Lambda cold starts during VPC migration (~10-30 seconds)
|
|
137
|
+
- ⚠️ Must ensure Frigg VPC networking is configured correctly
|
|
138
|
+
|
|
139
|
+
### Option 2: Update Template to Use Default VPC (NOT RECOMMENDED)
|
|
140
|
+
|
|
141
|
+
**Steps:**
|
|
142
|
+
|
|
143
|
+
1. Update serverless.yml to remove VPC configuration
|
|
144
|
+
2. Deploy stack update
|
|
145
|
+
3. Delete all 3 orphaned Frigg VPCs
|
|
146
|
+
|
|
147
|
+
**Why NOT recommended:**
|
|
148
|
+
- ❌ Loses VPC isolation benefits
|
|
149
|
+
- ❌ Lambda functions exposed to internet (less secure)
|
|
150
|
+
- ❌ Shared default VPC across all accounts
|
|
151
|
+
- ❌ No control over networking
|
|
152
|
+
|
|
153
|
+
### Option 3: Delete All and Let CloudFormation Recreate (RISKY)
|
|
154
|
+
|
|
155
|
+
**Steps:**
|
|
156
|
+
|
|
157
|
+
1. Delete all 3 orphaned VPCs
|
|
158
|
+
2. Add VPC back to CloudFormation template
|
|
159
|
+
3. Deploy stack update
|
|
160
|
+
|
|
161
|
+
**Why RISKY:**
|
|
162
|
+
- ❌ CloudFormation will create NEW VPC with different ID
|
|
163
|
+
- ❌ Requires stack update to fix Lambda drift
|
|
164
|
+
- ❌ More disruptive than import
|
|
165
|
+
|
|
166
|
+
## Answering Your Questions
|
|
167
|
+
|
|
168
|
+
### Q1: What are the drifted properties?
|
|
169
|
+
|
|
170
|
+
**Answer:**
|
|
171
|
+
- **Expected** (from template): Subnets in `vpc-0eadd96976d29ede7` (Frigg VPC)
|
|
172
|
+
- **Actual** (in AWS): Subnets in `vpc-01f21101d4ed6db59` (default VPC)
|
|
173
|
+
- **Cause**: Lambdas were manually moved to default VPC
|
|
174
|
+
|
|
175
|
+
### Q2: Will CloudFormation migrate Lambdas if we import the VPC?
|
|
176
|
+
|
|
177
|
+
**Answer:** ✅ **YES!**
|
|
178
|
+
|
|
179
|
+
When you import `vpc-0eadd96976d29ede7` and its subnets/SG:
|
|
180
|
+
1. CloudFormation will recognize the resources exist
|
|
181
|
+
2. Next stack update will detect Lambda VPC config drift
|
|
182
|
+
3. CloudFormation will automatically update Lambda functions to use imported VPC
|
|
183
|
+
4. Migration happens safely with blue-green deployment (no downtime)
|
|
184
|
+
|
|
185
|
+
### Q3: What's the right approach?
|
|
186
|
+
|
|
187
|
+
**Answer:** **Import `vpc-0eadd96976d29ede7` and delete the other 2 VPCs**
|
|
188
|
+
|
|
189
|
+
This VPC is the one the template expects, and it contains the correct subnets/SG that match the template.
|
|
190
|
+
|
|
191
|
+
### Q4: Are these VPCs intended for -dev stage?
|
|
192
|
+
|
|
193
|
+
**Answer:** ✅ **YES, all 3 VPCs have `STAGE=dev` tags**
|
|
194
|
+
|
|
195
|
+
But only `vpc-0eadd96976d29ede7` contains the resources referenced by the template. The other 2 are duplicates/old deployments.
|
|
196
|
+
|
|
197
|
+
## Implementation Plan
|
|
198
|
+
|
|
199
|
+
1. ✅ **Verify VPC networking is correct:**
|
|
200
|
+
```bash
|
|
201
|
+
# Check route tables, NAT gateways, internet gateways
|
|
202
|
+
aws ec2 describe-route-tables --filters "Name=vpc-id,Values=vpc-0eadd96976d29ede7"
|
|
203
|
+
aws ec2 describe-nat-gateways --filter "Name=vpc-id,Values=vpc-0eadd96976d29ede7"
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
2. ✅ **Import the correct VPC:**
|
|
207
|
+
```bash
|
|
208
|
+
frigg repair --import quo-integrations-dev
|
|
209
|
+
# Select: vpc-0eadd96976d29ede7 ONLY
|
|
210
|
+
# Select: All subnets in vpc-0eadd96976d29ede7
|
|
211
|
+
# Select: sg-07c01370e830b6ad6
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
3. ✅ **Deploy stack update to fix Lambda drift:**
|
|
215
|
+
```bash
|
|
216
|
+
frigg deploy --stage dev
|
|
217
|
+
# CloudFormation will update Lambda VPC configs automatically
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
4. ✅ **Verify Lambdas migrated successfully:**
|
|
221
|
+
```bash
|
|
222
|
+
aws lambda get-function-configuration --function-name quo-integrations-dev-attio \
|
|
223
|
+
--query 'VpcConfig.{VpcId:VpcId,SubnetIds:SubnetIds}'
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
5. ✅ **Delete duplicate VPCs:**
|
|
227
|
+
```bash
|
|
228
|
+
# Delete subnets first, then VPCs
|
|
229
|
+
aws ec2 delete-vpc --vpc-id vpc-0e2351eac99adcb83
|
|
230
|
+
aws ec2 delete-vpc --vpc-id vpc-020a0365610c05f0b
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
6. ✅ **Re-run health check:**
|
|
234
|
+
```bash
|
|
235
|
+
frigg doctor quo-integrations-dev
|
|
236
|
+
# Should show 100/100 health score
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## Next Steps for Relationship Analysis Implementation
|
|
240
|
+
|
|
241
|
+
Based on this real-world scenario, the relationship analysis should:
|
|
242
|
+
|
|
243
|
+
1. **Detect template-expected resources:**
|
|
244
|
+
- Parse CloudFormation template to find expected VPC config
|
|
245
|
+
- Extract subnet IDs, security group IDs from template
|
|
246
|
+
|
|
247
|
+
2. **Match orphans against expected resources:**
|
|
248
|
+
- `vpc-0eadd96976d29ede7` contains expected subnets → **HIGH priority import**
|
|
249
|
+
- Other VPCs don't contain expected resources → **LOW priority (delete)**
|
|
250
|
+
|
|
251
|
+
3. **Show recommendation:**
|
|
252
|
+
```
|
|
253
|
+
⚠ Multiple VPCs detected (3 orphaned)
|
|
254
|
+
|
|
255
|
+
Analysis:
|
|
256
|
+
1. vpc-0eadd96976d29ede7 - Contains resources expected by template [IMPORT THIS]
|
|
257
|
+
- subnet-00ab9e0502e66aac3 (expected)
|
|
258
|
+
- subnet-00d085a52937aaf91 (expected)
|
|
259
|
+
- sg-07c01370e830b6ad6 (expected)
|
|
260
|
+
|
|
261
|
+
2. vpc-0e2351eac99adcb83 - No expected resources [DELETE]
|
|
262
|
+
3. vpc-020a0365610c05f0b - No expected resources [DELETE]
|
|
263
|
+
|
|
264
|
+
Recommendation:
|
|
265
|
+
✅ Import vpc-0eadd96976d29ede7 to restore template compliance
|
|
266
|
+
❌ Delete vpc-0e2351eac99adcb83 and vpc-020a0365610c05f0b (old/unused)
|
|
267
|
+
```
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
# Build Template vs Deployed Template Analysis
|
|
2
|
+
|
|
3
|
+
**CRITICAL DISCOVERY**: The local build template and deployed CloudFormation template are DIFFERENT!
|
|
4
|
+
|
|
5
|
+
## The Discrepancy
|
|
6
|
+
|
|
7
|
+
### Local Build Template (.serverless/cloudformation-template-update-stack.json)
|
|
8
|
+
|
|
9
|
+
**Contains VPC Resources:**
|
|
10
|
+
```json
|
|
11
|
+
{
|
|
12
|
+
"Resources": {
|
|
13
|
+
"FriggVPC": { "Type": "AWS::EC2::VPC" },
|
|
14
|
+
"FriggPrivateSubnet1": { "Type": "AWS::EC2::Subnet" },
|
|
15
|
+
"FriggPrivateSubnet2": { "Type": "AWS::EC2::Subnet" },
|
|
16
|
+
"FriggPublicSubnet": { "Type": "AWS::EC2::Subnet" },
|
|
17
|
+
"FriggPublicSubnet2": { "Type": "AWS::EC2::Subnet" },
|
|
18
|
+
"FriggLambdaSecurityGroup": { "Type": "AWS::EC2::SecurityGroup" },
|
|
19
|
+
"FriggVPCEndpointSecurityGroup": { "Type": "AWS::EC2::SecurityGroup" }
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Lambda VPC Config uses Refs:**
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"VpcConfig": {
|
|
28
|
+
"SecurityGroupIds": [{ "Ref": "FriggLambdaSecurityGroup" }],
|
|
29
|
+
"SubnetIds": [
|
|
30
|
+
{ "Ref": "FriggPrivateSubnet1" },
|
|
31
|
+
{ "Ref": "FriggPrivateSubnet2" }
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Deployed CloudFormation Template (in AWS)
|
|
38
|
+
|
|
39
|
+
**Does NOT contain VPC Resources:**
|
|
40
|
+
- ✅ Has Lambda functions
|
|
41
|
+
- ✅ Has SQS queues
|
|
42
|
+
- ✅ Has IAM roles
|
|
43
|
+
- ❌ **NO VPC resources** (FriggVPC, FriggPrivateSubnet1, FriggPrivateSubnet2, etc.)
|
|
44
|
+
|
|
45
|
+
**Lambda VPC Config uses Hardcoded Physical IDs:**
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"VpcConfig": {
|
|
49
|
+
"SecurityGroupIds": ["sg-07c01370e830b6ad6"], // Hardcoded physical ID
|
|
50
|
+
"SubnetIds": [
|
|
51
|
+
"subnet-00ab9e0502e66aac3", // Hardcoded physical ID
|
|
52
|
+
"subnet-00d085a52937aaf91" // Hardcoded physical ID
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## What This Means
|
|
59
|
+
|
|
60
|
+
### 1. VPC Resources Were Removed from Stack
|
|
61
|
+
|
|
62
|
+
At some point, the VPC resources were removed from CloudFormation management:
|
|
63
|
+
- VPC was created by CloudFormation originally
|
|
64
|
+
- VPC was later removed from the template/stack (but physical resources left in AWS)
|
|
65
|
+
- Lambda functions still reference the VPC subnets/SG by physical ID
|
|
66
|
+
|
|
67
|
+
### 2. Local Build != Deployed State
|
|
68
|
+
|
|
69
|
+
**If you deploy the local build template now:**
|
|
70
|
+
- CloudFormation will try to CREATE new VPC resources (FriggVPC, subnets, SG)
|
|
71
|
+
- CloudFormation will FAIL because resources with those logical IDs already exist physically
|
|
72
|
+
- OR it will create NEW resources with different physical IDs
|
|
73
|
+
- Lambda functions will reference the NEW resources (via Ref)
|
|
74
|
+
|
|
75
|
+
### 3. Import Operation is Complex
|
|
76
|
+
|
|
77
|
+
When you import `vpc-0eadd96976d29ede7`:
|
|
78
|
+
- You need to map it to the logical ID `FriggVPC` in the template
|
|
79
|
+
- You need to import ALL related resources:
|
|
80
|
+
- `FriggPrivateSubnet1` → `subnet-00ab9e0502e66aac3`
|
|
81
|
+
- `FriggPrivateSubnet2` → `subnet-00d085a52937aaf91`
|
|
82
|
+
- `FriggLambdaSecurityGroup` → `sg-07c01370e830b6ad6`
|
|
83
|
+
- etc.
|
|
84
|
+
|
|
85
|
+
## CloudFormation Import Process
|
|
86
|
+
|
|
87
|
+
### How Import Works
|
|
88
|
+
|
|
89
|
+
**Q: Will it know to grab the right VPC?**
|
|
90
|
+
|
|
91
|
+
**A:** ❌ **NO, you must explicitly tell it which physical ID maps to which logical ID**
|
|
92
|
+
|
|
93
|
+
CloudFormation import requires:
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"Resources": [
|
|
97
|
+
{
|
|
98
|
+
"ResourceType": "AWS::EC2::VPC",
|
|
99
|
+
"LogicalResourceId": "FriggVPC",
|
|
100
|
+
"ResourceIdentifier": {
|
|
101
|
+
"VpcId": "vpc-0eadd96976d29ede7" // You specify this
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"ResourceType": "AWS::EC2::Subnet",
|
|
106
|
+
"LogicalResourceId": "FriggPrivateSubnet1",
|
|
107
|
+
"ResourceIdentifier": {
|
|
108
|
+
"SubnetId": "subnet-00ab9e0502e66aac3" // You specify this
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
// ... more resources
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Q: Will it clear or delete the old resources?**
|
|
117
|
+
|
|
118
|
+
**A:** ❌ **NO, you must manually delete unused resources**
|
|
119
|
+
|
|
120
|
+
CloudFormation import:
|
|
121
|
+
- ✅ Adds existing resources to the stack (doesn't create or delete anything)
|
|
122
|
+
- ✅ Updates Lambda Refs to point to imported resources
|
|
123
|
+
- ❌ Does NOT delete the 2 unused VPCs
|
|
124
|
+
- ❌ Does NOT clean up orphaned resources
|
|
125
|
+
|
|
126
|
+
## The Right Approach
|
|
127
|
+
|
|
128
|
+
### Step 1: Update Local Build Template to Match Deployed State
|
|
129
|
+
|
|
130
|
+
**OPTION A: Remove VPC from local template (quick fix)**
|
|
131
|
+
|
|
132
|
+
Remove VPC resources from `serverless.yml`:
|
|
133
|
+
```yaml
|
|
134
|
+
# Comment out or remove:
|
|
135
|
+
# resources:
|
|
136
|
+
# Resources:
|
|
137
|
+
# FriggVPC: ...
|
|
138
|
+
# FriggPrivateSubnet1: ...
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Then use hardcoded subnet/SG IDs:
|
|
142
|
+
```yaml
|
|
143
|
+
provider:
|
|
144
|
+
vpc:
|
|
145
|
+
securityGroupIds:
|
|
146
|
+
- sg-07c01370e830b6ad6
|
|
147
|
+
subnetIds:
|
|
148
|
+
- subnet-00ab9e0502e66aac3
|
|
149
|
+
- subnet-00d085a52937aaf91
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**OPTION B: Import VPC resources to stack (proper fix)**
|
|
153
|
+
|
|
154
|
+
1. Create import template with mappings
|
|
155
|
+
2. Run CloudFormation import operation
|
|
156
|
+
3. Redeploy with local template
|
|
157
|
+
|
|
158
|
+
### Step 2: Decision Point
|
|
159
|
+
|
|
160
|
+
**CRITICAL QUESTION: Do you want CloudFormation to manage the VPC?**
|
|
161
|
+
|
|
162
|
+
**If YES (recommended for Frigg framework):**
|
|
163
|
+
- ✅ Import `vpc-0eadd96976d29ede7` and its resources
|
|
164
|
+
- ✅ CloudFormation will manage VPC lifecycle
|
|
165
|
+
- ✅ Template and reality stay in sync
|
|
166
|
+
- ✅ Proper infrastructure as code
|
|
167
|
+
|
|
168
|
+
**If NO (simpler but less controlled):**
|
|
169
|
+
- ✅ Remove VPC from local template
|
|
170
|
+
- ✅ Use hardcoded subnet/SG IDs in serverless.yml
|
|
171
|
+
- ✅ Manually manage VPC outside CloudFormation
|
|
172
|
+
- ⚠️ Template drift will always exist
|
|
173
|
+
|
|
174
|
+
## Recommended Action (CloudFormation Import)
|
|
175
|
+
|
|
176
|
+
### Phase 1: Prepare Import Template
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# 1. Get the local template
|
|
180
|
+
cd /Users/sean/Documents/GitHub/quo--frigg/backend
|
|
181
|
+
|
|
182
|
+
# 2. Create import-resources.json
|
|
183
|
+
cat > import-resources.json <<EOF
|
|
184
|
+
[
|
|
185
|
+
{
|
|
186
|
+
"ResourceType": "AWS::EC2::VPC",
|
|
187
|
+
"LogicalResourceId": "FriggVPC",
|
|
188
|
+
"ResourceIdentifier": { "VpcId": "vpc-0eadd96976d29ede7" }
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"ResourceType": "AWS::EC2::Subnet",
|
|
192
|
+
"LogicalResourceId": "FriggPrivateSubnet1",
|
|
193
|
+
"ResourceIdentifier": { "SubnetId": "subnet-00ab9e0502e66aac3" }
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"ResourceType": "AWS::EC2::Subnet",
|
|
197
|
+
"LogicalResourceId": "FriggPrivateSubnet2",
|
|
198
|
+
"ResourceIdentifier": { "SubnetId": "subnet-00d085a52937aaf91" }
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"ResourceType": "AWS::EC2::SecurityGroup",
|
|
202
|
+
"LogicalResourceId": "FriggLambdaSecurityGroup",
|
|
203
|
+
"ResourceIdentifier": { "GroupId": "sg-07c01370e830b6ad6" }
|
|
204
|
+
}
|
|
205
|
+
// ... add other resources (public subnets, SGs, etc.)
|
|
206
|
+
]
|
|
207
|
+
EOF
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Phase 2: Create Change Set for Import
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
aws cloudformation create-change-set \
|
|
214
|
+
--stack-name quo-integrations-dev \
|
|
215
|
+
--change-set-name import-vpc-resources \
|
|
216
|
+
--change-set-type IMPORT \
|
|
217
|
+
--resources-to-import file://import-resources.json \
|
|
218
|
+
--template-body file://.serverless/cloudformation-template-update-stack.json \
|
|
219
|
+
--capabilities CAPABILITY_IAM \
|
|
220
|
+
--region us-east-1
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Phase 3: Review and Execute
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
# Review the change set
|
|
227
|
+
aws cloudformation describe-change-set \
|
|
228
|
+
--stack-name quo-integrations-dev \
|
|
229
|
+
--change-set-name import-vpc-resources \
|
|
230
|
+
--region us-east-1
|
|
231
|
+
|
|
232
|
+
# Execute if looks good
|
|
233
|
+
aws cloudformation execute-change-set \
|
|
234
|
+
--stack-name quo-integrations-dev \
|
|
235
|
+
--change-set-name import-vpc-resources \
|
|
236
|
+
--region us-east-1
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Phase 4: Update Lambda VPC Configs
|
|
240
|
+
|
|
241
|
+
After import, CloudFormation will:
|
|
242
|
+
- ✅ Recognize VPC resources are in the stack
|
|
243
|
+
- ✅ Lambda Refs will resolve to imported physical IDs
|
|
244
|
+
- ✅ Next deploy will update Lambda VPC configs from default VPC back to Frigg VPC
|
|
245
|
+
|
|
246
|
+
### Phase 5: Clean Up
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
# Delete unused VPCs
|
|
250
|
+
aws ec2 delete-vpc --vpc-id vpc-0e2351eac99adcb83 --region us-east-1
|
|
251
|
+
aws ec2 delete-vpc --vpc-id vpc-020a0365610c05f0b --region us-east-1
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
## Alternative: Simpler Approach (Remove VPC from Template)
|
|
255
|
+
|
|
256
|
+
If you don't want CloudFormation to manage VPC:
|
|
257
|
+
|
|
258
|
+
### Step 1: Update serverless.yml
|
|
259
|
+
|
|
260
|
+
```yaml
|
|
261
|
+
provider:
|
|
262
|
+
name: aws
|
|
263
|
+
vpc:
|
|
264
|
+
# Hardcode the VPC resources
|
|
265
|
+
securityGroupIds:
|
|
266
|
+
- sg-07c01370e830b6ad6
|
|
267
|
+
subnetIds:
|
|
268
|
+
- subnet-00ab9e0502e66aac3
|
|
269
|
+
- subnet-00d085a52937aaf91
|
|
270
|
+
|
|
271
|
+
# Remove VPC resource definitions
|
|
272
|
+
# resources:
|
|
273
|
+
# Resources:
|
|
274
|
+
# FriggVPC: ...
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### Step 2: Deploy
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
serverless deploy --stage dev
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### Step 3: Clean Up
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
# Delete all 3 orphaned VPCs
|
|
287
|
+
aws ec2 delete-vpc --vpc-id vpc-0eadd96976d29ede7
|
|
288
|
+
aws ec2 delete-vpc --vpc-id vpc-0e2351eac99adcb83
|
|
289
|
+
aws ec2 delete-vpc --vpc-id vpc-020a0365610c05f0b
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
## Recommendation
|
|
293
|
+
|
|
294
|
+
**For Frigg Framework consistency: Import VPC resources**
|
|
295
|
+
|
|
296
|
+
Why:
|
|
297
|
+
- ✅ Maintains infrastructure as code principles
|
|
298
|
+
- ✅ VPC lifecycle managed by CloudFormation
|
|
299
|
+
- ✅ Consistent with Frigg framework design
|
|
300
|
+
- ✅ Template matches deployed state
|
|
301
|
+
- ✅ `frigg doctor` will show 100/100 health
|
|
302
|
+
|
|
303
|
+
**Trade-offs:**
|
|
304
|
+
- ⚠️ More complex import process
|
|
305
|
+
- ⚠️ Must map all VPC resources correctly
|
|
306
|
+
- ⚠️ One-time effort but proper long-term solution
|
|
307
|
+
|
|
308
|
+
## Next Steps for Relationship Analysis
|
|
309
|
+
|
|
310
|
+
The relationship analysis should:
|
|
311
|
+
|
|
312
|
+
1. **Parse local build template** (not just deployed template)
|
|
313
|
+
2. **Detect CloudFormation Refs** in Lambda VPC configs
|
|
314
|
+
3. **Resolve Refs to physical IDs** from deployed stack
|
|
315
|
+
4. **Match orphaned resources** against resolved physical IDs
|
|
316
|
+
5. **Identify import mapping**:
|
|
317
|
+
- `FriggVPC` (logical) → `vpc-0eadd96976d29ede7` (physical)
|
|
318
|
+
- `FriggPrivateSubnet1` → `subnet-00ab9e0502e66aac3`
|
|
319
|
+
- etc.
|
|
320
|
+
|
|
321
|
+
This will enable `frigg repair --import` to:
|
|
322
|
+
- Show correct VPC to import
|
|
323
|
+
- Generate import-resources.json automatically
|
|
324
|
+
- Handle CloudFormation import operation
|