Onboarding a Terraform template
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.
Before you begin
-
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.Use this release of the sample Terraform code as an example of how to set up your repository.
Create a private catalog
Private catalogs provide a way for you to make your own products available to users in your account.
- Go to Manage > Catalogs in the IBM Cloud 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 IBM Cloud® catalog from your catalog.
- Click Create.
Import your Terraform template
- 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.
Review the version details
From the Configure version tab, you can review your version details. After you review your version details, click Next.
Configure the deployment values
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.
Edit output value descriptions
You can improve the descriptions for your Terraform template's output values to help users better understand the purpose of the parameters. The description of any output value that you include in your template can be updated.
To add output values, you need to include them in a new imported version of your Terraform template.
Complete the following steps to edit the product's output value descriptions:
- Click Configure version > Next.
- From the Output value descriptions section, provide a new description for the parameter that you want to update.
- Click Next.
Define IAM access
After you configure your deployment values, you can add the service access and platform access roles that are required to install your product.
Use the following steps to define your product's access:
- Click Configure version > Next > Next.
- Click Add.
- Select the service and the required service and platform access.
- The service access role allows access for using the service and performing service API calls.
- The platform access role enables actions to be performed on platform resources, such as creating an instance, connecting instances to apps, and assigning user access.
- Click Save.
Set the license requirements
If users are required to accept any license agreements beyond the IBM Cloud 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.
Validate the Terraform template
-
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 IBM Cloud Schematics workspace. Tags provide a way to organize, track usage costs, and manage access to the resources in your account.
-
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.
Manage compliance
You can add profiles and controls to your software to prove that it meets security and compliance requirements. You must use Security and Compliance Center to scan the resources created during validation.
Only profiles and controls that are supported by the Security and Compliance Center and validated by Security and Compliance Center scans appear in the catalog.
Run a Security and Compliance Center scan
When you claim profiles and controls, you must evaluate the resources that were created during validation to ensure compliance. To run a scan, complete the following steps:
- In the IBM Cloud console, click the Menu icon
> Security and Compliance to access Security and Compliance Center.
- In the navigation, click Profile.
- Click the Overflow menu in the row of the profile that you want to evaluate and select Run scan.
- Click Run scan.
After your scan completes, you can return to your private catalog to continue the onboarding process.
Adding compliance controls
Add the profiles and controls that you want to claim.
- In the Manage compliance section of your product, select Add claims.
- Select the profile that you want to add.
- Choose to add the entire profile or a subset of controls.
- If you choose an entire profile, continue to the next step. If you choose to add a subset of controls, select the controls that you want to add.
- Click Add.
Applying Security and Compliance Center scans
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 Scanning your resources.
- Click Add scan.
- Select the profile that you used for the evaluation.
- Select the Security and Compliance Center scan.
- Click Apply scan.
- Click Next.
Review requirements
You must complete validation and any other requirements to publish to your account.
Next steps
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.