[BUG] the cluster_type value does not get validated
Closed this issue · 2 comments
fernando-villalba commented
Description
Issue
If you create a cluster with a gibberish value on cluster_type
cluster defaults to k3s.
resource "civo_firewall" "my-firewall" {
name = "my-firewall2"
create_default_rules = false
ingress_rule {
protocol = "tcp"
port_range = "6443"
cidr = ["0.0.0.0/0"]
label = "kubernetes-api-server"
action = "allow"
}
}
data "civo_size" "xsmall" {
filter {
key = "type"
values = ["kubernetes"]
}
sort {
key = "ram"
direction = "asc"
}
}
resource "civo_kubernetes_cluster" "my-cluster" {
name = "my-clusterito"
firewall_id = civo_firewall.my-firewall.id
cluster_type = "dsfsdf" # Giberish value
pools {
label = "front-end"
size = element(data.civo_size.xsmall.sizes, 0).name
node_count = 3
}
}
Acceptance Criteria
- It should fail with an error if the value provided is not 'k3s' or 'talos'
Screenshots
No response
Additional information
No response
Praveen005 commented
Hi @uzaxirr,
I worked on this issue and would like to share my approach for a review.
To resolve this, we can add a validation function, which during the planning phase itself, verifies if the cluster_type
is one of talos
or k3s
.
It correctly throws an error:
uzaxirr commented
Looks fine, raise a PR