siderolabs / terraform-provider-talos

Mozilla Public License 2.0
128 stars 17 forks source link

Error: failed to retrieve kubeconfig in terraform #135

Closed Annavar-satish closed 11 months ago

Annavar-satish commented 1 year ago

Bug Report

Description

I was using example terraform aws modules to create a cluster with t2.micro and faced a error below error

 Error: creating EC2 Instance: Unsupported: Your requested instance type (t2.micro) is not supported in your requested Availability Zone (ap-south-1c). Please retry your request by not specifying an Availability Zone or choosing ap-south-1a, ap-south-1b.
      status code: 400, request id: 84dbd290-4e6b-49af-bd93-ee89eb285643

  with module.talos_control_plane_nodes[2].aws_instance.this[0],
  on .terraform/modules/talos_control_plane_nodes/main.tf line 19, in resource "aws_instance" "this":
  19: resource "aws_instance" "this" {

and tried to destory and reapply the plan while destroing got this error

Logs

 Error: failed to retrieve kubeconfig

   with data.talos_cluster_kubeconfig.this,
   on main.tf line 209, in data "talos_cluster_kubeconfig" "this":
  209: data "talos_cluster_kubeconfig" "this" {

empty retryable error received. This is a bug with the Terraform provider and should be reported as a GitHub issue in the provider repository.

Environment

frezbo commented 1 year ago

This is expected TF behavior, TF tries to refresh data resources for every operation and since the Talos cluster was not created the refreshing of the kubeconfig resource would fail. In this case pass -refresh=false to the TF destroy command.

Annavar-satish commented 1 year ago

thanks for helping me quickly @frezbo

Annavar-satish commented 1 year ago

@frezbo The error was not gone. even when I use TF apply freshly It giving me the same error the nodes are being created and I can get out put for talosconfig but the kubeconfig was not created . I have used -refresh=false for TF apply too didn't solve .

Planning failed. Terraform encountered an error while generating this plan.

╷
│ Error: failed to retrieve kubeconfig
│ 
│   with data.talos_cluster_kubeconfig.this,
│   on main.tf line 208, in data "talos_cluster_kubeconfig" "this":
│  208: data "talos_cluster_kubeconfig" "this" {
│ 
│ empty retryable error received. This is a bug with the Terraform provider and should be reported as a GitHub issue in the provider repository.
frezbo commented 11 months ago

Closing this issue for now, since we use the TF provider code with Talos e2e-aws tests. please re-open if issue still persists.