This is an blueprint of building [SQL Server Always On Availability Groups](https://cloud.google.com/compute/docs/instances/sql-server/configure-availability)
The actual setup process (apart from Active Directory operations) has been scripted, so that least amount of
manual works needs to performed:
- Joining the domain using appropriate credentials
- Running an automatically generated initialization script (`C:\InitializeCluster.ps1`)
- Creating the [Availability Groups using the wizard](https://cloud.google.com/compute/docs/instances/sql-server/configure-availability#creating_an_availability_group)
(please note that healthchecks are automatically configured when the appropriate AGs are created)
To monitor the installation process, the startup scripts log output to Application Log (visible under Windows Logs in Event Viewer)
and to `C:\GcpSetupLog.txt` file.
<!-- TFDOC OPTS files:1 -->
<!-- BEGIN TFDOC -->
## Files
| name | description | modules |
|---|---|---|
| [instances.tf](./instances.tf) | Creates SQL Server instances and witness. | <code>compute-vm</code> |
| [main.tf](./main.tf) | Module-level locals and resources. | <code>project</code> |
| [sql_admin_password](variables.tf#L148) | Password for the SQL admin user to be created. | <code>string</code> | ✓ | |
| [subnetwork](variables.tf#L163) | Subnetwork to use in the project. | <code>string</code> | ✓ | |
| [always_on_groups](variables.tf#L33) | List of Always On Groups. | <code>list(string)</code> | | <code>["bookshelf"]</code> |
| [boot_disk_size](variables.tf#L39) | Boot disk size in GB. | <code>number</code> | | <code>50</code> |
| [cluster_name](variables.tf#L45) | Cluster name (prepended with prefix). | <code>string</code> | | <code>"cluster"</code> |
| [data_disk_size](variables.tf#L51) | Database disk size in GB. | <code>number</code> | | <code>200</code> |
| [project_create](variables.tf#L122) | Provide values if project creation is needed, uses existing project if null. Parent is in 'folders/nnn' or 'organizations/nnn' format. | <codetitle="object({ billing_account_id = string parent = string })">object({…})</code> | | <code>null</code> |
| [region](variables.tf#L136) | Region for resources. | <code>string</code> | | <code>"europe-west4"</code> |
| [shared_vpc_project_id](variables.tf#L142) | Shared VPC project ID for firewall rules. | <code>string</code> | | <code>null</code> |
| [sql_client_cidrs](variables.tf#L157) | CIDR ranges that are allowed to connect to SQL Server. | <code>list(string)</code> | | <code>["0.0.0.0/0"]</code> |
| [vpc_ip_cidr_range](variables.tf#L168) | Ip range used in the subnet deployef in the Service Project. | <code>string</code> | | <code>"10.0.0.0/20"</code> |