docs(terraform): Add quick start guide
This commit is contained in:
133
terraform/aws-infrastructure/docs/QUICKSTART.md
Normal file
133
terraform/aws-infrastructure/docs/QUICKSTART.md
Normal file
@@ -0,0 +1,133 @@
|
||||
# 🚀 Quick Start Guide
|
||||
|
||||
## 5-Minute Setup
|
||||
|
||||
### Step 1: Clone Repository
|
||||
```bash
|
||||
git clone http://git.thedevops.dev/admin/k3s-gitops.git
|
||||
cd k3s-gitops/terraform/aws-infrastructure
|
||||
```
|
||||
|
||||
### Step 2: Configure AWS
|
||||
```bash
|
||||
export AWS_ACCESS_KEY_ID="your-key"
|
||||
export AWS_SECRET_ACCESS_KEY="your-secret"
|
||||
export AWS_DEFAULT_REGION="us-east-1"
|
||||
```
|
||||
|
||||
### Step 3: Create Configuration
|
||||
```bash
|
||||
cp environments/dev.tfvars terraform.tfvars
|
||||
vim terraform.tfvars
|
||||
```
|
||||
|
||||
**Required variables:**
|
||||
```hcl
|
||||
project_name = "myapp"
|
||||
environment = "dev"
|
||||
db_username = "admin"
|
||||
db_password = "SecurePassword123!"
|
||||
```
|
||||
|
||||
### Step 4: Deploy
|
||||
```bash
|
||||
terraform init
|
||||
terraform plan
|
||||
terraform apply
|
||||
```
|
||||
|
||||
**Deployment time:** 15-20 minutes
|
||||
**Cost:** ~$50-100/month (dev)
|
||||
|
||||
---
|
||||
|
||||
## Post-Deployment
|
||||
|
||||
### Get ALB DNS
|
||||
```bash
|
||||
terraform output alb_dns_name
|
||||
```
|
||||
|
||||
### Test Application
|
||||
```bash
|
||||
curl http://$(terraform output -raw alb_dns_name)/health
|
||||
```
|
||||
|
||||
### View All Outputs
|
||||
```bash
|
||||
terraform output
|
||||
terraform output -json > outputs.json
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Common Tasks
|
||||
|
||||
### Update Infrastructure
|
||||
```bash
|
||||
vim terraform.tfvars # Make changes
|
||||
terraform plan
|
||||
terraform apply
|
||||
```
|
||||
|
||||
### Scale Application
|
||||
```bash
|
||||
# Edit terraform.tfvars
|
||||
asg_desired_capacity = 5
|
||||
|
||||
terraform apply
|
||||
```
|
||||
|
||||
### View Logs
|
||||
```bash
|
||||
# CloudWatch Console
|
||||
open https://console.aws.amazon.com/cloudwatch
|
||||
|
||||
# Or AWS CLI
|
||||
aws logs tail /aws/ec2/dev/system --follow
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Cleanup
|
||||
|
||||
### Development
|
||||
```bash
|
||||
terraform destroy -var-file="environments/dev.tfvars"
|
||||
```
|
||||
|
||||
### Production (⚠️ Dangerous)
|
||||
```bash
|
||||
# Create backup first!
|
||||
terraform destroy -var-file="environments/production.tfvars"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**Issue:** "Error creating VPC"
|
||||
**Solution:** Check AWS limits
|
||||
|
||||
**Issue:** "Insufficient permissions"
|
||||
**Solution:** Ensure IAM user has required permissions
|
||||
|
||||
**Issue:** "State lock timeout"
|
||||
**Solution:** `terraform force-unlock <LOCK_ID>`
|
||||
|
||||
---
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. Read [README.md](../README.md)
|
||||
2. Review security best practices
|
||||
3. Setup CI/CD pipeline
|
||||
4. Configure monitoring
|
||||
|
||||
---
|
||||
|
||||
## Getting Help
|
||||
|
||||
- Issues: http://git.thedevops.dev/admin/k3s-gitops/issues
|
||||
- Slack: #infrastructure
|
||||
- Email: devops@example.com
|
||||
Reference in New Issue
Block a user