Preparing to Deploy PCF on Azure using Terraform
Page last updated:
This guide describes the preparation steps required to install Pivotal Cloud Foundry (PCF) on Azure using Terraform templates.
The Terraform template for PCF on Azure describes a set of Azure resources and properties. For more information about how Terraform creates resources in Azure, see the Azure Provider topic on the Terraform site.
You may also find it helpful to review different deployment options in the Reference Architecture for Pivotal Cloud Foundry on Azure.
In addition to fulfilling the prerequisites listed in the Installing Pivotal Cloud Foundry on Azure topic, ensure you have the following:
- The Terraform CLI
- In your Azure project, ensure you have completed the steps in Preparing to Deploy PCF on Azure to create a service principal.
Before you can run Terraform commands to create infrastructure resources, you must fill out a template variables file.
Select Pivotal Application Service. The Pivotal Application Service page opens.
Download the Azure Terraform zip file.
Extract the contents of the zip file and move the folder to the
workspacedirectory on your local machine.
From a terminal window, navigate to the folder:
$ cd ~/workspace/TERRAFORMING-AZURE-FOLDER
Create a new file named
$ touch terraform.tfvars
terraform.tfvarsfile and paste in the following contents:
subscription_id = "YOUR-SUBSCRIPTION-ID" tenant_id = "YOUR-TENANT-ID" client_id = "YOUR-CLIENT-ID" client_secret = "YOUR-CLIENT-SECRET" env_name = "YOUR-ENVIRONMENT-NAME" location = "YOUR-AZURE-LOCATION" ops_manager_image_uri = "YOUR-OPS-MAN-IMAGE-URI" dns_suffix = "YOUR-DNS-SUFFIX" vm_admin_username = "YOUR-ADMIN-USERNAME"
Edit the values in the file according to the table below:
Value to replace Guidance
Enter the subscription ID of your Azure service principal. Terraform uses this ID when creating resources.
Enter the tenant ID of your Azure service principal. Terraform uses this ID when creating resources.
Enter the client ID of your Azure service principal. Terraform uses this ID when creating resources.
Enter your Azure service client secret. Terraform requires this secret to create resources.
Enter a name to use to identify resources in Azure. Terraform prepends the names of the resources it creates with this environment name. Example:
Enter the name of the Azure location in which you want Terraform to create resources. Example:
Enter the URL for the Ops Manager Azure image you want to boot. You can find this code in the PDF included with the Ops Manager release on Pivotal Network.
Enter a domain name to use as part of the system domain for your PCF deployment. Terraform creates DNS records in Azure using
YOUR-DNS-SUFFIX. For example, if you enter
example.comfor your DNS suffix and have
pcfas your environment name, Terraform creates DNS records at
Enter the admin username you want to use for your Ops Manager deployment.
Complete this section if you plan to deploy the Isolation Segment tile.
Note: You can see the configurable options by opening the
variables.tf file and looking for variables with default values.
Add the following variable to your
This causes Terraform to create an additional HTTP load balancer and DNS record to use for the Isolation Segment tile.
isolation_segment = "true"
Follow these steps to use the Terraform CLI to create resources on Azure:
From the directory that contains the Terraform files, run
terraform initto initialize the directory based on the information you specified in the
$ terraform init
Run the following command to create the execution plan for Terraform.
$ terraform plan -out=plan
Run the following command to execute the plan from the previous step. It may take several minutes for Terraform to create all the resources in Azure.
$ terraform apply plan
In a browser, navigate to the DNS provider for the DNS suffix you entered in your
Create a new NS (Name server) record for your PCF system domain. Your system domain is
In this record, enter the name servers included in
env_dns_zone_name_serversfrom your Terraform output.
Proceed to the next step in the deployment, Configuring BOSH Director on Azure (Terraform).