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

wait_till for Classic Clusters data source is not working (ibm_container_cluster) #5611

Closed
ctolon22 opened this issue Sep 4, 2024 · 0 comments · Fixed by #5631
Closed

wait_till for Classic Clusters data source is not working (ibm_container_cluster) #5611

ctolon22 opened this issue Sep 4, 2024 · 0 comments · Fixed by #5631
Labels
service/Kubernetes Service Issues related to Kubernetes Service Issues

Comments

@ctolon22
Copy link

ctolon22 commented Sep 4, 2024

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform IBM Provider Version

Terraform v1.6.6
on linux_amd64
+ provider registry.terraform.io/hashicorp/helm v2.15.0
+ provider registry.terraform.io/hashicorp/kubernetes v2.32.0
+ provider registry.terraform.io/ibm-cloud/ibm v1.69.0

Your version of Terraform is out of date! The latest version
is 1.9.5. You can update by downloading from https://www.terraform.io/downloads.html

Affected Resource(s)

  • ibm_container_cluster (data source)

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

########################################################################################################################
# Provider config
########################################################################################################################

provider "ibm" {
  ibmcloud_api_key = var.ibmcloud_api_key
  region           = var.region
}

provider "kubernetes" {
  host  = data.ibm_container_cluster_config.cluster_config.host
  token = data.ibm_container_cluster_config.cluster_config.token
}

provider "helm" {
  kubernetes {
    host                   = data.ibm_container_cluster_config.cluster_config.host
    token                  = data.ibm_container_cluster_config.cluster_config.token
    cluster_ca_certificate = data.ibm_container_cluster_config.cluster_config.ca_certificate
  }
}

data "ibm_container_vpc_cluster" "cluster" {
  count             = var.is_vpc_cluster ? 1 : 0
  name              = var.cluster_name
  wait_till         = var.wait_till
  wait_till_timeout = var.wait_till_timeout
}

data "ibm_container_cluster" "cluster" {
  count             = var.is_vpc_cluster ? 0 : 1
  name              = var.cluster_name
  wait_till         = var.wait_till
  wait_till_timeout = var.wait_till_timeout
}

data "ibm_container_cluster_config" "cluster_config" {
  cluster_name_id = var.is_vpc_cluster ? data.ibm_container_vpc_cluster.cluster[0].name : data.ibm_container_cluster.cluster[0].name
  config_dir      = "${path.module}/kubeconfig"
  endpoint_type   = var.cluster_endpoint_type
}

Debug Output

Panic Output

Expected Behavior

wait_till should be taken into consideration before any action against the cluster.

Actual Behavior

When the cluster is being created, the provider tries to collect the list of bounded services and fails because the cluster is not ready.

The problem is that it gets List of Bounded Services here https://github.com/IBM-Cloud/terraform-provider-ibm/blob/master/ibm/service/kubernetes/data_source_ibm_container_cluster.go#L438

and the wait is done later here https://github.com/IBM-Cloud/terraform-provider-ibm/blob/master/ibm/service/kubernetes/data_source_ibm_container_cluster.go#L468

Steps to Reproduce

  1. Create a new classic cluster
  2. Run the Terraform apply with wait_till (to any value) while the cluster is being created
  3. It fails because list bounded services (set to true by default) is interacts with the cluster when it's not ready

Important Factoids

References

  • #0000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service/Kubernetes Service Issues related to Kubernetes Service Issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant