✅ You've already run terraform/setup.sh successfully
✅ AWS credentials are configured with platform-admin profile
✅ All Terraform stacks are initialized
# Export the required environment variables
export AWS_PROFILE="platform-admin"
export AWS_REGION="eu-west-1"
export TF_STATE_BUCKET="eth-signer-challenge-tfstate-1e79bf1bc6454cf390428fb9d65aa84a"
# Verify your bucket exists:
aws s3 ls | grep "eth-signer-challenge-tfstate"You MUST deploy stacks in this exact order because IRSA depends on remote state from EKS and KMS:
cd terraform/stacks/vpc
# Plan the deployment
terraform plan -var-file=../../envs/prod/prod.tfvars
# Apply the deployment
terraform apply -var-file=../../envs/prod/prod.tfvars
# Verify outputs
terraform outputExpected Outputs:
vpc_id- VPC identifierprivate_subnets- List of private subnet IDspublic_subnets- List of public subnet IDs
cd ../kms
# Plan the deployment
terraform plan -var-file=../../envs/prod/prod.tfvars
# Apply the deployment
terraform apply -var-file=../../envs/prod/prod.tfvars
# Verify outputs
terraform outputExpected Outputs:
key_arn- KMS key ARN (needed for IRSA and K8s ConfigMap)alias_name-alias/eth-signer-mainnet-prod
cd ../eks
# Plan the deployment
terraform plan \
-var-file=../../envs/prod/prod.tfvars \
-var="tf_state_bucket=$TF_STATE_BUCKET"
# Apply the deployment
terraform apply \
-var-file=../../envs/prod/prod.tfvars \
-var="tf_state_bucket=$TF_STATE_BUCKET"
# Verify outputs
terraform output
# Update kubeconfig
aws eks update-kubeconfig \
--region $AWS_REGION \
--name kms-eks-eth-prod \
--profile $AWS_PROFILE
# Test cluster connectivity
kubectl get nodesExpected Outputs:
cluster_endpoint- EKS API server endpointoidc_provider_arn- OIDC provider for IRSAcluster_oidc_issuer_url- OIDC issuer URL
cd ../irsa
# Plan the deployment
terraform plan \
-var-file=../../envs/prod/prod.tfvars \
-var="tf_state_bucket=$TF_STATE_BUCKET"
# Apply the deployment
terraform apply \
-var-file=../../envs/prod/prod.tfvars \
-var="tf_state_bucket=$TF_STATE_BUCKET"
# Verify outputs
terraform outputExpected Outputs:
role_arn- IAM role ARN (needed for K8s ServiceAccount annotation)
After successful deployment, collect these values for your K8s manifests:
# Get KMS Key ARN for ConfigMap
cd terraform/stacks/kms
export KMS_KEY_ARN=$(terraform output -raw key_arn)
echo "KMS Key ARN: $KMS_KEY_ARN"
# Get IRSA Role ARN for ServiceAccount
cd ../irsa
export IRSA_ROLE_ARN=$(terraform output -raw role_arn)
echo "IRSA Role ARN: $IRSA_ROLE_ARN"Update these files:
k8s/base/configmap.yaml- SetkmsKeyId: "$KMS_KEY_ARN"k8s/base/serviceaccount.yaml- Set annotationeks.amazonaws.com/role-arn: "$IRSA_ROLE_ARN"
Using prod.tfvars gives you:
- Environment:
prod - Cluster:
kms-eks-eth-prod - KMS Alias:
alias/eth-signer-mainnet-prod - Namespace:
eth-signer - ServiceAccount:
eth-signer-sa - Node Groups: 2-6 nodes (3 desired) with
t3.medium - VPC Flow Logs: Enabled for security
- VPC stack deployed successfully with 3 AZs
- KMS stack deployed with
ECC_SECG_P256K1key - EKS cluster is accessible (
kubectl get nodesworks) - IRSA role created with minimal KMS permissions
- All Terraform outputs captured for K8s configuration
- IRSA fails: Make sure VPC, KMS, and EKS are deployed first
- Remote state not found: Deploy dependencies in correct order
- Missing TF_STATE_BUCKET: Verify the bucket name is correct
- AWS Profile Issues: Verify
aws sts get-caller-identity --profile platform-adminworks - Region Mismatch: Ensure all commands use
eu-west-1region
# Destroy in reverse order
cd terraform/stacks/irsa && terraform destroy -var-file=../../envs/prod/prod.tfvars -var="tf_state_bucket=$TF_STATE_BUCKET"
cd ../eks && terraform destroy -var-file=../../envs/prod/prod.tfvars -var="tf_state_bucket=$TF_STATE_BUCKET"
cd ../kms && terraform destroy -var-file=../../envs/prod/prod.tfvars
cd ../vpc && terraform destroy -var-file=../../envs/prod/prod.tfvarsAfter Phase 1 completion, proceed to:
- Phase 2: Build and push the Go application
- Phase 3: Configure SOPS/age secrets
- Phase 4: Deploy with Kustomize