IBM Cloud Docs
Importing Schematics templates into the IBM Cloud catalog

Importing Schematics templates into the IBM Cloud catalog

Understand how to Create your private catalog, manage your private catalog, assign access to the private catalog in IBM Cloud®. And import your Terraform templates as products to make them available to your users. With a private catalog, you can limit the services that you want your users to see and the service settings that they can adjust. This way, you have more control over the type of service that is provisioned in your account and that naming conventions for services and service components are followed in your organization.

Objectives

In this tutorial, you import the IBM provided Observability Terraform template as a product to your private catalog to help users create the following IBM Cloud services at once:

  • IBM Cloud Log Analysis - Use this service to add logging capabilities to other IBM Cloud services, and to manage system and app logs.
  • IBM Cloud Monitoring - Use this service to gain operational visibility into the performance and health of your apps, services, and platforms.
  • IBM Cloud Activity Tracker - Use this service to track any activity for a service so that you can comply with regulatory audit requirements.

Time required

30 minutes

Audience

This tutorial is intended for developers and system administrators who want to learn how to use Terraform templates to create and manage cloud infrastructure services by using IBM Cloud Schematics.

Prerequisites

Before you begin, make sure that you are assigned the following permissions:

Prepare your Terraform template for the private catalog

To upload a Terraform template to a private catalog, you must first compress all your Terraform configuration files to a TGZ file, and upload this file to a GitHub repository to create a release.

  1. Download the content of the terraform-ibm-observability sample repository to your local machine. This repository is owned and maintained by IBM, and provides a Terraform template to create an instance of IBM Cloud Log Analysis, IBM Cloud Monitoring, and IBM Cloud Activity Tracker.

    If you want to use your own Terraform template, make sure that you put all Terraform configuration files in to a folder on your local machine. Do not store Terraform configuration files in a subfolder.

    git clone https://github.com/Cloud-Schematics/terraform-ibm-observability.git
    
  2. Change in to the terraform-ibm-observability directory.

    cd terraform-ibm-observability
    
  3. Optional: Review the readme.md file and the Terraform configuration files.

  4. Compress your Terraform configuration files to create the TGZ file. The TGZ file is required to upload your Terraform template as a product to the private catalog.

    To run this command, make sure that you are not in the directory that stores your Terraform template, but that you navigate to the parent directory one level preceding. If you use the IBM-provided observability template as part of this tutorial, make sure that you are in the terraform-ibm-observability directory.

    If your .tgz file size if greater than 40 MB. Then, use rm -rf .git .gitignore command to reduce the size of the .tgz file and then create tar czfv <reponame>.tgz ..

    tar czvf observability.tgz .
    

    Example output

    a .
    a ./output.tf
    a ./main.tf
    a ./.README.md.swp
    a ./LICENSE
    a ./observability.png
    a ./diagrams
    a ./observability.tgztar: ./observability.tgz: Can't add archive to itself
    
    a ./README.md
    a ./.secrets.baseline
    a ./observability.drawio
    a ./variables.tf
    a ./local.tf
    a ./version.tf
    a ./diagrams/observability.png
    a ./diagrams/observability.drawio
    

Creating a release

Create a release in your source code repository to deliver and manage versions of your software. You can create new releases with release notes.

  1. Find your existing repository in GitHub to upload your TGZ file.
  2. Open the GitHub release page for your repository by appending /releases to your repository URL as shown in the following example.
    https://github.com/<gh_org>/<gh_repo>/releases
    
  3. Click Draft a new release.
  4. Click Choose a tag, type a version number, a title, and an optional description for your release. Use the tagging suggestions in the GitHub UI to find a supported tag version.
  5. If you had created a tag, use the drop-down menu to select the branch that contains the project you want to release.
  6. Drag your TGZ file from your local machine to the Attach binary file by dropping them here or selecting them section.
  7. Click Publish release to view your published releases feed for your repository.
  8. Optional: Right-click on your TGZ file and copy the link to the file.
  9. Enter the link in your browser to verify that the TGZ file is automatically downloaded to your local machine.
  10. Decompress the TGZ file and verify that you can see all Terraform configuration files without the subfolder.

Create a private catalog and add your Terraform template as a product

  1. Create a private catalog in IBM Cloud.
  2. Import your Schematics template as a product into your private catalog.
    1. From the Private catalogs page, select the private catalog that you created.
    2. Click Add.
    3. Enter the URL to your TGZ file that you verified earlier.
    4. Click Add.
  3. From the Version list of your product, select the product that you uploaded.
  4. Go to the Configure product tab.
    1. In the Configure the deployment details section, click Add deployment values. The Terraform configuration files in your TGZ file are automatically scanned for any input variables that are defined in the template.
    2. Select all deployment values and click Add deployment values.
    3. Review the default values that are set for your deployment values.
    4. Enter values for the activity_tracker_service_plan, logdna_service_plan, sysdig_service_plan, and region variables by clicking Edit from the actions menu. You can optionally change any of the other default deployment variable values.
    5. Save your changes by clicking Update.
    6. Change to the Add license agreement tab, and add any license that the user needs to agree to.
    7. Change to the Edit readme tab, and add or edit the readme for your product.
    8. Change to the Validate product tab.
      • Enter a name for the Schematics workspaces that you want to create for the product validation.
      • In the Deployment values section, verify that the default values are displayed. If you want to use different values to validate your product, change the deployment values as necessary.
      • Click Validate to start the validation. During the validation, a Schematics workspaces is created and the IBM Cloud services that you defined in your Terraform templates are created. To monitor the progress of the validation in your workspace, you can click View logs. If the validation is successful, the status of your product changes to Not published: Validated.
    9. From the actions menu, click Share to make your product available to other users in your private catalog. To provide access group and assign your catalog to users, see Setting up the access groups.
    10. Optional: From the IBM Cloud Resource list, remove the IBM Cloud Log Analysis, IBM Cloud Monitoring, and IBM Cloud Activity Tracker service instances that you created when you validated the product.

In this tutorial, you learned how to create a private catalog in IBM Cloud? and How to upload an IBM-provided Terraform template as a product to your catalog?

What's next?