feat: implement naming convention, deployment automation, and infrastructure updates
- Add comprehensive naming convention (provider-region-resource-env-purpose) - Implement Terraform locals for centralized naming - Update all Terraform resources to use new naming convention - Create deployment automation framework (18 phase scripts) - Add Azure setup scripts (provider registration, quota checks) - Update deployment scripts config with naming functions - Create complete deployment documentation (guide, steps, quick reference) - Add frontend portal implementations (public and internal) - Add UI component library (18 components) - Enhance Entra VerifiedID integration with file utilities - Add API client package for all services - Create comprehensive documentation (naming, deployment, next steps) Infrastructure: - Resource groups, storage accounts with new naming - Terraform configuration updates - Outputs with naming convention examples Deployment: - Automated deployment scripts for all 15 phases - State management and logging - Error handling and validation Documentation: - Naming convention guide and implementation summary - Complete deployment guide (296 steps) - Next steps and quick start guides - Azure prerequisites and setup completion docs Note: ESLint warnings present - will be addressed in follow-up commit
This commit is contained in:
103
scripts/deploy/phase2-azure-infrastructure.sh
Executable file
103
scripts/deploy/phase2-azure-infrastructure.sh
Executable file
@@ -0,0 +1,103 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Phase 2: Azure Infrastructure Setup
|
||||
# Terraform infrastructure deployment
|
||||
#
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "${SCRIPT_DIR}/config.sh"
|
||||
|
||||
log_info "=========================================="
|
||||
log_info "Phase 2: Azure Infrastructure Setup"
|
||||
log_info "=========================================="
|
||||
|
||||
# 2.1 Azure Subscription Preparation
|
||||
log_step "2.1 Preparing Azure subscription..."
|
||||
|
||||
cd "${PROJECT_ROOT}"
|
||||
|
||||
# Run Azure setup scripts
|
||||
if [ -f "${INFRA_DIR}/scripts/azure-setup.sh" ]; then
|
||||
log_info "Running Azure setup script..."
|
||||
bash "${INFRA_DIR}/scripts/azure-setup.sh" || error_exit "Azure setup script failed"
|
||||
else
|
||||
log_warning "Azure setup script not found, skipping..."
|
||||
fi
|
||||
|
||||
# Register resource providers
|
||||
if [ -f "${INFRA_DIR}/scripts/azure-register-providers.sh" ]; then
|
||||
log_info "Registering Azure resource providers..."
|
||||
bash "${INFRA_DIR}/scripts/azure-register-providers.sh" || error_exit "Provider registration failed"
|
||||
else
|
||||
log_warning "Provider registration script not found, skipping..."
|
||||
fi
|
||||
|
||||
# 2.2 Terraform Infrastructure Deployment
|
||||
log_step "2.2 Deploying Terraform infrastructure..."
|
||||
|
||||
cd "${TERRAFORM_DIR}"
|
||||
|
||||
# Initialize Terraform
|
||||
log_info "Initializing Terraform..."
|
||||
terraform init || error_exit "Terraform initialization failed"
|
||||
|
||||
# Create initial state storage if needed
|
||||
if [ "${CREATE_STATE_STORAGE:-false}" = "true" ]; then
|
||||
log_info "Creating Terraform state storage..."
|
||||
terraform plan -target=azurerm_resource_group.terraform_state \
|
||||
-target=azurerm_storage_account.terraform_state \
|
||||
-target=azurerm_storage_container.terraform_state \
|
||||
|| log_warning "State storage resources may already exist"
|
||||
|
||||
terraform apply -target=azurerm_resource_group.terraform_state \
|
||||
-target=azurerm_storage_account.terraform_state \
|
||||
-target=azurerm_storage_container.terraform_state \
|
||||
|| log_warning "State storage may already exist"
|
||||
fi
|
||||
|
||||
# Plan infrastructure
|
||||
log_info "Planning infrastructure changes..."
|
||||
terraform plan -out=tfplan || error_exit "Terraform plan failed"
|
||||
|
||||
# Review plan (optional)
|
||||
if [ "${AUTO_APPLY:-false}" != "true" ]; then
|
||||
log_warning "Terraform plan created. Review tfplan before applying."
|
||||
log_info "To apply: terraform apply tfplan"
|
||||
log_info "To auto-apply: set AUTO_APPLY=true"
|
||||
else
|
||||
log_info "Applying Terraform plan..."
|
||||
terraform apply tfplan || error_exit "Terraform apply failed"
|
||||
log_success "Infrastructure deployed"
|
||||
fi
|
||||
|
||||
# Get outputs
|
||||
log_info "Retrieving Terraform outputs..."
|
||||
terraform output -json > "${STATE_DIR}/terraform-outputs.json" || log_warning "Failed to save outputs"
|
||||
|
||||
# 2.3 Kubernetes Configuration
|
||||
log_step "2.3 Configuring Kubernetes..."
|
||||
|
||||
# Get AKS credentials
|
||||
log_info "Getting AKS credentials..."
|
||||
az aks get-credentials --resource-group "${AKS_RESOURCE_GROUP}" \
|
||||
--name "${AKS_NAME}" \
|
||||
--overwrite-existing \
|
||||
|| log_warning "AKS cluster may not exist yet"
|
||||
|
||||
# Verify cluster access
|
||||
if kubectl cluster-info &> /dev/null; then
|
||||
log_success "Kubernetes cluster accessible"
|
||||
kubectl get nodes || log_warning "No nodes found"
|
||||
else
|
||||
log_warning "Kubernetes cluster not accessible yet"
|
||||
fi
|
||||
|
||||
# Save state
|
||||
save_state "phase2" "complete"
|
||||
|
||||
log_success "=========================================="
|
||||
log_success "Phase 2: Azure Infrastructure - COMPLETE"
|
||||
log_success "=========================================="
|
||||
|
||||
Reference in New Issue
Block a user