#!/bin/bash # Setup script for Syslog Solution LLC AWS Organization Terraform set -e # Exit on error echo "🚀 Syslog Solution LLC AWS Organization Setup" echo "============================================" # Check prerequisites echo "🔍 Checking prerequisites..." # Check AWS CLI if ! command -v aws &> /dev/null; then echo "❌ AWS CLI not found. Please install AWS CLI first." echo " Visit: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html" exit 1 fi # Check Terraform if ! command -v terraform &> /dev/null; then echo "❌ Terraform not found. Please install Terraform first." echo " Visit: https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli" exit 1 fi echo "✅ Prerequisites check passed" # Configure AWS CLI echo "" echo "🔧 Configuring AWS CLI..." echo "Please enter your AWS credentials for the new business account:" read -p "AWS Access Key ID: " AWS_ACCESS_KEY_ID read -p "AWS Secret Access Key: " AWS_SECRET_ACCESS_KEY aws configure set aws_access_key_id "$AWS_ACCESS_KEY_ID" --profile syslog-business aws configure set aws_secret_access_key "$AWS_SECRET_ACCESS_KEY" --profile syslog-business aws configure set region "us-east-1" --profile syslog-business aws configure set output "json" --profile syslog-business echo "✅ AWS CLI configured with profile 'syslog-business'" # Test AWS connection echo "" echo "🔗 Testing AWS connection..." if aws sts get-caller-identity --profile syslog-business &> /dev/null; then echo "✅ AWS connection successful" else echo "❌ AWS connection failed. Please check your credentials." exit 1 fi # Initialize Terraform echo "" echo "🏗️ Initializing Terraform..." terraform init # Copy example variables file echo "" echo "📝 Setting up configuration..." if [ ! -f terraform.tfvars ]; then cp terraform.tfvars.example terraform.tfvars echo "✅ Created terraform.tfvars from example" echo "" echo "⚠️ Please edit terraform.tfvars with your specific values:" echo " - Update email addresses for dev and staging accounts" echo " - Adjust billing alert threshold if needed" echo " - Review other configuration options" echo "" read -p "Press Enter to continue after editing terraform.tfvars..." else echo "✅ terraform.tfvars already exists" fi # Show plan echo "" echo "📋 Showing Terraform plan..." terraform plan echo "" echo "============================================" echo "🎯 Setup complete! Next steps:" echo "" echo "1. Review the Terraform plan above" echo "2. Apply the configuration:" echo " terraform apply" echo "" echo "3. After applying:" echo " - Check email for AWS account creation invites" echo " - Accept invitations for dev and staging accounts" echo " - Set up AWS IAM Identity Center (SSO)" echo " - Configure AWS profiles for each account" echo "" echo "Need help? Check README.md for detailed instructions." echo "============================================"