PromptBase
Upgrade
Close icon
General
Home
Marketplace
Create
Hire
Login
Chat
Sell
Explore

Prompt Details

Model
(claude-5-5-sonnet)
Token size
3,812
Example input
[INFRASTRUCTURE_REQUIREMENTS_AND_WORKLOAD]: Production web application with frontend, REST API, PostgreSQL database, file uploads, and background jobs. [CLOUD_PROVIDER_AND_TARGET_SERVICES]: AWS; compute, VPC, load balancing, PostgreSQL, object storage, monitoring. [ENVIRONMENTS_REGIONS_AND_DEPLOYMENT_CONSTRAINTS]: Dev, staging, production; one AWS region; production changes require approval. [DATA_STATE_AND_OPERATIONAL_REQUIREMENTS]: PostgreSQL is persistent; backups/recovery must be considered; Terraform state must be protected and isolated by environment. [VALIDATION_TESTING_AND_DELIVERY_REQUIREMENTS]: Terraform formatting/validation, security scanning, plan review, integration testing, post-deployment verification.
Example output
# 🔎 PHASE 1 — INFRASTRUCTURE REQUIREMENT RECONSTRUCTION ### 📌 Explicit Requirements - **Workload:** Production web application. - **Application components:** - Frontend - REST API - PostgreSQL database - File-upload storage - Background jobs - **Cloud:** AWS. - **IaC:** Terraform. - **Environments:** Dev, staging, production. - **Networking:** Public HTTPS entry point with application/database resources kept private. - **Security:** Least-privilege IAM, encryption, secure secrets management. - **Data:** Persistent PostgreSQL database and object storage. - **Operations:** Monitoring, backups/recovery considerations, protected Terraform state. - **Delivery:** Reviewable plans, validation, security checks, integration tests, post-deployment verification. ### 🧠 Inferred Architecture - A load-balancing layer is appropriate because the API should not be directly exposed. - Application compute should reside in private networking. - Database resources should be isolated from direct public access. - Object storage should be separated from application compute. - Background processing should be separated logically from synchronous API traffic. - Environment isolation should exist at the infrastructure/state level. ### ⚠️ Assumptions - The application requires HTTPS. - PostgreSQL is the selected relational database technology. - The application needs persistent file storage. - Background jobs are sufficiently important to justify infrastructure representation. - Exact AWS services have not been dictated by the input. ### ❓ Unresolved Decisions - Exact compute technology. - Exact load balancer configuration. - Exact background-job technology. - Exact database sizing. - Exact availability requirements. - Exact monitoring/alerting thresholds. - Exact backup retention requirements. - Exact AWS region. **Important:** No region or account ID is invented. --- # 🏗️ PHASE 2 — CLOUD RESOURCE ARCHITECTURE | Application Requirement | Infrastructure Capability | Proposed Resource Category | Purpose | |---|---|---|---| | HTTPS application access | Public ingress | Load balancer | Receive external traffic | | REST API | Private compute | Application compute | Run API | | Frontend | Application delivery | Frontend hosting/compute | Serve frontend | | PostgreSQL | Managed relational database | PostgreSQL service | Persistent application data | | File uploads | Object storage | Object storage bucket | Store uploaded files | | Background jobs | Async compute | Worker compute | Process background tasks | | Private application | Network isolation | VPC + private subnets | Protect internal resources | | Access control | Identity management | IAM roles/policies | Least-privilege access | | Monitoring | Observability | Monitoring/logging resources | Detect failures | | Secrets | Secret management | Secrets service | Keep credentials outside Git | ### 🎯 Resource Principle No resource is introduced merely because it is common. Each proposed resource maps to an actual requirement. --- # 🗺️ PHASE 3 — INFRASTRUCTURE DEPENDENCY GRAPH ```text Terraform Provider | v Network Layer | +--------------------+ | | v v Public Ingress Private Network | +----------+----------+ | | v v App Compute PostgreSQL | +-------+-------+ | | v v Object Storage Background Worker | v File Data IAM / Secrets | +----> App Compute | +----> Worker Monitoring | +----> Load Balancer +----> Application +----> Database +----> Worker ``` ### 🔍 Dependency Analysis - Network must exist before resources requiring network placement. - Application compute depends on network configuration. - Database depends on network/database security configuration. - Application requires IAM permissions for permitted AWS services. - Worker requires only the permissions needed for its jobs. - Object storage permissions should be granted to application components only where required. - Monitoring depends on the resources being monitored. ### ⚠️ Potential Risks - IAM and application configuration can create dependency cycles if poorly designed. - Application startup should not require Terraform to retrieve application runtime secrets directly. - Database replacement could cause severe data loss if lifecycle controls are poorly designed. - Network changes can affect several downstream resources simultaneously. --- # ⚙️ PHASE 4 — TERRAFORM ARCHITECTURE Because Terraform was explicitly selected, the architecture uses Terraform concepts only. ### 📁 Recommended Structure ```text infrastructure/ │ ├── modules/ │ ├── network/ │ ├── application/ │ ├── database/ │ ├── storage/ │ ├── worker/ │ ├── iam/ │ └── monitoring/ │ ├── environments/ │ ├── dev/ │ │ ├── main.tf │ │ ├── variables.tf │ │ └── outputs.tf │ │ │ ├── staging/ │ │ ├── main.tf │ │ ├── variables.tf │ │ └── outputs.tf │ │ │ └── production/ │ ├── main.tf │ ├── variables.tf │ └── outputs.tf │ └── README.md ``` ### 🧩 Abstraction Strategy Use modules where they represent meaningful infrastructure boundaries: - `network` - `application` - `database` - `storage` - `worker` - `iam` - `monitoring` Do not create a separate module for every individual resource. --- # 🧩 PHASE 5 — MODULE ARCHITECTURE ### 🌐 Network Module **Purpose:** Create the application's networking foundation. **Inputs:** - network configuration - subnet configuration - environment information **Outputs:** - network identifiers - subnet identifiers - relevant security references --- ### 🖥️ Application Module **Purpose:** Deploy application compute. **Inputs:** - compute configuration - network references - IAM references - application configuration **Outputs:** - application resource identifiers - service endpoint information where applicable --- ### 🗄️ Database Module **Purpose:** Manage PostgreSQL infrastructure. **Inputs:** - database configuration - network references - security configuration - backup requirements **Outputs:** - database connection endpoint information where appropriate Sensitive credentials should not be exposed through ordinary Terraform outputs. --- ### 📦 Storage Module **Purpose:** Manage application object storage. **Inputs:** - bucket configuration - encryption configuration - access requirements **Outputs:** - storage identifier --- ### ⚙️ Worker Module **Purpose:** Run background processing. **Inputs:** - worker configuration - network references - IAM references **Outputs:** - worker resource identifiers --- ### 🔐 IAM Module **Purpose:** Define application identities and permissions. **Principle:** ```text Application ↓ Required AWS API ↓ Minimum Required Permission ``` Not: ```text Application ↓ Administrator-level Access ``` --- # 🌍 PHASE 6 — ENVIRONMENT & CONFIGURATION ARCHITECTURE ### Development - Smaller compute configuration. - Lower operational scale. - Separate state. - Separate secrets. - Lower-cost configuration where appropriate. ### Staging - Production-like architecture where practical. - Used for integration and release validation. - Separate state and credentials. ### Production - Strongest deployment controls. - Production-specific secrets. - Higher reliability configuration where required. - Approval before infrastructure changes. - Enhanced monitoring and recovery controls. ### 🔐 Configuration Separation ```text Reusable Terraform Modules | +---- Dev Configuration | +---- Staging Configuration | +---- Production Configuration ``` Environment configuration should not be embedded into reusable modules. --- # 🔐 PHASE 7 — IAM, SECURITY & SECRET ARCHITECTURE ### IAM Use separate identities for: - Application - Background worker - Terraform deployment process Each identity receives only required permissions. ### 🔒 Network Security ```text Internet | HTTPS | Load Balancer | Private Application | Private Database ``` The database should not be publicly exposed under this architecture. ### 🔐 Secrets Database credentials and application secrets should be stored in an appropriate secrets-management system. Never: ```text password = "MyDatabasePassword123" ``` inside Terraform source code. Never commit: ```text .env credentials private keys database passwords ``` to version control. ### 🔒 Encryption Encryption should be enabled where supported and appropriate for: - database storage - object storage - sensitive data - secret storage --- # 💾 PHASE 8 — STATE ARCHITECTURE Terraform state is sensitive infrastructure information. ### Recommended Model ```text Dev State | +---- Dev Resources Staging State | +---- Staging Resources Production State | +---- Production Resources ``` ### State Controls - Protected remote state storage. - Appropriate access control. - State locking where supported by the selected backend. - Environment isolation. - Restricted access to production state. - No state files committed to Git. ### ⚠️ State Risks Potential problems include: - Concurrent modifications. - State corruption. - Incorrect resource ownership. - Accidental production changes. - State/resource mismatch. Exact backend configuration remains provider/account-specific and is therefore not fabricated here. --- # 🚀 PHASE 9 — PROVISIONING WORKFLOW ```text INIT ↓ FORMAT ↓ VALIDATE ↓ STATIC / SECURITY CHECKS ↓ PLAN ↓ ENGINEERING REVIEW ↓ APPROVAL ↓ APPLY ↓ POST-DEPLOYMENT VERIFY ``` ### 🧪 Development Developers can iterate rapidly with plan/validation checks. ### 🧪 Staging Changes should pass: - Terraform validation - security checks - plan review - integration testing - deployment verification ### 🔒 Production Production should require explicit review before applying infrastructure changes. --- # 🧪 PHASE 10 — INFRASTRUCTURE VALIDATION ### 1. Syntax Validation Check: - Terraform configuration syntax - module references - variable definitions - provider configuration ### 2. Static Validation Check: - invalid configuration - deprecated patterns - inconsistent references - obvious configuration problems ### 3. Security Validation Check: - public database exposure - overly broad IAM - unencrypted storage - insecure network rules - exposed secrets ### 4. Policy Validation Potential organizational rules: ```text Production database must not be public Production resources must have required tags Encryption must be enabled IAM must follow least privilege ``` ### 5. Plan Validation Review: - resources to create - resources to modify - resources to destroy - replacements - unexpected changes **No validation result is claimed here because the infrastructure has not actually been executed.** --- # 🔍 PHASE 11 — INFRASTRUCTURE TESTING ### 🧩 Unit-Like IaC Tests Test infrastructure logic such as: - required variables - module outputs - expected configuration - security conditions ### 🔗 Integration Tests Verify: - application can communicate with required services - application can access permitted storage - application can reach the database - unauthorized network paths remain blocked ### 🚀 Post-Provisioning Tests After deployment: ```text Load Balancer ↓ Application Health ↓ Database Connectivity ↓ Storage Access ↓ Background Worker ↓ Monitoring ``` ### ❌ Do Not Claim ```text All tests passed ``` unless actual execution evidence exists. --- # 🔄 PHASE 12 — DRIFT & CHANGE MANAGEMENT ### Drift Workflow ```text Detect ↓ Compare ↓ Investigate ↓ Determine Intent ↓ Approve Decision ↓ Reconcile ``` ### Example Suppose someone manually changes an application's infrastructure. Do not immediately overwrite it. First determine: 1. Was the change intentional? 2. Was it emergency remediation? 3. Should Terraform become the source of truth? 4. Does Terraform need updating? 5. Could reconciliation cause replacement? ### Change Categories - IaC code change - Environment configuration change - Provider change - Manual cloud change - Intentional emergency change - Unintentional drift --- # ⚠️ PHASE 13 — FAILURE, REPLACEMENT & RECOVERY | High-Risk Change | Potential Impact | Required Consideration | |---|---|---| | Database replacement | Data loss/outage | Backup and recovery validation | | Network replacement/change | Application outage | Dependency analysis | | IAM policy change | Application failure/security exposure | Permission testing | | Storage deletion | File loss | Data protection/recovery | | Application replacement | Downtime | Deployment strategy | | State modification | Resource management failure | State backup/access controls | ### 🚨 Database Scenario ```text Database Change ↓ Replacement Detected ↓ STOP ↓ Review Impact ↓ Verify Recovery Capability ↓ Approve ↓ Execute ↓ Validate ``` `terraform destroy` should **not** be treated as a generic rollback mechanism. --- # 📊 PHASE 14 — COST, SCALE & RELIABILITY REVIEW ### 💰 Main Cost Drivers Potential cost-sensitive areas include: - application compute - database compute/storage - load balancing - object storage - data transfer - monitoring/logging - background processing Exact costs cannot be calculated from the supplied requirements because usage and pricing inputs are missing. ### 📈 Scaling Considerations Review: - API traffic - concurrent users - database workload - file-storage growth - background-job volume ### 🛡️ Reliability Evaluate: - application failure - database failure - network failure - deployment failure - dependency failure - recovery time requirements Do not claim a specific availability percentage without an actual availability design and requirements. --- # 🛠️ PHASE 15 — IMPLEMENTATION & DELIVERY ROADMAP ## Step 1 — Terraform Foundation **Prerequisite:** AWS account/access and Terraform execution environment. **Change:** - Terraform project structure - provider configuration - environment boundaries **Expected Result:** - Reproducible Terraform foundation. **Validation:** - Formatting - Configuration validation --- ## Step 2 — State Architecture **Prerequisite:** State-management decision. **Change:** - Configure protected environment-specific state. **Expected Result:** - Independent state ownership. **Validation:** - State access and locking behavior verified according to selected backend. --- ## Step 3 — Networking **Prerequisite:** Terraform foundation. **Change:** - Network - Subnets - Routing - Security boundaries **Expected Result:** - Private application/data network. **Validation:** - Network connectivity tests. --- ## Step 4 — IAM **Prerequisite:** Network architecture defined. **Change:** - Application identity - Worker identity - Deployment permissions **Expected Result:** - Least-privilege access model. **Validation:** - Permission tests. --- ## Step 5 — Database **Prerequisite:** Network and database security. **Change:** - PostgreSQL infrastructure. **Expected Result:** - Private persistent database. **Validation:** - Connectivity - Configuration - Backup/recovery verification where configured. --- ## Step 6 — Application & Worker **Prerequisite:** Network, IAM and database dependencies. **Change:** - Application compute - Worker infrastructure **Expected Result:** - Application and background processing available. **Validation:** - Health checks - Integration tests. --- ## Step 7 — Storage **Prerequisite:** IAM architecture. **Change:** - Object storage - Encryption - Access controls **Expected Result:** - Secure application file storage. **Validation:** - Authorized access - Unauthorized access rejection. --- ## Step 8 — Monitoring **Prerequisite:** Application infrastructure exists. **Change:** - Logs - Metrics - Relevant alerts **Expected Result:** - Operational visibility. --- ## Step 9 — Security & Policy Validation **Prerequisite:** Infrastructure complete. **Change:** - Run static/security/policy validation. **Expected Result:** - Security issues identified before production. --- ## Step 10 — Production Deployment **Prerequisite:** All required tests and approvals complete. **Workflow:** ```text PLAN ↓ REVIEW ↓ APPROVE ↓ APPLY ↓ VERIFY ↓ MONITOR ``` --- # 🏆 PHASE 16 — FINAL INFRASTRUCTURE AS CODE BLUEPRINT ## 1. Executive Infrastructure Summary - **Workload:** Web application with REST API, frontend, PostgreSQL, file uploads and background jobs. - **Cloud:** AWS. - **IaC:** Terraform. - **Environments:** Development, staging, production. - **Architecture:** Public HTTPS ingress → private application → private database/storage integrations. - **Primary priorities:** Security, reproducibility, environment isolation, validation and controlled production changes. --- ## 2. Infrastructure Architecture ```text 🌐 INTERNET | HTTPS | v 🔀 PUBLIC INGRESS | v 🖥️ PRIVATE APP / \ / \ v v 🗄️ PostgreSQL 📦 Object Storage | | v ⚙️ Background Jobs 🔐 IAM / SECRETS | v All Authorized Services 📊 MONITORING | +---------+---------+ | | | App DB Worker ``` --- # 3. Resource Inventory | Resource | Purpose | Environment | Dependency | Risk | |---|---|---|---|---| | VPC/Network | Network isolation | All | None | High | | Subnets | Resource placement | All | Network | High | | Load Balancer | Public HTTPS ingress | All | Network | Medium | | Application Compute | Run application | All | Network/IAM | High | | PostgreSQL | Persistent data | All | Network/security | Very High | | Object Storage | File storage | All | IAM | Medium | | Worker Compute | Background jobs | All | Network/IAM | Medium | | IAM Roles/Policies | Access control | All | Service requirements | High | | Secrets Service | Sensitive configuration | All | IAM | High | | Monitoring | Operations | All | Application resources | Medium | | Terraform State | Infrastructure ownership | Separate | Backend | Very High | --- # 4. Dependency Graph ```text Terraform | v Network | +----> Load Balancer | +----> Application | | | +----> Storage | | | +----> Database | +----> Worker IAM | +----> Application +----> Worker +----> Terraform Deployment Monitoring | +----> Load Balancer +----> Application +----> Database +----> Worker ``` --- # 5. Terraform Structure ```text infrastructure/ ├── modules/ │ ├── network/ │ ├── application/ │ ├── database/ │ ├── storage/ │ ├── worker/ │ ├── iam/ │ └── monitoring/ │ ├── environments/ │ ├── dev/ │ ├── staging/ │ └── production/ │ └── README.md ``` --- # 6. Configuration & Environment Model ```text Reusable Modules | +----------------+----------------+ | | | DEV STAGING PRODUCTION | | | Dev Config Stage Config Prod Config | | | Dev State Stage State Prod State ``` Environment-specific values must remain outside reusable module logic. --- # 7. IAM & Security Architecture ### 🔐 Security Principles - Least privilege. - Private application networking. - Private database. - Controlled public ingress. - Encryption where applicable. - Secrets outside source code. - Separate environment credentials/access. - Restricted production deployment permissions. - No unjustified wildcard IAM permissions. --- # 8. State Architecture ```text Terraform State | +---- Development | +---- Staging | +---- Production ``` Production state should have stricter access controls than development state. State should be treated as sensitive infrastructure information. --- # 9. Provisioning Workflow ```text 📝 INIT ↓ 🔍 VALIDATE ↓ 🔐 SECURITY CHECK ↓ 📋 PLAN ↓ 👀 REVIEW ↓ ✅ APPROVE ↓ 🚀 APPLY ↓ 🧪 VERIFY ↓ 📊 MONITOR ``` --- # 10. Validation & Testing ### Before Deployment - Terraform formatting. - Terraform configuration validation. - Static analysis. - Security scanning. - Policy validation. - Plan review. - Destructive-change review. ### After Deployment - Application health. - HTTPS accessibility. - Database connectivity. - Storage access. - Background worker execution. - IAM behavior. - Monitoring/logging. - Environment isolation. --- # 11. Drift & Change Management ```text Infrastructure ↓ Detect Drift ↓ Compare With IaC ↓ Investigate ↓ Intentional? / \ YES NO | | Update Reconcile IaC Carefully \ / ↓ PLAN ↓ REVIEW ↓ APPLY ``` --- # 12. Failure & Recovery Plan ### 🚨 Highest-Risk Areas 1. Database replacement. 2. Database deletion. 3. Network changes. 4. IAM permission changes. 5. Storage deletion. 6. Terraform state corruption or incorrect state ownership. ### Recovery Principle ```text Detect → Stop → Assess Impact → Verify Recovery Capability → Approve → Recover → Validate → Monitor ``` Infrastructure recovery and application rollback are treated as separate concerns. --- # 13. Cost & Reliability Review ### 💰 Cost Drivers - Compute usage. - Database resources. - Load balancing. - Object storage. - Data transfer. - Background processing. - Monitoring/logging. ### 🛡️ Reliability Risks - Database failure. - Application failure. - Network misconfiguration. - IAM misconfiguration. - State problems. - Destructive Terraform changes. - Insufficient recovery preparation. Exact cloud costs and availability guarantees remain **unresolved** because the necessary usage, pricing, and availability requirements were not supplied. --- # 14. Production Readiness Checklist ### 🔐 Security - [ ] No secrets in Git. - [ ] Least-privilege IAM. - [ ] Database not publicly exposed. - [ ] Encryption requirements verified. - [ ] Network access reviewed. ### 💾 State - [ ] Production state isolated. - [ ] State access restricted. - [ ] Locking configured where applicable. - [ ] State recovery procedure understood. ### 🗄️ Data - [ ] Database recovery requirements defined. - [ ] Backup configuration verified where required. - [ ] Destructive changes reviewed. - [ ] Storage deletion risks reviewed. ### 🚀 Deployment - [ ] Terraform validation passed. - [ ] Security checks passed. - [ ] Plan reviewed. - [ ] Production approval obtained. - [ ] Post-deployment verification defined. ### 📊 Operations - [ ] Monitoring configured. - [ ] Logs available. - [ ] Important failure conditions observable. - [ ] Drift detection/review process defined. --- # 15. Implementation Roadmap ```text 1. 🏗️ Terraform Foundation ↓ 2. 💾 State Architecture ↓ 3. 🌐 Networking ↓ 4. 🔐 IAM & Security ↓ 5. 🗄️ Database ↓ 6. 🖥️ Application ↓ 7. ⚙️ Background Worker ↓ 8. 📦 Object Storage ↓ 9. 📊 Monitoring ↓ 10. 🧪 Validation & Testing ↓ 11. 📋 Production Plan Review ↓ 12. 🚀 Production Deployment ↓ 13. 🔍 Post-Deployment Verification ↓ 14. 🔄 Drift Monitoring ``` --- # 🏁 FINAL IaC ARCHITECTURE BLUEPRINT ```text REQUIREMENTS ↓ CLOUD ARCHITECTURE ↓ RESOURCE MODEL ↓ DEPENDENCY GRAPH ↓ TERRAFORM MODULES ↓ ENVIRONMENT CONFIGURATION ↓ IAM & SECURITY ↓ STATE MANAGEMENT ↓ PROVISIONING WORKFLOW ↓ VALIDATION ↓ INFRASTRUCTURE TESTING ↓ DRIFT MANAGEMENT ↓ FAILURE / RECOVERY ↓ PRODUCTION READINESS ↓ CONTROLLED DEPLOYMENT ``` ## 🏷️ Classification - **Confirmed requirements:** AWS, Terraform, web application, PostgreSQL, file storage, background jobs, dev/staging/production, security and validation requirements. - **Assumptions:** Exact AWS service selection, scaling model, availability target and monitoring thresholds. - **Proposed resources:** Network, ingress/load balancing, private application compute, PostgreSQL, object storage, worker infrastructure, IAM, secrets and monitoring. - **Provider-dependent configuration:** Exact AWS resource types, backend implementation, regional configuration, sizing and pricing. - **High-risk changes:** Database replacement/deletion, network changes, IAM changes, storage deletion and state modifications. - **Unresolved decisions:** AWS region, exact compute platform, exact worker architecture, backup retention, RTO/RPO, traffic volume, database sizing and cost targets. ### 🎯 Overall Result This test demonstrates that the skill does **not jump directly into Terraform code**. It first reconstructs requirements, maps them to infrastructure, establishes dependencies, separates environments, designs security and state management, defines provisioning and validation, analyzes drift and destructive changes, and finally produces a production-oriented IaC blueprint.
Claude

Infrastructure As Code Architect

Add to Cart
Instant accessInstant access
Usage rightsCommercial use
Money-back guaranteeMoney‑back
By purchasing this prompt, you agree to our terms of service
CLAUDE-5-5-SONNET
Tested icon
Guide icon
4 examples icon
Free credits icon
Infrastructure as Code Architect transforms infrastructure requirements into a structured Terraform/Pulumi architecture, provisioning workflow, validation strategy, environment structure, dependency map, and deployment plan. this is not simply a Terraform code generator. It treats IaC as an infrastructure engineering system—requirements → resource architecture → dependencies → modules → provisioning → validation → drift/change analysis → production readiness.
...more
Added 3 days ago
Report
Browse Marketplace