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] Inconsistent Kubernetes Version Handling for "talos" Cluster Type in Terraform Provider after 1st apply [400 bad request] cluster is already at the requested version 1.x.z #365

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

Comments

@brokedba
Copy link

brokedba commented Jan 24, 2025

Description

I. What's the issue?

There is a bug in the Civo Terraform provider (version 1.1.4 or lower) related to the kubernetes_version parameter for the "talos" cluster type.

1. Initial Deployment:
Specifying kubernetes_version = "talos-v1.5.0" successfully deploys the cluster.

2. Subsequent apply Operations:
When making changes (e.g., adding nodes) and running terraform apply, the process fails with the following error:

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: []  

If I comment kubernetes_version . Removing the kubernetes_version line results in another error:

Error: [ERR] failed to update kubernetes cluster: Error: Unknown error response 
- status: 400 Bad Request, code: 400, 
- reason: {"code":"kubernetes_cluster_invalid_version_upgrade",
"reason":"The cluster cannot be upgraded with the given kubernetes version: this cluster is already at the requested version 1.27.0"}  

Root Cause:

There appears to be a mismatch between the format required for the initial deployment (talos-vX.Y.Z) and the API's metadata response (1.27.0).

Impact:
This results in an inability to apply any updates to the cluster. The only workaround is to destroy and recreate the cluster, which is inefficient and frustrating.

2. Steps to reproduce it

  • Deploy a "talos" cluster using Terraform:
resource "civo_kubernetes_cluster" "talos_cluster" {  
  name                = "example-cluster"  
  kubernetes_version  = "talos-v1.5.0"  
  nodes               = 3  
  ...  
}  
  1. Run terraform apply .
    The cluster deploys successfully.
  2. Add any update (e.g., increase node count, add helm deployment) and run terraform apply again.
    result > The error regarding the invalid Kubernetes version appears.
  3. Comment out the kubernetes_version parameter and run terraform apply.
    result > The second error occurs, preventing updates.

3. Additional information

Related Issue: This behavior seems similar to the data source issue reported in #363.

It has been very frustrating to have to destroy all deployments in order to add a resource.
second apply change Screenshots:

Image

Acceptance Criteria

Provide a Fix:
Ensure that the Terraform provider properly handles the Kubernetes version for "talos" clusters across all operations (apply, plan, and destroy).
Update the control logic to:

  1. Accept the talos-vX.Y.Z format consistently.
  2. Prevent metadata overwrite issues that cause subsequent apply operations to fail.
@brokedba brokedba added the bug Something isn't working label Jan 24, 2025
@uzaxirr
Copy link
Member

uzaxirr commented Jan 24, 2025

Hey the team is working on this as we speak

@brokedba
Copy link
Author

brokedba commented Jan 24, 2025

@uzaxirr thanks I thought it'd be better to create an issue instead of a random chat in slack support channel.
please keep me posted.

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