Terraform module to deploy Confidential Virtual Machines on GCP using Intel TDX (Trust Domain Extensions) secure execution environment.
The module focuses on deploying VMs for BuilderNet using custom images and does not rely on standard GCP VM provisioning features like cloud-init or OS Login.
The module handles the following infrastructure components:
- Creates a GCS bucket for storing VM images (optional);
- Downloads images from remote HTTP(S) URLs (optional);
- Uploads local or downloaded image files to GCS (optional);
- Creates GCP Compute Images with TDX-capable guest OS features;
- Allocates static external IP addresses;
- Creates firewall rules for ingress/egress traffic;
- Deploys Confidential VMs with Intel TDX enabled.
Before using this module, you must:
- Have a GCP project with Compute Engine API enabled;
- Prepare your VM image as a
.tar.gzfile compatible with GCP; - Provide the image via one of: local path, GCS URI, or remote HTTP(S) URL;
- Have
curlinstalled locally (required only if downloading images from remote HTTP(S) URLs).
- Intel TDX requires C3 series machine types (e.g.,
c3-standard-44); - TDX VMs do not support live migration (
on_host_maintenanceis set toTERMINATE); - The module creates empty secure boot certificates by default.
Refer to the examples directory for detailed configuration examples.
| Name | Version |
|---|---|
| terraform | >= 1.1 |
| >= 7.0.0 | |
| null | >= 3.0.0 |
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| create_empty_secure_boot_keys | Create empty secure boot keys for TDX images | bool |
true |
no |
| create_image_bucket | Whether to create a new GCS bucket for storing VM images | bool |
true |
no |
| image_bucket_name | Name of the GCS bucket for storing VM images. Used both for creating new bucket or referencing existing one | string |
n/a | yes |
| images | Map of image names to their source URI. The source type is auto-detected based on the URI scheme: - https://storage.googleapis.com/bucket/path - GCS URI, image already in cloud storage (used directly) - https://... or http:// - Remote URL, downloaded via curl then uploaded to GCS - /path/to/file - Local file path, uploaded to GCS Example: terraform |
map(object({ |
n/a | yes |
| project | The GCP project ID where all resources will be created | string |
n/a | yes |
| region | The GCP region where resources will be created | string |
n/a | yes |
| secure_boot_keys | Custom secure boot keys in base64 format. Only used if create_empty_secure_boot_keys is false | object({ |
{} |
no |
| vms | Map of VM configurations keyed by VM name. Example: terraform |
tcp | ssh" = ["0.0.0.0/0"] "30303 |
tcp |
| Name | Description |
|---|---|
| image_bucket | Name of the GCS bucket used for VM images |
| images | Map of created compute images |
| vm_details | VM details |
The source_uri field auto-detects the source type based on the URI scheme:
| URI Scheme | Behavior |
|---|---|
https://storage.googleapis.com/bucket/path |
GCS URI - used directly, no upload needed |
https://... or http://... |
Remote URL - downloaded via curl, then uploaded to GCS |
/path/to/file |
Local file path - uploaded to GCS |
Note: When using HTTP(S) URLs, the image is downloaded to .terraform/image-downloads/ within the module directory using curl, then uploaded to GCS. Ensure you have sufficient disk space for large images.
Firewall rules use a pipe-delimited format: "PORT | PROTOCOL | DESCRIPTION"
- PORT: Single port (
22), port range (8000-8100), or0for all ports - PROTOCOL:
tcp,udp,icmp, orall - DESCRIPTION: Optional human-readable description (used in rule naming)
Refer to the examples directory for detailed configuration examples.
Make sure to use terraform-docs to generate the configuration parameters of the module (provider requirements, input variables, outputs) should you update them.
terraform-docs markdown --hide modules,resources,providers ./