https://github.com/spectrocloud/terraform-spectrocloud-edge
https://github.com/spectrocloud/terraform-spectrocloud-edge
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/spectrocloud/terraform-spectrocloud-edge
- Owner: spectrocloud
- License: gpl-3.0
- Created: 2022-07-26T22:27:40.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2026-04-06T14:48:12.000Z (3 months ago)
- Last Synced: 2026-04-06T16:27:44.236Z (3 months ago)
- Language: HCL
- Size: 188 KB
- Stars: 0
- Watchers: 5
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
[](https://www.gnu.org/licenses/gpl-3.0)
[](https://www.spectrocloud.com)
# Palette Edge Native Terraform Module
The Spectro Cloud Provider for Palette is available in the [Terraform Registry](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest). This repository contains the module and examples to create a Kubernetes Edge Cluster using Palette.
## Assumptions
Addon profiles that will be used for the cluster creation have already been defined. This module will reference those resources rather than create them. Profiles can be created through the [Cluster Profile Resource](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_profile)
## Usage
Module Version | Required Terraform Version
---------------|----------------------------
<= 1.0.0 | <= 1.2.9
\>= 1.1.0 | >= 1.3.0
See the [Examples](https://github.com/spectrocloud/terraform-palette-edge/tree/main/examples) for usage of this module. This module is written for the Edge Native Deployment option.
This is a sample "main.tf" file. In this example, we are creating a 3-node Ubuntu-PXKE 1.24 cluster. This cluster has a basic profile for the Ubuntu Operating System, PXK-E (Palette Optimized Kubernetes for the Edge), a CNI, and a few other example profiles. These profiles were created ahead of time.
Additionally, with the "VIP" tag, we enable Kubevip for HA. The Edge Host is now looked up via the "tag" on the Edge Host. Multiple tags can be used for this purpose. See the example for usage with multiple pools. The Tag(s) should be added to the Edge Host before running the plan. This applies to virtual machines as well. For ease of use, we have provided a QRCode giving you the ability to easily copy the UID of the device.
```tf
## #########################################################################################
## Example of using cluster profiles with a cluster template
## #########################################################################################
module "edge-demo-module-template" {
source = "spectrocloud/edge/spectrocloud"
version = "2.0.4"
# Store Number/Location
name = "demo"
# add tags to the cluster (optional) list(strings)
cluster_tags = ["origin:terraform"]
ssh_keys = [
"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbm test2",
"ecdsa-sha2-nistp256 AAAAE2VjZHNhL test1"]
ntp_servers = [
"10.10.10.1",
"10.10.10.2"
]
# Cluster VIP to be used with KubeVIP If not using Overlay
cluster_vip = "10.100.101.71"
# Overlay CIDR Range
# overlay_cidr_range = "100.64.128.0/18"
# Node Pools for Cluster
machine_pools = [
# Control Plane Node Pool
{
name = "control-plane"
control_plane = true
control_plane_as_worker = false
additional_labels = {
"region" : "east"
}
edge_host = [
{
host_uid = "demo-18b14144f3c7e249be69ea02992a8801"
host_name = "edge1"
static_ip = "10.100.100.31"
subnet_mask = "255.255.255.0"
default_gateway = "10.100.100.1"
dns_servers = ["10.100.100.1", "10.100.100.2"]
},
{
host_uid = "edge123456"
host_name = "edge2"
static_ip = "10.100.100.32"
subnet_mask = "255.255.255.0"
default_gateway = "10.100.100.1"
dns_servers = ["10.100.100.1", "10.100.100.2"]
nic_name = "auto"
}
]
},
# # Add additional node pools
{
name = "gpu"
control_plane = false
edge_host = [
{
host_uid = "123test"
static_ip = "2.2.2.2"
}
]
additional_labels = {
"type" : "gpu",
"region" : "east"
}
}
]
# Cluster Geolocation (Optional)
location = {
latitude = 40.442829
longitude = -79.950432
}
rbac_bindings = [
{
rbac_type = "ClusterRoleBinding"
rbac_role = {
name = "cluster-admin"
kind = "ClusterRole"
}
subjects = [
{
name = "k8s-admin"
rbac_type = "Group"
}
]
}
]
# Template and profile IDs are looked up automatically by name
cluster_template = {
name = "east-clusters"
context = "project" # Optional: "project" (default) or "tenant"
cluster_profile = [
{
name = "edge-profile"
tag = "1.33.5" # Optional: version tag
context = "project" # Optional: "project" (default), "tenant", or "system"
variables = {
"clusterCIDR" = "10.10.100.0/18"
"svcCIDR" = "10.10.128.0/18"
}
}
]
}
}
## #########################################################################################
## Example of using cluster profiles without a cluster template
## #########################################################################################
module "edge-demo-module-no-template" {
source = "spectrocloud/edge/spectrocloud"
version = "2.0.4"
# Store Number/Location
name = "demo"
# add tags to the cluster (optional) list(strings)
cluster_tags = ["origin:terraform"]
ssh_keys = [
"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbm test2",
"ecdsa-sha2-nistp256 AAAAE2VjZHNhL test1"]
ntp_servers = [
"10.10.10.1",
"10.10.10.2"
]
# Cluster VIP to be used with KubeVIP If not using Overlay
cluster_vip = "10.100.101.71"
# Overlay CIDR Range
# overlay_cidr_range = "100.64.128.0/18"
# Cluster Timezone
cluster_timezone = "America/New_York"
# Update worker pools in parallel (optional, default: true)
# update_worker_pools_in_parallel = false
# Node Pools for Cluster
machine_pools = [
# Control Plane Node Pool
{
name = "control-plane"
control_plane = true
control_plane_as_worker = false
additional_labels = {
"region" : "east"
}
edge_host = [
{
host_uid = "demo-18b14144f3c7e249be69ea02992a8801"
host_name = "edge1"
static_ip = "10.100.100.31"
subnet_mask = "255.255.255.0"
default_gateway = "10.100.100.1"
dns_servers = ["10.100.100.1", "10.100.100.2"]
},
{
host_uid = "edge123456"
host_name = "edge2"
static_ip = "10.100.100.32"
subnet_mask = "255.255.255.0"
default_gateway = "10.100.100.1"
dns_servers = ["10.100.100.1", "10.100.100.2"]
nic_name = "auto"
}
]
},
# # Add additional node pools
{
name = "gpu"
control_plane = false
edge_host = [
{
host_uid = "123test"
static_ip = "2.2.2.2"
}
]
additional_labels = {
"type" : "gpu",
"region" : "east"
}
}
]
# Profiles to be added Profile should be an Edge-Native Infra or Full Profile with the OS, Kubernetes Distribution and CNI of choice
cluster_profiles = [
{
name = "edge-profile"
tag = "1.33.5"
context = "project"
variables = {
"clusterCIDR" = "10.10.100.0/18"
"svcCIDR" = "10.10.128.0/18"
}
},
{
name = "edge-services"
tag = "1.0.0"
context = "project"
},
{
name = "edge-logging"
tag = "1.0.0"
context = "project"
}
]
# Cluster Geolocation (Optional)
location = {
latitude = 40.442829
longitude = -79.950432
}
rbac_bindings = [
{
rbac_type = "ClusterRoleBinding"
rbac_role = {
name = "cluster-admin"
kind = "ClusterRole"
}
subjects = [
{
name = "k8s-admin"
rbac_type = "Group"
}
]
}
]
}
```
## Requirements
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.3.0 |
| [spectrocloud](#requirement\_spectrocloud) | >= 0.27.0 |
## Providers
| Name | Version |
|------|---------|
| [spectrocloud](#provider\_spectrocloud) | >= 0.27.0 |
## Modules
No modules.
## Resources
| Name | Type |
|------|------|
| [spectrocloud_cluster_edge_native.this](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/resources/cluster_edge_native) | resource |
| [spectrocloud_cluster_config_template.this](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cluster_config_template) | data source |
| [spectrocloud_cluster_profile.template_profiles](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cluster_profile) | data source |
| [spectrocloud_cluster_profile.this](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs/data-sources/cluster_profile) | data source |
## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [cluster\_profiles](#input\_cluster\_profiles) | Values for the profile(s) to be used for cluster creation. For `context` a value of [project tenant system] is expected. |
list(object({
name = string
tag = optional(string)
context = string # project tenant system
packs = optional(list(object({
name = string
tag = string
values = optional(string)
manifest = optional(list(object({
name = string
tag = string
content = string
})))
})))
variables = optional(map(string))
})) | `[]` | no |
| [cluster\_tags](#input\_cluster\_tags) | Tags to be added to the profile. key:value | `list(string)` | `[]` | no |
| [cluster\_template](#input\_cluster\_template) | Optional cluster template configuration. Provide the template name and context, and optionally cluster profiles with variables. IDs are looked up automatically. | object({
name = string
context = optional(string, "project") # project or tenant
cluster_profile = optional(list(object({
name = string
tag = optional(string)
context = optional(string, "project") # project, tenant, or system
variables = optional(map(string))
})))
}) | `null` | no |
| [cluster\_timezone](#input\_cluster\_timezone) | Timezone for the cluster. | `string` | `""` | no |
| [cluster\_vip](#input\_cluster\_vip) | IP Address or DNS name for Cluster VIP for HA. If using an IP, it must be unused and on the same layer 2 segment as the node IPs. | `string` | `""` | no |
| [location](#input\_location) | Optional - If used Latitude and Longitude represent the coordinates of the location you wish to assign to the cluster. https://www.latlong.net/ is one tool that can be used to find this. | object({
latitude = optional(number)
longitude = optional(number)
}) | {
"latitude": 0,
"longitude": 0
} | no |
| [machine\_pools](#input\_machine\_pools) | Values for the attributes of the Node Pools. 'edge\_host\_tags' is used to lookup the Edge Host already registered with Palette. | list(object({
name = string
additional_labels = optional(map(string))
control_plane = optional(bool)
control_plane_as_worker = optional(bool)
taints = optional(list(object({
effect = string
key = string
value = string
})))
edge_host = list(object({
host_uid = string
host_name = optional(string)
nic_name = optional(string)
static_ip = optional(string)
subnet_mask = optional(string)
default_gateway = optional(string)
dns_servers = optional(list(string))
two_node_role = optional(string)
}))
})) | n/a | yes |
| [name](#input\_name) | Name of the cluster to be created. | `string` | n/a | yes |
| [ntp\_servers](#input\_ntp\_servers) | n/a | `list(string)` | `[]` | no |
| [overlay\_cidr\_range](#input\_overlay\_cidr\_range) | CIDR range for the overlay network. | `string` | `""` | no |
| [rbac\_bindings](#input\_rbac\_bindings) | RBAC Bindings to be added to the cluster | list(object({
rbac_type = string
namespace = optional(string)
rbac_role = optional(map(string))
subjects = optional(list(object({
name = string
rbac_type = string
namespace = optional(string)
})))
})) | `[]` | no |
| [skip\_wait\_for\_completion](#input\_skip\_wait\_for\_completion) | n/a | `bool` | `true` | no |
| [ssh\_keys](#input\_ssh\_keys) | n/a | `list(string)` | `[]` | no |
| [update\_worker\_pools\_in\_parallel](#input\_update\_worker\_pools\_in\_parallel) | Whether to update worker pools in parallel. When true, all worker node pools are updated simultaneously. | `bool` | `true` | no |
## Outputs
| Name | Description |
|------|-------------|
| [admin\_kube\_config](#output\_admin\_kube\_config) | n/a |
| [id](#output\_id) | n/a |
| [kubeconfig](#output\_kubeconfig) | n/a |
| [name](#output\_name) | n/a |