← Back to Central Guide
Terraform And Bootstrap Guide Provisioning Path
Tested Infrastructure Reality

Terraform And Bootstrap Guide

This page explains what the current Terraform environment and VM bootstrap actually create, what they do not create, and how to apply, re-run, and troubleshoot the estate without relying on outdated assumptions.

3Primary VM Roles
4Storage Containers
1SQL MI Target
F:Working Data Drive
What changed

This guide now follows the tested repository behavior instead of the older proposal-era assumptions.

⚠️
What to remember

Terraform and bootstrap prepare the platform, but real application deployment, validation (now automated via GitHub Actions and Azure Run Commands), and manual checks still matter.

01

What This Guide Covers

Use this page when the problem is infrastructure creation, private connectivity, VM bootstrap, installer sourcing, or re-running Terraform safely.

The key correction

Older documentation understated how much the current Terraform and bootstrap now prepare, while also overstating some older installer and path assumptions. This page corrects both sides.

02

Prerequisites Before Running Apply

Treat these as the minimum conditions for a clean and understandable run. Skipping them usually produces confusion that looks like Terraform failure later.

Prerequisite Why it matters
Correct environment selection You need to be sure you are targeting the test environment configuration and not another state or subscription context.
Access to required Azure resources Terraform can only create or read what the active identity is allowed to manage.
Expected storage inputs available Bootstrap relies on storage-backed content such as scripts and artifact-related material.
Clear understanding of scope You should know whether you are provisioning from scratch, repairing drift, or re-running bootstrap after a failed attempt.
03

What The Current Terraform Baseline Creates

The tested environment provisions a meaningful baseline. It is not only empty infrastructure, but it is also not the same as a full application deployment.

🌐

Network Baseline

Virtual networking (UK West region), segmentation, private routing intent, Bastion-oriented access, NAT Gateway for internet egress, and VNet peering to an externally-managed SQL Managed Instance VNet.

🗄️

Data Baseline

Azure SQL Managed Instance targeting, storage account resources, and the foundation needed for environment data operations.

🖥️

Compute Baseline

Web, worker, and build VMs with role-specific bootstrap logic triggered through the VM extension path.

What it does not mean

Successful apply does not mean the web application and worker payloads are already deployed. It means the environment is provisioned and prepared to receive them.

04

Execution Order You Should Expect

Understanding the order helps you decide where a failure belongs: infrastructure definition, VM provisioning, extension execution, or post-bootstrap deployment.

1
Terraform creates the core Azure resources. This includes the main resource topology for networking, storage, data, and compute.
2
VM creation completes. At this point the machines exist, but role preparation may still be running or pending.
3
VM extensions run role bootstrap scripts. This is where the web, worker, and build VMs become meaningfully prepared.
4
Prepared folders, tools, and services appear. This is the handoff point from provisioning into deployment and validation.
05

Bootstrap Expectations By VM Role

The role bootstrap scripts are one of the most important corrections to the old documentation. They now do more practical preparation than the old presentation suggested.

Role What bootstrap now prepares What still needs later work
Web VM IIS-related prerequisites, app structure, Java, Solr, Memcached, and prepared application paths on F:. Copying the real built web payload and confirming live site behavior.
Worker VM Framework features, service-hosting support, worker directories, host aliases, and service preparation patterns. Deploying the real worker binaries and proving queue, Totem, and downstream behavior.
Build VM Git, NuGet, NSSM, PowerShell modules, runner-related setup, and the signed Visual Studio Build Tools install flow. Producing proven build outputs and turning the machine into the trusted build source.

Current path assumption

The tested environment uses F: as the main prepared application drive. Old D: references should be treated as outdated unless a new environment intentionally changes that design.

06

Storage, Secrets, And Access Reality

These are areas where old assumptions caused repeated confusion during the real environment build.

Area Tested guidance
Storage containers The relevant container set includes backup, restore, scripts, and artifacts.
Build tools installer source The current bootstrap flow expects required installers and utilities, including build tooling, to be present in the configured Blob storage layout.
Package cache location The tested guidance places the Visual Studio package cache on F:\vs-package-cache.
Terraform backend The test environment now uses Azure remote state, so GitHub Actions can plan and apply against the same backend safely.
Access path Bastion and private-connectivity behaviors are part of the intended access model, but guest-level SSH is still required for real scp usage.
07

Script, Storage, And Log Map

This is the practical map of where the current provisioning model stores its bootstrap assets and where you inspect evidence after apply runs.

Repository bootstrap scripts

The source scripts live under the Terraform bootstrap area and are uploaded into storage during provisioning.

