Bring your own infrastructure¶
Do you already manage shared Azure resources with Terraform? Point ESAF at those resources with the settings below. Decide which tool owns each resource, so that Terraform and ESAF never change the same one.
ESAF deploys with Bicep
ESAF has no Terraform templates of its own. You keep Terraform for the resources it already manages, and ESAF deploys the rest with Bicep.
Choose Terraform: the iac switch¶
iac in the factory configuration (variables.json, dev) picks the tool for the factory foundation:
"iac": "bicep" (the default) or "iac": "terraform". Set it before the factory is first deployed; one tool
per factory, because switching needs a terraform import. A new scale set takes the factory's iac.
"iac": "terraform",
"tfstateResourceGroup": "rg-aif-tfstate-sdc-001",
"tfstateStorageAccount": "staiftfstatesdc001",
"tfstateContainer": "tfstate",
"tfstateSubscriptionId": ""
| Key | GitHub variable of infra-common-terraform.yml |
Default |
|---|---|---|
tfstateResourceGroup |
TFSTATE_RESOURCE_GROUP |
required with Terraform |
tfstateStorageAccount |
TFSTATE_STORAGE_ACCOUNT |
required with Terraform |
tfstateContainer |
TFSTATE_CONTAINER |
tfstate |
tfstateSubscriptionId |
TFSTATE_SUBSCRIPTION_ID |
the target subscription |
With the Factory API (esaf.init_factory(..., iac="terraform"), azurefactory esaf init-factory --iac terraform),
the API installs infra-common-terraform.yml instead of infra-common.yml, sets those GitHub variables and runs
the factory common through the pipeline route. It refuses Terraform with Azure DevOps (only a GitHub Actions
template exists), with an accelerator that has no Terraform template (before v1.26), without the two required
state keys, or for a factory that already uses the other tool. Projects stay on Bicep until the Terraform
project slice ships. Deleting a scale set or the factory also removes its state blobs
(aifactory/<subscription>/<common resource group>/...). Keep the state account outside the factory, so it
survives the factory's deletion, and give the deployment identity Storage Blob Data Contributor on it.
A practical split¶
Your platform team provides subscriptions, the hub network, DNS, storage or other common services. ESAF then uses them through these settings.
| Input | What it identifies |
|---|---|
vnetNameFull_param, vnetResourceGroup_param |
Existing VNet and its resource group |
commonResourceGroup_param |
Common resource-group reference |
datalakeName_param |
Existing data-lake account |
kvNameFromCOMMON_param |
Existing common Key Vault |
BYO_subnets and the subnet names |
Use subnets that already exist |
centralDnsZoneByPolicyInHub and privDns* settings |
Central private-DNS design and location |
See all parameters for the exact names and conditions. Give the deployment identity access to each resource you name.
Before you integrate¶
- Agree which tool owns each resource and its state.
- Collect the IDs, subscriptions, address ranges, DNS zones and routes.
- Give the deployment identity only the permissions it needs.
- Read what a Factory or project deletion removes, so that it stays away from the resources Terraform owns. See Clean up.
More info
ESAF doesn't read Terraform state. You name each existing resource in the settings.