civo / terraform-provider-civo

Terraform Civo provider
https://www.civo.com
Mozilla Public License 2.0
71 stars 56 forks source link

[BUG] Creating clusters with applications that have plans with spaces doesn't work #284

Closed fernando-villalba closed 3 months ago

fernando-villalba commented 3 months ago

Description

Issue

If you use the following command to create a cluster:

civo kubernetes create --applications "argocd,linkerd:Linkerd with Dashboard & Jaeger"

It works:

image

However doing the same with Terraform doesn't:


provider "civo" {

  region = "LON1"
}

resource "civo_firewall" "example" {
    name = "example-firewall"
    create_default_rules = true
    network_id = civo_network.example.id

}

resource "civo_network" "example" {
  label = "example-network8"

}

resource "civo_kubernetes_cluster" "example" {
    name = "example-cluster"
    applications = "argocd,linkerd:Linkerd with Dashboard & Jaeger" # Doesn't work
    network_id = civo_network.example.id
    firewall_id = civo_firewall.example.id

    cluster_type = "k3s"
    pools {
        label = "shop"
        size = "g4s.kube.small"
        node_count = 3
    }
}

Error:

image

Looks like the provider is stripping the spaces.

Acceptance criteria

Screenshots

No response

Additional information

No response

Praveen005 commented 3 months ago

Hi @uzaxirr

In here, Spaces are being trimmed from the plans's name.

correcting that fixes the issue. I believe this is how the API expects.

https://github.com/civo/terraform-provider-civo/blob/c9b61643378f97130d56aae00999e68168192bcd/civo/kubernetes/resource_kubernetes_cluster.go#L244

Screenshot 2024-07-26 134935

Result:

Screenshot 2024-07-26 135049 Screenshot 2024-07-26 135137 Screenshot 2024-07-26 135359
uzaxirr commented 3 months ago

Hi @uzaxirr

In here, Spaces are being trimmed from the plans's name.

correcting that fixes the issue. I believe this is how the API expects.

https://github.com/civo/terraform-provider-civo/blob/c9b61643378f97130d56aae00999e68168192bcd/civo/kubernetes/resource_kubernetes_cluster.go#L244

Screenshot 2024-07-26 134935

Result:

Screenshot 2024-07-26 135049 Screenshot 2024-07-26 135137 Screenshot 2024-07-26 135359

@Praveen005 Please raise a PR