terraform-ibm-modules/terraform-ibm-base-ocp-vpc

Standard and multiple MZR examples are not actually creating worker pools across AZs

vburckhardt opened this issue · 1 comments

The example at https://github.com/terraform-ibm-modules/terraform-ibm-base-ocp-vpc/blob/main/examples/standard/main.tf#L49 creates 3 worker pools, with one in each availability zone.

A typical MZR cluster would have each of its workpool spread across the 3 availability zones.

I think there is an issue here https://github.com/terraform-ibm-modules/terraform-ibm-base-ocp-vpc/blob/main/examples/standard/main.tf#L49

Instead of

  cluster_vpc_subnets = {
    zone-1 = [{
      id         = module.vpc.subnet_zone_list[0].id
      zone       = module.vpc.subnet_zone_list[0].zone
      cidr_block = module.vpc.subnet_zone_list[0].cidr
    }],
    zone-2 = [{
      id         = module.vpc.subnet_zone_list[1].id
      zone       = module.vpc.subnet_zone_list[1].zone
      cidr_block = module.vpc.subnet_zone_list[1].cidr
    }],
    zone-3 = [{
      id         = module.vpc.subnet_zone_list[2].id
      zone       = module.vpc.subnet_zone_list[2].zone
      cidr_block = module.vpc.subnet_zone_list[2].cidr
    }]
  }

There should probably be something along the lines of (not tested the syntax):

  cluster_vpc_subnets = {
    zone-1 = [
      for zone in module.vpc.subnet_zone_list :
      {
        id         = zone.id
        zone       = zone.zone
        cidr_block = zone.cidr_block
    }
    ]
    }

The other issue here in cluster_vpc_subnets is the prefix set to "zone-1". This is very confusing as this does not actually map to any zone in the ocp-base module. This key "zone-1" is what is referred to as "prefix" in the ocp-base module. I would name it "default" as it is used to defined the default worker pool lower in the code of the example.

PR merged. Closing issue