Skip to content

equinix-labs/terraform-equinix-labs

Repository files navigation

Terraform Equinix Labs Project

Experimental run-pre-commit-hooks generate-terraform-docs

This repository contains a collection of Terraform modules to help automate the deployment and management of either bare metal nodes or a kubernetes cluster environment running on Equinix Metal.

Usage

This project is intended to be used as a Terraform module. It may also be forked, cloned, or downloaded and modified as needed as the base in your integrations and deployments.

Prerequisites:

  • A valid Equinix Metal organization ID, API token, and/or project ID.
  • HashiCorp Terraform installed. Please see tfenv util.

Optional:

To initialize pre-commit: pre-commit install.

Run terraform init -upgrade and terraform apply.

Examples

This project may be deployed into new project(s) or existing project(s). Check out sample deployments in the examples directory described as follows:

Name Description
k8s-setup Deploys a kubernetes cluster into existing projects
k8s-setup-new Deploys a kubernetes cluster into new projects provisioned for each user described in users.csv
k3s-setup Deploys a SUSE K3s cluster into existing projects
k3s-setup-new Deploys a SUSE K3s cluster into new projects provisioned for each user described in users.csv
eksa-setup Deploys a AWS EKS-A cluster into existing projects
eksa-setup-new Deploys a AWS EKS-A cluster into new projects provisioned for each user described in users.csv
metal-setup Deploys a cluster or bare nodes into existing projects
metal-setup-new Deploys a cluster or bare nodes into new projects provisioned for each user described in users.csv

Requirements

Name Version
terraform >= 1.3

Providers

No providers.

Modules

Name Source Version
deploy_eksa ./modules/eksa n/a
deploy_k3s ./modules/k3s n/a
deploy_k8s ./modules/k8s n/a
deploy_metal ./modules/metal n/a
project_setup ./modules/invite-from-csv n/a

Resources

No resources.

Inputs

Name Description Type Default Required
metal_auth_token Equinix Metal user api token. string n/a yes
metal_organization_id Equinix Metal organization id string n/a yes
eksa_config Module configuration for EKSA module
object({
cluster_name = string
cp_device_count = number
worker_device_count = number
})
{
"cluster_name": "equinix-labs-cluster",
"cp_device_count": 3,
"worker_device_count": 3
}
no
enable_eksa Enable EKSA module bool false no
enable_k3s Enable K3s module bool false no
enable_k8s Enable k8s module bool false no
enable_metal Enable Metal module bool false no
enable_workshop_setup Enable Workshop Setup module bool false no
global_ip Enables a global anycast IPv4 that will be shared for all clusters in all metros bool false no
k3s_config Module configuration for K3s module
list(object({
name = string
metro = string
plan_control_plane = string
plan_node = string
node_count = number
k3s_ha = bool
os = string
control_plane_hostnames = string
node_hostnames = string
custom_k3s_token = string
ip_pool_count = number
k3s_version = string
metallb_version = string
}))
[
{
"control_plane_hostnames": "k3s-cp",
"custom_k3s_token": "",
"ip_pool_count": 1,
"k3s_ha": true,
"k3s_version": "",
"metallb_version": "",
"metro": "SV",
"name": "k3s-cluster",
"node_count": 3,
"node_hostnames": "k3s-node",
"os": "debian_11",
"plan_control_plane": "c3.small.x86",
"plan_node": "c3.small.x86"
}
]
no
k8s_config Module configuration for k8s module
object({
kube_vip_version = string
kubernetes_version = string
ssh_private_key_path = string
cp_ha = bool
worker_host_count = number
})
{
"cp_ha": true,
"kube_vip_version": "v0.6.2",
"kubernetes_version": "v1.27.5",
"ssh_private_key_path": "",
"worker_host_count": 1
}
no
metal_config Configuration for Metal module
object({
device_count = number
os = string
billing_cycle = string
cluster_name = string
device_type = string
})
{
"billing_cycle": "hourly",
"cluster_name": "metal-cluster",
"device_count": 3,
"device_type": "m3.small.x86",
"os": "ubuntu_20_04"
}
no
metal_metro Equinix Metal metro string "sv" no
metal_project_id Project ID string "" no
metal_tags String list of common tags for Equinix resources list(string)
[
"terraform",
"equinix-labs"
]
no

Outputs

Name Description
deploy_eksa_outputs Outputs of the Deploy EKSA module
deploy_k3s_outputs Outputs of the Deploy K3s module
deploy_k8s_outputs Outputs of the Deploy k8s module
deploy_metal_outputs Outputs of the Deploy Metal module
project_setup_outputs Outputs of the Project Setup module

Contributing

If you would like to contribute to this module, see CONTRIBUTING page for more info.

License

Apache License, Version 2.0. See LICENSE.