Deploying Ops Manager on Azure Using Terraform
Page last updated:
This guide describes the preparation steps required to deploy Ops Manager to Azure using Terraform templates.
The Azure Terraform templates describe 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 PCF on Azure.
Prerequisites
In addition to fulfilling the prerequisites listed in the Installing Pivotal Cloud Foundry on Azure topic, ensure you have the following:
The Terraform CLI. For information about installing the Terraform CLI, see Installing Terraform in the Terraform documentation.
In your Azure project, ensure you have completed the steps in Preparing to Deploy Ops Manager on Azure Using Terraform to create a service principal.
Step 1: Download Templates and Edit Variables File
Before you can run Terraform commands to provision infrastructure resources, you must download the Azure Terraform Templates and create a Terraform template variables file. To download the templates and create the template variables file:
On Pivotal Network, navigate to the Pivotal Application Service (PAS) release.
Download the Azure Terraform Templates ZIP file. You can use the templates to deploy PAS or Enterprise Pivotal Container Service (Enterprise PKS).
Extract the contents of the ZIP file.
Move the extracted folder to the
workspace
directory on your local machine.On the command line, navigate to the directory. For example:
$ cd ~/workspace/pivotal-cf-terraforming-azure
Navigate to the
terraforming-pas
orterraforming-pks
directory that contains the Terraform files for your runtime.In the runtime directory, create a text file named
terraform.tfvars
.Open the
terraform.tfvars
file and add the following:subscription_id = "YOUR-SUBSCRIPTION-ID" tenant_id = "YOUR-TENANT-ID" client_id = "YOUR-APP-ID" client_secret = "YOUR-CLIENT-SECRET" env_name = "YOUR-ENVIRONMENT-NAME" env_short_name = "YOUR-ENVIRONMENT-SHORTNAME" 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. For information about locating your Azure service principal values, see Preparing to Deploy Ops Manager on Azure Using Terraform.
Value to replace Guidance YOUR-SUBSCRIPTION-ID
Enter the subscription ID of your Azure service principal. Terraform uses this ID when creating resources. YOUR-TENANT-ID
Enter the tenant ID of your Azure service principal. Terraform uses this ID when creating resources. YOUR-APP-ID
Enter the app ID of your Azure service principal. Terraform uses this ID when creating resources. YOUR-CLIENT-SECRET
Enter your Azure service client secret. Terraform requires this secret to create resources. YOUR-ENVIRONMENT-NAME
Enter a name to use to identify resources in Azure. Terraform prepends the names of the resources it creates with this environment name. This environment variable is also used to name the Azure resource group created for the deployment. Example: mypcf
.YOUR-ENVIRONMENT-SHORTNAME
Enter a name to use when creating storage accounts in Azure. Must be a-z only and no longer than 10 characters. Example: myazure
.YOUR-AZURE-LOCATION
Enter the name of the Azure location in which you want Terraform to create resources. Example: Central US
.YOUR-OPS-MAN-IMAGE-URI
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.
To prevent the creation of an Ops Manager VM, set this value to an empty string (""
). When using Platform Automation, you must disable the creation of the Ops Manager VM from Terraform. For more information, see Platform Automation.YOUR-DNS-SUFFIX
Enter a domain name to use as part of the system domain for your deployment. Terraform creates DNS records in Azure using YOUR-ENVIRONMENT-NAME
andYOUR-DNS-SUFFIX
. For example, if you enterexample.com
for your DNS suffix and havepcf
as your environment name, Terraform creates DNS records atpcf.example.com
.YOUR-ADMIN-USERNAME
Enter the admin username you want to use for your Ops Manager deployment.
Step 2: (Optional) Add Variables for PCF Isolation Segment
Complete this section if you plan to deploy the PCF 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 terraform.tfvars
file. This causes Terraform to create an additional HTTP load balancer and DNS record to use for the PCF Isolation Segment tile.
isolation_segment = "true"
Step 3: Create Azure Resources with Terraform
Follow these steps to use the Terraform CLI to create resources on Azure:
From the directory that contains the Terraform files, run
terraform init
to initialize the directory based on the information you specified in theterraform.tfvars
file.$ 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
Step 4: Create DNS Record
In a browser, navigate to the DNS provider for the DNS suffix you entered in your
terraform.tfvars
file.Create a new name server (NS) record for your system domain. Your system domain is
YOUR-ENVIRONMENT-NAME.YOUR-DNS-SUFFIX
.In this record, enter the name servers included in
env_dns_zone_name_servers
from your Terraform output.
Next Steps
Proceed to the next step in the deployment, Configuring BOSH Director on Azure Using Terraform.