Setting up Terraform#

The HCL™ Launch extensions for Terraform include both a provider and a provisioner. The Terraform provider resources support interactions with the HCL Launch server to manage the lifecycle of tasks, such as environment creation, component mapping, and application process execution. The Terraform provisioner for HCL Launch automates the installation and configuration of an HCL Launch agent on new virtual machines, in any cloud, and on multiple operating systems.

To use the Terraform extensions for HCL Launch to orchestrate full-stack provisioning of an HCL Launch application, complete the following setup steps.

  1. Download and extract the installation files for the engine.

    These files are available for download from the HCL® Passport Advantage® website. See the HCL UrbanCode Deploy download document.

  2. Change to the ibm-ucd-patterns-install/engine-install/resources/ibm-ucd-terraform directory.

  3. Copy the provider and provisioner files for your platform to the Terraform third-party plugins folder.

    • On Windows, in the sub-path terraform.d/plugins beneath your user's "Application Data" directory.
    • On all other systems, in the sub-path .terraform.d/plugins in your user's home directory. The terraform init script searches this directory for additional plugins during plugin initialization.

    Note: The naming scheme for provider plugins is terraform-provider-NAME-vX.Y.Z, and Terraform uses the name to understand the name and version of a particular provider binary.

    Note: Ensure that the copied files are in an executable format.

  4. Change to the ibm-ucd-terraform/test folder. For example, run this command:

    cd <extracted_location>/ibm-ucd-patterns-install/engine-install/resources/ibm-ucd-terraform/test

  5. Use the sample Terraform configuration to test both the provider and provisioner.

    1. Install the AWS and TLS providers:

      terraform init

    2. Apply the configuration:

      ``` terraform apply


    Your HCL Launch server must be directly accessible from your Terraform runtime server. You are individually prompted for each of these variable values:

    • AWS Access ID
    • AWS Secret Key
    • The name of the AWS Key Pair to create
    • UrbanCode Deploy Server URL
    • UrbanCode Deploy User
    • UrbanCode Deploy Password
    • To verify the results of the apply, log into your HCL Launch server, and click Resources. In the Resource Tree, expand the provider-test-base-resource-group resource group. If the resource group contains an agent, and the agent is online, the apply succeeded.
  6. Clean up the resources after your test:

    terraform destroy

    All resources should be destroyed. To verify the results, return to your HCL Launch server, and click Resources. The entry for the provider-test-base-resource-group resource group is no longer in the resource tree.

Parent topic: Terraform