Microsoft Azure
Overview
Microsoft Azure Cloud or Azure is a cloud computing service by Microsoft to:
Test, build, deploy, and manage applications using Microsoft managed data centers
Support various programming languages, tools, and frameworks
Microsoft Azure supports both Microsoft-specific and third-party software and systems.
Deploying a Microsoft Azure Terraform Blueprint is a three-step process where you’ll need to:
Before you begin
Ensure that you have access to at least one resource pool.
Create a Terraform Blueprint
Creating a Terraform-based Blueprint is a three-step process. You’ll need to:
Configure a Terraform Backend State
A Terraform backend allows for abstraction and determines how a state is loaded, and operations executed. Terraform uses the local backend by default. In the HCP portal, a Terraform Backend state stores the current state of the deployment. [1]
To create a Terraform Backend State:
Log in to your HCP portal account.
Click Service Orchestration and navigate to Services > Infra as Code > Backend State > Click + New Backend State.
Enter the following details in the New backend State dialog:
Enter a Name for your Backend State.
Select the Cloud Type from the drop-down list.
Select your Resource Pool from the drop-down list.
Enter a brief Description of your Backend State.
To entitle users to your Backend State, select:
Only Me: if you do not want anyone to access your backend state.
Everyone: if you want to share your backend state with everyone.
Groups & Users: if you want to share the backend state with specific users or groups.
Enter the first three alphabets of the username in the Users drop-down and select the username.
Type the first three alphabets of the Group Name in the Groups drop-down and select the group name.
Click Save Changes.
Note
[1] If the backend state has no state saved previously, the Terraform plan will provide you an information object which will be created.
Otherwise, the Terraform output will show updates and delete tasks too, which means existing resources will change if ignored.
Create a Terraform Workspace
Workspaces are collections of infrastructure that run locally. In other words, a workspace is an isolated instance of state data for a Terraform CLI. A Terraform workspace manages each collection of infrastructure with a persistent working directory, which contains a configuration, state data, and variables. You can create multiple workspaces to manage various sets of discrete infrastructure from a single configuration in a single directory. The Terraform cloud manages infrastructure collections through workspaces instead of directories. The terraform workspace organizes your infrastructure into groups. You can create a workspace to manage your collection of infrastructure resources.
To create a Terraform Workspace: [1]
Login to your HCP account.
Click Service Orchestration and navigate to Infra as Code > Workspace > Click + New Workspace.
Enter the following details in the New Workspace dialog:
Enter your workspace Name.
Enter a brief description of your Workspace.
Select your workspace Environment.
Select the Cloud Type from the drop-down list.
Select your Resource Pool from the drop-down list.
Select your Backend State from the drop-down list.
To entitle users to your new Workspace, select:
Only Me: if you do not want anyone to access your Workspace.
Everyone: if you want to share your Workspace with everyone.
Groups & Users: if you want to share the Workspace with specific users or groups.
Enter the first three alphabets of the username in the Users drop-down and select the username.
Type the first three alphabets of the Group Name in the Groups drop-down and select the group name.
Click New Workspace.
Notes
[1] Resource pool contains cloud provider information. Therefore, a Terraform deployment does not affect the quota limit of the resource pool.
Create a Terraform Blueprint
Terraform-based blueprints let you create infrastructure on your cloud environment using a template.
Follow these steps to create a Terraform-based blueprint:
Log in to your HCP portal account.
Click Service Orchestration and navigate to AppStore > Click New > Select Terraform from the drop-down list.
Enter these details in the New Terraform dialog:
Enter a Name for your Terraform Template,
Example: Azure PostgreSQL (PaaS).Enter a brief description of your Terraform Template. This is an optional field.
You can create a Terraform template using a template file in .zip format. Click Choose File to upload a Terraform template file.
Configure your Terraform template version. This is an optional step.
Select the Cloud Type from the drop-down list.
To entitle users to your Terraform template, select:
Only Me: if you do not want anyone to access your Terraform template.
Everyone: if you want to share your Terraform template with everyone.
Groups & Users: if you want to share your Terraform template with specific users or groups.
Enter the first three alphabets of the username in the Users drop-down and select the username.
Type the first three alphabets of the Group Name in the Groups drop-down and select the group name.
If you are a Cloud Administrator, you can choose All Tenants to make the template available to all the tenants.
Click Create.
Provision your Resource using Terraform Blueprint
To provision your Microsoft Azure resource using a Terraform blueprint:
Login to your HCP portal account.
Click Service Orchestration and navigate to AppStore > Terraform > Click open your Terraform Blueprint to view Blueprint Azure Postgres (PaaS.)
Review your Terraform details on the Overview page, and click Next.
Enter these details in the workspace page:
Select New from the workspace Type drop-down list.
Enter a Name for your Workspace.
Provide a brief Description of your new Workspace.
Select the Environment Type from the drop-down list.
Select the Cloud Type from the drop-down list.
Select the Resource Pool from the drop-down list.
Select the Backend State for your new Workspace.
To entitle users to your Terraform template:
Only Me: if you do not want anyone to access your Terraform template.
Everyone: if you want to share your Terraform template with everyone.
Groups & Users: if you want to share your Terraform template with specific users or groups.
Enter the first three alphabets of the username in the Users drop-down and select the username.
Type the first three alphabets of the Group Name in the Groups drop-down and select the group name.
Select the Workspace Type - Existing, and click Validate. [1]
From the Define Variables page, click Action and enter the variables in your test case. [2]
Example: rg_name: “hgprod-tf-rg” to define your Resource Group.Click Plan and review the Successful Plan Output. [3]
Click Apply.
Click open your Workspace.
Click Timeline to monitor the Terraform provisioning status.
Once you’ve successfully provisioned your Terraform template, click the Resource to view the resources created via the Terraform template.
Deploy your Terraform Blueprint
Once you’ve provisioned a Terraform Blueprint, you’ll need to deploy it. Follow these steps to deploy your Terraform Blueprint:
Login to your HCP portal account.
Click Service Orchestration and navigate to AppStore > Terraform > Click open your Terraform Blueprint.
Select your Workspace and click Validate.
Check your Terraform variables for syntax errors by clicking Validate.
Click Plan to create a plan of execution and review the changes to your deployed Resource.
Click Apply to deploy your Blueprint and configure your resources in the cloud provider.
© 2020 CloudSphere