vCommander Build

Files for this Scenario

7.0.2
Download from GitHub

This scenario enables you to use deploy resources using Terraform configurations in the Embotics® vCommander® service catalog. It includes an optional approval workflow that uses the output of the Terraform plan command. 

Prerequisites

  • vCommander release 7.0.2 or higher
  • A system with Terraform installed that is accessible through SSH.

    This system is referred to hereafter as the Terraform host. The Terraform host will be used to keep state and must be configured to use the proper credentials to allow access the Terraform host.

  • Install the Terraform Workflow Plug-in Step Package

Install the Terraform plug-in workflow step package

Go to Embotics GitHub / Plug-in Workflow-Steps and clone or download the repository. Then install the wfplugins-terraform step package. The workflows in this scenario reference those Terraform plug-in workflow steps.

To learn how to download and install workflow plug-in steps, see Adding Workflow Plug-In Steps in the vCommander User Guide.

Set up the Service Catalog

To set up the service catalog to allow Terraform configurations to be uploaded, you must do the following:

  1. Create the Terraform organization
  2. Create the deployment destination
  3. Create the Terraform deployment service request form
  4. Create the reploy Terraform approval workflow
  5. Create the deploy Terraform template completion workflow
  6. Create the Terraform deployment blueprint

Create the Terraform organization

The Terraform service request requires a form that can identify the owner of the deployed resources. That form must be assigned to an organization.

Note: The Terraform organization will already exist if you have already gone through the Deploying User-Provided Terraform Configurations scenario.

  1. Log into vCommander, go to Configuration >  Organizations and Quotas, then click the Organizations tab.
  2. Click Add.
  3. In the Configure Organization dialog, for Organization Name, enter "Terraform Org2".

  4. Add groups or users to the organization.
  5. If you need to configure additional organization details, click Next and configure the organization as required.
  6. Click Finish when you're done.

Create the deployment destination

For the Terraform configuration to provision resources, you must configure an automated deployment destination and assign the destination to Terraform Org2.

For information on how to configure deployment destinations, see Configuring Automated Deployment for Approved Service Requests. This topic provides information for vCenter, AWS, Azure, and SCVMM managed systems.

Create the Terraform deployment service request form

After the organization has been created, you need to create a form to capture the user that will be set as the owner of the deployed VM created by the Terraform template.

  1. In vCommander go to Configuration > Service Request Configuration, then click the Form Designer tab.
  2. Click Add.
  3. In the Add Request Form dialog, type "Terraform Deployment" for the Form Name, and in the Organizations section, select Terraform Org2 and click Add. Then click OK.

  4. If the Primary Owner field isn't already present in the Service Form section of the Form Designer page, click the Primary Owner link on the right-hand side to add it.
  5. For the Primary Owner element, click Edit. Clear the Display Only checkbox, enable the Required checkbox, and click OK.
  6. Click Save to save the form.

Create the deploy Terraform approval workflow

You can use an approval workflow to generate the Terraform plan and have it approved. The approval workflow definition provided with this scenario will download the Terraform configuration through http from version control or an s3 bucket. 

See Importing and Exporting Workflow Definitions in the vCommander User Guide for more information about how to import workflow definitions.

Note: The provided approval workflow definition has steps that require credentials. After you import this workflow definition, you must edit the workflow definition in a text editor to use the appropriate credentials that have been added to vCommander. For information on how to add credentials to vCommander, see Adding Username/password credentials.

  1. Go to Embotics Git Hub / Scenarios and clone or download the Scenarios repository.
  2. In vCommander, go to Configuration > Service Request Configuration and click the Approval Workflow tab.
  3. On the Approval Workflow page, click Import.
  4. Go to the Scenarios repo that you cloned or downloaded, then from the Deploying-Embedded-Terraform-Configurations directory, select the Terraform-from-url-approval-workflow .yaml or .json file, and click Open.

    vCommander automatically validates the workflow and displays the validation results in the Messages area of the Import Workflow dialog.

  5. Enter a comment about the workflow in the Description of Changes field, and click Import.
  6. Select the Terraform from URL Approval workflow from the list of approval workflows and click Edit.
  7. In the Approval and Pre-Provisioning Workflow Configuration dialog, go to the Steps page and customize the step details as required for your Terraform environment and deployment destination.

  8. Click Next when you are done.
  9. On the Assigned Components page, click Next.
  10. On the Summary page, enter a comment about the workflow in the Description of Changes field and click Finish.

Create the deploy Terraform template completion workflow

Next, you have to create a completion workflow to apply the Terraform plan. For this workflow, the configuration is embedded in the workflow step.

You can import an existing workflow definition that is provided from the Scenarios repository.

  1. In vCommander, go to Configuration > Service Request Configuration and click the Completion Workflow tab.
  2. On the Completion Workflow page, click Import.
  3. Go to the Scenarios repo that you cloned or downloaded, then from the Deploying-Embedded-Terraform-Configurations directory, select the Terraform-embedded-completion-workflow .yaml or .json file, and click Open.

    vCommander automatically validates the workflow and displays the validation results in the Messages area of the Import Workflow dialog.

  4. Enter a comment about the workflow in the Description of Changes field, and click Import.
  5. After the completion workflow is imported, select it from the list, and click Edit.
  6. In the Completion Workflow Configuration dialog, go to the Assigned Components page, and ensure the Do not apply this workflow to any custom component option is enabled.
  7. Click Next, then Finish.

Create the Terraform deployment blueprint

Finally, create the Service Definition for the Terraform deployment service.

  1. In vCommander, click the Service Catalog tab, then click Add Service.
  2. For Name, type "Embedded Terraform Deployment" and click Next.
  3. On the Component Blueprints page, select Add > New Component Type.
  4. In the Create New Component Type dialog, enter "EC2 Instance via Terraform" for Name,  enter 0 for Annual Cost, then click Add to Service.

  5. For the new EC2 Instance via Terraform component blueprint, click the Infrastructure tab, then from the Completion Workflow dropdown, select Embedded Terraform completion workflow.
  6. Click the Form tab, and from the Toolbox at the right side of the window, click Input Text Field. Then in the added Input Text Field form element, enter "Name" in the  Display Label box, ensure that the Required check box is enabled, and click OK.
  7. Click Next.
  8. On the Deployment page, click Next.
  9. For the purposes of this walk-through, we’ll skip the Intelligent Placement page. Click Next. To learn more, see Intelligent Placement.
  10. On the Visibility page select Publish - Specific organizations, users and groups and add Terraform Org2. Then click Next.
  11. On the Summary page, click Finish.

Log in and test

  1. Log in to the portal as a member of Terraform Org2.
  2. Click + Service Catalog, then for "Embedded Terrform Deployment", click + Add to request the service.
  3. On the Service page, complete the form that appears. You must complete all fields marked with an asterisk (*). Click Next when you're done.
  4. On the Component page, in the Terraform Plan ID field, enter the ID of the service request that you want to delete.
  5. Click Submit to submit the request.