oracle-terraform-modules/terraform-oci-oke

[5.x] Invalid count argument error in autoscaler.tf

rodrigc opened this issue ยท 0 comments

I updated my terraform to use the 5.x branch at 69d6b99
and got an error in autoscaler.tf (see below).

Backing out to the revision 8dc91b1 and I did not get the error.

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 "me too" comments, 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 Version and Provider Version

terraform -v
Terraform v1.4.4
on darwin_amd64
+ provider registry.terraform.io/hashicorp/cloudinit v2.3.2
+ provider registry.terraform.io/hashicorp/helm v2.11.0
+ provider registry.terraform.io/hashicorp/http v3.4.0
+ provider registry.terraform.io/hashicorp/null v3.2.1
+ provider registry.terraform.io/hashicorp/random v3.5.1
+ provider registry.terraform.io/hashicorp/time v0.9.1
+ provider registry.terraform.io/oracle/oci v4.119.0

Affected Resource(s)

Terraform Configuration Files

module "oke" {
  //source  = "oracle-terraform-modules/oke/oci"
  //version = "5.0.0-beta.3"
  source = "github.com/oracle-terraform-modules/terraform-oci-oke?ref=69d6b99658afa2f0e17f566a21569175cafc4b3c"

  kubernetes_version         = "v1.26.2"
  cluster_name               = local.name
  control_plane_is_public    = false
  cluster_type               = "enhanced"
  cluster_autoscaler_install = true

  compartment_id         = module.oke_prereqs.oke_compartment_id
  network_compartment_id = module.oke_prereqs.oke_compartment_id
  worker_compartment_id  = module.oke_prereqs.oke_compartment_id
  tenancy_id             = local.tenancy_id

  ssh_private_key_path = var.ssh_private_key_path
  ssh_public_key_path  = var.ssh_public_key_path

  home_region = local.home_region
  region      = var.region

  // node pool config
  worker_pools            = var.worker_pools
  worker_image_id         = "none"
  worker_image_type       = "oke"
  worker_image_os         = "Oracle Linux"
  worker_image_os_version = "8"

  create_operator       = true
  create_bastion        = true
  bastion_allowed_cidrs = ["0.0.0.0/0"]

  create_iam_resources       = true
  create_iam_operator_policy = "always"

  providers = {
    oci.home = oci.home
  }
}

Actual Behavior

โ•ท
โ”‚ Error: Invalid count argument
โ”‚
โ”‚   on .terraform/modules/oke/modules/extensions/autoscaler.tf line 44, in data "helm_template" "cluster_autoscaler":
โ”‚   44:   count        = local.cluster_autoscaler_enabled ? 1 : 0
โ”‚
โ”‚ The "count" value depends on resource attributes that cannot be determined until apply, so Terraform cannot predict how many instances
โ”‚ will be created. To work around this, use the -target argument to first apply only the resources that the count depends on.
โ•ต