Files

128 lines
3.0 KiB
Markdown
Raw Permalink Normal View History

# 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](https://opentofu.org/) >= 1.0 or [Terraform](https://www.terraform.io/) >= 1.0
- Azure CLI configured with appropriate credentials
- Azure subscription with necessary permissions
## Getting Started
### 1. Authenticate with Azure
```bash
az login
az account set --subscription "<your-subscription-id>"
```
### 2. Initialize OpenTofu
```bash
tofu init
```
Or if using Terraform:
```bash
terraform init
```
### 3. Review the Plan
```bash
tofu plan
```
### 4. Apply the Configuration
```bash
tofu apply
```
## Project Structure
- `main.tf` - Main infrastructure configuration
- `variables.tf` - Input variable definitions
- `outputs.tf` - Output value definitions
- `terraform.tfvars.example` - Example variable values (copy to `terraform.tfvars`)
## Configuration
### Required Configuration
1. Copy the example variables file:
```bash
cp terraform.tfvars.example terraform.tfvars
```
2. Edit `terraform.tfvars` and set your admin password:
```hcl
admin_password = "YourSecurePassword123!"
```
**Important**: The password must be at least 12 characters long and contain uppercase, lowercase, and numbers.
3. **Security Recommendation**: Change `allowed_rdp_source` to your public IP address instead of `"*"`:
```hcl
allowed_rdp_source = "YOUR_PUBLIC_IP/32"
```
You can find your public IP with:
```bash
curl ifconfig.me
```
### Optional Customization
You can also customize:
- `resource_group_name`: Name of the resource group
- `location`: Azure region (default: westeurope)
- `vm_name`: Name of the virtual machine
- `vm_size`: VM size (default: Standard_B2s)
- `vnet_address_space`: Virtual network address space
- `subnet_address_prefix`: Subnet address prefix
## Connecting to the VM
After the infrastructure is created, you can connect to the Windows VM via RDP:
1. Get the public IP address:
```bash
tofu output vm_public_ip
```
2. Connect using Remote Desktop:
- **Windows**: Use the connection string from output:
```bash
tofu output rdp_connection_string
```
- **macOS**: Use Microsoft Remote Desktop app
- **Linux**: Use Remmina or similar RDP client
3. Login credentials:
- Username: The value you set for `admin_username` (default: azureadmin)
- Password: The password you set in `terraform.tfvars`
## Cleanup
To destroy all resources:
```bash
tofu destroy
```
**Warning**: This will permanently delete all resources created by this configuration.