Skip to content

Deploy the demo

  • Terraform at the version floor in terraform/versions.tf>= 1.8, for provider-defined functions and the check block that guards the VIP.
  • The xcsh provider. Nothing pins a version: .terraform.lock.hcl is gitignored and the constraint is an open-ended floor, so every init resolves the latest published release. That is deliberate for a prerelease project — the demo should fail on a provider regression rather than sit on a stale version that hides it.
  • An F5 XC API credential for the tenant in var.expected_xc_tenant, exported as XCSH_API_TOKEN (or the P12/PEM pair). Export the credential only, never a URL — see below.
  • Azure credentials with rights to create a resource group, VNet, Route Server and VMs.
  • A pre-existing F5 XC namespace for the app tier. The deployment reads it and never creates or destroys it, so a namespace holding unrelated demos can never land on this stack’s destroy list.

Every variable has a default or derived default. For internet readers and reference deployments, supply your own values via terraform.tfvars so deployment-specific names, subscriptions, domains, and addresses are not hardcoded into configuration:

Terminal window
cd terraform
cp terraform.tfvars.example terraform.tfvars
VariableDefault / RoleWhy it should be customized
origin_ip(no default)Public IP of your origin server (e.g. 203.0.113.10 from RFC 5737 documentation space).
lb_domain(no default)FQDN for Rest of World traffic (e.g. mcn-ce-ha.f5-sales-demo.com or mcn.example.com).
ca_lb_domainmcn-ce-ha.f5-sales-demo.caFQDN for Canada-only traffic (e.g. mcn.example.ca).
enable_canadatrueToggle to deploy parallel Canadian regional infrastructure, virtual sites, and load balancer.
ca_locationcanadacentralAzure region for Canadian CEs and Route Server.
ca_hub_cidr10.200.0.0/16VNet CIDR block for Canadian Hub VNet (RFC 1918 space).
ca_vip10.250.1.10HA VIP advertised by Canadian CEs via eBGP (must be outside VNet CIDRs).
ca_re_cities["toronto", "montreal"]List of Regional Edge cities for Canadian RE Virtual Site selector expression.

Both origin_ip and domains are format-validated so a typo fails the plan rather than runtime routing.

terraform.tfvars is gitignored to protect sensitive environment variables, subscription IDs, and custom credentials.

The tenant is configuration, not whatever your shell is exporting

Section titled “The tenant is configuration, not whatever your shell is exporting”

var.expected_xc_tenant names the tenant and is the only place it is named. providers.tf derives the xcsh provider’s api_url from it, which deliberately overrides any XCSH_API_URL in the environment, and a postcondition in terraform/main.tf fails the plan when the environment names a different tenant.

Read either half without running anything that changes state:

Terminal window
terraform output -raw xc_tenant # what the deployment targets
terraform output -raw xc_env_tenant # what your shell claims — diagnostic only

Illustrative output for a correctly matched configuration:

example-corp
example-corp
  1. Initialise. The backend config is not committed; supply your own.

    Terminal window
    terraform init -upgrade -backend-config=backend.hcl
  2. First apply. This builds Azure, the CE sites and the registration token, and boots the CEs.

    Terminal window
    terraform apply
  3. Apply again once the CEs have registered. This is not optional, and the reason is below rather than being something you discover.

    Terminal window
    terraform apply

Then go to prove it healthy before showing it to anyone.

Registration approval is automated, and the apply is still two-phase

Section titled “Registration approval is automated, and the apply is still two-phase”

Registration approval no longer needs a human in the console: the xcsh_registration_approval resource performs it, and the site module resolves which registration to approve.

That still does not make the deployment a single hands-off apply, and the reason is worth understanding before you watch a first run and conclude it failed:

  • A CE’s registration object is named r-<uuid>. It is never named after the site, so nothing can predict the name at plan time.
  • The registration only exists after the VM has booted and vpm has registered.
  • So the first apply plans no approval at all. Re-apply once the CEs have registered and the approvals are created.

terraform/main.tf documents this ordering at the top of the file, which is the authoritative version — the deploy sequence lives with the code that implements it.

The deployment writes an operator key to the appliance admin account, whose login shell is the Site CLI. It is written by cloud-init write_files, which runs once on first boot.

Terminal window
terraform destroy

The app namespace survives: it is read, never managed, so destroy cannot take a namespace holding unrelated demos with it. Everything else in the resource group goes.