Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Invalid kubernetes_version Format in Data Source vs. CLI Output (mismatch) #363

Open
brokedba opened this issue Jan 20, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@brokedba
Copy link

Description

Description:

I'm encountering an issue with the civo_kubernetes_version data source in the Civo Terraform Provider version 1.1.3. When attempting to create a Kubernetes cluster with the Talos distribution, the Terraform plan fails due to an invalid Kubernetes version format. The error message is as follows:

Image

Error: invalid Kubernetes version format: '1.27.0' for cluster type 'talos'.

Please ensure your version matches the expected format, e.g., 'talos-vX.Y.Z'.

Available versions for 'talos':
- Stable: [talos-v1.5.0]
- Development: []

Steps to Reproduce:

Define the civo_kubernetes_version data source with the following configuration:

data "civo_kubernetes_version" "latest_talos" {
  filter {
    key    = "type"
    values = ["talos"]
  }
  filter {
    key    = "default"
    values = ["true"]
  }
  sort {
    key       = "label"
    direction = "desc"
  }
}

Output the versions retrieved by the data source:

output "version_name" {
  value = data.civo_kubernetes_version.latest_talos.versions
}
  • Run terraform plan.

  • Observed Behavior:

The output from the data source is:

[
  {
    "default": true,
    "label": "v1.27.0",
    "type": "talos",
    "version": "1.27.0"      <---- wrong
  }
]
  • However, when using the Civo CLI, the expected format is returned:
civo kubernetes versions -o json | jq '.[] | select(.cluster_type == "talos" and .default == "true")'
{
  "cluster_type": "talos",
  "default": "true",
  "label": "talos-v1.5.0",    <---- right
  "type": "stable",
  "version": "1.27.0"
}

Expected Behavior:

The civo_kubernetes_version data source should return the label in the format 'talos-vX.Y.Z', consistent with the CLI output, to prevent version format errors during cluster creation.

Additional Information:

This discrepancy causes Terraform to fail with the following error:

Error: invalid Kubernetes version format: '1.27.0' for cluster type 'talos'.
It appears that the data source is not retrieving the correct metadata, leading to this inconsistency.

Acceptance Criteria

Please fix it as the current version of the data source will stay useless if left this way.

  • The civo_kubernetes_version data source returns the label attribute in the 'talos-vX.Y.Z' format for Talos clusters.
  • Terraform plans execute successfully without version format errors when using the label from the data source for Talos clusters.
@brokedba brokedba added the bug Something isn't working label Jan 20, 2025
@Praveen005
Copy link
Contributor

Hi @brokedba, Thank You for creating the ticket. We are working on this, and a fix will be pushed very shortly.

@brokedba
Copy link
Author

any update ?

@Praveen005
Copy link
Contributor

Hi @brokedba, the error: Error: invalid Kubernetes version format: '1.27.0' for cluster type 'talos'. It appears that the data source is not retrieving the correct metadata, leading to this inconsistency. gets fixed by the last API change that we discussed in #365.

For the incorrect label from the datasource, I have this PR in place to correct that.

@brokedba
Copy link
Author

@Praveen005 that doesn't fix the version displayed in the data source . especially when users try to leverage the version from the data source instead of hardcoding it through a variable. I think it either should be talos.x.y.z or 1.x.y.z and not a mix.

[
  {
    "default": true,
    "label": "v1.27.0",
    "type": "talos",
    "version": "1.27.0"      <---- wrong   , should be talos-v1.5.0 for example as there is still confusion between label an version
  }
]

also, as future enhancement request it'd be nice to have the type field (.i.e stable) for a better/granular search .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants