Skip to content

Cloud Modules

The CAPTF project maintains reference modules for five clouds: AWS, Google Cloud, Azure, Oracle Cloud Infrastructure (OCI) and OpenStack. Each set has one repository for each role, implements the v1alpha1 module contract and ships as module images you reference from a TerraformCluster, TerraformMachineTemplate or TerraformMachinePool. They are meant to be used as they are, and to be forked as the starting point for your own modules.

A sixth set, No-op, provisions nothing: it runs real plans and keeps real state with no cloud and no credentials, for trying CAPTF and testing a management cluster.

Status: pre-release

The five cloud sets pass static analysis, mocked unit tests on Terraform and OpenTofu, and image smoke tests, but none has yet been applied to a real cloud. Each role repository’s DESIGN.md lists the facts the first real apply must confirm. Read it before you rely on a module, and pin a release tag. Images are signed with cosign: see verifying a signature.

The modules

  • AWS


    Network Load Balancer, security groups, IAM roles and an S3 bootstrap bucket; EC2 instances and Auto Scaling groups.

    AWS

  • Google Cloud


    Proxy Network Load Balancer, firewall rules and service accounts; Shielded VMs and managed instance groups.

    Google Cloud

  • Azure


    Standard load balancer, network security groups and a resource group; VMs and scale sets.

    Azure

  • OCI


    Network security groups, a network load balancer and a dynamic group; compute instances and instance pools.

    OCI

  • OpenStack


    Octavia load balancer, security groups and a server group; Nova servers. No machinepool role.

    OpenStack

  • No-op


    Real plans, state and outputs with nothing provisioned: try CAPTF or test a management cluster without a cloud.

    No-op

  • Shared Behavior


    What all five sets have in common: endpoint, traffic, identities, bootstrap data, health, tags and destroy.

    Shared Behavior

Cloud Images Roles Provider
AWS captf-io/module-images cluster, machine, machinepool hashicorp/aws 6.67.0
Google Cloud captf-io/module-images cluster, machine, machinepool hashicorp/google 8.5.0
Azure captf-io/module-images cluster, machine, machinepool hashicorp/azurerm 5.7.0
OCI captf-io/module-images cluster, machine, machinepool oracle/oci 9.8.0
OpenStack captf-io/module-images cluster, machine terraform-provider-openstack/openstack 3.4.0
No-op captf-io/module-images cluster, machine, machinepool None: terraform_data is built in

All the images are built by one repository, captf-io/module-images, which holds no module code. The code of each role lives in its own repository, captf-io/terraform-<provider>-<role>, and is published on the Terraform Registry as captf-io/<role>/<provider>, for example captf-io/cluster/aws. The provider is aws, azure, google, oci, openstack or noop; the images and the cloud pages keep the name gcp for Google Cloud.

Cloud Role repositories Registry addresses
AWS terraform-aws-cluster, -machine, -machinepool captf-io/cluster/aws, captf-io/machine/aws, captf-io/machinepool/aws
Google Cloud terraform-google-cluster, -machine, -machinepool captf-io/cluster/google, captf-io/machine/google, captf-io/machinepool/google
Azure terraform-azure-cluster, -machine, -machinepool captf-io/cluster/azure, captf-io/machine/azure, captf-io/machinepool/azure
OCI terraform-oci-cluster, -machine, -machinepool captf-io/cluster/oci, captf-io/machine/oci, captf-io/machinepool/oci
OpenStack terraform-openstack-cluster, -machine captf-io/cluster/openstack, captf-io/machine/openstack
No-op terraform-noop-cluster, -machine, -machinepool captf-io/cluster/noop, captf-io/machine/noop, captf-io/machinepool/noop

You can call a module from your own Terraform, but it is a CAPTF root module first: it configures its own provider block, which takes no count, for_each or depends_on and reads its credentials from the environment; it pins its providers exactly; and it needs the captf_* contract inputs. Each repository’s README says how in its Usage section.

OpenStack has no machinepool role: it has no native scaling group, and a MachineDeployment of individual machines covers the same need.

Each role is a separate image:

  • cluster creates what one workload cluster needs around its nodes: the security rules, the API server load balancer and, except on OpenStack, the node identities. It publishes the API endpoint, the failure domains and the ids the other roles need (its exports).
  • machine creates one instance for one Machine and registers control-plane instances with the API load balancer.
  • machinepool creates one native scaling group (an Auto Scaling group, a managed instance group, a scale set or an instance pool) for one MachinePool.

The no-op roles create none of this: each records its inputs in its state and returns placeholder outputs.

None of them creates a network. You bring the network, the subnets and the egress path, and the modules make nodes in them.

Images and tags

Every role is published as ghcr.io/captf-io/module-images/<cloud>-<role>, for example ghcr.io/captf-io/module-images/aws-machine, for linux/amd64 and linux/arm64, in two flavours: one built FROM terraform-base and one FROM opentofu-base (see Base Images). The tags name the runtime (<version>-terraform, <version>-opentofu). Each image carries a mirror of the providers its role needs, so a Job never downloads a provider at run time.

Images are published under module-images/ rather than at the top level of ghcr.io/captf-io/. GitHub has no API to grant a repository’s workflow write access to a package it did not create, so module-images publishes packages under its own name, which its workflow creates and owns; adding an image needs no package settings. The earlier top-level images, such as ghcr.io/captf-io/aws-machine, and the <cloud>-modules repositories that built them have been deleted.

The image version is the module release: vX.Y.Z-<runtime> contains release vX.Y.Z of the module, fetched from the Terraform Registry.

Tag Meaning
vX.Y.Z-opentofu, vX.Y.Z-terraform Module release vX.Y.Z on that runtime; rebuilt if the image changes
opentofu, terraform The newest module release on that runtime

Both forms are rebuilt, with a new digest, when the image changes without a module release, for example after a base image bump. Pin a release tag, or a digest for an image that must not change, in anything you keep. The examples in each cloud’s module repository pin v0.1.0-opentofu. Releasing a Module covers how these tags are published and which reference to pin.

What you bring

The no-op set needs only the identity. Every cloud set needs all of these:

  • A network. The VPC, VNet, VCN or network, its subnets, and an egress path (NAT gateway, Cloud NAT, router) exist before the cluster. Each cloud page lists what the subnets need.
  • Node images. Images built for Cluster API, such as the image-builder images, with cloud-init and a kubelet that runs with --cloud-provider=external.
  • A cloud controller manager and a CNI in the workload cluster: the nodes stay NotReady and tainted until both run. The modules set up what the cloud controller manager needs (node identities, tags, provider IDs) but do not install it; on Azure they also write its configuration file on each node. On OpenStack you also supply its credentials.
  • An identity. A TerraformClusterIdentity whose Secret holds the cloud credentials the provider reads; each cloud page shows the keys. See Identities and Credentials.

The modules read the network you bring with data sources; Building on Existing State shows the pattern and how to build on it.

Using the modules

  1. Read the cloud page for the prerequisites and the identity Secret.
  2. Create the identity Secret and the TerraformClusterIdentity.
  3. Generate a cluster from the cluster repository’s examples/cluster-kubeadm.yaml with clusterctl generate yaml --from, filling in the network ids and the node image.
  4. Install the CNI and the cloud controller manager in the workload cluster once its API server answers.

The no-op set skips all of this: see its quick start.

Module settings beyond the contract inputs are ordinary module variables, set with spec.variables or spec.variablesFrom; see Module Variables. Each role page lists them.

Forking a module

Each repository is built to be forked. To change a module, fork its role repository (terraform-<provider>-<role>): its CONVENTIONS.md is the rule book every cloud role repository shares, and make verify checks most of it: the file layout, tags on every resource, terraform validate and tofu validate (including the oldest validated runtimes, Terraform 1.5.7 and OpenTofu 1.6.3), the unit tests, tflint, tfcapi-lint, shellcheck and a trivy scan. To build your own module images, fork module-images, point sources/versions.tf at your modules, change the registry and image names, run make lock, then make verify and make test. Module Repository Layout walks through forking a set or starting from the no-op modules.

The no-op modules are the smallest modules that meet the contract, and the starting point of Your First Module.

Shared Behavior describes what all five sets have in common.