Skip to content

UCL-ARC/terraform-harvester-mkdocs-site

Repository files navigation

terraform-harvester-mkdocs-site

Important

This repository is still under construction!

A Terraform module for serving a mkdocs documentation website on Condenser.

It will deploy a virtual machine using the Harvester Terraform provider. The VM will be provided with a script to build and serve the website.

This template is suitable for deploying on Condenser.

Usage

  1. Use this template when creating a new repo. If creating a self-contained module, name your repo according to the module naming convention of terraform-<PROVIDER>-<NAME>.
  2. Change CODEOWNERS to you or your Team.

Deployment

Create a new file env.tfvars with the following contents to configure the variables for the module:

img_display_name   = "almalinux-9.3" # Display name of an image in the harvester-public namespace
prefix             = "terraform-harvester-vm"
namespace          = "my-ns" # A namespace in the cluster
public_key         = "my-key" # Your key in the namespace
network_name       = "my-ns/my-net" # A network in the namespace; this can also be left empty
baseos_repo_url    = "" # A URL for the baseos repo
appstream_repo_url = "" # A URL for the appstream repo
mkdocs_repo_url    = "" # A HTTPS URL for the documentation Git repo, e.g. https://github.com/UCL-ARC/condenser-mkdocs.git
mkdocs_repo_branch = "main" # Optional; specify a branch. Defaults to main.
network = {
  ip      = "" # Choose an IP address for the VM
  iface   = "eth0" # eth0 is a required interface
  dns     = "" # point to DNS for the network
  gateway = "" # point to Gateway for the network
}

Obtain a suitable kubeconfig file to access the Harvester cluster. Then you can deploy this module as follows:

KUBECONFIG=/path/to/kubeconfig.yaml terraform apply -var-file=env.tfvars

Wait for the deployment to complete and for the VM to finish restarting. Then log in to the VM and become the root user to run the script to build and serve the website.

sudo su -
./build_mkdocs_site.sh

The Terraform module outputs will suggest an SSH command to tunnel to the VM and serve the website to your localhost.

You can destroy the VM like so:

KUBECONFIG=/path/to/kubeconfig.yaml terraform apply -destroy -var-file=env.tfvars

Requirements

Name Version
terraform >= 1.8.5
cloudinit 2.3.5
harvester 0.6.4
random 3.6.3

Providers

Name Version
cloudinit 2.3.5
harvester 0.6.4
random 3.6.3
terraform n/a

Modules

No modules.

Resources

Name Type
harvester_cloudinit_secret.cloud-config resource
harvester_virtualmachine.vm resource
random_id.secret resource
terraform_data.vm_tags resource
cloudinit_config.server_user_data data source
harvester_image.img data source
harvester_ssh_key.mysshkey data source

Inputs

Name Description Type Default Required
appstream_repo_url URL where the AppStream RPMs can be accessed string n/a yes
baseos_repo_url URL where the BaseOS RPMs can be accessed string n/a yes
img_display_name Display name of an image in the harvester-public namespace string n/a yes
local_port Port on your local machine where the site can be served through an SSH tunnel number 3000 no
mkdocs_repo_branch Name of a branch in the mkdocs repository string "main" no
mkdocs_repo_url HTTPS URL for a publicly-accessible mkdocs repository string n/a yes
namespace Namespace that the SSH public key and network are already deployed in, and that the VM will be deployed in string n/a yes
network Harvester VM network to add NICs for
object({
ip = string
iface = string
dns = string
gateway = string
})
n/a yes
network_name Name of a network in the specified namespace string n/a yes
prefix Prefix for the VM name string n/a yes
public_key Name of an SSH key in the specified namespace string n/a yes
vm_count n/a number 1 no

Outputs

Name Description
site_url n/a
ssh_tunnel n/a
vm_ids n/a

About

A deployment that serves a mkdocs site from a Harvester VM

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •