diff --git a/README.md b/README.md index 3a0c526..eb7e47c 100644 --- a/README.md +++ b/README.md @@ -27,10 +27,10 @@ Additionally, with the "VIP" tag, we enable Kubevip for HA. The Edge Host is no | --------|--------- | ![QRCode](images/qrcode.png) | ![UID Copy](images/uid_copy.png) -``` +```tf module "edge-demo-module" { source = "spectrocloud/edge/spectrocloud" - version = "1.4.0" + version = "1.5.0" # Store Number/Location name = "demo" # add tags to the cluster (optional) list(strings) @@ -62,7 +62,22 @@ module "edge-demo-module" { edge_host = [ { host_uid = "edge12345" + 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" + } ] }, @@ -89,7 +104,7 @@ module "edge-demo-module" { cluster_profiles = [ { name = "edge-profile" - tag = "1.27.7" + tag = "1.30.5-ubuntu" context = "project" }, { @@ -126,6 +141,7 @@ module "edge-demo-module" { } + ``` ## Requirements @@ -133,13 +149,13 @@ module "edge-demo-module" { | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.3.0 | -| [spectrocloud](#requirement\_spectrocloud) | >= 0.17.4 | +| [spectrocloud](#requirement\_spectrocloud) | >= 0.22.0 | ## Providers | Name | Version | |------|---------| -| [spectrocloud](#provider\_spectrocloud) | >= 0.17.4 | +| [spectrocloud](#provider\_spectrocloud) | 0.22.0 | ## Modules @@ -160,7 +176,7 @@ No modules. | [cluster\_tags](#input\_cluster\_tags) | Tags to be added to the profile. key:value | `list(string)` | `[]` | no | | [cluster\_vip](#input\_cluster\_vip) | IP Address for Cluster VIP for HA. Must be unused on 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
static_ip = optional(string)

}))
}))
| n/a | yes | +| [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 | diff --git a/examples/cluster.tf b/examples/cluster.tf index 1b3b28b..27745b9 100644 --- a/examples/cluster.tf +++ b/examples/cluster.tf @@ -1,6 +1,6 @@ module "edge-demo-module" { source = "spectrocloud/edge/spectrocloud" - version = "1.4.0" + version = "1.5.0" # Store Number/Location name = "demo" # add tags to the cluster (optional) list(strings) @@ -31,8 +31,23 @@ module "edge-demo-module" { } edge_host = [ { - host_uid = "edge12345" - static_ip = "10.100.100.31" + host_uid = "edge12345" + 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" + } ] }, @@ -59,7 +74,7 @@ module "edge-demo-module" { cluster_profiles = [ { name = "edge-profile" - tag = "1.27.7" + tag = "1.30.5-ubuntu" context = "project" }, { diff --git a/examples/main.tf b/examples/main.tf index f239a82..68d94b8 100644 --- a/examples/main.tf +++ b/examples/main.tf @@ -4,7 +4,7 @@ terraform { required_providers { spectrocloud = { - version = "= 0.17.4" + version = "= 0.22.0" source = "spectrocloud/spectrocloud" } } diff --git a/main.tf b/main.tf index 18091ee..2a6d79f 100644 --- a/main.tf +++ b/main.tf @@ -44,11 +44,17 @@ resource "spectrocloud_cluster_edge_native" "this" { dynamic "edge_host" { for_each = machine_pool.value.edge_host content { - host_uid = edge_host.value.host_uid - static_ip = edge_host.value.static_ip + host_uid = edge_host.value.host_uid + host_name = edge_host.value.host_name + nic_name = edge_host.value.nic_name + static_ip = edge_host.value.static_ip + subnet_mask = edge_host.value.subnet_mask + default_gateway = edge_host.value.default_gateway + dns_servers = edge_host.value.dns_servers + two_node_role = edge_host.value.two_node_role + } } - # edge_host = machine_pool.value.edge_host != null ? machine_pool.value.edge_host : data.spectrocloud_appliances.this[machine_pool.value.name].ids } } dynamic "cluster_profile" { diff --git a/providers.tf b/providers.tf index 5fe0284..d54697b 100644 --- a/providers.tf +++ b/providers.tf @@ -1,7 +1,7 @@ terraform { required_providers { spectrocloud = { - version = ">= 0.17.4" + version = ">= 0.22.0" source = "spectrocloud/spectrocloud" } } diff --git a/variables.tf b/variables.tf index 94e6d01..b6169f3 100644 --- a/variables.tf +++ b/variables.tf @@ -1,5 +1,5 @@ variable "machine_pools" { - description = "Values for the attributes of the Node Pools. 'edge_host_tags' is used to lookup the Edge Host already registered with Palette." + description = "Values for the attributes of the Node Pools. 'edge_host_tags' is used to lookup the Edge Host already registered with Palette." type = list(object({ name = string additional_labels = optional(map(string)) @@ -11,11 +11,28 @@ variable "machine_pools" { value = string }))) edge_host = list(object({ - host_uid = string - static_ip = optional(string) - + 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) })) })) + + validation { + condition = alltrue([for mp in var.machine_pools : alltrue([ + for eh in mp.edge_host : ( + eh.two_node_role == null || + eh.two_node_role == "primary" || + eh.two_node_role == "secondary" + ) + ])]) + + error_message = "The 'two_node_role' field in 'edge_host' objects must be either 'primary', 'secondary', or not set (null)." + } } variable "cluster_tags" { type = list(string)