src/terraform/bootstrap/windows/
Blob container layout

The tested storage layout includes the containers used for scripts, artifacts, and environment data movement.

backup / restore / scripts / artifacts
CI/CD dependency source (active)

The same storage pattern is the active source for the encrypted vendor dependency bundle (.zop AES-256) used by GitHub-hosted windows-2022 runners during build workflows.

artifacts / installers / dependency bundle (.zop)
Guest bootstrap logs

The main bootstrap evidence is on the VM itself, not only in Terraform output.

C:\Bootstrap\Logs
Build-specific package cache

The current build tools install path uses the tested package cache on the data drive.

F:\vs-package-cache
Role Primary log path Primary state path
Build VM C:\Bootstrap\Logs\bootstrap-build.log C:\Bootstrap\State\build-<bootstrapVersion>
Worker VM C:\Bootstrap\Logs\bootstrap-worker.log C:\Bootstrap\State\worker-<bootstrapVersion>
Web VM C:\Bootstrap\Logs C:\Bootstrap\State
08

Re-runs, Repairs, And Drift

Not every Terraform run is a first-time apply. Sometimes you are re-running because an extension failed, because a VM was rebuilt, or because a script changed.

  1. Decide what kind of rerun this is. Full environment apply, targeted repair, or validation-only follow-up.
  2. Check whether the failure belongs to Azure provisioning or guest bootstrap. They are different recovery paths.
  3. Prefer understanding the existing state before forcing changes. Blind reruns can hide the real failure location.
  4. After a successful rerun, return to the validation flow. Provisioning success still needs runtime proof.

Drift reminder

If someone manually changes the environment after apply, Terraform may not match what the VM actually looks like during troubleshooting. Always check whether drift was introduced outside code.

Firewall public IP changes after destroy/rebuild

The Azure Firewall public IP is dynamic — it changes every time you destroy and rebuild the environment. After a rebuild, retrieve the new IP with terraform output firewall_public_ip and update any external access rules or DNS records that reference it.

09

Quick Status Checks You Can Run

These are the fast checks that tell you whether Azure, Terraform, and guest bootstrap are aligned enough for you to proceed.

1
List VM power and provisioning state
az vm list -g "$SPOKE_RG" -d \ --query "[].{vm:name, power:powerState, provisioning:provisioningState, privateIp:privateIps}" \ -o table
2
Check bootstrap extension state
for vm in "$BUILD_VM" "$WEB_VM" "$WORKER_VM"; do az vm extension show \ -g "$SPOKE_RG" \ --vm-name "$vm" \ -n "bootstrap-$vm" \ --query "{name:name, provisioningState:provisioningState, bootstrapVersion:settings.bootstrapVersion}" \ -o json done
3
Check Terraform drift
TF_VAR_subscription_id="$SUBSCRIPTION_ID" \ TF_VAR_sql_admin_password='YOUR_SQL_PASSWORD' \ TF_VAR_vm_admin_password='YOUR_VM_PASSWORD' \ terraform -chdir="$TF_DIR" plan -input=false
10

Troubleshooting Patterns

These patterns separate likely infrastructure issues from likely deployment or runtime issues.

Terraform succeeded but the app does not work

This is usually a deployment or configuration problem, not a resource-creation problem. Move from this guide into the Central Runbook.

VM exists but role setup is incomplete

This usually points to VM extension or bootstrap execution problems rather than Terraform network or resource-definition problems.

Build VM assumptions still mention old installer flow

Correct the mental model first. The current path relies on the Blob-backed bootstrap prerequisites and the tested package cache location on F:.

11

When Terraform Hands Off To Validation

Provisioning and validation are connected, but they are not the same stage. This is the exact handoff point.

1
Terraform and bootstrap finish. The landing zone is ready.
2
Trusted application artifacts are deployed. Real payload replaces placeholder-only structure.
3
Runtime validation begins with the web VM. This proves the application tier before background processing checks begin.

Best next page

After apply and bootstrap are complete, move into the Central Runbook for manual validation order, or into the GitHub CI/CD Guide if you are designing the automation path.

12

Reuse Pattern For Future Projects

This guide can be reused if you treat it as a pattern for how infrastructure guides should be written, not only as Pearl-specific instructions.

  • Document what apply creates. Be explicit about what becomes real automatically.
  • Document what bootstrap prepares. Separate guest preparation from final application deployment.
  • Document what still requires manual or pipeline work. This prevents false confidence after apply succeeds.
  • Document the handoff into validation. Infrastructure teams and application teams need a clear boundary.