copyright | lastupdated | keywords | subcollection | content-type | services | account-plan | completion-time | ||
---|---|---|---|---|---|---|---|---|---|
|
2022-07-27 |
private catalog, software, onboard, Terraform, terraform template |
account |
tutorial |
Terraform |
paid |
20m |
{{site.data.keyword.attribute-definition-list}}
{: #catalog-terraform-template-tutorial} {: toc-content-type="tutorial"} {: toc-services="Terraform"} {: toc-completion-time="20m"}
This tutorial walks you through how to onboard a Terraform template to your account. By completing this tutorial, you learn how to create a private catalog and import the template. After that, you can validate that the template can create resources, or run a script, and you can make it available to users who have access to your account. {: shortdesc}
{: #terraform-prereqs}
-
Verify that you're using a Pay-As-You-Go or Subscription account. See Viewing your account type for more details.
-
Verify that you're assigned the following roles. For more information, see Assigning access to account management services and Managing access to resources.
- Administrator on all account management services and all IAM-enabled services
- Editor on the catalog management service
- Manager service access role for IBM Cloud Schematics
- Operator platform role for VPC Infrastructure
- Editor on the software instance service
- Required permission to complete a specific task
-
Create your Terraform template.
-
To test your Terraform template, run the following commands from the Terraform CLI:
terraform init
terraform validate
-
Upload your Terraform template to a GitHub release and create a
.tgz
file. For more information, see Upload your Terraform template and readme file to your GitHub repository{: external}.Use this release of the sample Terraform code{: external} as an example of how to set up your repository. {: tip}
{: #catalog-terraform-private} {: step}
Private catalogs provide a way for you to make your own products available to users in your account.
- Go to Manage > Catalogs in the {{site.data.keyword.cloud_notm}} console, and click Create a catalog.
- Select Product default as the catalog type.
- Enter the name of your catalog, for example,
Sample Terraform
. - Select No products to exclude all products in the {{site.data.keyword.cloud}} catalog from your catalog.
- Click Create.
{: #catalog-terraform-import} {: step}
- On the Private products page, click Add.
- Select Terraform as your deployment method.
- Select the type of repository.
- Enter the example Terraform URL as your source URL.
- Enter the software version in the format of major version, minor version, and revision, for example,
1.0.0
. - Click Add product.
{: #catalog-terraform-review-version} {: step}
From the Configure version tab, you can review your version details. After you review your version details, click Next.
{: #catalog-terraform-cfgdeploy} {: step}
After you review the version details, you're ready to configure the deployment values.
- If you need to specify the Terraform runtime version that you want Schematics to use, click the Override the default Terraform runtime version checkbox and enter a version.
- From the Configure the deployment details section, click Add deployment values.
- Select the Parameter checkbox to select all options, and click Add.
- To customize which parameters are required for users to specify during the installation and which ones are hidden from users, select a parameter and click Edit. Click the checkboxes to configure the values and click Save.
{{site.data.content.output-values}}
{{site.data.content.define-IAM-access}}
{: #catalog-terraform-license} {: step}
If users are required to accept any license agreements beyond the {{site.data.keyword.cloud_notm}} Services Agreement, provide the URL to each agreement. Or, if users can bring their own licenses, you can provide that URL as well.
- Click Add license agreements > Add.
- Enter the name and URL, and click Update.
- After you enter the additional license agreements, click Next.
{: #catalog-terraform-validate} {: step}
-
From the Validate product tab, enter the name of your workspace, select a resource group, select a Schematics region, and click Next.
In the Tags field, you can enter a name of a specific tag to attach to your template. This tag is put on the {{site.data.keyword.bplong_notm}} workspace. Tags provide a way to organize, track usage costs, and manage access to the resources in your account. {: tip}
-
From the Deployment values section, review your parameter values, and click Next.
-
In the Validation product section, select I have read and agree to the following license agreements.
-
Click Validate.
To monitor the progress of the validation process, click View logs. {: tip}
{: #catalog-terraform-controls} {: step}
Controls are safeguards that are used to meet security and compliance requirements. Only controls that are supported by Security and Compliance Center, formatted correctly, and validated by Code Risk Analysis and Security and Compliance Center scans appear in the catalog. For more information, see Adding compliance details.
{: #catalog-terraform-add-controls}
You can review the controls that were added from your readme file and add additional controls.
- Click Add controls.
- Choose a profile.
- Select the controls that you want to add to your version.
- Click Add.
{: #catalog-terraform-cra-scan}
Scan your source code with Code Risk Analyzer to identify any security vulnerabilities that you need to assess.
- Click Run scan.
- Wait for the scan to finish.
{: #catalog-terraform-scc-scan}
Add the scans that you previously ran in the Security and Compliance Center. Security and Compliance Center scans determine adherence to regulatory controls. For more information, see Scheduling a scan.
- Select the profile that you scanned.
- Select the Security and Compliance Center scan.
- Click Add scan.
- Click Next.
{: #catalog-terraform-review-reqs}
You must complete validation and any other requirements to publish to your account.
{: #catalog-terraform-next}
After you onboard and validate your Terraform template, you're ready to publish it to your account. From the Actions menu, select Publish to account. As a result, the Terraform template is available to only users that have access to the Sample Terraform
private catalog in your account.