Subchapter 27.42
references/phases/generate/generate-artifacts-billing.mdMarkdown6 KBView on GitHub
Loaded by generate.md when generation-billing.json and aws-design-billing.json exist.
Generate skeleton Terraform with TODO markers for billing-only migrations. These configurations are NOT deployable as-is — they require manual configuration refinement based on actual infrastructure discovery.
Every resource block includes TODO markers indicating what is missing and where to get it.
Read from $MIGRATION_DIR/:
aws-design-billing.json (REQUIRED) — Billing-based service mapping from Phase 3generation-billing.json (REQUIRED) — Conservative migration plan from Stage 1If any required file is missing: STOP. Output: “Missing required artifact: [filename]. Complete the prior phase that produces it.”
| File | When | Contains |
|---|---|---|
main.tf | Only if infra track didn’t create it | Provider config, backend, data sources |
variables.tf | Only if infra track didn’t create it | Inferred variables with TODO markers |
skeleton.tf | Always | Resource stubs with TODO markers |
Do NOT overwrite existing main.tf or variables.tf if the infrastructure track already generated them.
From aws-design-billing.json: services[] (mapped), unknowns[] (unmapped), metadata.total_services, metadata.confidence_note.
From generation-billing.json: migration timeline (for header comments), risk level (for confidence tags).
Requirements:
terraform block: required_version >= 1.5.0, hashicorp/aws ~> 5.0, commented S3 backendprovider "aws" block: region = var.aws_region, default_tags with Project, Environment, ManagedBy, Confidence = "billing-only-skeleton"aws_caller_identity, aws_region, aws_availability_zonesGlobal variables: aws_region (from preferences.json), project_name, environment.
Per-service variables: For each mapped service in aws-design-billing.json.services[], create variables with:
# Verify comment# TODO comment with placeholderHeader comment: “Many values are placeholders. Search for TODO to find values needing manual configuration.”
For each mapped service in aws-design-billing.json.services[], generate a resource stub.
Every resource block must include:
# TODO: Verify all configuration values against actual GCP resource settings# TODO per configurable attributeConfidence = "billing-inferred"Resource generation by GCP service type:
| GCP Service | AWS Resource Type | Key TODO Attributes |
|---|---|---|
| Cloud Run, GCE, GKE | ECS cluster + task def | CPU, memory, container image, port, auto-scaling |
| Cloud SQL | RDS instance | Engine, version, instance class, storage, networking |
| Spanner, Firestore | DynamoDB / Aurora | Capacity, schema, access patterns |
| Cloud Storage | S3 bucket + versioning + encryption | Bucket count, storage classes, lifecycle policies |
| Cloud Load Balancing | VPC + ALB | CIDR, subnets, security groups, listeners |
| Cloud DNS | Route 53 | Zone names, record types |
| Cloud NAT | NAT Gateway | Subnet associations |
For compute stubs: include ECS cluster + task definition with FARGATE compatibility, awsvpc network mode, awslogs log configuration.
For database stubs: include storage_encrypted = true, skip_final_snapshot = true # TODO: Set to false for production.
For storage stubs: include bucket with account ID suffix, versioning enabled, SSE-KMS encryption.
Unmapped services: At the bottom of skeleton.tf, add a comment block for each service in unknowns[] with: service name, monthly cost, reason unmapped, possible AWS target suggestion, TODO marker.
skeleton.tf# TODO commentmain.tf and skeleton.tfConfidence = "billing-inferred" on every resourceunknowns[] listed at bottommain.tf or variables.tf from infrastructure trackReport generated files to the parent orchestrator. Do NOT update .phase-status.json — the parent generate.md handles phase completion.
Generated billing skeleton artifacts:
- terraform/skeleton.tf (with TODO markers)
- terraform/main.tf (if not already present)
- terraform/variables.tf (if not already present)
WARNING: These are SKELETON configurations generated from billing data only.
They are NOT deployable without manual configuration.
TODO markers: [N] items requiring manual configuration
Unmapped services: [N] services need manual AWS target assignment
Recommendation: Provide Terraform files and re-run discovery for deployable configurations.