Trusted AI Demo - OpenTofu Infrastructure
This project contains OpenTofu/Terraform configuration for the Trusted AI Demo infrastructure on Azure.
Infrastructure Components
This configuration creates:
- Resource Group: Container for all Azure resources
- Virtual Network: 10.0.0.0/16 address space
- Subnet: 10.0.1.0/24 for VM placement
- Network Security Group: With RDP (port 3389) rule for remote access
- Public IP: Static public IP for VM access
- Network Interface: Connects VM to the virtual network
- Windows Server 2022 VM: Standard_B2s (2 vCPUs, 4 GB RAM)
Prerequisites
- OpenTofu >= 1.0 or Terraform >= 1.0
- Azure CLI configured with appropriate credentials
- Azure subscription with necessary permissions
Getting Started
1. Authenticate with Azure
az login
az account set --subscription "<your-subscription-id>"
2. Initialize OpenTofu
tofu init
Or if using Terraform:
terraform init
3. Review the Plan
tofu plan
4. Apply the Configuration
tofu apply
Project Structure
main.tf- Main infrastructure configurationvariables.tf- Input variable definitionsoutputs.tf- Output value definitionsterraform.tfvars.example- Example variable values (copy toterraform.tfvars)
Configuration
Required Configuration
-
Copy the example variables file:
cp terraform.tfvars.example terraform.tfvars -
Edit
terraform.tfvarsand set your admin password:admin_password = "YourSecurePassword123!"Important: The password must be at least 12 characters long and contain uppercase, lowercase, and numbers.
-
Security Recommendation: Change
allowed_rdp_sourceto your public IP address instead of"*":allowed_rdp_source = "YOUR_PUBLIC_IP/32"You can find your public IP with:
curl ifconfig.me
Optional Customization
You can also customize:
resource_group_name: Name of the resource grouplocation: Azure region (default: westeurope)vm_name: Name of the virtual machinevm_size: VM size (default: Standard_B2s)vnet_address_space: Virtual network address spacesubnet_address_prefix: Subnet address prefix
Connecting to the VM
After the infrastructure is created, you can connect to the Windows VM via RDP:
-
Get the public IP address:
tofu output vm_public_ip -
Connect using Remote Desktop:
- Windows: Use the connection string from output:
tofu output rdp_connection_string - macOS: Use Microsoft Remote Desktop app
- Linux: Use Remmina or similar RDP client
- Windows: Use the connection string from output:
-
Login credentials:
- Username: The value you set for
admin_username(default: azureadmin) - Password: The password you set in
terraform.tfvars
- Username: The value you set for
Cleanup
To destroy all resources:
tofu destroy
Warning: This will permanently delete all resources created by this configuration.