This Terraform configuration deploys an Azure Machine Learning workspace with an A10v5 GPU compute instance, private endpoint support, and integrated healthcare AI agents for medical image analysis and report generation.
The configuration creates the following resources:
- Resource Group: Container for all resources
- Virtual Network: Private network with dedicated subnets
- Azure Machine Learning Workspace: ML workspace with private endpoint configuration
- A10v5 Compute Instance: GPU-enabled compute instance for healthcare AI workloads
- Healthcare AI Endpoints: Online endpoints for CXRReportGen, MedImageParse, and MedImageInsight models
- Private Endpoints: Secure network access to ML workspace and model endpoints
- Supporting Resources: Key Vault, Storage Account, Application Insights
- DNS Configuration: Private DNS zones for name resolution
The configuration includes three specialized healthcare AI agents:
- CXRReportGen: Automated chest X-ray report generation
- MedImageParse: Medical image segmentation and tumor size calculation
- MedImageInsight: Medical image and text embedding for tumor malignancy assessment
-
Azure CLI: Install and authenticate with Azure
az login az account set --subscription "your-subscription-id"
-
Terraform: Install Terraform >= 1.0
# On macOS with Homebrew brew install terraform # On Ubuntu/Debian wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list sudo apt update && sudo apt install terraform
-
SSH Key Pair: Generate SSH keys for compute instance access
ssh-keygen -t rsa -b 4096 -C "your-email@example.com"
-
Copy the example variables file:
cp terraform.tfvars.example terraform.tfvars
-
Edit terraform.tfvars with your specific values:
- REQUIRED: Update
subscription_idwith your Azure subscription ID - Update
ssh_public_keywith your public key content - Modify
resource_group_name,location, andprefixas needed - Choose appropriate
a10v5_vm_sizebased on your requirements - Configure healthcare agent settings (
healthcare_agents_enabled, model names) - Add relevant tags for your organization
- REQUIRED: Update
Note: Azure Provider 4.0+ requires explicit subscription ID configuration. You can either set it in terraform.tfvars or use the ARM_SUBSCRIPTION_ID environment variable.
| Size | vCPUs | RAM (GiB) | GPU Fraction | Use Case |
|---|---|---|---|---|
| Standard_NV6ads_A10_v5 | 6 | 55 | 1/6 GPU | Light ML workloads, development |
| Standard_NV12ads_A10_v5 | 12 | 110 | 1/3 GPU | Medium ML workloads |
| Standard_NV18ads_A10_v5 | 18 | 165 | 1/2 GPU | Heavy ML workloads |
| Standard_NV36ads_A10_v5 | 36 | 330 | 1 GPU | Full GPU ML workloads |
| Standard_NV72ads_A10_v5 | 72 | 660 | 2 GPUs | Multi-GPU ML workloads |
-
Initialize Terraform:
terraform init
-
Validate configuration:
terraform validate
-
Plan deployment:
terraform plan
-
Apply configuration:
terraform apply
The configuration creates private endpoints for secure access to the ML workspace. The workspace is configured with public_network_access_enabled = false, meaning it can only be accessed through the private endpoint.
Private DNS zones are automatically configured for:
privatelink.api.azureml.ms- ML workspace API accessprivatelink.notebooks.azure.net- Jupyter notebooks access
- The compute instance is deployed in a private subnet with no public IP
- SSH access is available through the private network only
- All ML workspace communication happens over private endpoints
After successful deployment, the following outputs are available:
resource_group_name: Name of the created resource groupmachine_learning_workspace_name: Name of the ML workspacecompute_instance_name: Name of the A10v5 compute instanceprivate_endpoint_ip: Private IP of the ML workspace endpointkey_vault_uri: URI of the associated Key Vaultstorage_account_name: Name of the storage accountcxr_report_gen_endpoint_uri: CXRReportGen model endpoint URImed_image_parse_endpoint_uri: MedImageParse model endpoint URImed_image_insight_endpoint_uri: MedImageInsight model endpoint URIhealthcare_endpoints: All healthcare AI model endpoints
- Access ML Workspace: Through Azure Portal
- Connect to Compute Instance: Via SSH using private key
- Configure Healthcare Agents: Update endpoint URLs in agent configuration
- Start Healthcare AI Development: Use Jupyter notebooks with healthcare AI samples
- Deploy Models: Use the healthcare AI endpoints for inference
After deployment, configure the healthcare agents:
# SSH into the compute instance
ssh azureuser@<compute-instance-ip>
# Navigate to healthcare agents directory
cd /home/azureuser/healthcare-agents
# Update configuration with deployed endpoint URLs
vim config.py
# Test healthcare agents
python cxr_report_gen.py --test
python med_image_parse.py --test
python med_image_insight.py --test- Private Network: All resources are deployed in a private network
- No Public Access: ML workspace has public access disabled
- Key Vault: Secrets and keys are stored in Azure Key Vault with purge protection
- SSH Keys: Compute instance access requires SSH key authentication
- Network Policies: Private endpoint network policies are properly configured
main.tf: Core infrastructure definition with healthcare AI endpointsvariables.tf: Configurable parameters including healthcare agent settingsoutputs.tf: Important output values including healthcare endpoint URIsterraform.tfvars.example: Example configuration with healthcare variablesdeploy.sh: Automated deployment scriptinstall-healthcare-agents.sh: Standalone healthcare AI installation script (Linux/macOS)install-healthcare-agents.ps1: Standalone healthcare AI installation script (Windows PowerShell)DATA_SCIENCE_TOOLS.md: Comprehensive data science tooling recommendations
- Purpose: Automated chest X-ray report generation
- Input: Chest X-ray images (DICOM or standard formats)
- Output: Structured radiology reports with findings
- Use Cases: Radiology workflow automation, preliminary screening
- Purpose: Medical image segmentation and analysis
- Input: Medical images (CT, MRI, X-ray)
- Output: Segmentation masks, tumor measurements
- Use Cases: Tumor detection, organ segmentation, quantitative analysis
- Purpose: Medical image and text embedding
- Input: Medical images and clinical text
- Output: Malignancy likelihood scores, embeddings
- Use Cases: Tumor classification, clinical decision support
For installation without Terraform, use the standalone script:
# Set environment variables
export ARM_SUBSCRIPTION_ID="your-subscription-id"
export RESOURCE_GROUP_NAME="rg-healthcare-ai"
export LOCATION="eastus"
export SSH_PUBLIC_KEY="$(cat ~/.ssh/id_rsa.pub)"
# Run installation script
./install-healthcare-agents.sh# Set environment variables
$env:ARM_SUBSCRIPTION_ID = "your-subscription-id"
$env:SSH_PUBLIC_KEY = Get-Content ~/.ssh/id_rsa.pub -Raw
# Run installation script with parameters
.\install-healthcare-agents.ps1 -ResourceGroupName "rg-healthcare-ai" -Location "eastus"- A10v5 instances are charged per hour when running
- Consider using smaller VM sizes for development/testing
- Stop compute instances when not in use to reduce costs
- Monitor usage through Azure Cost Management
- Quota Limits: Ensure your subscription has sufficient quota for A10v5 VMs
- Region Availability: A10v5 VMs are not available in all regions
- SSH Access: Ensure your SSH public key is correctly formatted
- DNS Resolution: Private DNS zones may take time to propagate
# Check Terraform state
terraform state list
# Show specific resource details
terraform state show azurerm_machine_learning_compute_instance.a10v5_instance
# Refresh state
terraform refresh
# Destroy resources (use with caution)
terraform destroyFor issues related to:
- Terraform: Check the Terraform Azure Provider documentation
- Azure ML: Refer to Azure Machine Learning documentation
- A10v5 VMs: See Azure VM sizes documentation
For detailed documentation and data science tooling recommendations, see:
README.md- This fileDATA_SCIENCE_TOOLS.md- Comprehensive tooling guideDEPLOYMENT_GUIDE.md- Quick deployment guide
This configuration is provided as-is for educational and deployment purposes.