heidloff.net - Building is my Passion
Post
Cancel

Developing TechZone Toolkit Terraform Modules

With the TechZone Accelerator Toolkit IBM software, open source projects and custom applications can easily be deployed to various clouds. This article explains on a high level how to develop new modules with Terraform.

Check out my earlier blog that introduces the toolkit: Introducing IBM’s Toolkit to handle Everything as Code. The toolkit leverages Terrafrom and GitOps and is based on best practices from IBM projects with partners and clients. With the toolkit both infrastructure like Kubernetes clusters as well as Kubernetes resources within clusters can be deployed. Infrastructure resources are deployed via Terraform, resources within clusters via Argo CD.

Custom Modules and custom Catalogs

The toolkit is available as open source and it is extensible. Custom modules can be added to deploy more software or to add other target platforms. The TechZone Module Catalog contains a list of curated modules which need to provide automatic testing capabilities. However, the curated catalog doesn’t have to be used or can be used in addition to a custom catalog. This is necessary if you want to build modules for internal consumption only and it is necessary for modules while they are being developed.

My colleague Thomas Südbröcker has documented how to create your own catalog. When running the ‘iascable’ CLI to generate Terraform modules based on BOMs (bill of materials), the locations of the catalogs can be passed in. Alternatively you can also define the catalogs directly in the BOMs.

1
2
3
$ BASE_CATALOG=https://modules.cloudnativetoolkit.dev/index.yaml
$ CUSTOM_CATALOG=https://raw.githubusercontent.com/Vishal-Ramani/UBI-helm-module-example/main/example/catalog/ubi-helm-catalog.yaml
$ iascable build -i ibm-vpc-roks-argocd-ubi.yaml -c $BASE_CATALOG -c $CUSTOM_CATALOG

Terraform Modules

The TechZone Toolkit provides two types of modules:

  1. Terraform modules
  2. GitOps modules

Terraform modules are used to create infrastructure like clusters, VPCs, external resources and more. The GitOps modules are used to deploy and operate different types of software within clusters.

The Toolkit Terraform modules are just Terraform modules with some extended conventions how to build them. Modules contain these files:

  • main.tf: Logic of the module
  • variables.tf: Input variables
  • outputs.tf: Output variables which can be passed to child modules
  • version.tf: Minimum required Terraform version
  • module.yaml: Metadata descriptor
  • README.md: Documentation

The best way to get started building modules is to look at the available modules in the catalog. The module catalog provides a filter ‘Module type’. Browse through the existing modules and pick one which sounds similar to what you want to achieve or simple enough to use it as template or starting point.

image

To find out more about these capabilities, check out the following resources:

Featured Blog Posts
Disclaimer
The postings on this site are my own and don’t necessarily represent IBM’s positions, strategies or opinions.
Trending Tags