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:
- To create a private catalog in IBM Cloud.
- To create a Schematics workspaces.
- To create an IBM Cloud Log Analysis instance.
- To create an IBM Cloud Monitoring instance.
- To create an IBM Cloud Activity Tracker instance.
- Write access to a GitHub repository on
github.com
. This repository is needed to upload the Terraform template that you want to add as a product to your private catalog.
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.
-
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
-
Change in to the
terraform-ibm-observability
directory.cd terraform-ibm-observability
-
Optional: Review the
readme.md
file and the Terraform configuration files. -
Compress your Terraform configuration files to create the
TGZ
file. TheTGZ
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 is greater than 40 MB. Then, userm -rf .git .gitignore
command to reduce the size of the.tgz
file and then createtar 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.
- Find your existing repository in GitHub to upload your
TGZ
file. - 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
- Click Draft a new release.
- 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.
- If you had created a tag, use the drop-down menu to select the branch that contains the project you want to release.
- Drag your
TGZ
file from your local machine to the Attach binary file by dropping them here or selecting them section. - Click Publish release to view your published releases feed for your repository.
- Optional: Right-click on your
TGZ
file and copy the link to the file. - Enter the link in your browser to verify that the
TGZ
file is automatically downloaded to your local machine. - Decompress the
TGZ
file and verify that you can see all Terraform configuration files without thesubfolder
.
Create a private catalog and add your Terraform template as a product
- Create a private catalog in IBM Cloud.
- Import your Schematics template as a product into your private catalog.
- From the Private catalogs page, select the private catalog that you created.
- Click Add.
- Enter the URL to your
TGZ
file that you verified earlier. - Click Add.
- From the Version list of your product, select the product that you uploaded.
- Go to the Configure product tab.
- 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. - Select all deployment values and click Add deployment values.
- Review the default values that are set for your deployment values.
- Enter values for the
activity_tracker_service_plan
,logdna_service_plan
,sysdig_service_plan
, andregion
variables by clicking Edit from the actions menu. You can optionally change any of the other default deployment variable values. - Save your changes by clicking Update.
- Change to the Add license agreement tab, and add any license that the user needs to agree to.
- Change to the Edit readme tab, and add or edit the readme for your product.
- 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
.
- 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.
- 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 the Configure the deployment details section, click Add deployment values. The Terraform configuration files in your
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?