What Gets Created
The bootstrap process provisions:- S3 Bucket: Stores Terraform state files for all layers
- DynamoDB Table: Provides state locking to prevent concurrent modifications
- Backend Configuration: Updates all layer backend configs to use the remote state
Bootstrap Steps
Initialize Terraform
Review the plan
- S3 bucket with versioning and encryption enabled
- DynamoDB table with primary key for state locking
Post-Bootstrap Configuration
Thepost-bootstrap.sh script automatically updates the backend configuration for all three infrastructure layers:
1-infrastructure/backend.tf2-platform/backend.tf3-apps/backend.tf
State Management
State Files
Each layer maintains its own state file:1-infrastructure/terraform.tfstate: VPC, EKS, Tailscale, Vault infrastructure2-platform/terraform.tfstate: Kubernetes platform components3-apps/terraform.tfstate: Applications and services
State Locking
DynamoDB provides state locking to prevent multiple users or processes from modifying state simultaneously. When you runterraform apply, Terraform automatically:
- Acquires a lock in DynamoDB
- Performs the operation
- Releases the lock
If a lock is held by another process, Terraform will wait until the lock is released or timeout after 10 minutes.
Verification
Verify the bootstrap resources were created:- AWS Console
- AWS CLI
- Navigate to S3 in the AWS Console
-
Find the bucket named
shipyard-terraform-state-dev - Verify versioning and encryption are enabled
- Navigate to DynamoDB
-
Find the table named
shipyard-terraform-locks-dev
Troubleshooting
Bucket Already Exists
If you see an error that the S3 bucket already exists:- Check if the bucket was created in a previous run
- If so, skip to running
post-bootstrap.sh - If the bucket is in a different account, choose a different bucket name in
bootstrap/main.tf
Permission Denied
If you encounter permission errors:- Verify your AWS credentials have permissions to create S3 buckets and DynamoDB tables
- Ensure your IAM user/role has
AdministratorAccessor equivalent permissions - Check that your AWS credentials are correctly configured:
aws sts get-caller-identity
Next Steps
With the bootstrap complete, you’re ready to deploy the infrastructure layer.Infrastructure Layer
Deploy VPC, EKS cluster, and core infrastructure