|
| 1 | +# Terraform Cloud Bootstrap |
| 2 | + |
| 3 | +This module manages Terraform Cloud workspaces and configuration for the hello-fastapi-k8s project. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +This creates a complete Terraform Cloud setup including: |
| 8 | +- Organization project |
| 9 | +- Workspaces for each layer and environment |
| 10 | +- Variable sets for AWS credentials and common configurations |
| 11 | +- Run triggers for dependent workspaces |
| 12 | +- Team access controls |
| 13 | + |
| 14 | +## Prerequisites |
| 15 | + |
| 16 | +1. Terraform Cloud account and organization |
| 17 | +2. GitHub OAuth connection configured in TFC |
| 18 | +3. AWS credentials for TFC to use |
| 19 | + |
| 20 | +## Usage |
| 21 | + |
| 22 | +1. First, create the bootstrap workspace manually or via CLI: |
| 23 | +```bash |
| 24 | +cd infra/0_tfc_bootstrap |
| 25 | +terraform login |
| 26 | +terraform workspace new tfc-bootstrap |
| 27 | +``` |
| 28 | + |
| 29 | +2. Configure variables: |
| 30 | +```bash |
| 31 | +# Required variables |
| 32 | +export TF_VAR_tfc_organization="your-org" |
| 33 | +export TF_VAR_aws_access_key_id="AKIA..." |
| 34 | +export TF_VAR_aws_secret_access_key="secret..." |
| 35 | +export TF_VAR_github_repository="yourusername/hello-flask-k8s" |
| 36 | +``` |
| 37 | + |
| 38 | +3. Run terraform: |
| 39 | +```bash |
| 40 | +terraform init |
| 41 | +terraform plan |
| 42 | +terraform apply |
| 43 | +``` |
| 44 | + |
| 45 | +## Workspace Structure |
| 46 | + |
| 47 | +The following workspaces will be created: |
| 48 | + |
| 49 | +- `ipam-global` - IP Address Management (shared across all environments) |
| 50 | +- `base-{dev,staging,prod}` - Base infrastructure (VPC, EKS) |
| 51 | +- `argo-{dev,staging,prod}` - ArgoCD deployment |
| 52 | +- `addons-{dev,staging,prod}` - Kubernetes addons |
| 53 | + |
| 54 | +## Features |
| 55 | + |
| 56 | +- **Auto-apply**: Enabled for dev workspaces only |
| 57 | +- **Run triggers**: Dependent workspaces trigger automatically |
| 58 | +- **Branch protection**: |
| 59 | + - Dev/staging workspaces use respective branches |
| 60 | + - Prod workspaces use main branch |
| 61 | +- **Access control**: Developers have write access to dev/staging, plan-only for prod |
| 62 | + |
| 63 | +## Customization |
| 64 | + |
| 65 | +Edit `main.tf` to: |
| 66 | +- Add more layers or environments |
| 67 | +- Change auto-apply settings |
| 68 | +- Modify team permissions |
| 69 | +- Add notification channels (Slack, email, webhooks) |
0 commit comments