oracle-terraform-modules / terraform-oci-oke

The Terraform OKE Module Installer for Oracle Cloud Infrastructure provides a Terraform module that provisions the necessary resources for Oracle Container Engine.
https://oracle-terraform-modules.github.io/terraform-oci-oke/
Universal Permissive License v1.0
153 stars 206 forks source link

Unable to create just a node pool using the workers submodule #900

Closed NIXKnight closed 7 months ago

NIXKnight commented 7 months ago

I have an existing OKE cluster. I am trying to use the workers submodule to create a node pool. After resolving many missing parameters this is what my terraform code looks like: data.tf

data "oci_identity_availability_domains" "ads" {
  compartment_id = "<my_compartment_id>"
}

locals.tf

locals {
  ad_numbers_to_names = { for ad in data.oci_identity_availability_domains.ads.availability_domains: ad.name => ad.name }
}

node-pool.tf

module "my_oke_nodepool" {
  source = "github.com/oracle-terraform-modules/terraform-oci-oke//modules/workers?ref=v5.1.2"

  compartment_id = "<my_compartment_id>"
  tenancy_id     = "<my_tenancy_id>"

  cluster_id         = "<my_cluster_id>"
  worker_pool_mode   = "node-pool"
  worker_pool_size   = 3

  kubernetes_version = "<my_kubernetes_version>"
  image_id           = "<my_custom_image_id>"
  image_type         = "custom"
  timezone           = "Etc/UTC"
  assign_public_ip   = false
  shape = {
    shape            = "VM.Standard.E4.Flex",
    ocpus            = 4,
    memory           = 8,
    boot_volume_size = 160
  }

  assign_dns             = true
  cni_type               = "flannel"
  apiserver_private_host = "<my_apiserver_private_host>"
  worker_subnet_id       = "<my_apiserver_private_host>"
  pod_subnet_id          = null
  ad_numbers             = ["1"]
  ad_numbers_to_names    = local.ad_numbers_to_names
  agent_config           = null

  worker_pools = {
    my-nodepool = {
      create           = true,
      size             = 3,
      shape            = "VM.Standard.E4.Flex",
      ocpus            = 4,
      memory           = 8,
      boot_volume_size = 160,

    }
  }
}

However I am currently stuck on this error:

╷
│ Error: Insufficient placement_configs blocks
│ 
│   on .terraform/modules/my_oke_nodepool/modules/workers/nodepools.tf line 17, in resource "oci_containerengine_node_pool" "workers":
│   17:   node_config_details {
│ 
│ At least 1 "placement_configs" blocks are required.
╵

I cannot find sufficient submodule docs to help me resolve this I have tried adding some parameters after reading the module code i.e. availability_domains, capacity_reservation_id, and subnet_id under my-nodepool but that doesn't seem to help. Could someone please provide any pointers?

NIXKnight commented 7 months ago

I realized I was using it the wrong way. I have shifted to the main module instead of using the submodule and that resolved all of the problems.