Files
smom-dbis-138/scripts/deployment/deploy-infrastructure-phase1.sh

53 lines
1.3 KiB
Bash
Raw Permalink Normal View History

#!/usr/bin/env bash
# Phase 1: Deploy Azure Infrastructure
set -e
cd "$(dirname "$0")/../.."
# Color codes
echo "==================================================================="
echo " PHASE 1: AZURE INFRASTRUCTURE DEPLOYMENT"
echo "==================================================================="
# Load environment variables
if [ -f .env ]; then
source .env 2>/dev/null || true
fi
cd terraform
# Check if terraform.tfvars exists
if [ ! -f "terraform.tfvars" ]; then
if [ -f "terraform.tfvars.example" ]; then
log_warn "⚠️ terraform.tfvars not found, creating from example..."
cp terraform.tfvars.example terraform.tfvars
log_error "❌ Please edit terraform.tfvars with your values before proceeding"
exit 1
else
log_error "❌ terraform.tfvars not found and no example available"
exit 1
fi
fi
# Initialize Terraform
log_info "Initializing Terraform..."
terraform init
# Validate configuration
log_info "Validating Terraform configuration..."
terraform validate
# Create plan
log_info "Creating Terraform plan..."
terraform plan -out=tfplan
log_warn "⚠️ REVIEW THE PLAN ABOVE"
echo "To apply this plan, run:"
echo " terraform apply tfplan"
echo "Or to apply directly:"
echo " terraform apply"
cd ..