Terraform Modules for IBM Cloud

4 min read

Supercharge your business-critical IBM Cloud infrastructure deployment with Terraform modules.

IBM Cloud Schematics is excited to announce the general availability of reusable Terraform modules for IBM Cloud to rapidly build your IBM Cloud Infrastructure.

If you have used the IBM Cloud Provider plugins for Terraform to develop Terraform configuration files for your team or organization, you may have asked: "What if there was a curated collection of Terraform modules that could be used to assemble and build the complex cloud infrastructure instead of trying to learn and navigate through a multitude of Terraform resources and data sources?"

Luckily, there is — you can now use the collection of Terraform modules for IBM Cloud built by automation experts within IBM who are constantly validating and keeping them updated for use in the IBM Cloud.

What are Terraform modules for IBM Cloud?

Terraform modules are the logical groupings of Terraform configuration files developed based on common infrastructure code patterns, best practices and reference architectures with which you are developing. You can learn more about Terraform modules here.

The benefits of using Terraform modules for IBM Cloud include the following:

  • Accelerates the development of Terraform infrastructure code for IBM Cloud.
  • Lowers the skill barrier required to develop Terraform code for IBM Cloud and reduces the complexity of the Terraform infrastructure code.
  • Adopts up-to-date industry best practices and infrastructure code patterns that are codified by the automation subject matter experts from IBM.
  • Open-sourced and validated modules, which reduce the scope of testing needed to ensure proper function.
  • Full IBM support for these Terraform modules for any issues that may arise.

The following are the IBM Terraform modules that are published in the Terraform registry:


  • The growing list of modules is sourced from the Git repositories published here, which act as the authorized source of Terraform modules for IBM Cloud.
  • Work is underway to migrate Terraform modules from other IBM sources — from their public repositories into this authorized Git repository for IBM Cloud.
  • IBM Cloud Schematics will maintain and support the Terraform modules in these repositories only, please raise your issues, defects, and enhancement requests here.

Getting started with Terraform modules

Let us see how Terraform modules improve the developer's experience while developing a Terraform configuration file for the following deployment architecture:

Let us see how Terraform modules improve the developer's experience while developing a Terraform configuration file for the following deployment architecture:

As a developer, you have to read and understand about using IBM Cloud Terraform provider resources and data sources to set up and configure a Virtual Private Cloud (VPC), Cluster, Identity Access Management (IAM), Key Management System (KMS), Cloud Object Storage (COS) buckets and the dependencies between the Cluster resources and the Observability resources. In each of the following services, you must configure the corresponding resources:

  • VPC resources: Subnet, address prefix, public gateway, security group and security group rules
  • Cluster resources: VPC cluster, VPC worker pools
  • Observability resources: Log Analysis and Monitoring service instances
  • Other supported resources: Key Protect (or KMS), COS, COS bucket, IAM authorisation policies
  • Bindings between resources: Cluster and observability 

This result is more than 1,500 lines of Terraform configuration code, comprised of Terraform resources and data sources. This is a time-consuming and error-prone process during the development cycle, where every iteration of development involves significant amounts of debugging and testing time.

On the other hand, if you use these Terraform modules for deploying the same deployment architecture resources, you will notice that the entire template is a simple assembly of pre-validated Terraform resources. 

Here is a sample Terraform template that provisions a secure Red Hat Openshift cluster with less than 200 lines of code that can be verified incrementally and seamlessly for the given architecture. You can be sure that the resulting IBM Cloud infrastructure built by using Terraform modules incorporates industry best practices and follows the guidelines prescribed by both HashiCorp and IBM Cloud.

The current release includes the modules for some of the most popular services in the IBM Cloud (as listed in the table above). The future may include Terraform modules for services like Certificate Manager, IBM Cloud Internet Services, IBM Cloud Paks, IBM Key Protect for IBM Cloud, IBM Cloud Hyper Protect Crypto Service, IBM Cloud Satellite and more.

What’s next?

The above was a sample deployment architecture using resources powered by Terraform modules to build a secure Red Hat Openshift cluster on IBM Cloud. You can also deep dive into other examples, such as the observability template that uses the corresponding Terraform modules. Refer to these examples while developing your own Terraform templates for your projects. 

If you have questions or comments, check out Getting help and support.

Be the first to hear about news, product updates, and innovation from IBM Cloud