Skip to content

Terraform

The Unikraft Cloud provider for Terraform allows unikernel instances to be managed on Unikraft Cloud (UKC) using HashiCorp Terraform.

Quick Start

To use the Unikraft Cloud provider in a Terraform module, start by declaring a provider requirement for the kraftcloud provider inside a terraform block:

terraform.tf
terraform {
required_providers {
kraftcloud = {
source = "registry.terraform.io/kraftcloud/kraftcloud"
version = "~>0.1"
}
}
}

Next, run terraform init to initialize the workspace and download the kraftcloud provider from the Terraform Registry.

You can then configure the kraftcloud provider as outlined in its documentation, and declare the unikernel instances that should be run on Unikraft Cloud using the resources exposed by the provider:

main.tf
provider "kraftcloud" {
metro = "fra0"
}
resource "kraftcloud_instance" "example" {
image = "index.unikraft.io/official/nginx:latest"
memory_mb = 64
port = 8080
autostart = true
}

Finally, run terraform apply to apply the configuration and run the described Unikraft Cloud instance(s).

External References

Refer to the provider’s documentation on the Terraform Registry for a comprehensive guide about the usage of the provider, as well as the resources and data sources it exposes.